custom training price
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','id9073794_tollashodos','uprRscU8bGpJ','id9073794_tollashodos');
|
||||
|
||||
//megnézzük, hogy a KID benne van-e olyan category-val, ami az adott grouphoz tartozik
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','id9073794_tollashodos','uprRscU8bGpJ','id9073794_tollashodos');
|
||||
|
||||
if ($_POST['parent_id'] == 'null') {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','id9073794_tollashodos','uprRscU8bGpJ','id9073794_tollashodos');
|
||||
|
||||
if (empty($_GET['template_id'])) {
|
||||
|
||||
19
_ajax/get_trt_default_price.php
Normal file
19
_ajax/get_trt_default_price.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','id9073794_tollashodos','uprRscU8bGpJ','id9073794_tollashodos');
|
||||
|
||||
if (empty($_GET['trt_id'])) {
|
||||
echo json_encode(null);
|
||||
}
|
||||
else {
|
||||
$trt_query = "SELECT trt_default_price FROM training_type WHERE trt_id = " . $_GET['trt_id'];
|
||||
|
||||
$trt_default_price = $sql->single_variable($trt_query);
|
||||
|
||||
echo json_encode($trt_default_price);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,7 +2,7 @@
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','id9073794_tollashodos','uprRscU8bGpJ','id9073794_tollashodos');
|
||||
|
||||
$filter1 = "";
|
||||
|
||||
@@ -7,7 +7,7 @@ foreach ($_POST as $key => $value) {
|
||||
trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE);
|
||||
}
|
||||
*/
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','id9073794_tollashodos','uprRscU8bGpJ','id9073794_tollashodos');
|
||||
|
||||
$check_query = "SELECT * FROM presence WHERE pr_training_tr_id = " . $_POST['tr_id'] . " AND pr_user_kid_uk_id = " . $_POST['user_id'] . ";";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
PAGE CLASS
|
||||
url alapjan lekeri a template-et
|
||||
http://badmintoncoach-demo.hu/PAGE/SUBPAGE/ID
|
||||
http://cegledcoach.hu/PAGE/SUBPAGE/ID
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
/*
|
||||
TRAINING osztály
|
||||
Edzések
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class training {
|
||||
@@ -16,13 +13,12 @@ class training {
|
||||
private $tr_duration;
|
||||
private $tr_note;
|
||||
private $tr_locked;
|
||||
private $tr_price;
|
||||
private $tr_deleted;
|
||||
private $coaches = array();
|
||||
|
||||
private $helpers = array();
|
||||
|
||||
|
||||
|
||||
public function set_tr_id($_tr_id) {
|
||||
$this->tr_id = $_tr_id;
|
||||
}
|
||||
@@ -47,6 +43,10 @@ class training {
|
||||
$this->tr_locked = $_tr_locked;
|
||||
}
|
||||
|
||||
public function set_tr_price($_tr_price) {
|
||||
$this->tr_price = $_tr_price;
|
||||
}
|
||||
|
||||
public function set_tr_deleted($_tr_deleted) {
|
||||
$this->tr_deleted = $_tr_deleted;
|
||||
}
|
||||
@@ -89,6 +89,10 @@ class training {
|
||||
return $this->tr_locked;
|
||||
}
|
||||
|
||||
public function get_tr_price() {
|
||||
return $this->tr_price;
|
||||
}
|
||||
|
||||
public function get_tr_deleted() {
|
||||
return $this->tr_deleted;
|
||||
}
|
||||
@@ -209,6 +213,9 @@ class training {
|
||||
if ($_training_value_array['tr_note'] == "") {
|
||||
$_training_value_array['tr_note'] = null;
|
||||
}
|
||||
if ($_training_value_array['tr_price'] == "") {
|
||||
$_training_value_array['tr_price'] = null;
|
||||
}
|
||||
$new_tr_id = $sql->insert_into('training', $_training_value_array);
|
||||
log::register('new_training', $new_tr_id);
|
||||
if (isset($coaches)) {
|
||||
|
||||
@@ -2,42 +2,62 @@
|
||||
|
||||
# EDZÉS TÍPUS OSZTÁLY
|
||||
|
||||
|
||||
class training_type {
|
||||
private $trt_id;
|
||||
private $trt_name;
|
||||
private $trt_deleted;
|
||||
private $trt_id;
|
||||
private $trt_name;
|
||||
private $trt_default_price;
|
||||
private $trt_deleted;
|
||||
|
||||
public function set_trt_id($_id) {
|
||||
$this->trt_id = $_id;
|
||||
}
|
||||
public function set_trt_id($_id) {
|
||||
$this->trt_id = $_id;
|
||||
}
|
||||
|
||||
public function set_trt_name($_name) {
|
||||
$this->trt_name = $_name;
|
||||
}
|
||||
public function set_trt_name($_name) {
|
||||
$this->trt_name = $_name;
|
||||
}
|
||||
|
||||
public function set_trt_deleted($_deleted) {
|
||||
$this->trt_deleted = $_deleted;
|
||||
}
|
||||
public function set_trt_deleted($_deleted) {
|
||||
$this->trt_deleted = $_deleted;
|
||||
}
|
||||
|
||||
public function get_trt_id() {
|
||||
return $this->trt_id;
|
||||
}
|
||||
public function set_trt_default_price($_price) {
|
||||
$this->trt_default_price = $_price;
|
||||
}
|
||||
|
||||
public function get_trt_name() {
|
||||
return $this->trt_name;
|
||||
}
|
||||
public function get_trt_id() {
|
||||
return $this->trt_id;
|
||||
}
|
||||
|
||||
public function get_trt_deleted() {
|
||||
return $this->trt_deleted;
|
||||
}
|
||||
public function get_trt_name() {
|
||||
return $this->trt_name;
|
||||
}
|
||||
|
||||
public static function create_training_type($_trt_value_array) {
|
||||
global $sql;
|
||||
return $sql->insert_into('training_type', $_trt_value_array);
|
||||
}
|
||||
public function get_trt_default_price() {
|
||||
return $this->trt_default_price;
|
||||
}
|
||||
|
||||
public function set_trt_data_by_id($_id) {
|
||||
public function get_trt_deleted() {
|
||||
return $this->trt_deleted;
|
||||
}
|
||||
|
||||
public static function create_training_type($_trt_value_array) {
|
||||
global $sql;
|
||||
if ('' == $_trt_value_array['trt_default_price']) {
|
||||
$_trt_value_array['trt_default_price'] = 'null';
|
||||
}
|
||||
return $sql->insert_into('training_type', $_trt_value_array);
|
||||
}
|
||||
|
||||
public static function update_training_type($_trt_value_array) {
|
||||
global $sql;
|
||||
$default_price = $_trt_value_array['trt_default_price'];
|
||||
if ('' == $default_price) {
|
||||
$default_price = 'null';
|
||||
}
|
||||
return $sql->update_table('training_type', array('trt_name' => $_trt_value_array['trt_name'], 'trt_default_price' => $default_price), array('trt_id' => $_trt_value_array['trt_id']));
|
||||
}
|
||||
|
||||
public function set_trt_data_by_id($_id) {
|
||||
global $sql;
|
||||
$trt_data_assoc_array = $sql->assoc_array("select * from training_type where trt_id = " . $_id);
|
||||
$trt_data_array = $trt_data_assoc_array[0];
|
||||
@@ -49,5 +69,4 @@ class training_type {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -531,7 +531,9 @@ class user_kid extends user_parent {
|
||||
if ($_de->get_de_type() == 'training') {
|
||||
|
||||
//$balance -= 1200;
|
||||
$_de->set_de_transaction(-1000); //beállítjuk, mennyivel csökken az egyenleg
|
||||
$training = $_de->get_de_training();
|
||||
$trainingPrice = $training->get_tr_price();
|
||||
$_de->set_de_transaction(-$trainingPrice); //beállítjuk, mennyivel csökken az egyenleg
|
||||
if (0 == $i) {
|
||||
$_de->set_de_balance($balance+$_de->get_de_transaction()); //beállítjuk az új egyenleget
|
||||
}
|
||||
@@ -588,7 +590,7 @@ class user_kid extends user_parent {
|
||||
if(pr_training_tr_id is not null, 'training', null) as object_type
|
||||
FROM
|
||||
presence
|
||||
JOIN training ON tr_id = pr_training_tr_id
|
||||
JOIN training ON (tr_id = pr_training_tr_id AND tr_locked = 1)
|
||||
WHERE
|
||||
pr_user_kid_uk_id = ".$userId."
|
||||
AND tr_deleted = 0) UNION (SELECT
|
||||
|
||||
@@ -15,6 +15,18 @@ if ($this->is_id()) {
|
||||
)
|
||||
);
|
||||
log::register(($locked?'training_open':'training_close'), $this->get_id());
|
||||
|
||||
if (true) {
|
||||
//ha most zárjuk le
|
||||
$kid_ids = $sql->assoc_array('SELECT pr_user_kid_uk_id FROM presence WHERE pr_training_tr_id = ' . $this->get_id());
|
||||
foreach ($kid_ids as $k_array) {
|
||||
$kid = new user_kid();
|
||||
$kid->set_user_data_by_id($k_array['pr_user_kid_uk_id']);
|
||||
|
||||
$kid->update_balance();
|
||||
}
|
||||
}
|
||||
|
||||
//SEND NOTIFICATION
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
<?php
|
||||
|
||||
|
||||
# HA NINCS ID, AKKOR EDZÉSTÍPUSLISTA
|
||||
|
||||
if ($this->is_id()) {
|
||||
|
||||
# EDZÉS TÍPUS SZERKESZTÉSE
|
||||
# EDZÉS TÍPUS SZERKESZTÉSE
|
||||
$trt = new training_type();
|
||||
$trt->set_trt_data_by_id($this->get_id());
|
||||
|
||||
$smarty->assign('trt', $trt);
|
||||
|
||||
$smarty->display('training_type_edit.tpl');
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
# EDZÉS TÍPUS LISTA
|
||||
# EDZÉS TÍPUS LISTA
|
||||
|
||||
$tr_type_query = "SELECT * FROM training_type WHERE trt_deleted = 0 ORDER BY trt_name ASC";
|
||||
$tr_type_assoc_array = $sql->assoc_array($tr_type_query);
|
||||
$tr_type_query = "SELECT * FROM training_type WHERE trt_deleted = 0 ORDER BY trt_name ASC";
|
||||
$tr_type_assoc_array = $sql->assoc_array($tr_type_query);
|
||||
|
||||
$smarty->assign('tr_type_assoc_array',$tr_type_assoc_array);
|
||||
$smarty->display('training_type_list.tpl');
|
||||
$trt_array = array();
|
||||
foreach ($tr_type_assoc_array as $trt_data) {
|
||||
$new_trt = new training_type();
|
||||
$new_trt->set_trt_data_by_id($trt_data['trt_id']);
|
||||
$trt_array[] = $new_trt;
|
||||
}
|
||||
|
||||
$smarty->assign('tr_type_assoc_array',$tr_type_assoc_array);
|
||||
$smarty->assign('trt_array',$trt_array);
|
||||
$smarty->display('training_type_list.tpl');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -5,66 +5,59 @@
|
||||
|
||||
if ($this->is_id()) {
|
||||
|
||||
# ADOTT EDZÉS ADATAINAK MEGJELENÍTÉSE
|
||||
//training adatok
|
||||
$training_data_query = "SELECT * FROM training WHERE tr_id = " . $this->get_id();
|
||||
$training_data_assoc_array = $sql->assoc_array($training_data_query);
|
||||
$smarty->assign('training_data', $training_data_assoc_array[0]);
|
||||
//TRAINING TYPE ARRAY
|
||||
$training_type_query = "SELECT * FROM training_type WHERE trt_deleted = 0 ORDER BY trt_name ASC;";
|
||||
$training_type_assoc_array = $sql->assoc_array($training_type_query);
|
||||
$smarty->assign("training_type_assoc_array", $training_type_assoc_array);
|
||||
//COACH ARRAY
|
||||
$coach_data_query = "SELECT * FROM user_coach WHERE ua_deleted = 0 ORDER BY ua_id ASC;";
|
||||
$coach_data_assoc_array = $sql->assoc_array($coach_data_query);
|
||||
$coach_array = array();
|
||||
foreach ($coach_data_assoc_array as $coach_data) {
|
||||
$new_coach = new user();
|
||||
$new_coach->set_user_data_by_id($coach_data['ua_id']);
|
||||
$coach_array[] = $new_coach;
|
||||
}
|
||||
//TRAINING-COACH ARRAY
|
||||
$trc_query = "SELECT * FROM training_coach WHERE trc_training_tr_id = " . $this->get_id();
|
||||
$trc_coaches = array();
|
||||
$trc_assoc_array = $sql->assoc_array($trc_query);
|
||||
foreach ($trc_assoc_array as $trc_data) {
|
||||
$new_coach = new user();
|
||||
$new_coach->set_user_data_by_id($trc_data['trc_coach_uc_id']);
|
||||
$trc_coaches[] = $new_coach;
|
||||
}
|
||||
# ADOTT EDZÉS ADATAINAK MEGJELENÍTÉSE
|
||||
//training adatok
|
||||
$training_data_query = "SELECT * FROM training WHERE tr_id = " . $this->get_id();
|
||||
$training_data_assoc_array = $sql->assoc_array($training_data_query);
|
||||
$smarty->assign('training_data', $training_data_assoc_array[0]);
|
||||
//TRAINING TYPE ARRAY
|
||||
$training_type_query = "SELECT * FROM training_type WHERE trt_deleted = 0 ORDER BY trt_name ASC;";
|
||||
$training_type_assoc_array = $sql->assoc_array($training_type_query);
|
||||
$smarty->assign("training_type_assoc_array", $training_type_assoc_array);
|
||||
//COACH ARRAY
|
||||
$coach_data_query = "SELECT * FROM user_coach WHERE ua_deleted = 0 ORDER BY ua_id ASC;";
|
||||
$coach_data_assoc_array = $sql->assoc_array($coach_data_query);
|
||||
$coach_array = array();
|
||||
foreach ($coach_data_assoc_array as $coach_data) {
|
||||
$new_coach = new user();
|
||||
$new_coach->set_user_data_by_id($coach_data['ua_id']);
|
||||
$coach_array[] = $new_coach;
|
||||
}
|
||||
//TRAINING-COACH ARRAY
|
||||
$trc_query = "SELECT * FROM training_coach WHERE trc_training_tr_id = " . $this->get_id();
|
||||
$trc_coaches = array();
|
||||
$trc_assoc_array = $sql->assoc_array($trc_query);
|
||||
foreach ($trc_assoc_array as $trc_data) {
|
||||
$new_coach = new user();
|
||||
$new_coach->set_user_data_by_id($trc_data['trc_coach_uc_id']);
|
||||
$trc_coaches[] = $new_coach;
|
||||
}
|
||||
|
||||
$smarty->assign("coach_data_assoc_array", $coach_data_assoc_array);
|
||||
$smarty->assign("coach_array", $coach_array); //összes coach
|
||||
$smarty->assign("trc_coaches", $trc_coaches); //csak a bejelölt coach coach
|
||||
$smarty->assign("tr_id", $this->get_id()); //aktualis training id
|
||||
|
||||
|
||||
$smarty->assign("coach_data_assoc_array", $coach_data_assoc_array);
|
||||
$smarty->assign("coach_array", $coach_array); //összes coach
|
||||
$smarty->assign("trc_coaches", $trc_coaches); //csak a bejelölt coach coach
|
||||
$smarty->assign("tr_id", $this->get_id()); //aktualis training id
|
||||
|
||||
|
||||
$smarty->display('training_data_'.$tpl.'.tpl');
|
||||
$smarty->display('training_data_'.$tpl.'.tpl');
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
$traning_list_query = "SELECT * FROM training WHERE tr_deleted = 0 ORDER BY tr_date DESC;";
|
||||
$training_list_assoc_array = $sql->assoc_array($traning_list_query);
|
||||
|
||||
$training_array = array();
|
||||
foreach ($training_list_assoc_array as $training_list_array) {
|
||||
$training = new training();
|
||||
$training->set_training_data_by_id($training_list_array['tr_id']);
|
||||
$training_array[] = $training;
|
||||
}
|
||||
//var_dump($traning_array);
|
||||
$smarty->assign('edit', $tpl);
|
||||
$smarty->assign("training_array", $training_array);
|
||||
$smarty->display("training_list.tpl");
|
||||
$traning_list_query = "SELECT * FROM training WHERE tr_deleted = 0 ORDER BY tr_date DESC;";
|
||||
$training_list_assoc_array = $sql->assoc_array($traning_list_query);
|
||||
|
||||
$training_array = array();
|
||||
foreach ($training_list_assoc_array as $training_list_array) {
|
||||
$training = new training();
|
||||
$training->set_training_data_by_id($training_list_array['tr_id']);
|
||||
$training_array[] = $training;
|
||||
}
|
||||
//var_dump($traning_array);
|
||||
$smarty->assign('edit', $tpl);
|
||||
$smarty->assign("training_array", $training_array);
|
||||
$smarty->display("training_list.tpl");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -96,15 +96,15 @@ $smarty->assign('today', date('Y-m-d'));
|
||||
$smarty->assign('error_msg', $error_msg);
|
||||
|
||||
//SQL KAPCSOLAT BEÁLLÍTÁSA
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('bcd_mysql','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','id9073794_tollashodos','uprRscU8bGpJ','id9073794_tollashodos');
|
||||
|
||||
$dev = $_SERVER['HTTP_HOST'] == 'badmintoncoach-demo.hu';
|
||||
$dev = $_SERVER['HTTP_HOST'] == 'cegledcoach.hu';
|
||||
|
||||
$config = array();
|
||||
|
||||
if ($dev) {
|
||||
$config['domain'] = 'badmintoncoach-demo.hu';
|
||||
$config['domain'] = 'cegledcoach.hu';
|
||||
}
|
||||
else {
|
||||
$config['domain'] = '000webhostapp.com';
|
||||
|
||||
@@ -169,11 +169,12 @@ if (isset($_POST['action'])) {
|
||||
case 'training_type_update':
|
||||
# edzés típus lista updatelése ABí-ba
|
||||
unset($_POST['action']);
|
||||
foreach ($_POST as $key => $value) {
|
||||
$key_parts = explode('_', $key);
|
||||
$trt_id = $key_parts[1];
|
||||
$sql->update_table('training_type', array('trt_name' => $value), array('trt_id' => $trt_id));
|
||||
}
|
||||
// foreach ($_POST as $key => $value) {
|
||||
// $key_parts = explode('_', $key);
|
||||
// $trt_id = $key_parts[1];
|
||||
// $sql->update_table('training_type', array('trt_name' => $value), array('trt_id' => $trt_id));
|
||||
// }
|
||||
training_type::update_training_type($_POST);
|
||||
log::register('update_training_type', 'update all');
|
||||
header("Location: " . $actual_link);
|
||||
break;
|
||||
|
||||
5
queries/trt_default_price_20190718.sql
Normal file
5
queries/trt_default_price_20190718.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE `badminton_coach`.`training_type`
|
||||
ADD COLUMN `trt_default_price` INT NULL DEFAULT NULL AFTER `trt_deleted`;
|
||||
|
||||
ALTER TABLE `badminton_coach`.`training`
|
||||
ADD COLUMN `tr_price` INT NULL DEFAULT NULL AFTER `tr_deleted`;
|
||||
@@ -44,6 +44,10 @@
|
||||
<div><input type="text" name="tr_duration" id="tr_duration" required></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="tr_price">Ár:</label>
|
||||
<div><input type="text" name="tr_price" id="tr_price" required></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title1" for="every_week">Minden héten ebben az időpontban: (az adott hónapban)</label>
|
||||
@@ -96,7 +100,6 @@
|
||||
|
||||
$('#training_templates').on('change', function(e) {
|
||||
let selectedTemplate = $('#training_templates option:selected').val();
|
||||
console.log(selectedTemplate);
|
||||
$.ajax({
|
||||
url: '/_ajax/get_training_template.php',
|
||||
//method: 'GET',
|
||||
@@ -110,6 +113,7 @@
|
||||
|
||||
$('#tr_date').val('');
|
||||
$('#tr_training_type_trt_id').val('null');
|
||||
$('#tr_training_type_trt_id').trigger('change');
|
||||
$('#tr_duration').val('');
|
||||
|
||||
return;
|
||||
@@ -128,10 +132,36 @@
|
||||
|
||||
|
||||
if (null != pdata['tt_time']) $('#tr_date').val(output + ' ' + pdata['tt_time']);
|
||||
if (null != pdata['tt_training_type']) $('#tr_training_type_trt_id').val(pdata['tt_training_type']);
|
||||
if (null != pdata['tt_training_type']) {
|
||||
$('#tr_training_type_trt_id').val(pdata['tt_training_type']);
|
||||
$('#tr_training_type_trt_id').trigger('change');
|
||||
}
|
||||
if (null != pdata['tt_duration']) $('#tr_duration').val(pdata['tt_duration']);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#tr_training_type_trt_id').on('change', function(e) {
|
||||
//get trt default price by ajax
|
||||
let selectedType = $('#tr_training_type_trt_id option:selected').val();
|
||||
$.ajax({
|
||||
url: '/_ajax/get_trt_default_price.php',
|
||||
//method: 'GET',
|
||||
data: {
|
||||
'trt_id' : selectedType
|
||||
},
|
||||
success: function(data, status, jqXHR) {
|
||||
let pdata = JSON.parse(data);
|
||||
console.log(pdata);
|
||||
if (null === pdata) {
|
||||
$('#tr_price').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
$('#tr_price').val(pdata);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
<div class="form_wrapper">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="training_type_create">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="training_type_create">
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title1" for="trt_name">Új edzés típus neve:</label>
|
||||
<div><input type="text" name="trt_name" id="trt_name" required></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" id="title1" for="trt_name">Új edzés típus neve:</label>
|
||||
<div><input type="text" name="trt_name" id="trt_name" required></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" id="title1" for="trt_default_price">Alapértelmezett edzésdíj:</label>
|
||||
<div><input type="text" name="trt_default_price" id="trt_default_price"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Létrehozás">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Létrehozás">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
23
template/templates/training_type_edit.tpl
Normal file
23
template/templates/training_type_edit.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
<div class="form_wrapper">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="training_type_update">
|
||||
<input type="hidden" name="trt_id" value="{$trt->get_trt_id()}">
|
||||
<div class="buttons">
|
||||
<a href="/admin/delete_training_type/{$trt->get_trt_id()}" class="addbutton delete-big">Törlés</a>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" id="title1" for="trt_name">Név:</label>
|
||||
<div><input type="text" name="trt_name" id="trt_name" value="{$trt->get_trt_name()}" required></div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="desc" id="title1" for="trt_default_price">Alapértelmezett edzésdíj:</label>
|
||||
<div><input type="text" name="trt_default_price" id="trt_default_price" value="{$trt->get_trt_default_price()}"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Mentés">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,23 +1,15 @@
|
||||
<div class="form_wrapper">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="training_type_update">
|
||||
<div class="buttons">
|
||||
<a href="/admin/create/training_type" class="addbutton add-big">Új edzés típus hozzáadása</a>
|
||||
</div>
|
||||
{foreach $tr_type_assoc_array as $tr_type}
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<input type="text" name="trt_{$tr_type.trt_id}" id="trt_{$tr_type.trt_id}" value="{$tr_type.trt_name}">
|
||||
<a href="/admin/delete_training_type/{$tr_type.trt_id}" class="addbutton delete">Törlés</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{/foreach}
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<input class="button black" type="submit" value="Mentés">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="buttons">
|
||||
<a href="/admin/create/training_type" class="addbutton add-big">Új edzés típus hozzáadása</a>
|
||||
</div>
|
||||
{foreach $trt_array as $tr_type}
|
||||
<div class="list">
|
||||
<a href="/admin/training_types/{$tr_type->get_trt_id()}">
|
||||
<div class="list_item">
|
||||
<img src="/_image/training.png">
|
||||
{$tr_type->get_trt_name()}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user