make 'other' field optional and add inactivate/activate button
This commit is contained in:
@@ -44,7 +44,7 @@ class page
|
|||||||
OR ua_authority_a_id = 1)
|
OR ua_authority_a_id = 1)
|
||||||
WHERE
|
WHERE
|
||||||
spage_page_id = 1
|
spage_page_id = 1
|
||||||
AND ua_user_kid_uk_id = '.$user->get_ua_id().' ORDER BY spage_id ASC;
|
AND ua_user_kid_uk_id = ' . $user->get_ua_id() . ' ORDER BY spage_id ASC;
|
||||||
';
|
';
|
||||||
} else {
|
} else {
|
||||||
$menus_query = 'SELECT * FROM subpage WHERE spage_page_id = 1;';
|
$menus_query = 'SELECT * FROM subpage WHERE spage_page_id = 1;';
|
||||||
@@ -404,6 +404,10 @@ class page
|
|||||||
// TÁBORVEZETŐ TÖRLÉS
|
// TÁBORVEZETŐ TÖRLÉS
|
||||||
include 'include_delete_camp_leader.php';
|
include 'include_delete_camp_leader.php';
|
||||||
break;
|
break;
|
||||||
|
case 'set_active_status':
|
||||||
|
// TÁBORVEZETŐ TÖRLÉS
|
||||||
|
include 'include_set_active_status.php';
|
||||||
|
break;
|
||||||
case 'emails':
|
case 'emails':
|
||||||
# email log
|
# email log
|
||||||
include('include_emails.php');
|
include('include_emails.php');
|
||||||
@@ -419,7 +423,7 @@ class page
|
|||||||
break;
|
break;
|
||||||
case 'ajax':
|
case 'ajax':
|
||||||
if ($this->is_subpage()) {
|
if ($this->is_subpage()) {
|
||||||
include 'ajax/'.$this->get_subpage();
|
include 'ajax/' . $this->get_subpage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'view':
|
case 'view':
|
||||||
|
|||||||
17
_include/include_set_active_status.php
Normal file
17
_include/include_set_active_status.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->is_id()) {
|
||||||
|
$user_kid = new user_kid();
|
||||||
|
$user_kid->set_user_data_by_id($this->get_id());
|
||||||
|
|
||||||
|
$activityToSet = $user_kid->get_uk_is_active() == 1 ? 0 : 1;
|
||||||
|
|
||||||
|
$sql->update_table('user_kid', [
|
||||||
|
'uk_is_active' => $activityToSet
|
||||||
|
], [
|
||||||
|
'uk_id' => $this->get_id()
|
||||||
|
]);
|
||||||
|
|
||||||
|
header("Location: /admin/members/" . $this->get_id());
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="form_wrapper">
|
<div class="form_wrapper">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="action" id="action" value="user_data_create">
|
<input type="hidden" name="action" id="action" value="user_data_create">
|
||||||
<div>
|
<div>
|
||||||
<label class="desc" for="uk_name">Név:</label>
|
<label class="desc" for="uk_name">Név:</label>
|
||||||
@@ -162,36 +162,37 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$('#uk_parent_1').change(function() {
|
||||||
$('#uk_parent_1').change(function() {
|
|
||||||
$(".add_parent_1_block").toggle(this.value == 'null');
|
$(".add_parent_1_block").toggle(this.value == 'null');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#uk_parent_2').change(function() {
|
$('#uk_parent_2').change(function() {
|
||||||
$(".add_parent_2_block").toggle(this.value == 'null');
|
$(".add_parent_2_block").toggle(this.value == 'null');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#uk_school_sc_id').change(function() {
|
$('#uk_school_sc_id').change(function() {
|
||||||
$(".add_school").toggle(this.value == 'null');
|
$(".add_school").toggle(this.value == 'null');
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
const form = document.querySelector(".form_wrapper form");
|
const form = document.querySelector(".form_wrapper form");
|
||||||
const submitButton = form.querySelector('input.button.black[type="submit"]');
|
const submitButton = form.querySelector('input.button.black[type="submit"]');
|
||||||
|
|
||||||
const textInputs = Array.from(form.querySelectorAll('input[type="text"], input[type="email"], textarea'));
|
// Collect text inputs but exclude #uk_other
|
||||||
|
const textInputs = Array.from(form.querySelectorAll(
|
||||||
|
'input[type="text"], input[type="email"], textarea'
|
||||||
|
)).filter(input => input.id !== "uk_other");
|
||||||
|
|
||||||
// Select fields that control conditional validation
|
// Select fields that control conditional validation
|
||||||
const parentSelect = form.querySelector('#uk_parent_1');
|
const parentSelect = form.querySelector('#uk_parent_1');
|
||||||
const schoolSelect = form.querySelector('#uk_school_sc_id');
|
const schoolSelect = form.querySelector('#uk_school_sc_id');
|
||||||
const addressSelect = form.querySelector('#uk_address_scc_id');
|
const addressSelect = form.querySelector('#uk_address_scc_id');
|
||||||
|
|
||||||
const conditionalFields = [
|
const conditionalFields = [{
|
||||||
{
|
|
||||||
select: parentSelect,
|
select: parentSelect,
|
||||||
valueToIgnore: 'null',
|
valueToIgnore: 'null',
|
||||||
fields: [
|
fields: [
|
||||||
@@ -240,6 +241,5 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
// Initial validation
|
// Initial validation
|
||||||
toggleSubmitButton();
|
toggleSubmitButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,6 +1,13 @@
|
|||||||
<div class="form_wrapper">
|
<div class="form_wrapper">
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a href="/admin/delete_member/{$user_data.uk_id}" class="addbutton delete-big">Törlés</a>
|
<a href="/admin/delete_member/{$user_data.uk_id}" class="addbutton delete-big">Törlés</a>
|
||||||
|
<a href="/admin/set_active_status/{$user_data.uk_id}" class="addbutton big">
|
||||||
|
{if $user_data.uk_is_active}
|
||||||
|
Inaktiválás
|
||||||
|
{else}
|
||||||
|
Aktiválás
|
||||||
|
{/if}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="action" id="action" value="user_data_edit">
|
<input type="hidden" name="action" id="action" value="user_data_edit">
|
||||||
@@ -13,12 +20,6 @@
|
|||||||
value="{$user_data.uk_name}" required></div>
|
value="{$user_data.uk_name}" required></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class="desc" for="uk_is_active">Aktív:</label>
|
|
||||||
<div><input type="checkbox" name="uk_is_active" id="uk_is_active" value="1"
|
|
||||||
{if 1==$user_data.uk_is_active}checked{/if}></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="uk_lease">Bérletes:</label>
|
<label for="uk_lease">Bérletes:</label>
|
||||||
<div><input type="checkbox" name="uk_lease" id="uk_lease" value="1" {if 1==$user_data.uk_lease}checked{/if}>
|
<div><input type="checkbox" name="uk_lease" id="uk_lease" value="1" {if 1==$user_data.uk_lease}checked{/if}>
|
||||||
@@ -258,8 +259,10 @@
|
|||||||
const form = document.querySelector(".form_wrapper form");
|
const form = document.querySelector(".form_wrapper form");
|
||||||
const submitButton = form.querySelector('input.button.black[type="submit"]');
|
const submitButton = form.querySelector('input.button.black[type="submit"]');
|
||||||
|
|
||||||
|
// Collect text inputs but exclude #uk_other
|
||||||
const textInputs = Array.from(form.querySelectorAll(
|
const textInputs = Array.from(form.querySelectorAll(
|
||||||
'input[type="text"], input[type="email"], textarea'));
|
'input[type="text"], input[type="email"], textarea'
|
||||||
|
)).filter(input => input.id !== "uk_other");
|
||||||
|
|
||||||
// Select fields that control conditional validation
|
// Select fields that control conditional validation
|
||||||
const parentSelect = form.querySelector('#uk_parent_1');
|
const parentSelect = form.querySelector('#uk_parent_1');
|
||||||
|
|||||||
Reference in New Issue
Block a user