diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index 9283fb0..441fb8c 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -418,25 +418,12 @@ class user_kid extends user_parent { $_user_value_array['uk_parent_1'] = self::add_new_parent( $_user_value_array['add_parent_1'], $_user_value_array['parent_1_email'], - $_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']); + '', $_user_value_array['parent_1_phone']); log::register('new_parent', $_user_value_array['uk_parent_1']); } if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']); if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']); - if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']); if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']); - //PARENT_2 HANDLER - if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") { - $_user_value_array['uk_parent_2'] = self::add_new_parent( - $_user_value_array['add_parent_2'], - $_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'], - $_user_value_array['parent_2_phone']); - log::register('new_parent', $_user_value_array['uk_parent_2']); - } - if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']); - if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']); - if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']); - if (isset($_user_value_array['parent_2_phone'])) unset($_user_value_array['parent_2_phone']); //date handler if (!isset($_user_value_array['uk_first_training']) || $_user_value_array['uk_first_training'] == "") { @@ -482,38 +469,21 @@ class user_kid extends user_parent { $_user_value_array['uk_parent_1'] = self::add_new_parent( $_user_value_array['add_parent_1'], $_user_value_array['parent_1_email'], - $_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']); + '', $_user_value_array['parent_1_phone']); log::register('new_parent', $_user_value_array['uk_parent_1']); } else { //meglévő szülő updatelése user_parent::update_parent(array( 'up_email' => $_user_value_array['parent_1_email'], - 'up_facebook' => $_user_value_array['parent_1_facebook'], 'up_phone' => $_user_value_array['parent_1_phone']), $_user_value_array['uk_parent_1']); } if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']); if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']); - if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']); if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']); //PARENT_2 HANDLER - if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") { - $_user_value_array['uk_parent_2'] = self::add_new_parent( - $_user_value_array['add_parent_2'], - $_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'], - $_user_value_array['parent_2_phone']); - log::register('new_parent', $_user_value_array['uk_parent_2']); - } - else { - //meglévő szülő updatelése - //var_dump($_user_value_array['uk_parent_2']); - user_parent::update_parent(array( - 'up_email' => $_user_value_array['parent_2_email'], - 'up_facebook' => $_user_value_array['parent_2_facebook'], - 'up_phone' => $_user_value_array['parent_2_phone']), $_user_value_array['uk_parent_2']); - - } + if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']); if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']); if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']); diff --git a/_css/button.css b/_css/button.css index 7f026b9..7784938 100644 --- a/_css/button.css +++ b/_css/button.css @@ -42,8 +42,13 @@ text-shadow: 0 1px 0 #2f2f2f; padding: 5px; } + +.button.black[disabled] { + color: #aa9e9e; + background: linear-gradient(#656565, #6a6262); +} -.button.black:hover { +.button.black:not([disabled]):hover { background: #4c4c4c; background: -webkit-gradient(linear, 0 0, 0 bottom, from(#4c4c4c), to(#565656)); background: -moz-linear-gradient(#4c4c4c, #565656); diff --git a/_include/include_export_users.php b/_include/include_export_users.php index efa39ab..01e9361 100644 --- a/_include/include_export_users.php +++ b/_include/include_export_users.php @@ -3,28 +3,33 @@ $userAssocArray = $sql->assoc_array(" SELECT uk_name AS 'Név', - GROUP_CONCAT(trt_name) as 'Szint', - sc_name as 'Iskola', - uk_email as 'Email', - uk_phone as 'Telefonszám', - p1.up_name as 'Szülő1', - p1.up_email as 'Sz1_Email', - p1.up_phone as 'Sz1_Telefonszám', - p2.up_name as 'Szülő2', - p2.up_email as 'Sz2_Email', - p2.up_phone as 'Sz2_Telefonszám' + CASE + WHEN uk_gender = 1 THEN 'fiú' + ELSE 'lány' + END AS 'Nem', + uk_birth_date AS 'Születési dátum', + scc_city AS 'Lakhely', + CASE + WHEN uk_hand = 1 THEN 'bal' + ELSE 'jobb' + END AS 'Kéz', + sc_name AS 'Iskola', + uk_email AS 'Email', + uk_phone AS 'Telefonszám', + p1.up_name AS 'Szülő', + p1.up_email AS 'Szülő Email', + p1.up_phone AS 'Szülő Telefonszám', + uk_other AS 'Egyéb' FROM user_kid LEFT JOIN user_parent p1 ON p1.up_id = uk_parent_1 LEFT JOIN - user_parent p2 ON p2.up_id = uk_parent_2 - LEFT JOIN school ON sc_id = uk_school_sc_id LEFT JOIN user_kid_training_type ON uktt_user_kid_uk_id = uk_id LEFT JOIN - training_type ON trt_id = uktt_training_type_tt_id + school_city ON uk_address_scc_id = scc_id WHERE uk_deleted = 0 AND uk_is_active = 1 GROUP BY uk_name diff --git a/_include/include_userlist.php b/_include/include_userlist.php index ab07cd7..a560916 100644 --- a/_include/include_userlist.php +++ b/_include/include_userlist.php @@ -3,28 +3,33 @@ $userAssocArray = $sql->assoc_array(" SELECT uk_name AS 'Név', - GROUP_CONCAT(trt_name) as 'Szint', - sc_name as 'Iskola', - uk_email as 'Email', - uk_phone as 'Telefonszám', - p1.up_name as 'Szülő1', - p1.up_email as 'Sz1_Email', - p1.up_phone as 'Sz1_Telefonszám', - p2.up_name as 'Szülő2', - p2.up_email as 'Sz2_Email', - p2.up_phone as 'Sz2_Telefonszám' + CASE + WHEN uk_gender = 1 THEN 'fiú' + ELSE 'lány' + END AS 'Nem', + uk_birth_date AS 'Születési dátum', + scc_city AS 'Lakhely', + CASE + WHEN uk_hand = 1 THEN 'bal' + ELSE 'jobb' + END AS 'Kéz', + sc_name AS 'Iskola', + uk_email AS 'Email', + uk_phone AS 'Telefonszám', + p1.up_name AS 'Szülő', + p1.up_email AS 'Szülő Email', + p1.up_phone AS 'Szülő Telefonszám', + uk_other AS 'Egyéb' FROM user_kid LEFT JOIN user_parent p1 ON p1.up_id = uk_parent_1 LEFT JOIN - user_parent p2 ON p2.up_id = uk_parent_2 - LEFT JOIN school ON sc_id = uk_school_sc_id LEFT JOIN user_kid_training_type ON uktt_user_kid_uk_id = uk_id LEFT JOIN - training_type ON trt_id = uktt_training_type_tt_id + school_city ON uk_address_scc_id = scc_id WHERE uk_deleted = 0 AND uk_is_active = 1 GROUP BY uk_name diff --git a/template/templates/user_data_create.tpl b/template/templates/user_data_create.tpl index 93b8d6d..68a8e77 100644 --- a/template/templates/user_data_create.tpl +++ b/template/templates/user_data_create.tpl @@ -61,18 +61,7 @@ - -
- -
-
- -
- -
-
- - +
Kéz:
@@ -85,16 +74,6 @@
- {*
- - {foreach $tt_assoc_array as $tt} -
- - {$tt['trt_name']} -
- {/foreach} -
*} -
@@ -105,30 +84,6 @@
-
- -
-
- -
- -
- -
-
- -
- -
-
-
@@ -162,33 +117,6 @@
- - - -
- -
- -
-
- -
- -
-
- -
- -
-
-
@@ -216,52 +144,6 @@
-
- -
-
- - -
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
- -
-

@@ -275,7 +157,7 @@
- +
@@ -297,4 +179,67 @@ $('#uk_school_sc_id').change(function() { $(".add_school").toggle(this.value == 'null'); }); +document.addEventListener("DOMContentLoaded", function () { + const form = document.querySelector(".form_wrapper form"); + const submitButton = form.querySelector('input.button.black[type="submit"]'); + + const textInputs = Array.from(form.querySelectorAll('input[type="text"], input[type="email"], textarea')); + + // Select fields that control conditional validation + const parentSelect = form.querySelector('#uk_parent_1'); + const schoolSelect = form.querySelector('#uk_school_sc_id'); + const addressSelect = form.querySelector('#uk_address_scc_id'); + + const conditionalFields = [ + { + select: parentSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_parent_1'), + form.querySelector('#parent_1_email'), + form.querySelector('#parent_1_phone') + ] + }, + { + select: schoolSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_school') + ] + } + ]; + + function toggleSubmitButton() { + let fieldsToCheck = [...textInputs]; + + // Exclude fields based on select value + conditionalFields.forEach(group => { + if (group.select.value !== group.valueToIgnore) { + fieldsToCheck = fieldsToCheck.filter(field => !group.fields.includes(field)); + } + }); + + // Check if any required field is empty + const anyEmpty = fieldsToCheck.some(input => input.value.trim() === ""); + + // Check if uk_address_scc_id is still "null" + const addressMissing = addressSelect.value === "null"; + + submitButton.disabled = anyEmpty || addressMissing; + } + + // Listen to input changes + textInputs.forEach(input => { + input.addEventListener("input", toggleSubmitButton); + }); + + // Listen to select changes + [parentSelect, schoolSelect, addressSelect].forEach(select => { + select.addEventListener("change", toggleSubmitButton); + }); + + // Initial validation + toggleSubmitButton(); +}); + diff --git a/template/templates/user_data_edit.tpl b/template/templates/user_data_edit.tpl index 700bae7..c36b730 100644 --- a/template/templates/user_data_edit.tpl +++ b/template/templates/user_data_edit.tpl @@ -1,42 +1,36 @@
- -
- - - +
+ Törlés +
+ + + +
-
+
-
+
-
-
- -
- -
+
+
-
+
-{*
- -
-
*} -
{{$user_data.uk_balance|number_format:0:'':' '}} Ft
@@ -90,7 +84,8 @@
-
- -
- -
-
-
Kéz:
@@ -120,16 +105,6 @@
- {*
- - {foreach $tt_assoc_array as $tt} -
- - {$tt['trt_name']} -
- {/foreach} -
*} -
@@ -140,37 +115,14 @@
-
- -
-
- -
- -
- -
-
- -
- -
-
-
- - {foreach $region_assoc_array as $region_array} - - {/foreach} - -
-
- -
- -
-
- -
- -
-
-
-
- -
-
- - - - -
- -
- -
-
- -
- -
-
- -
- -
-
-
- -
-
- -
- -
-
- -
- -
- -
-

@@ -317,11 +197,11 @@
- + + document.addEventListener("DOMContentLoaded", function() { + const form = document.querySelector(".form_wrapper form"); + const submitButton = form.querySelector('input.button.black[type="submit"]'); + + const textInputs = Array.from(form.querySelectorAll( + 'input[type="text"], input[type="email"], textarea')); + + // Select fields that control conditional validation + const parentSelect = form.querySelector('#uk_parent_1'); + const schoolSelect = form.querySelector('#uk_school_sc_id'); + const addressSelect = form.querySelector('#uk_address_scc_id'); + + const conditionalFields = [{ + select: parentSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_parent_1'), + form.querySelector('#parent_1_email'), + form.querySelector('#parent_1_phone') + ] + }, + { + select: schoolSelect, + valueToIgnore: 'null', + fields: [ + form.querySelector('#add_school') + ] + } + ]; + + function toggleSubmitButton() { + let fieldsToCheck = [...textInputs]; + + // Exclude fields based on select value + conditionalFields.forEach(group => { + if (group.select.value !== group.valueToIgnore) { + fieldsToCheck = fieldsToCheck.filter(field => !group.fields.includes(field)); + } + }); + + // Check if any required field is empty + const anyEmpty = fieldsToCheck.some(input => input.value.trim() === ""); + + // Check if uk_address_scc_id is still "null" + const addressMissing = addressSelect.value === "null"; + + submitButton.disabled = anyEmpty || addressMissing; + } + + // Listen to input changes + textInputs.forEach(input => { + input.addEventListener("input", toggleSubmitButton); + }); + + // Listen to select changes + [parentSelect, schoolSelect, addressSelect].forEach(select => { + select.addEventListener("change", toggleSubmitButton); + }); + + // Initial validation + toggleSubmitButton(); + }); + \ No newline at end of file diff --git a/template/templates/user_export_list.tpl b/template/templates/user_export_list.tpl index 5d005be..185b911 100644 --- a/template/templates/user_export_list.tpl +++ b/template/templates/user_export_list.tpl @@ -8,30 +8,32 @@ - + + + + + + - - - - - - - - + + + + {foreach $users as $user} - - + + + + - - - - - - + + + + + {/foreach}
NévSzintNemSzületési dátumLakhelyKézEmailTelefonszám IskolaEmailTelefonszámSzülő 1EmailTelefonszámSzülő 2EmailTelefonszámSzülőSzülő EmailSzülő TelefonszámEgyéb
{$user['Név']}{$user['Szint']}{$user['Iskola']}{$user['Nem']}{$user['Születési dátum']}{$user['Lakhely']}{$user['Kéz']} {$user['Email']} {$user['Telefonszám']}{$user['Szülő1']}{$user['Sz1_Email']}{$user['Sz1_Telefonszám']}{$user['Szülő2']}{$user['Sz2_Email']}{$user['Sz2_Telefonszám']}{$user['Iskola']}{$user['Szülő']}{$user['Szülő Email']}{$user['Szülő Telefonszám']}{$user['Egyéb']}