Remove prefix from secretaries HTML elements

This commit is contained in:
Alex Tselegidis 2022-01-18 10:05:17 +01:00
parent cacc84fd74
commit 837bcab4fc
2 changed files with 59 additions and 59 deletions

View file

@ -54,136 +54,136 @@
<div class="form-message alert" style="display:none;"></div>
<input type="hidden" id="secretary-id" class="record-id">
<input type="hidden" id="id" class="record-id">
<div class="row">
<div class="secretary-details col-12 col-md-6">
<div class="details col-12 col-md-6">
<div class="mb-3">
<label class="form-label" for="secretary-first-name">
<label class="form-label" for="first-name">
<?= lang('first_name') ?>
<span class="text-danger">*</span>
</label>
<input id="secretary-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="secretary-last-name">
<label class="form-label" for="last-name">
<?= lang('last_name') ?>
<span class="text-danger">*</span>
</label>
<input id="secretary-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="secretary-email">
<label class="form-label" for="email">
<?= lang('email') ?>
<span class="text-danger">*</span>
</label>
<input id="secretary-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="secretary-phone-number">
<label class="form-label" for="phone-number">
<?= lang('phone_number') ?>
<span class="text-danger">*</span>
</label>
<input id="secretary-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="secretary-mobile-number">
<label class="form-label" for="mobile-number">
<?= lang('mobile_number') ?>
</label>
<input id="secretary-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="secretary-address">
<label class="form-label" for="address">
<?= lang('address') ?>
</label>
<input id="secretary-address" class="form-control" maxlength="256">
<input id="address" class="form-control" maxlength="256">
</div>
<div class="mb-3">
<label class="form-label" for="secretary-city">
<label class="form-label" for="city">
<?= lang('city') ?>
</label>
<input id="secretary-city" class="form-control" maxlength="256">
<input id="city" class="form-control" maxlength="256">
</div>
<div class="mb-3">
<label class="form-label" for="secretary-state">
<label class="form-label" for="state">
<?= lang('state') ?>
</label>
<input id="secretary-state" class="form-control" maxlength="128">
<input id="state" class="form-control" maxlength="128">
</div>
<div class="mb-3">
<label class="form-label" for="secretary-zip-code">
<label class="form-label" for="zip-code">
<?= lang('zip_code') ?>
</label>
<input id="secretary-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="secretary-notes">
<label class="form-label" for="notes">
<?= lang('notes') ?>
</label>
<textarea id="secretary-notes" class="form-control" rows="3"></textarea>
<textarea id="notes" class="form-control" rows="3"></textarea>
</div>
</div>
<div class="secretary-settings col-12 col-md-6">
<div class="settings col-12 col-md-6">
<div class="mb-3">
<label class="form-label" for="secretary-username">
<label class="form-label" for="username">
<?= lang('username') ?>
<span class="text-danger">*</span>
</label>
<input id="secretary-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="secretary-password">
<label class="form-label" for="password">
<?= lang('password') ?>
<span class="text-danger">*</span>
</label>
<input type="password" id="secretary-password" class="form-control required"
<input type="password" id="password" class="form-control required"
maxlength="512" autocomplete="new-password">
</div>
<div class="mb-3">
<label class="form-label" for="secretary-password-confirm">
<label class="form-label" for="password-confirm">
<?= lang('retype_password') ?>
<span class="text-danger">*</span>
</label>
<input type="password" id="secretary-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="secretary-calendar-view">
<label class="form-label" for="calendar-view">
<?= lang('calendar') ?>
<span class="text-danger">*</span>
</label>
<select id="secretary-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="secretary-timezone">
<label class="form-label" for="timezone">
<?= lang('timezone') ?>
<span class="text-danger">*</span>
</label>
<?= render_timezone_dropdown('id="secretary-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="secretary-notifications">
<label class="form-check-label" for="secretary-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.Secretaries = (function () {
const $secretaries = $('#secretaries');
const $id = $('#secretary-id');
const $firstName = $('#secretary-first-name');
const $lastName = $('#secretary-last-name');
const $email = $('#secretary-email');
const $mobileNumber = $('#secretary-mobile-number');
const $phoneNumber = $('#secretary-phone-number');
const $address = $('#secretary-address');
const $city = $('#secretary-city');
const $state = $('#secretary-state');
const $zipCode = $('#secretary-zip-code');
const $notes = $('#secretary-notes');
const $timezone = $('#secretary-timezone');
const $username = $('#secretary-username');
const $password = $('#secretary-password');
const $passwordConfirmation = $('#secretary-password-confirm');
const $notifications = $('#secretary-notifications');
const $calendarView = $('#secretary-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 $filterSecretaries = $('#filter-secretaries');
let filterResults = {};
let filterLimit = 20;
@ -49,7 +49,7 @@ App.Pages.Secretaries = (function () {
*
* @param {jQuery.Event} event
*/
$secretaries.on('blur', '#secretary-username', (event) => {
$secretaries.on('blur', '#username', (event) => {
const $input = $(event.target);
if ($input.prop('readonly') === true || $input.val() === '') {
@ -129,7 +129,7 @@ App.Pages.Secretaries = (function () {
$secretaries.find('.save-cancel-group').show();
$secretaries.find('.record-details').find('input, textarea').prop('disabled', false);
$secretaries.find('.record-details').find('select').prop('disabled', false);
$('#secretary-password, #secretary-password-confirm').addClass('required');
$('#password, #password-confirm').addClass('required');
$('#secretary-providers input:checkbox').prop('disabled', false);
});
@ -143,7 +143,7 @@ App.Pages.Secretaries = (function () {
$secretaries.find('.save-cancel-group').show();
$secretaries.find('.record-details').find('input, textarea').prop('disabled', false);
$secretaries.find('.record-details').find('select').prop('disabled', false);
$('#secretary-password, #secretary-password-confirm').removeClass('required');
$('#password, #password-confirm').removeClass('required');
$('#secretary-providers input:checkbox').prop('disabled', false);
});
@ -288,12 +288,12 @@ App.Pages.Secretaries = (function () {
// Validate passwords.
if ($password.val() !== $passwordConfirmation.val()) {
$('#secretary-password, #secretary-password-confirm').addClass('is-invalid');
$('#password, #password-confirm').addClass('is-invalid');
throw new Error('Passwords mismatch!');
}
if ($password.val().length < vars('min_password_length') && $password.val() !== '') {
$('#secretary-password, #secretary-password-confirm').addClass('is-invalid');
$('#password, #password-confirm').addClass('is-invalid');
throw new Error(
'Password must be at least ' + BackendSecretaries.MIN_PASSWORD_LENGTH + ' characters long.'
);
@ -326,8 +326,8 @@ App.Pages.Secretaries = (function () {
$filterSecretaries.find('button').prop('disabled', false);
$filterSecretaries.find('.results').css('color', '');
$secretaries.find('.record-details').find('input, select, textarea').val('').prop('disabled', true);
$secretaries.find('.record-details #secretary-calendar-view').val('default');
$secretaries.find('.record-details #secretary-timezone').val('UTC');
$secretaries.find('.record-details #calendar-view').val('default');
$secretaries.find('.record-details #timezone').val('UTC');
$secretaries.find('.add-edit-delete-group').show();
$secretaries.find('.save-cancel-group').hide();
$secretaries.find('.form-message').hide();