From 1db830ca71b054691255c85c163c8dade8bf4cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B3th=20Rich=C3=A1rd?= Date: Sun, 16 Sep 2018 13:06:12 +0200 Subject: [PATCH] jump to presence; bigger checkbox; actual balance --- _class/class_training.php | 20 +- _css/default_view.css | 12 + _css/form.css | 33 ++- _include/include_create.php | 2 +- event_handler.php | 12 +- template/templates/training_data_create.tpl | 127 +++++---- template/templates/training_data_edit.tpl | 6 +- template/templates/user_data_create.tpl | 48 ++-- template/templates/user_diary.tpl | 282 ++++++++++---------- 9 files changed, 300 insertions(+), 242 deletions(-) diff --git a/_class/class_training.php b/_class/class_training.php index 4e51311..5ac769e 100644 --- a/_class/class_training.php +++ b/_class/class_training.php @@ -25,11 +25,11 @@ class training { } public function set_tr_date($_tr_date) { - $this->tr_date = $_tr_date; + $this->tr_date = $_tr_date; } public function set_tr_training_type_trt_id($_tr_training_type_trt_id) { - $this->tr_training_type_trt_id = $_tr_training_type_trt_id; + $this->tr_training_type_trt_id = $_tr_training_type_trt_id; } public function set_tr_duration($_tr_duration) { @@ -58,7 +58,7 @@ class training { public function get_tr_date_day() { $day = date("d", strtotime($this->tr_date)); - if (substr($day, 0, 1) == '0') return substr($day, 1, 1); + if (substr($day, 0, 1) == '0') return substr($day, 1, 1); return date("d", strtotime($this->tr_date)); } @@ -112,7 +112,7 @@ class training { $training_data_array = $training_data_assoc_array[0]; foreach ($training_data_array as $field => $value) { $function_name = "set_" . $field; - $this->$function_name($value); + $this->$function_name($value); } $this->set_tr_coaches(); } @@ -142,9 +142,9 @@ class training { $day_of_week = date('N', strtotime($_training_value_array['tr_date'])); //kigyűjtük a hónap további ilyen napjait $last_day = date("t", strtotime($_training_value_array['tr_date'])); - - for ($actual_day=date('d', strtotime($_training_value_array['tr_date'])); $actual_day <= $last_day; $actual_day=$actual_day+7) { - $new_tr_id = $sql->insert_into('training', + + for ($actual_day=date('d', strtotime($_training_value_array['tr_date'])); $actual_day <= $last_day; $actual_day=$actual_day+7) { + $new_tr_id = $sql->insert_into('training', array( 'tr_date' => date('Y-m', strtotime($_training_value_array['tr_date'])) . '-' . $actual_day . ' ' . date('H:i', strtotime($_training_value_array['tr_date'])), 'tr_training_type_trt_id' => $_training_value_array['tr_training_type_trt_id'], @@ -201,6 +201,8 @@ class training { } } + return $new_tr_id; + } public static function update_training($_training_value_array, $_tr_id) { @@ -220,7 +222,7 @@ class training { foreach ($_training_value_array['helpers'] as $coach_id) { $sql->insert_into('training_coach', array('trc_training_tr_id' => $_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1)); } - + unset($_training_value_array['helpers']); } if ($_training_value_array['tr_note'] == "") { @@ -231,4 +233,4 @@ class training { } -?> \ No newline at end of file +?> diff --git a/_css/default_view.css b/_css/default_view.css index d1224a9..79d0415 100644 --- a/_css/default_view.css +++ b/_css/default_view.css @@ -42,6 +42,18 @@ div.list div.money_deposit { color: #002E4C; } +div.list div.actual_balance { + background-color: #020372; + border-left: 2px solid #FD9500; + color: white; +} + +div.list div.actual_balance:hover { + background-color: #020372; + border-left: 2px solid #FD9500; + color: white; +} + .list_item.training { background-color: #a1ffff; border-left: 2px solid #0a40ff; diff --git a/_css/form.css b/_css/form.css index e2b6c3c..aaa065a 100644 --- a/_css/form.css +++ b/_css/form.css @@ -1,5 +1,5 @@ .form_wrapper { - + } form > div { @@ -78,24 +78,24 @@ textarea:hover, input[type=text]:hover, input[type=email]:hover { outline: 0; - + color: #333; border-color: rgba(41, 92, 161, 0.4); - + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6); -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6); - outline: 0 none; + outline: 0 none; } .coach { float: left; - margin: 3px 10px 0px 0px; + margin: 10px 10px 0px 0px; } .coach_type { - margin: 3px 0px 0px 0px; - + transform: scale(2); + margin: 10px 20px; } .coach_type_text { @@ -105,7 +105,7 @@ input[type=email]:hover { @media (max-width: 600px) { form > div { - margin: 0 0 15px 0; + margin: 0 0 15px 0; } form > div > label, legend { @@ -123,7 +123,7 @@ input[type=email]:hover { input[type=password], textarea, select { - width: 100%; + width: 100%; } } @media (min-width: 1250px) { @@ -136,6 +136,16 @@ input[type=email]:hover { .form_wrapper { width: 70%; } + + .coach_type { + transform: none; + margin: 0; + } + + .coach { + float: left; + margin: 3px 10px 0px 0px; + } } @media (min-width: 601px) { @@ -145,4 +155,7 @@ input[type=email]:hover { padding-top: 5px; float: left; } -} \ No newline at end of file +} + +@media (min-width: 680px) { +} diff --git a/_include/include_create.php b/_include/include_create.php index f0b0b66..16852e7 100644 --- a/_include/include_create.php +++ b/_include/include_create.php @@ -48,7 +48,7 @@ switch ($this->get_id()) { $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;"; + $coach_data_query = "SELECT * FROM user_coach WHERE ua_deleted = 0 AND ua_name != 'Tóth Richárd';"; $coach_data_assoc_array = $sql->assoc_array($coach_data_query); diff --git a/event_handler.php b/event_handler.php index 9c3adb9..af58f09 100644 --- a/event_handler.php +++ b/event_handler.php @@ -164,9 +164,17 @@ if (isset($_POST['action'])) { unset($_POST['action']); $every_week = isset($_POST['every_week']); + $jumpTo = $_POST['jumpTo']; + unset($_POST['jumpTo']); if ($every_week) unset($_POST['every_week']); - training::create_training($_POST, $every_week); - header("Location: /admin/trainings/"); + $tr_id = training::create_training($_POST, $every_week); + + if (!$jumpTo) { + header("Location: /admin/trainings/"); + } + else { + header("Location: /admin/presence/".$tr_id); + } break; diff --git a/template/templates/training_data_create.tpl b/template/templates/training_data_create.tpl index 8c219c4..7793591 100644 --- a/template/templates/training_data_create.tpl +++ b/template/templates/training_data_create.tpl @@ -1,68 +1,81 @@
-
- + + + -
- -
-
+
+ +
+
-
- -
- -
-
+
+ +
+ +
+
-
- -
-
+
+ +
+
-
- -
-
+
+ +
+
-
- -
- -
-
+
+ +
+ +
+
-
- - - - - - - - {foreach $coach_array as $coach} - - - - - - {/foreach} -
NévESE
{$coach->get_ua_name()}
-
+
+ + + + + + + + {foreach $coach_array as $coach} + + + + + + {/foreach} +
NévESE
{$coach->get_ua_name()}
+
-
-
- -
-
-
-
\ No newline at end of file +
+
+ + +
+
+ + + + diff --git a/template/templates/training_data_edit.tpl b/template/templates/training_data_edit.tpl index dc5fb86..f577961 100644 --- a/template/templates/training_data_edit.tpl +++ b/template/templates/training_data_edit.tpl @@ -42,8 +42,8 @@ - - + + {foreach $coach_array as $coach} @@ -62,4 +62,4 @@ - \ No newline at end of file + diff --git a/template/templates/user_data_create.tpl b/template/templates/user_data_create.tpl index d15aee0..85a47de 100644 --- a/template/templates/user_data_create.tpl +++ b/template/templates/user_data_create.tpl @@ -102,6 +102,30 @@
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
@@ -162,30 +186,6 @@
-
- -
- -
-
- -
- -
-
- -
- -
-
-
diff --git a/template/templates/user_diary.tpl b/template/templates/user_diary.tpl index 76f1cae..3a52963 100644 --- a/template/templates/user_diary.tpl +++ b/template/templates/user_diary.tpl @@ -1,190 +1,200 @@
- {if count($actions) == 0} -
-
- Áthozat: {$balance_transfer} Ft -
-
- {/if} + {if count($actions) == 0} +
+
+ Áthozat: {$balance_transfer} Ft +
+
+ {/if} - {foreach $actions as $action} + {foreach $actions as $action} - {if $action->get_de_training()|is_a:'training'} + {if $action@first} +
+
+ + Aktuális egyenleg: {$action->get_de_balance()|number_format:0:'':' '} Ft + +
+
+ {/if} - {if !$action@first && - $actions[$action@index-1]->get_de_training()|is_a:'training' && - $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 + {if $action->get_de_training()|is_a:'training'} - || + {if !$action@first && + $actions[$action@index-1]->get_de_training()|is_a:'training' && + $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 - !$action@first && - $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && - $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 + || - } + !$action@first && + $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && + $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 -
- {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) -
- Egyenleg - -
-
-
+ } - {elseif $action@first} - {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) -
- Egyenleg - -
-
-
+
+ {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} + ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) +
+ Egyenleg + +
+
+
- {/if} -
-
- - {$action->get_de_training()->get_tr_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} - {$action->get_de_training()->get_tr_date_day()}. - {$days[$action->get_de_training()->get_tr_date_day_of_week()]} - {$action->get_de_training()->get_tr_date_time()} - -
- {if $action->get_de_training()->get_tr_training_type_trt_id()}{$action->get_de_training()->get_tr_type_name_by_id()} edzés{/if} - {$action->get_de_training()->get_tr_duration()} p - {if $action->get_de_training()->is_coach()} - {foreach $action->get_de_training()->get_tr_coaches_name() as $coach_name} - {if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if} - {/foreach} - {/if} + {elseif $action@first} + {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} + ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) +
+ Egyenleg + +
+
+
- {assign var="discount" value=""} - {if $action->get_de_has_discount()} - {if $action->get_de_discount_id() == 1} - {assign var="discount" value="Próba kedvezmény"} - {elseif $action->get_de_discount_id() == 2} - {assign var="discount" value="Havi 10+ kedvezmény"} - {elseif $action->get_de_discount_id() == 3} - {assign var="discount" value="Duplázó kedvezmény"} - {/if} - {/if} + {/if} +
+
+ + {$action->get_de_training()->get_tr_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} + {$action->get_de_training()->get_tr_date_day()}. + {$days[$action->get_de_training()->get_tr_date_day_of_week()]} + {$action->get_de_training()->get_tr_date_time()} + +
+ {if $action->get_de_training()->get_tr_training_type_trt_id()}{$action->get_de_training()->get_tr_type_name_by_id()} edzés{/if} + {$action->get_de_training()->get_tr_duration()} p + {if $action->get_de_training()->is_coach()} + {foreach $action->get_de_training()->get_tr_coaches_name() as $coach_name} + {if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if} + {/foreach} + {/if} -
- Egyenleg: {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft - {if $discount != ""}
{$discount}{/if} -
-
+ {assign var="discount" value=""} + {if $action->get_de_has_discount()} + {if $action->get_de_discount_id() == 1} + {assign var="discount" value="Próba kedvezmény"} + {elseif $action->get_de_discount_id() == 2} + {assign var="discount" value="Havi 10+ kedvezmény"} + {elseif $action->get_de_discount_id() == 3} + {assign var="discount" value="Duplázó kedvezmény"} + {/if} + {/if} -
+
+ Egyenleg: {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft + {if $discount != ""}
{$discount}{/if} +
+
+ +
- {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft
{$discount} -
-
+ {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft
{$discount} +
+
- {elseif $action->get_de_money_deposit()|is_a:'money_deposit'} + {elseif $action->get_de_money_deposit()|is_a:'money_deposit'} - {if !$action@first && - $actions[$action@index-1]->get_de_training()|is_a:'training' && - $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 + {if !$action@first && + $actions[$action@index-1]->get_de_training()|is_a:'training' && + $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 - || + || - !$action@first && - $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && - $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 + !$action@first && + $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && + $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 - } + } -
- {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) - - -
+
+ {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} + ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) + + +
- {elseif $action@first} + {elseif $action@first} - {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) - - -
+ {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} + ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) + + +
- {/if} -
-
- - {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} - {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date_day()}. - -
- befizetés: {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_sum(true)} Ft -
+ {/if} +
+
+ + {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} + {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date_day()}. + +
+ befizetés: {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_sum(true)} Ft +
-
- {assign var="discount" value=""} - {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft
{$discount} -
-
+
+ {assign var="discount" value=""} + {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft
{$discount} +
+
- {/if} + {/if} - {if $action@last} -
-
- Áthozat: {$balance_transfer} Ft -
-
+ {if $action@last} +
+
+ Áthozat: {$balance_transfer} Ft +
+
-
+
- {/if} - {/foreach} + {/if} + {/foreach}
NévESEESE