Remove prefix from admins HTML elements

This commit is contained in:
Alex Tselegidis 2022-01-18 10:33:59 +01:00
parent 65d2836911
commit 8bc1f49613
2 changed files with 61 additions and 61 deletions

View file

@ -54,137 +54,137 @@
<div class="form-message alert" style="display:none;"></div>
<input type="hidden" id="admin-id" class="record-id">
<input type="hidden" id="id" class="record-id">
<div class="row">
<div class="admin-details col-12 col-md-6">
<div class="details col-12 col-md-6">
<div class="mb-3">
<label class="form-label" for="admin-first-name">
<label class="form-label" for="first-name">
<?= lang('first_name') ?>
<span class="text-danger">*</span>
</label>
<input id="admin-first-name" class="form-control required" maxlength="256">
<input id="first-name" class="form-control required" maxlength="256">
</div>
<div class="mb-3">
<label class="form-label" for="admin-last-name">
<label class="form-label" for="last-name">
<?= lang('last_name') ?>
<span class="text-danger">*</span>
</label>
<input id="admin-last-name" class="form-control required" maxlength="512">
<input id="last-name" class="form-control required" maxlength="512">
</div>
<div class="mb-3">
<label class="form-label" for="admin-email">
<label class="form-label" for="email">
<?= lang('email') ?>
<span class="text-danger">*</span>
</label>
<input id="admin-email" class="form-control required" maxlength="512">
<input id="email" class="form-control required" maxlength="512">
</div>
<div class="mb-3">
<label class="form-label" for="admin-phone-number">
<label class="form-label" for="phone-number">
<?= lang('phone_number') ?>
<span class="text-danger">*</span>
</label>
<input id="admin-phone-number" class="form-control required" maxlength="128">
<input id="phone-number" class="form-control required" maxlength="128">
</div>
<div class="mb-3">
<label class="form-label" for="admin-mobile-number">
<label class="form-label" for="mobile-number">
<?= lang('mobile_number') ?>
</label>
<input id="admin-mobile-number" class="form-control" maxlength="128">
<input id="mobile-number" class="form-control" maxlength="128">
</div>
<div class="mb-3">
<label class="form-label" for="admin-address">
<label class="form-label" for="address">
<?= lang('address') ?>
</label>
<input id="admin-address" class="form-control" maxlength="256">
<input id="address" class="form-control" maxlength="256">
</div>
<div class="mb-3">
<label class="form-label" for="admin-city">
<label class="form-label" for="city">
<?= lang('city') ?>
</label>
<input id="admin-city" class="form-control" maxlength="256">
<input id="city" class="form-control" maxlength="256">
</div>
<div class="mb-3">
<label class="form-label" for="admin-state">
<label class="form-label" for="state">
<?= lang('state') ?>
</label>
<input id="admin-state" class="form-control" maxlength="128">
<input id="state" class="form-control" maxlength="128">
</div>
<div class="mb-3">
<label class="form-label" for="admin-zip-code">
<label class="form-label" for="zip-code">
<?= lang('zip_code') ?>
</label>
<input id="admin-zip-code" class="form-control" maxlength="64">
<input id="zip-code" class="form-control" maxlength="64">
</div>
<div class="mb-3">
<label class="form-label" for="admin-notes">
<label class="form-label" for="notes">
<?= lang('notes') ?>
</label>
<textarea id="admin-notes" class="form-control" rows="3"></textarea>
<textarea id="notes" class="form-control" rows="3"></textarea>
</div>
</div>
<div class="admin-settings col-12 col-md-6">
<div class="settings col-12 col-md-6">
<div class="mb-3">
<label class="form-label" for="admin-username">
<label class="form-label" for="username">
<?= lang('username') ?>
<span class="text-danger">*</span>
</label>
<input id="admin-username" class="form-control required" maxlength="256">
<input id="username" class="form-control required" maxlength="256">
</div>
<div class="mb-3">
<label class="form-label" for="admin-password">
<label class="form-label" for="password">
<?= lang('password') ?>
<span class="text-danger">*</span>
</label>
<input type="password" id="admin-password" class="form-control required" maxlength="512"
<input type="password" id="password" class="form-control required" maxlength="512"
autocomplete="new-password">
</div>
<div class="mb-3">
<label class="form-label" for="admin-password-confirm">
<label class="form-label" for="password-confirm">
<?= lang('retype_password') ?>
<span class="text-danger">*</span>
</label>
<input type="password" id="admin-password-confirm" class="form-control required"
<input type="password" id="password-confirm" class="form-control required"
maxlength="512" autocomplete="new-password">
</div>
<div class="mb-3">
<label class="form-label" for="admin-calendar-view">
<label class="form-label" for="calendar-view">
<?= lang('calendar') ?>
<span class="text-danger">*</span>
</label>
<select id="admin-calendar-view" class="form-control required">
<select id="calendar-view" class="form-control required">
<option value="default">Default</option>
<option value="table">Table</option>
</select>
</div>
<div class="mb-3">
<label class="form-label" for="admin-timezone">
<label class="form-label" for="timezone">
<?= lang('timezone') ?>
<span class="text-danger">*</span>
</label>
<?= render_timezone_dropdown('id="admin-timezone" class="form-control required"') ?>
<?= render_timezone_dropdown('id="timezone" class="form-control required"') ?>
</div>
<br>
<div class="form-check form-switch me-4">
<input class="form-check-input" type="checkbox" id="admin-notifications">
<label class="form-check-label" for="admin-notifications">
<input class="form-check-input" type="checkbox" id="notifications">
<label class="form-check-label" for="notifications">
<?= lang('receive_notifications') ?>
</label>
</div>

