Corrected disabled state on users page.

This commit is contained in:
Alex Tselegidis 2020-09-07 14:33:02 +03:00
parent 6188df7ae5
commit 69e39b9062
5 changed files with 26 additions and 30 deletions

View file

@ -242,7 +242,7 @@
<h3><?= lang('working_plan') ?></h3> <h3><?= lang('working_plan') ?></h3>
<button id="reset-working-plan" class="btn btn-primary" <button id="reset-working-plan" class="btn btn-primary"
title="<?= lang('reset_working_plan') ?>"> title="<?= lang('reset_working_plan') ?>">
<i class="fas fa-redo-alt"></i> <i class="fas fa-redo-alt mr-2"></i>
<?= lang('reset_plan') ?></button> <?= lang('reset_plan') ?></button>
<table class="working-plan table table-striped mt-2"> <table class="working-plan table table-striped mt-2">
<thead> <thead>
@ -265,7 +265,7 @@
<div> <div>
<button type="button" class="add-break btn btn-primary"> <button type="button" class="add-break btn btn-primary">
<i class="far fa-plus-square"></i> <i class="far fa-plus-square mr-2"></i>
<?= lang('add_break') ?> <?= lang('add_break') ?>
</button> </button>
</div> </div>
@ -293,7 +293,7 @@
</span> </span>
<div> <div>
<button type="button" class="add-extra-periods btn btn-primary"> <button type="button" class="add-extra-periods btn btn-primary mr-2">
<i class="far fa-plus-square"></i> <i class="far fa-plus-square"></i>
<?= lang('add_extra_period') ?> <?= lang('add_extra_period') ?>
</button> </button>

View file

@ -72,13 +72,16 @@ window.BackendUsers = window.BackendUsers || {};
$('<input/>', { $('<input/>', {
'class': 'form-check-input', 'class': 'form-check-input',
'type': 'checkbox', 'type': 'checkbox',
'data-id': service.id 'data-id': service.id,
'prop': {
'disabled': true
}
}), }),
$('<label/>', { $('<label/>', {
'class': 'form-check-label', 'class': 'form-check-label',
'text': service.name, 'text': service.name,
'for': service.id 'for': service.id
}), })
] ]
}) })
] ]
@ -102,7 +105,7 @@ window.BackendUsers = window.BackendUsers || {};
'class': 'form-check-label', 'class': 'form-check-label',
'text': provider.first_name + ' ' + provider.last_name, 'text': provider.first_name + ' ' + provider.last_name,
'for': provider.id 'for': provider.id
}), })
] ]
}) })
] ]

View file

