From d73e0cce1afbaef795a52f53ee763c7cf93e7ec3 Mon Sep 17 00:00:00 2001 From: Ricsi Date: Sun, 22 Jan 2017 21:23:27 +0100 Subject: [PATCH] money basics: create, update deposits deposit icon to user list css modified, tablet view available --- _class/class_money_deposit.php | 96 ++++++++++++++ _class/class_page.php | 4 + _css/default.css | 131 +++++++++++++++----- _css/form.css | 11 +- _css/nav.css | 52 ++++---- _include/include_create.php | 19 +++ _include/include_money_deposit.php | 47 +++++++ common.php | 1 + event_handler.php | 16 +++ template/templates/money_deposit.tpl | 33 +++++ template/templates/money_deposit_create.tpl | 34 +++++ template/templates/money_deposit_update.tpl | 35 ++++++ template/templates/user_list.tpl | 11 +- 13 files changed, 428 insertions(+), 62 deletions(-) create mode 100644 _class/class_money_deposit.php create mode 100644 _include/include_money_deposit.php create mode 100644 template/templates/money_deposit.tpl create mode 100644 template/templates/money_deposit_create.tpl create mode 100644 template/templates/money_deposit_update.tpl diff --git a/_class/class_money_deposit.php b/_class/class_money_deposit.php new file mode 100644 index 0000000..46c4c41 --- /dev/null +++ b/_class/class_money_deposit.php @@ -0,0 +1,96 @@ +mod_id = $_id; + } + + public function set_mod_user_kid_uk_id($_user_kid_uk_id) { + $this->mod_user_kid_uk_id = $_user_kid_uk_id; + } + + public function set_mod_user_kid($_user_kid) { + $this->mod_user_kid = $_user_kid; + } + + public function set_mod_date($_date) { + $this->mod_date = $_date; + } + + public function set_mod_sum($_sum) { + $this->mod_sum = $_sum; + } + + public function get_mod_id() { + return $this->mod_id; + } + + public function get_mod_user_kid_uk_id() { + return $this->mod_user_kid_uk_id; + } + + public function get_mod_user_kid() { + return $this->mod_user_kid; + } + + public function get_mod_date() { + return $this->mod_date; + } + + public function get_mod_sum() { + return $this->mod_sum; + } + + public function set_mod_data_by_id($_id) { + global $sql; + $mod_query = "SELECT * FROM money_deposit WHERE mod_id = " . $_id . ";"; + $mod_assoc_array = $sql->assoc_array($mod_query); + //var_dump($mod_assoc_array); + foreach ($mod_assoc_array[0] as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); //alapadatok beállítása + if ($field == "mod_user_kid_uk_id") { + $new_user = new user_kid(); + $new_user->set_user_data_by_id($value); + $this->set_mod_user_kid($new_user); + } + } + + } + + public function create_money_deposit($_user_id, $_date, $_sum) { + global $sql; + return $sql->insert_into('money_deposit', array( + 'mod_user_kid_uk_id' => $_user_id, + 'mod_date' => $_date, + 'mod_sum' => $_sum + ) + ); + } + + public function update_money_deposit($_user_id, $_date, $_sum, $_mod_id) { + global $sql; + $sql->update_table('money_deposit', array( + 'mod_user_kid_uk_id' => $_user_id, + 'mod_date' => $_date, + 'mod_sum' => $_sum + ), array( + 'mod_id' => $_mod_id + )); + + } + + +} + +?> \ No newline at end of file diff --git a/_class/class_page.php b/_class/class_page.php index 6c318de..b7e19cf 100755 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -129,6 +129,10 @@ class page { # NAPLÓ include('include_log.php'); break; + case 'money_deposit': + # BEFIZETÉSEK + include('include_money_deposit.php'); + break; case 'lock_training': # EDZÉS ZÁROLÁS, FELOLDÁS include('include_lock_training.php'); diff --git a/_css/default.css b/_css/default.css index df94dba..4365db4 100644 --- a/_css/default.css +++ b/_css/default.css @@ -131,6 +131,29 @@ td.create a { line-height: 18px; font-size: 18px; } + + +.list_item table.money { + width: 100%; + padding: 0px; + text-align: left; +} + +.list_item table.money td.icon { + width: 25px; + padding: 0px; +} + +.list_item table.money td.sum { + width: 1%; + white-space: nowrap; +} + +.list_item table.money td.date { + text-align: right; + padding-right: 25px; +} + .list .name_tag { text-align: left; @@ -158,6 +181,11 @@ td.create a { } +.user_mod_form { + width: 20px; + float: right; +} + .list { clear: both; } @@ -178,13 +206,27 @@ td.create a { border-left: 2px solid #000; } -.list .list_item img, .list .name_tag img, .list .name_tag_checked img { +.list .list_item img, .list .name_tag img, .list .name_tag_checked img{ width: 20px; height: 20px; float: left; margin-right: 5px; } +.list .add_deposit { + position: relative; + top: -30px; + right: 10px; + cursor: pointer; + padding: 0px !important; + margin: 0px !important; +} + +.list .add_deposit img { + width: 20px; + height: 20px; +} + .list a { @@ -291,49 +333,21 @@ table.log tr.delete:hover { @media (min-width: 680px) { +/* */ + + + -main #main_content, main #loading { - width: 80%; - margin: 0px auto; -} -.user_filter { - width: 90%; -} -.user_filter select { - width: 40%; - max-width: 200px; -} -.user_filter input { - width: 40%; - float: left; - margin: 0px 10px 0px 0px; -} -.danger { - width: 90%; -} -.list { - width: 40%; -} -.wide { - width: 80% !important; -} -.list .list_item, .list .name_tag, .list .name_tag_checked { - width: 100%; -} -.list_item label { - float: left; - padding-right: 5px; -} .list .date_separator { width: 100%; @@ -341,4 +355,55 @@ main #main_content, main #loading { +} + +@media (min-width: 1000px) { + .half_width { + width: 50% !important; + } + + .list_item label { + float: left; + padding-right: 5px; + text-align: right; + + } + + .danger { + width: 90%; + } + + .wide { + width: 80% !important; + } + + .user_filter { + width: 90%; + } + + .user_filter select { + width: 40%; + max-width: 200px; + } + + .user_filter input { + width: 40%; + float: left; + margin: 0px 10px 0px 0px; + } + + main #main_content, main #loading { + width: 80%; + margin: 0px auto; + } + + .list { + width: 40%; + min-width: 400px; + } + + .list .list_item, .list .name_tag, .list .name_tag_checked { + width: 100%; + } + } \ No newline at end of file diff --git a/_css/form.css b/_css/form.css index 7d05b4d..2c19e48 100644 --- a/_css/form.css +++ b/_css/form.css @@ -126,7 +126,7 @@ input[type=email]:hover { width: 100%; } } -@media (min-width: 1200px) { +@media (min-width: 1000px) { form > div > label, legend { text-align: right; @@ -136,4 +136,13 @@ input[type=email]:hover { .form_wrapper { width: 70%; } +} + +@media (min-width: 601px) { + form > div > label, + legend { + text-align: right; + padding-top: 5px; + float: left; + } } \ No newline at end of file diff --git a/_css/nav.css b/_css/nav.css index 25013c3..81ceb4b 100644 --- a/_css/nav.css +++ b/_css/nav.css @@ -55,43 +55,41 @@ ul.topnav span.mobile_logout { display: none; } -@media screen and (max-width:680px) { +@media screen and (max-width:1000px) { ul.topnav li {display: none;} ul.topnav li.login {display: inline-block;} ul.topnav li.icon { float: left; display: inline-block; } -} -@media screen and (max-width:680px) { -nav { - width: 100%; -} -ul.topnav.responsive {position: relative;} + nav { + width: 100%; + } + ul.topnav.responsive {position: relative;} -ul.topnav.responsive li { - float: none; - display: inline; -} -ul.topnav.responsive li a { - display: block; - text-align: left; -} + ul.topnav.responsive li { + float: none; + display: inline; + } + ul.topnav.responsive li a { + display: block; + text-align: left; + } -li.logout_mobile { - display: block; -} -ul.topnav li.logout { - display: none; -} + li.logout_mobile { + display: block; + } + ul.topnav li.logout { + display: none; + } -ul.topnav span.mobile_logout { - display: block; - position: absolute; - top: 15px; - right: 15px; - font-size: 16px; + ul.topnav span.mobile_logout { + display: block; + position: absolute; + top: 15px; + right: 15px; + font-size: 16px; } diff --git a/_include/include_create.php b/_include/include_create.php index 44d96e4..187c6de 100755 --- a/_include/include_create.php +++ b/_include/include_create.php @@ -100,6 +100,25 @@ switch ($this->get_id()) { } $smarty->assign('school_cities',$school_cities); $smarty->display('school_create.tpl'); + break; + case 'money_deposit': + # ÚJ BEFIZETÉS + $user_kid_query = "SELECT * FROM user_kid WHERE uk_is_active = 1 AND uk_deleted = 0 order by uk_name ASC;"; + $user_kid_assoc_array = $sql->assoc_array($user_kid_query); + $user_kids = array(); + foreach ($user_kid_assoc_array as $key => $value) { + $new_kid = new user_kid(); + $new_kid->set_user_data_by_id($value['uk_id']); + $user_kids[] = $new_kid; + } + + if (isset($_POST['mod_user_kid_uk_id'])) { + $smarty->assign('user_kid_id', $_POST['mod_user_kid_uk_id']); + } + + $smarty->assign('user_kids', $user_kids); + $smarty->display('money_deposit_create.tpl'); + break; default: # code... diff --git a/_include/include_money_deposit.php b/_include/include_money_deposit.php new file mode 100644 index 0000000..5ae7a4c --- /dev/null +++ b/_include/include_money_deposit.php @@ -0,0 +1,47 @@ +is_id()) { + # ADOTT BEFIZETÉS ADATINAK MEGTEKINTÉSE/MÓDOSÍTÁSA + $mod = new money_deposit(); + $mod->set_mod_data_by_id($this->get_id()); + + $user_kid_query = "SELECT * FROM user_kid WHERE uk_is_active = 1 AND uk_deleted = 0 order by uk_name ASC;"; + $user_kid_assoc_array = $sql->assoc_array($user_kid_query); + $user_kids = array(); + foreach ($user_kid_assoc_array as $key => $value) { + $new_kid = new user_kid(); + $new_kid->set_user_data_by_id($value['uk_id']); + $user_kids[] = $new_kid; + } + + + $smarty->assign('user_kids', $user_kids); + $smarty->assign("mod", $mod); + $smarty->display("money_deposit_update.tpl"); + +} +else { + # BEFIZETÉS LISTA + $mod_query = "SELECT * FROM money_deposit ORDER BY mod_date DESC LIMIT 50;"; + $mod_array = array(); + $mod_assoc_array = $sql->assoc_array($mod_query); + + foreach ($mod_assoc_array as $mod) { + $new_mod = new money_deposit(); + $new_mod->set_mod_data_by_id($mod['mod_id']); + $mod_array[] = $new_mod; + } + + $smarty->assign("mod_array", $mod_array); + $smarty->display("money_deposit.tpl"); + +} + +?> \ No newline at end of file diff --git a/common.php b/common.php index e0b81b4..99830a8 100644 --- a/common.php +++ b/common.php @@ -68,6 +68,7 @@ $smarty->setConfigDir('template/configs'); $smarty->assign('months', $months); $smarty->assign('days', $days); +$smarty->assign('today', date('Y-m-d')); //SQL KAPCSOLAT BEÁLLÍTÁSA if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('localhost','root','','badminton_coach'); diff --git a/event_handler.php b/event_handler.php index fbe3c8b..2e3b1d1 100644 --- a/event_handler.php +++ b/event_handler.php @@ -242,6 +242,22 @@ if (isset($_POST['action'])) { log::register('update_school', $_POST['sc_id']); header("Location: /admin/schools"); break; + case 'money_deposit_create': + # új befizetés létrehozása + $new_mod_id = money_deposit::create_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum']); + $tmp_user = new user_kid(); + $tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']); + log::register('create_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')'); + header("Location: /admin/money_deposit"); + break; + case 'money_deposit_update': + # befizetés módosítás + money_deposit::update_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_id']); + $tmp_user = new user_kid(); + $tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']); + log::register('update_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')'); + header("Location: /admin/money_deposit"); + break; default: # code... break; diff --git a/template/templates/money_deposit.tpl b/template/templates/money_deposit.tpl new file mode 100644 index 0000000..9c1849e --- /dev/null +++ b/template/templates/money_deposit.tpl @@ -0,0 +1,33 @@ +
+ + Új befizetés + +
+ +
+ {foreach $mod_array as $mod} + +
+ + + + + + + + +
+ + + {$mod->get_mod_user_kid()->get_uk_name()} + + {$mod->get_mod_date()} + + {$mod->get_mod_sum()} Ft +
+
+
+ {/foreach} + +
+ diff --git a/template/templates/money_deposit_create.tpl b/template/templates/money_deposit_create.tpl new file mode 100644 index 0000000..4f2d19e --- /dev/null +++ b/template/templates/money_deposit_create.tpl @@ -0,0 +1,34 @@ +
+
+ + +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/template/templates/money_deposit_update.tpl b/template/templates/money_deposit_update.tpl new file mode 100644 index 0000000..2943556 --- /dev/null +++ b/template/templates/money_deposit_update.tpl @@ -0,0 +1,35 @@ +
+
+ + + +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/template/templates/user_list.tpl b/template/templates/user_list.tpl index 5da5069..7d038ae 100755 --- a/template/templates/user_list.tpl +++ b/template/templates/user_list.tpl @@ -43,6 +43,10 @@ $("#uk_filter_name").keyup(function() { }); +function open_deposit(user_id) { + $("#"+user_id).submit(); +} + function search() { document.getElementById('user_list').innerHTML = 'Betöltés...'; $("#is_active").prop("disabled",true); @@ -64,7 +68,12 @@ function search() { \ '+pdata[i]['uk_name']+'\ \ - '; + \ +
\ +
\ + \ +
\ + ' } document.getElementById('user_list').innerHTML = content; $("#is_active").prop("disabled",false);