remove some fields from kids and change exported data columns
This commit is contained in:
@@ -61,18 +61,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_first_training">Első edzés dátuma:</label>
|
||||
<div><input type="text" name="uk_first_training" id="uk_first_training"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_beforehand">Előzmény:</label>
|
||||
<div><input type="text" name="uk_beforehand" id="uk_beforehand"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<legend class="desc" for="uk_hand">Kéz: </legend>
|
||||
<div>
|
||||
@@ -85,16 +74,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* <div>
|
||||
<label for="level">Szint:</label>
|
||||
{foreach $tt_assoc_array as $tt}
|
||||
<div>
|
||||
<input type="checkbox" name="level[]" value="{$tt['trt_id']}">
|
||||
<span style="position: relative; bottom: 3px;">{$tt['trt_name']}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div> *}
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_email">E-mail cím:</label>
|
||||
<div><input type="email" name="uk_email" id="uk_email"></div>
|
||||
@@ -105,30 +84,6 @@
|
||||
<div><input type="text" name="uk_phone" id="uk_phone"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_facebook">Facebook:</label>
|
||||
<div><input type="text" name="uk_facebook" id="uk_facebook"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_shirt_size_ss_id">Pólóméret:</label>
|
||||
<div>
|
||||
<select name="uk_shirt_size_ss_id" id="uk_shirt_size_ss_id">
|
||||
<option value="null"> - </option>
|
||||
{foreach $shirt_size_assoc_array as $shirt_size_array}
|
||||
<option value="{$shirt_size_array.shirt_id}">
|
||||
{$shirt_size_array.shirt_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_shirt_note">Póló megjegyzés:</label>
|
||||
<div><input type="text" name="uk_shirt_note" id="uk_shirt_note"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_school_sc_id">Iskola neve:</label>
|
||||
<div>
|
||||
@@ -162,33 +117,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_region_reg_id">Diákolimpia körzet:</label>
|
||||
<div>
|
||||
<select name="uk_region_reg_id" id="uk_region_reg_id">
|
||||
<option value="null"> - </option>
|
||||
{foreach $region_assoc_array as $region_array}
|
||||
<option value="{$region_array.reg_id}">
|
||||
{$region_array.reg_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_age_category">Diákolimpia korcsoport:</label>
|
||||
<div><input type="text" name="uk_age_category" id="uk_age_category"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_official_age_category">MTLSz korosztály:</label>
|
||||
<div><input type="text" name="uk_official_age_category" id="uk_official_age_category"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="desc" for="uk_parent_1">Szülő:</label>
|
||||
<div>
|
||||
@@ -216,52 +144,6 @@
|
||||
<label class="desc" for="parent_1_phone">Telefonszám:</label>
|
||||
<div><input type="text" name="parent_1_phone" id="parent_1_phone"></div>
|
||||
</div>
|
||||
<div class="add_parent_1_block">
|
||||
<label class="desc" for="parent_1_facebook">Facebook:</label>
|
||||
<div><input type="text" name="parent_1_facebook" id="parent_1_facebook"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="uk_parent_2">Szülő:</label>
|
||||
<div>
|
||||
<select name="uk_parent_2" id="uk_parent_2">
|
||||
<option value="null"> - (állítsd erre új szülő felvételéhez)</option>
|
||||
{foreach $parent_assoc_array as $parent_array}
|
||||
<option value="{$parent_array.up_id}">
|
||||
{$parent_array.up_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="add_parent_2">Új szülő neve:</label>
|
||||
<div><input type="text" name="add_parent_2" id="add_parent_2"></div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="parent_2_email">E-mail cím:</label>
|
||||
<div><input type="text" name="parent_2_email" id="parent_2_email"></div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="parent_2_phone">Telefonszám:</label>
|
||||
<div><input type="text" name="parent_2_phone" id="parent_2_phone"></div>
|
||||
</div>
|
||||
|
||||
<div class="add_parent_2_block">
|
||||
<label class="desc" id="title2" for="parent_2_facebook">Facebook:</label>
|
||||
<div><input type="text" name="parent_2_facebook" id="parent_2_facebook"></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<label class="desc" id="title2" for="uk_contact">Kapcsolat tartás:</label>
|
||||
<div><textarea rows="7" name="uk_contact" id="uk_contact"></textarea></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
@@ -275,7 +157,7 @@
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Létrehozás">
|
||||
<input disabled class="button black" type="submit" value="Létrehozás">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user