View file

@ -16,23 +16,23 @@
*/
App.Pages.Admins = (function () {
const $admins = $('#admins');
const $id = $('#admin-id');
const $firstName = $('#admin-first-name');
const $lastName = $('#admin-last-name');
const $email = $('#admin-email');
const $mobileNumber = $('#admin-mobile-number');
const $phoneNumber = $('#admin-phone-number');
const $address = $('#admin-address');
const $city = $('#admin-city');
const $state = $('#admin-state');
const $zipCode = $('#admin-zip-code');
const $notes = $('#admin-notes');
const $timezone = $('#admin-timezone');
const $username = $('#admin-username');
const $password = $('#admin-password');
const $passwordConfirmation = $('#admin-password-confirm');
const $notifications = $('#admin-notifications');
const $calendarView = $('#admin-calendar-view');
const $id = $('#id');
const $firstName = $('#first-name');
const $lastName = $('#last-name');
const $email = $('#email');
const $mobileNumber = $('#mobile-number');
const $phoneNumber = $('#phone-number');
const $address = $('#address');
const $city = $('#city');
const $state = $('#state');
const $zipCode = $('#zip-code');
const $notes = $('#notes');
const $timezone = $('#timezone');
const $username = $('#username');
const $password = $('#password');
const $passwordConfirmation = $('#password-confirm');
const $notifications = $('#notifications');
const $calendarView = $('#calendar-view');
const $filterAdmins = $('#filter-admins');
let filterResults = {};
let filterLimit = 20;
@ -47,7 +47,7 @@ App.Pages.Admins = (function () {
* When the admin leaves the username input field we will need to check if the username
* is not taken by another record in the system.
*/
$admins.on('blur', '#admin-username', function () {
$admins.on('blur', '#username', function () {
const $input = $(this);
if ($input.prop('readonly') === true || $input.val() === '') {
@ -125,7 +125,7 @@ App.Pages.Admins = (function () {
$admins.find('.save-cancel-group').show();
$admins.find('.record-details').find('input, textarea').prop('disabled', false);
$admins.find('.record-details').find('select').prop('disabled', false);
$('#admin-password, #admin-password-confirm').addClass('required');
$('#password, #password-confirm').addClass('required');
$('#filter-admins button').prop('disabled', true);
$('#filter-admins .results').css('color', '#AAA');
});
@ -138,7 +138,7 @@ App.Pages.Admins = (function () {
$admins.find('.save-cancel-group').show();
$admins.find('.record-details').find('input, textarea').prop('disabled', false);
$admins.find('.record-details').find('select').prop('disabled', false);
$('#admin-password, #admin-password-confirm').removeClass('required');
$('#password, #password-confirm').removeClass('required');
$('#filter-admins button').prop('disabled', true);
$('#filter-admins .results').css('color', '#AAA');
});
@ -147,7 +147,7 @@ App.Pages.Admins = (function () {
* Event: Delete Admin Button "Click"
*/
$admins.on('click', '#delete-admin', function () {
const adminId = $('#admin-id').val();
const adminId = $id.val();
const buttons = [
{
@ -198,7 +198,7 @@ App.Pages.Admins = (function () {
// Include id if changed.
if ($id.val() !== '') {
admin.id = $('#admin-id').val();
admin.id = $id.val();
}
if (!validate()) {
@ -277,12 +277,12 @@ App.Pages.Admins = (function () {
// Validate passwords.
if ($password.val() !== $passwordConfirmation.val()) {
$('#admin-password, #admin-password-confirm').addClass('is-invalid');
$('#password, #password-confirm').addClass('is-invalid');
throw new Error(lang('passwords_mismatch'));
}
if ($password.val().length < vars('min_password_length') && $password.val() !== '') {
$('#admin-password, #admin-password-confirm').addClass('is-invalid');
$('#password, #password-confirm').addClass('is-invalid');
throw new Error(lang('password_length_notice').replace('$number', vars('min_password_length')));
}
@ -316,8 +316,8 @@ App.Pages.Admins = (function () {
$admins.find('.add-edit-delete-group').show();
$admins.find('.save-cancel-group').hide();
$admins.find('.record-details').find('input, select, textarea').val('').prop('disabled', true);
$admins.find('.record-details #admin-calendar-view').val('default');
$admins.find('.record-details #admin-timezone').val('UTC');
$admins.find('.record-details #calendar-view').val('default');
$admins.find('.record-details #timezone').val('UTC');
$('#edit-admin, #delete-admin').prop('disabled', true);
$('#admins .is-invalid').removeClass('is-invalid');