@ -84,10 +84,8 @@
$('#filter-providers .results').css('color', '#AAA'); $('#filter-providers .results').css('color', '#AAA');
$('#providers .add-edit-delete-group').hide(); $('#providers .add-edit-delete-group').hide();
$('#providers .save-cancel-group').show(); $('#providers .save-cancel-group').show();
$('#providers .record-details').find('input, textarea').prop('disabled', false); $('#providers .record-details').find('input, select, textarea').prop('disabled', false);
$('#providers .record-details').find('select').prop('disabled', false);
$('#provider-password, #provider-password-confirm').addClass('required'); $('#provider-password, #provider-password-confirm').addClass('required');
$('#provider-notifications').prop('disabled', false);
$('#providers').find('.add-break, .edit-break, .delete-break, .add-extra-periods, .edit-extra, .delete-extra, #reset-working-plan').prop('disabled', false); $('#providers').find('.add-break, .edit-break, .delete-break, .add-extra-periods, .edit-extra, .delete-extra, #reset-working-plan').prop('disabled', false);
$('#provider-services input:checkbox').prop('disabled', false); $('#provider-services input:checkbox').prop('disabled', false);
@ -104,8 +102,7 @@
$('#providers .save-cancel-group').show(); $('#providers .save-cancel-group').show();
$('#filter-providers button').prop('disabled', true); $('#filter-providers button').prop('disabled', true);
$('#filter-providers .results').css('color', '#AAA'); $('#filter-providers .results').css('color', '#AAA');
$('#providers .record-details').find('input, textarea').prop('disabled', false); $('#providers .record-details').find('input, select, textarea').prop('disabled', false);
$('#providers .record-details').find('select').prop('disabled', false);
$('#provider-password, #provider-password-confirm').removeClass('required'); $('#provider-password, #provider-password-confirm').removeClass('required');
$('#provider-notifications').prop('disabled', false); $('#provider-notifications').prop('disabled', false);
$('#provider-services input:checkbox').prop('disabled', false); $('#provider-services input:checkbox').prop('disabled', false);
@ -331,12 +328,10 @@
$('#providers .add-edit-delete-group').show(); $('#providers .add-edit-delete-group').show();
$('#providers .save-cancel-group').hide(); $('#providers .save-cancel-group').hide();
$('#providers .record-details h3 a').remove(); $('#providers .record-details h3 a').remove();
$('#providers .record-details').find('input, textarea').prop('disabled', true); $('#providers .record-details').find('input, select, textarea')
$('#providers .record-details').find('select').prop('disabled', true); .val('')
.prop('disabled', true);
$('#providers .form-message').hide(); $('#providers .form-message').hide();
$('#provider-notifications').removeClass('active');
$('#provider-notifications').prop('disabled', true);
$('#provider-services input:checkbox').prop('disabled', true);
$('#providers .add-break, .add-extra-periods, #reset-working-plan').prop('disabled', true); $('#providers .add-break, .add-extra-periods, #reset-working-plan').prop('disabled', true);
BackendUsers.wp.timepickers(true); BackendUsers.wp.timepickers(true);
$('#providers .working-plan input:text').timepicker('destroy'); $('#providers .working-plan input:text').timepicker('destroy');
@ -347,8 +342,9 @@
$('#providers .has-error').removeClass('has-error'); $('#providers .has-error').removeClass('has-error');
$('#edit-provider, #delete-provider').prop('disabled', true); $('#edit-provider, #delete-provider').prop('disabled', true);
$('#providers .record-details').find('input, textarea').val(''); $('#provider-services input:checkbox')
$('#provider-services input:checkbox').prop('checked', false); .prop('disabled', true)
.prop('checked', false);
$('#provider-services a').remove(); $('#provider-services a').remove();
$('#providers .working-plan tbody').empty(); $('#providers .working-plan tbody').empty();
$('#providers .breaks tbody').empty(); $('#providers .breaks tbody').empty();
@ -426,12 +422,14 @@
// Display working plan // Display working plan
var workingPlan = $.parseJSON(provider.settings.working_plan); var workingPlan = $.parseJSON(provider.settings.working_plan);
BackendUsers.wp.setup(workingPlan); BackendUsers.wp.setup(workingPlan);
$('.working-plan').find('input').prop('disabled', true);
$('.breaks').find('.edit-break, .delete-break').prop('disabled', true); $('.breaks').find('.edit-break, .delete-break').prop('disabled', true);
$('#providers .extra-periods tbody').empty(); $('#providers .extra-periods tbody').empty();
var extraWorkingPlan = $.parseJSON(provider.settings.extra_working_plan); var extraWorkingPlan = $.parseJSON(provider.settings.extra_working_plan);
BackendUsers.wp.setupExtraPeriods(extraWorkingPlan); BackendUsers.wp.setupExtraPeriods(extraWorkingPlan);
$('.extra-periods').find('.edit-extra, .delete-extra').prop('disabled', true); $('.extra-periods').find('.edit-extra, .delete-extra').prop('disabled', true);
$('#providers .working-plan input:checkbox').prop('disabled', true); $('#providers .working-plan input:checkbox').prop('disabled', true);
Backend.placeFooterToBottom();
}; };
/** /**

View file

@ -90,7 +90,6 @@
$('#secretaries .record-details').find('input, textarea').prop('disabled', false); $('#secretaries .record-details').find('input, textarea').prop('disabled', false);
$('#secretaries .record-details').find('select').prop('disabled', false); $('#secretaries .record-details').find('select').prop('disabled', false);
$('#secretary-password, #secretary-password-confirm').addClass('required'); $('#secretary-password, #secretary-password-confirm').addClass('required');
$('#secretary-notifications').prop('disabled', false);
$('#secretary-providers input:checkbox').prop('disabled', false); $('#secretary-providers input:checkbox').prop('disabled', false);
}.bind(this)); }.bind(this));
@ -105,7 +104,6 @@
$('#secretaries .record-details').find('input, textarea').prop('disabled', false); $('#secretaries .record-details').find('input, textarea').prop('disabled', false);
$('#secretaries .record-details').find('select').prop('disabled', false); $('#secretaries .record-details').find('select').prop('disabled', false);
$('#secretary-password, #secretary-password-confirm').removeClass('required'); $('#secretary-password, #secretary-password-confirm').removeClass('required');
$('#secretary-notifications').prop('disabled', false);
$('#secretary-providers input:checkbox').prop('disabled', false); $('#secretary-providers input:checkbox').prop('disabled', false);
}); });
@ -152,7 +150,7 @@
timezone: $('#secretary-timezone').val(), timezone: $('#secretary-timezone').val(),
settings: { settings: {
username: $('#secretary-username').val(), username: $('#secretary-username').val(),
notifications: $('#secretary-notifications').hasClass('active'), notifications: $('#secretary-notifications').prop('checked'),
calendar_view: $('#secretary-calendar-view').val() calendar_view: $('#secretary-calendar-view').val()
} }
}; };
@ -303,17 +301,14 @@
* Resets the secretary tab form back to its initial state. * Resets the secretary tab form back to its initial state.
*/ */
SecretariesHelper.prototype.resetForm = function () { SecretariesHelper.prototype.resetForm = function () {
$('#secretaries .record-details').find('input, textarea').val(''); $('#secretaries .record-details').find('input, select, textarea')
.val('')
.prop('disabled', true);
$('#secretaries .add-edit-delete-group').show(); $('#secretaries .add-edit-delete-group').show();
$('#secretaries .save-cancel-group').hide(); $('#secretaries .save-cancel-group').hide();
$('#edit-secretary, #delete-secretary').prop('disabled', true); $('#edit-secretary, #delete-secretary').prop('disabled', true);
$('#secretaries .record-details').find('input, textarea').prop('disabled', true);
$('#secretaries .record-details').find('select').prop('disabled', true);
$('#secretaries .form-message').hide(); $('#secretaries .form-message').hide();
$('#secretary-notifications').removeClass('active');
$('#secretary-notifications').prop('disabled', true);
$('#secretary-providers input:checkbox').prop('checked', false); $('#secretary-providers input:checkbox').prop('checked', false);
$('#secretary-providers input:checkbox').prop('disabled', true);
$('#secretaries .has-error').removeClass('has-error'); $('#secretaries .has-error').removeClass('has-error');
$('#filter-secretaries .selected').removeClass('selected'); $('#filter-secretaries .selected').removeClass('selected');

View file

@ -475,7 +475,7 @@
// Make all cells in current row editable. // Make all cells in current row editable.
$(this).parent().parent().children().trigger('edit'); $(this).parent().parent().children().trigger('edit');
$(this).parent().parent().find('.break-start input, .break-end input').timepicker({ $(this).parent().parent().find('.break-start input, .break-end input').timepicker({
timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm', timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm TT' : 'HH:mm',
currentText: EALang.now, currentText: EALang.now,
closeText: EALang.close, closeText: EALang.close,
timeOnlyTitle: EALang.select_time, timeOnlyTitle: EALang.select_time,
@ -649,7 +649,7 @@
// Make all cells in current row editable. // Make all cells in current row editable.
$(this).parent().parent().children().trigger('edit'); $(this).parent().parent().children().trigger('edit');
$(this).parent().parent().find('.extra-start input, .extra-end input').timepicker({ $(this).parent().parent().find('.extra-start input, .extra-end input').timepicker({
timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm', timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm TT' : 'HH:mm',
currentText: EALang.now, currentText: EALang.now,
closeText: EALang.close, closeText: EALang.close,
timeOnlyTitle: EALang.select_time, timeOnlyTitle: EALang.select_time,
@ -840,7 +840,7 @@
if (disabled === false) { if (disabled === false) {
// Set timepickers where needed. // Set timepickers where needed.
$('.working-plan input:text').timepicker({ $('.working-plan input:text').timepicker({
timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm', timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm TT' : 'HH:mm',
currentText: EALang.now, currentText: EALang.now,
closeText: EALang.close, closeText: EALang.close,
timeOnlyTitle: EALang.select_time, timeOnlyTitle: EALang.select_time,