diff --git a/assets/js/backend_categories_helper.js b/assets/js/backend_categories_helper.js index 206d9701..647f9262 100644 --- a/assets/js/backend_categories_helper.js +++ b/assets/js/backend_categories_helper.js @@ -82,7 +82,7 @@ instance.resetForm(); $('#categories .add-edit-delete-group').hide(); $('#categories .save-cancel-group').show(); - $('#categories .record-details').find('input, textarea').prop('readonly', false); + $('#categories .record-details').find('input, select, textarea').prop('disabled', false); $('#filter-categories button').prop('disabled', true); $('#filter-categories .results').css('color', '#AAA'); }); @@ -93,8 +93,7 @@ $('#edit-category').on('click', function () { $('#categories .add-edit-delete-group').hide(); $('#categories .save-cancel-group').show(); - $('#categories .record-details').find('input, textarea').prop('readonly', false); - + $('#categories .record-details').find('input, select, textarea').prop('disbaled', false); $('#filter-categories button').prop('disabled', true); $('#filter-categories .results').css('color', '#AAA'); }); @@ -278,6 +277,9 @@ */ CategoriesHelper.prototype.validate = function () { $('#categories .has-error').removeClass('has-error'); + $('#categories .form-message') + .removeClass('alert-danger') + .hide(); try { var missingRequired = false; @@ -295,6 +297,10 @@ return true; } catch (error) { + $('#categories .form-message') + .addClass('alert-danger') + .text(error.message) + .show(); return false; } }; @@ -303,17 +309,20 @@ * Bring the category form back to its initial state. */ CategoriesHelper.prototype.resetForm = function () { + $('#filter-categories .selected').removeClass('selected'); + $('#filter-categories button').prop('disabled', false); + $('#filter-categories .results').css('color', ''); + $('#categories .add-edit-delete-group').show(); $('#categories .save-cancel-group').hide(); - $('#categories .record-details').find('input, textarea').val(''); - $('#categories .record-details').find('input, textarea').prop('readonly', true); + $('#categories .record-details') + .find('input, select, textarea') + .val('') + .prop('disabled', true); $('#edit-category, #delete-category').prop('disabled', true); - $('.record-details .has-error').removeClass('has-error'); - - $('#filter-categories .selected').removeClass('selected'); - $('#filter-categories .results').css('color', ''); - $('#filter-categories button').prop('disabled', false); + $('#categories .record-details .has-error').removeClass('has-error'); + $('#categories .record-details .form-message').hide(); }; /** diff --git a/assets/js/backend_customers_helper.js b/assets/js/backend_customers_helper.js index 21fb676f..b77260a2 100644 --- a/assets/js/backend_customers_helper.js +++ b/assets/js/backend_customers_helper.js @@ -105,9 +105,9 @@ instance.resetForm(); $('#add-edit-delete-group').hide(); $('#save-cancel-group').show(); - $('.record-details').find('input, textarea').prop('readonly', false); - $('.record-details').find('select').prop('disabled', false); - + $('.record-details') + .find('input, select, textarea') + .prop('disabled', false); $('#filter-customers button').prop('disabled', true); $('#filter-customers .results').css('color', '#AAA'); }); @@ -116,11 +116,11 @@ * Event: Edit Customer Button "Click" */ $('#edit-customer').on('click', function () { - $('.record-details').find('input, textarea').prop('readonly', false); - $('.record-details select').prop('disabled', false); + $('.record-details') + .find('input, select, textarea') + .prop('disabled', false); $('#add-edit-delete-group').hide(); $('#save-cancel-group').show(); - $('#filter-customers button').prop('disabled', true); $('#filter-customers .results').css('color', '#AAA'); }); @@ -278,9 +278,10 @@ * Bring the customer form back to its initial state. */ CustomersHelper.prototype.resetForm = function () { - $('.record-details').find('input, textarea').val(''); - $('.record-details').find('input, textarea').prop('readonly', true); - $('.record-details').find('select').prop('disabled', true); + $('.record-details') + .find('input, select, textarea') + .val('') + .prop('disabled', true); $('#customer-appointments').empty(); $('#appointment-details').toggleClass('d-none', true).empty(); diff --git a/assets/js/backend_services_helper.js b/assets/js/backend_services_helper.js index aa9a5ad0..a92b9d03 100644 --- a/assets/js/backend_services_helper.js +++ b/assets/js/backend_services_helper.js @@ -97,9 +97,9 @@ instance.resetForm(); $('#services .add-edit-delete-group').hide(); $('#services .save-cancel-group').show(); - $('#services .record-details').find('input, textarea').prop('disabled', false); - $('#services .record-details').find('select').prop('disabled', false); - + $('#services .record-details') + .find('input, select textarea') + .prop('disabled', false); $('#filter-services button').prop('disabled', true); $('#filter-services .results').css('color', '#AAA'); }); @@ -155,9 +155,9 @@ $('#edit-service').on('click', function () { $('#services .add-edit-delete-group').hide(); $('#services .save-cancel-group').show(); - $('#services .record-details').find('input, textarea').prop('disabled', false); - $('#services .record-details select').prop('disabled', false); - + $('#services .record-details') + .find('input, select textarea') + .prop('disabled', false); $('#filter-services button').prop('disabled', true); $('#filter-services .results').css('color', '#AAA'); }); @@ -242,6 +242,9 @@ */ ServicesHelper.prototype.validate = function () { $('#services .has-error').removeClass('has-error'); + $('#services .form-message') + .removeClass('alert-danger') + .hide(); try { // validate required fields. @@ -260,6 +263,10 @@ return true; } catch (error) { + $('#services .form-message') + .addClass('alert-danger') + .text(error.message) + .show(); return false; } }; @@ -268,19 +275,21 @@ * Resets the service tab form back to its initial state. */ ServicesHelper.prototype.resetForm = function () { - $('#services .record-details').find('input, textarea').val(''); - $('#service-category').val('null'); - $('#services .add-edit-delete-group').show(); - $('#services .save-cancel-group').hide(); - $('#edit-service, #delete-service').prop('disabled', true); - $('#services .record-details').find('input, textarea').prop('disabled', true); - $('#services .record-details').find('select').prop('disabled', true); - - $('.record-details .has-error').removeClass('has-error'); - $('#filter-services .selected').removeClass('selected'); $('#filter-services button').prop('disabled', false); $('#filter-services .results').css('color', ''); + + $('#services .record-details') + .find('input, select, textarea') + .val('') + .prop('disabled', true); + + $('#services .add-edit-delete-group').show(); + $('#services .save-cancel-group').hide(); + $('#edit-service, #delete-service').prop('disabled', true); + + $('#services .record-details .has-error').removeClass('has-error'); + $('#services .record-details .form-message').hide(); }; /** diff --git a/assets/js/backend_users_admins.js b/assets/js/backend_users_admins.js index 256ffc01..ee1a180a 100644 --- a/assets/js/backend_users_admins.js +++ b/assets/js/backend_users_admins.js @@ -84,7 +84,6 @@ $('#admins .record-details').find('input, textarea').prop('disabled', false); $('#admins .record-details').find('select').prop('disabled', false); $('#admin-password, #admin-password-confirm').addClass('required'); - $('#admin-notifications').prop('disabled', false); $('#filter-admins button').prop('disabled', true); $('#filter-admins .results').css('color', '#AAA'); }.bind(this)); @@ -98,7 +97,6 @@ $('#admins .record-details').find('input, textarea').prop('disabled', false); $('#admins .record-details').find('select').prop('disabled', false); $('#admin-password, #admin-password-confirm').removeClass('required'); - $('#admin-notifications').prop('disabled', false); $('#filter-admins button').prop('disabled', true); $('#filter-admins .results').css('color', '#AAA'); }); @@ -289,21 +287,18 @@ * Resets the admin form back to its initial state. */ AdminsHelper.prototype.resetForm = function () { - $('#admins .add-edit-delete-group').show(); - $('#admins .save-cancel-group').hide(); - $('#admins .record-details').find('input, textarea').prop('disabled', true); - $('#admins .record-details').find('select').prop('disabled', true); - $('#admins .form-message').hide(); - $('#admin-notifications').prop('disabled', true); - $('#admins .record-details').find('input, textarea').val(''); - $('#admin-notifications').removeClass('active'); - $('#edit-admin, #delete-admin').prop('disabled', true); - - $('#admins .has-error').removeClass('has-error'); - $('#filter-admins .selected').removeClass('selected'); $('#filter-admins button').prop('disabled', false); $('#filter-admins .results').css('color', ''); + + $('#admins .add-edit-delete-group').show(); + $('#admins .save-cancel-group').hide(); + $('#admins .record-details').find('input, select, textarea').prop('disabled', true); + $('#admins .record-details').find('input, textarea').val(''); + $('#edit-admin, #delete-admin').prop('disabled', true); + + $('#admins .has-error').removeClass('has-error'); + $('#admins .form-message').hide(); }; /** diff --git a/assets/js/backend_users_providers.js b/assets/js/backend_users_providers.js index d08389f5..6d474200 100755 --- a/assets/js/backend_users_providers.js +++ b/assets/js/backend_users_providers.js @@ -104,7 +104,6 @@ $('#filter-providers .results').css('color', '#AAA'); $('#providers .record-details').find('input, select, textarea').prop('disabled', false); $('#provider-password, #provider-password-confirm').removeClass('required'); - $('#provider-notifications').prop('disabled', false); $('#provider-services input:checkbox').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 input:checkbox').prop('disabled', false); @@ -269,6 +268,9 @@ */ ProvidersHelper.prototype.validate = function () { $('#providers .has-error').removeClass('has-error'); + $('#providers .form-message') + .removeClass('alert-danger') + .hide(); try { // Validate required fields. @@ -331,7 +333,6 @@ $('#providers .record-details').find('input, select, textarea') .val('') .prop('disabled', true); - $('#providers .form-message').hide(); $('#providers .add-break, .add-extra-periods, #reset-working-plan').prop('disabled', true); BackendUsers.wp.timepickers(true); $('#providers .working-plan input:text').timepicker('destroy'); @@ -339,7 +340,8 @@ $('.breaks').find('.edit-break, .delete-break').prop('disabled', true); $('.extra-periods').find('.edit-extra, .delete-extra').prop('disabled', true); - $('#providers .has-error').removeClass('has-error'); + $('#providers .record-details .has-error').removeClass('has-error'); + $('#providers .record-details .form-message').hide(); $('#edit-provider, #delete-provider').prop('disabled', true); $('#provider-services input:checkbox') diff --git a/assets/js/backend_users_secretaries.js b/assets/js/backend_users_secretaries.js index fdb7000d..377d903c 100644 --- a/assets/js/backend_users_secretaries.js +++ b/assets/js/backend_users_secretaries.js @@ -301,7 +301,12 @@ * Resets the secretary tab form back to its initial state. */ SecretariesHelper.prototype.resetForm = function () { - $('#secretaries .record-details').find('input, select, textarea') + $('#filter-secretaries .selected').removeClass('selected'); + $('#filter-secretaries button').prop('disabled', false); + $('#filter-secretaries .results').css('color', ''); + + $('#secretaries .record-details') + .find('input, select, textarea') .val('') .prop('disabled', true); $('#secretaries .add-edit-delete-group').show(); @@ -310,10 +315,6 @@ $('#secretaries .form-message').hide(); $('#secretary-providers input:checkbox').prop('checked', false); $('#secretaries .has-error').removeClass('has-error'); - - $('#filter-secretaries .selected').removeClass('selected'); - $('#filter-secretaries button').prop('disabled', false); - $('#filter-secretaries .results').css('color', ''); }; /**