Replaced "has-error" use with "is-invalid"

This commit is contained in:
Alex Tselegidis 2021-11-23 10:10:09 +01:00
parent 3808185ac9
commit 1fca948e55
24 changed files with 103 additions and 103 deletions

View file

@ -90,12 +90,12 @@ window.BackendAdmins = window.BackendAdmins || {};
$.post(url, data).done(function (response) { $.post(url, data).done(function (response) {
if (response.is_valid === 'false') { if (response.is_valid === 'false') {
$input.closest('.form-group').addClass('has-error'); $input.addClass('is-invalid');
$input.attr('already-exists', 'true'); $input.attr('already-exists', 'true');
$input.parents().eq(3).find('.form-message').text(EALang.username_already_exists); $input.parents().eq(3).find('.form-message').text(EALang.username_already_exists);
$input.parents().eq(3).find('.form-message').show(); $input.parents().eq(3).find('.form-message').show();
} else { } else {
$input.closest('.form-group').removeClass('has-error'); $input.removeClass('is-invalid');
$input.attr('already-exists', 'false'); $input.attr('already-exists', 'false');
if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) { if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) {
$input.parents().eq(3).find('.form-message').hide(); $input.parents().eq(3).find('.form-message').hide();

View file

@ -276,7 +276,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
AdminsHelper.prototype.validate = function () { AdminsHelper.prototype.validate = function () {
$('#admins .has-error').removeClass('has-error'); $('#admins .is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
@ -284,7 +284,7 @@
$('#admins .required').each(function (index, requiredField) { $('#admins .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -295,7 +295,7 @@
// Validate passwords. // Validate passwords.
if ($('#admin-password').val() !== $('#admin-password-confirm').val()) { if ($('#admin-password').val() !== $('#admin-password-confirm').val()) {
$('#admin-password, #admin-password-confirm').closest('.form-group').addClass('has-error'); $('#admin-password, #admin-password-confirm').addClass('is-invalid');
throw new Error(EALang.passwords_mismatch); throw new Error(EALang.passwords_mismatch);
} }
@ -303,19 +303,19 @@
$('#admin-password').val().length < BackendAdmins.MIN_PASSWORD_LENGTH && $('#admin-password').val().length < BackendAdmins.MIN_PASSWORD_LENGTH &&
$('#admin-password').val() !== '' $('#admin-password').val() !== ''
) { ) {
$('#admin-password, #admin-password-confirm').closest('.form-group').addClass('has-error'); $('#admin-password, #admin-password-confirm').addClass('is-invalid');
throw new Error(EALang.password_length_notice.replace('$number', BackendAdmins.MIN_PASSWORD_LENGTH)); throw new Error(EALang.password_length_notice.replace('$number', BackendAdmins.MIN_PASSWORD_LENGTH));
} }
// Validate user email. // Validate user email.
if (!GeneralFunctions.validateEmail($('#admin-email').val())) { if (!GeneralFunctions.validateEmail($('#admin-email').val())) {
$('#admin-email').closest('.form-group').addClass('has-error'); $('#admin-email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }
// Check if username exists // Check if username exists
if ($('#admin-username').attr('already-exists') === 'true') { if ($('#admin-username').attr('already-exists') === 'true') {
$('#admin-username').closest('.form-group').addClass('has-error'); $('#admin-username').addClass('is-invalid');
throw new Error(EALang.username_already_exists); throw new Error(EALang.username_already_exists);
} }
@ -341,7 +341,7 @@
$('#admins .record-details #admin-timezone').val('UTC'); $('#admins .record-details #admin-timezone').val('UTC');
$('#edit-admin, #delete-admin').prop('disabled', true); $('#edit-admin, #delete-admin').prop('disabled', true);
$('#admins .has-error').removeClass('has-error'); $('#admins .is-invalid').removeClass('is-invalid');
$('#admins .form-message').hide(); $('#admins .form-message').hide();
}; };

View file

@ -578,7 +578,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
var $dialog = $('#manage-appointment'); var $dialog = $('#manage-appointment');
// Reset previous validation css formatting. // Reset previous validation css formatting.
$dialog.find('.has-error').removeClass('has-error'); $dialog.find('.is-invalid').removeClass('is-invalid');
$dialog.find('.modal-message').addClass('d-none'); $dialog.find('.modal-message').addClass('d-none');
try { try {
@ -587,7 +587,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
$dialog.find('.required').each(function (index, requiredField) { $dialog.find('.required').each(function (index, requiredField) {
if ($(requiredField).val() === '' || $(requiredField).val() === null) { if ($(requiredField).val() === '' || $(requiredField).val() === null) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequiredField = true; missingRequiredField = true;
} }
}); });
@ -598,7 +598,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
// Check email address. // Check email address.
if (!GeneralFunctions.validateEmail($dialog.find('#email').val())) { if (!GeneralFunctions.validateEmail($dialog.find('#email').val())) {
$dialog.find('#email').closest('.form-group').addClass('has-error'); $dialog.find('#email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }
@ -606,7 +606,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
var start = $('#start-datetime').datetimepicker('getDate'); var start = $('#start-datetime').datetimepicker('getDate');
var end = $('#end-datetime').datetimepicker('getDate'); var end = $('#end-datetime').datetimepicker('getDate');
if (start > end) { if (start > end) {
$dialog.find('#start-datetime, #end-datetime').closest('.form-group').addClass('has-error'); $dialog.find('#start-datetime, #end-datetime').addClass('is-invalid');
throw new Error(EALang.start_date_before_end_error); throw new Error(EALang.start_date_before_end_error);
} }

View file

@ -30,19 +30,19 @@ window.BackendCalendarUnavailabilityEventsModal = window.BackendCalendarUnavaila
$('#manage-unavailable #save-unavailable').on('click', function () { $('#manage-unavailable #save-unavailable').on('click', function () {
var $dialog = $('#manage-unavailable'); var $dialog = $('#manage-unavailable');
$dialog.find('.modal-message').addClass('d-none'); $dialog.find('.modal-message').addClass('d-none');
$dialog.find('.has-error').removeClass('has-error'); $dialog.find('.is-invalid').removeClass('is-invalid');
var start = $dialog.find('#unavailable-start').datetimepicker('getDate'); var start = $dialog.find('#unavailable-start').datetimepicker('getDate');
if (!start) { if (!start) {
$dialog.find('#unavailable-start').closest('.form-group').addClass('has-error'); $dialog.find('#unavailable-start').addClass('is-invalid');
return; return;
} }
var end = Date.parse($dialog.find('#unavailable-end').datetimepicker('getDate')); var end = Date.parse($dialog.find('#unavailable-end').datetimepicker('getDate'));
if (!end) { if (!end) {
$dialog.find('#unavailable-end').closest('.form-group').addClass('has-error'); $dialog.find('#unavailable-end').addClass('is-invalid');
return; return;
} }
@ -54,7 +54,7 @@ window.BackendCalendarUnavailabilityEventsModal = window.BackendCalendarUnavaila
.addClass('alert-danger') .addClass('alert-danger')
.removeClass('d-none'); .removeClass('d-none');
$dialog.find('#unavailable-start, #unavailable-end').closest('.form-group').addClass('has-error'); $dialog.find('#unavailable-start, #unavailable-end').addClass('is-invalid');
return; return;
} }

View file

@ -30,26 +30,26 @@ window.BackendCalendarWorkingPlanExceptionsModal = window.BackendCalendarWorking
$('#manage-working-plan-exceptions #save-working-plan-exception').on('click', function () { $('#manage-working-plan-exceptions #save-working-plan-exception').on('click', function () {
$('#manage-working-plan-exceptions .modal-message').prop('hidden', true); $('#manage-working-plan-exceptions .modal-message').prop('hidden', true);
$('#manage-working-plan-exceptions').find('.has-error').removeClass('has-error'); $('#manage-working-plan-exceptions').find('.is-invalid').removeClass('is-invalid');
var date = $('#working-plan-exception-date').datetimepicker('getDate'); var date = $('#working-plan-exception-date').datetimepicker('getDate');
if (!date) { if (!date) {
$('#working-plan-exception-date').closest('.form-group').addClass('has-error'); $('#working-plan-exception-date').addClass('is-invalid');
return; return;
} }
var start = $('#working-plan-exception-start').datetimepicker('getDate'); var start = $('#working-plan-exception-start').datetimepicker('getDate');
if (!start) { if (!start) {
$('#working-plan-exception-start').closest('.form-group').addClass('has-error'); $('#working-plan-exception-start').addClass('is-invalid');
return; return;
} }
var end = Date.parse($('#working-plan-exception-end').datetimepicker('getDate')); var end = Date.parse($('#working-plan-exception-end').datetimepicker('getDate'));
if (!end) { if (!end) {
$('#working-plan-exception-end').closest('.form-group').addClass('has-error'); $('#working-plan-exception-end').addClass('is-invalid');
return; return;
} }
@ -60,8 +60,8 @@ window.BackendCalendarWorkingPlanExceptionsModal = window.BackendCalendarWorking
.addClass('alert-danger') .addClass('alert-danger')
.prop('hidden', false); .prop('hidden', false);
$('#working-plan-exception-start').addClass('has-error'); $('#working-plan-exception-start').addClass('is-invalid');
$('#working-plan-exception-end').addClass('has-error'); $('#working-plan-exception-end').addClass('is-invalid');
return; return;
} }

View file

@ -288,7 +288,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
CategoriesHelper.prototype.validate = function () { CategoriesHelper.prototype.validate = function () {
$('#categories .has-error').removeClass('has-error'); $('#categories .is-invalid').removeClass('is-invalid');
$('#categories .form-message').removeClass('alert-danger').hide(); $('#categories .form-message').removeClass('alert-danger').hide();
try { try {
@ -296,7 +296,7 @@
$('#categories .required').each(function (index, requiredField) { $('#categories .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -325,7 +325,7 @@
$('#categories .record-details').find('input, select, textarea').val('').prop('disabled', true); $('#categories .record-details').find('input, select, textarea').val('').prop('disabled', true);
$('#edit-category, #delete-category').prop('disabled', true); $('#edit-category, #delete-category').prop('disabled', true);
$('#categories .record-details .has-error').removeClass('has-error'); $('#categories .record-details .is-invalid').removeClass('is-invalid');
$('#categories .record-details .form-message').hide(); $('#categories .record-details .form-message').hide();
}; };

View file

@ -212,7 +212,7 @@
*/ */
CustomersHelper.prototype.validate = function () { CustomersHelper.prototype.validate = function () {
$('#form-message').removeClass('alert-danger').hide(); $('#form-message').removeClass('alert-danger').hide();
$('.has-error').removeClass('has-error'); $('.is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
@ -220,7 +220,7 @@
$('.required').each(function (index, requiredField) { $('.required').each(function (index, requiredField) {
if ($(requiredField).val() === '') { if ($(requiredField).val() === '') {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -231,7 +231,7 @@
// Validate email address. // Validate email address.
if (!GeneralFunctions.validateEmail($('#email').val())) { if (!GeneralFunctions.validateEmail($('#email').val())) {
$('#email').closest('.form-group').addClass('has-error'); $('#email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }
@ -256,7 +256,7 @@
$('#add-edit-delete-group').show(); $('#add-edit-delete-group').show();
$('#save-cancel-group').hide(); $('#save-cancel-group').hide();
$('.record-details .has-error').removeClass('has-error'); $('.record-details .is-invalid').removeClass('is-invalid');
$('.record-details #form-message').hide(); $('.record-details #form-message').hide();
$('#filter-customers button').prop('disabled', false); $('#filter-customers button').prop('disabled', false);

View file

@ -126,12 +126,12 @@ window.BackendProviders = window.BackendProviders || {};
$.post(url, data).done(function (response) { $.post(url, data).done(function (response) {
if (response.is_valid === 'false') { if (response.is_valid === 'false') {
$input.closest('.form-group').addClass('has-error'); $input.addClass('is-invalid');
$input.attr('already-exists', 'true'); $input.attr('already-exists', 'true');
$input.parents().eq(3).find('.form-message').text(EALang.username_already_exists); $input.parents().eq(3).find('.form-message').text(EALang.username_already_exists);
$input.parents().eq(3).find('.form-message').show(); $input.parents().eq(3).find('.form-message').show();
} else { } else {
$input.closest('.form-group').removeClass('has-error'); $input.removeClass('is-invalid');
$input.attr('already-exists', 'false'); $input.attr('already-exists', 'false');
if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) { if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) {
$input.parents().eq(3).find('.form-message').hide(); $input.parents().eq(3).find('.form-message').hide();

View file

@ -322,7 +322,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
ProvidersHelper.prototype.validate = function () { ProvidersHelper.prototype.validate = function () {
$('#providers .has-error').removeClass('has-error'); $('#providers .is-invalid').removeClass('is-invalid');
$('#providers .form-message').removeClass('alert-danger').hide(); $('#providers .form-message').removeClass('alert-danger').hide();
try { try {
@ -330,7 +330,7 @@
var missingRequired = false; var missingRequired = false;
$('#providers .required').each(function (index, requiredField) { $('#providers .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -340,7 +340,7 @@
// Validate passwords. // Validate passwords.
if ($('#provider-password').val() !== $('#provider-password-confirm').val()) { if ($('#provider-password').val() !== $('#provider-password-confirm').val()) {
$('#provider-password, #provider-password-confirm').closest('.form-group').addClass('has-error'); $('#provider-password, #provider-password-confirm').addClass('is-invalid');
throw new Error(EALang.passwords_mismatch); throw new Error(EALang.passwords_mismatch);
} }
@ -348,19 +348,19 @@
$('#provider-password').val().length < BackendProviders.MIN_PASSWORD_LENGTH && $('#provider-password').val().length < BackendProviders.MIN_PASSWORD_LENGTH &&
$('#provider-password').val() !== '' $('#provider-password').val() !== ''
) { ) {
$('#provider-password, #provider-password-confirm').closest('.form-group').addClass('has-error'); $('#provider-password, #provider-password-confirm').addClass('is-invalid');
throw new Error(EALang.password_length_notice.replace('$number', BackendProviders.MIN_PASSWORD_LENGTH)); throw new Error(EALang.password_length_notice.replace('$number', BackendProviders.MIN_PASSWORD_LENGTH));
} }
// Validate user email. // Validate user email.
if (!GeneralFunctions.validateEmail($('#provider-email').val())) { if (!GeneralFunctions.validateEmail($('#provider-email').val())) {
$('#provider-email').closest('.form-group').addClass('has-error'); $('#provider-email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }
// Check if username exists // Check if username exists
if ($('#provider-username').attr('already-exists') === 'true') { if ($('#provider-username').attr('already-exists') === 'true') {
$('#provider-username').closest('.form-group').addClass('has-error'); $('#provider-username').addClass('is-invalid');
throw new Error(EALang.username_already_exists); throw new Error(EALang.username_already_exists);
} }
@ -394,7 +394,7 @@
.find('.edit-working-plan-exception, .delete-working-plan-exception') .find('.edit-working-plan-exception, .delete-working-plan-exception')
.prop('disabled', true); .prop('disabled', true);
$('#providers .record-details .has-error').removeClass('has-error'); $('#providers .record-details .is-invalid').removeClass('is-invalid');
$('#providers .record-details .form-message').hide(); $('#providers .record-details .form-message').hide();
$('#edit-provider, #delete-provider').prop('disabled', true); $('#edit-provider, #delete-provider').prop('disabled', true);

View file

@ -113,12 +113,12 @@ window.BackendSecretaries = window.BackendSecretaries || {};
$.post(url, data).done(function (response) { $.post(url, data).done(function (response) {
if (response.is_valid === 'false') { if (response.is_valid === 'false') {
$input.closest('.form-group').addClass('has-error'); $input.addClass('is-invalid');
$input.attr('already-exists', 'true'); $input.attr('already-exists', 'true');
$input.parents().eq(3).find('.form-message').text(EALang.username_already_exists); $input.parents().eq(3).find('.form-message').text(EALang.username_already_exists);
$input.parents().eq(3).find('.form-message').show(); $input.parents().eq(3).find('.form-message').show();
} else { } else {
$input.closest('.form-group').removeClass('has-error'); $input.removeClass('is-invalid');
$input.attr('already-exists', 'false'); $input.attr('already-exists', 'false');
if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) { if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) {
$input.parents().eq(3).find('.form-message').hide(); $input.parents().eq(3).find('.form-message').hide();

View file

@ -289,7 +289,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
SecretariesHelper.prototype.validate = function () { SecretariesHelper.prototype.validate = function () {
$('#secretaries .has-error').removeClass('has-error'); $('#secretaries .is-invalid').removeClass('is-invalid');
$('#secretaries .form-message').removeClass('alert-danger'); $('#secretaries .form-message').removeClass('alert-danger');
try { try {
@ -297,7 +297,7 @@
var missingRequired = false; var missingRequired = false;
$('#secretaries .required').each(function (index, requiredField) { $('#secretaries .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -307,7 +307,7 @@
// Validate passwords. // Validate passwords.
if ($('#secretary-password').val() !== $('#secretary-password-confirm').val()) { if ($('#secretary-password').val() !== $('#secretary-password-confirm').val()) {
$('#secretary-password, #secretary-password-confirm').closest('.form-group').addClass('has-error'); $('#secretary-password, #secretary-password-confirm').addClass('is-invalid');
throw new Error('Passwords mismatch!'); throw new Error('Passwords mismatch!');
} }
@ -315,19 +315,19 @@
$('#secretary-password').val().length < BackendSecretaries.MIN_PASSWORD_LENGTH && $('#secretary-password').val().length < BackendSecretaries.MIN_PASSWORD_LENGTH &&
$('#secretary-password').val() !== '' $('#secretary-password').val() !== ''
) { ) {
$('#secretary-password, #secretary-password-confirm').closest('.form-group').addClass('has-error'); $('#secretary-password, #secretary-password-confirm').addClass('is-invalid');
throw new Error('Password must be at least ' + BackendSecretaries.MIN_PASSWORD_LENGTH + ' characters long.'); throw new Error('Password must be at least ' + BackendSecretaries.MIN_PASSWORD_LENGTH + ' characters long.');
} }
// Validate user email. // Validate user email.
if (!GeneralFunctions.validateEmail($('#secretary-email').val())) { if (!GeneralFunctions.validateEmail($('#secretary-email').val())) {
$('#secretary-email').closest('.form-group').addClass('has-error'); $('#secretary-email').addClass('is-invalid');
throw new Error('Invalid email address!'); throw new Error('Invalid email address!');
} }
// Check if username exists // Check if username exists
if ($('#secretary-username').attr('already-exists') === 'true') { if ($('#secretary-username').attr('already-exists') === 'true') {
$('#secretary-username').closest('.form-group').addClass('has-error'); $('#secretary-username').addClass('is-invalid');
throw new Error('Username already exists.'); throw new Error('Username already exists.');
} }
@ -354,7 +354,7 @@
$('#edit-secretary, #delete-secretary').prop('disabled', true); $('#edit-secretary, #delete-secretary').prop('disabled', true);
$('#secretaries .form-message').hide(); $('#secretaries .form-message').hide();
$('#secretary-providers input:checkbox').prop('checked', false); $('#secretary-providers input:checkbox').prop('checked', false);
$('#secretaries .has-error').removeClass('has-error'); $('#secretaries .is-invalid').removeClass('is-invalid');
}; };
/** /**

View file

@ -255,7 +255,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
ServicesHelper.prototype.validate = function () { ServicesHelper.prototype.validate = function () {
$('#services .has-error').removeClass('has-error'); $('#services .is-invalid').removeClass('is-invalid');
$('#services .form-message').removeClass('alert-danger').hide(); $('#services .form-message').removeClass('alert-danger').hide();
try { try {
@ -264,7 +264,7 @@
$('#services .required').each(function (index, requiredField) { $('#services .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -275,7 +275,7 @@
// Validate the duration. // Validate the duration.
if (Number($('#service-duration').val()) < 5) { if (Number($('#service-duration').val()) < 5) {
$('#service-duration').closest('.form-group').addClass('has-error'); $('#service-duration').addClass('is-invalid');
throw new Error(EALang.invalid_duration); throw new Error(EALang.invalid_duration);
} }
@ -301,7 +301,7 @@
$('#services .save-cancel-group').hide(); $('#services .save-cancel-group').hide();
$('#edit-service, #delete-service').prop('disabled', true); $('#edit-service, #delete-service').prop('disabled', true);
$('#services .record-details .has-error').removeClass('has-error'); $('#services .record-details .is-invalid').removeClass('is-invalid');
$('#services .record-details .form-message').hide(); $('#services .record-details .form-message').hide();
}; };

View file

@ -96,14 +96,14 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
SystemSettingsBusinessLogicHelper.prototype.validate = function () { SystemSettingsBusinessLogicHelper.prototype.validate = function () {
$('#business-logic .has-error').removeClass('has-error'); $('#business-logic .is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
var missingRequired = false; var missingRequired = false;
$('#business-logic .required').each(function (index, requiredField) { $('#business-logic .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });

View file

@ -135,14 +135,14 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
SystemSettingsClientFormHelper.prototype.validate = function () { SystemSettingsClientFormHelper.prototype.validate = function () {
$('#client-form .has-error').removeClass('has-error'); $('#client-form .is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
var missingRequired = false; var missingRequired = false;
$('#client-form .required').each(function (index, requiredField) { $('#client-form .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });

View file

@ -87,14 +87,14 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
SystemSettingsCurrentUserHelper.prototype.validate = function () { SystemSettingsCurrentUserHelper.prototype.validate = function () {
$('#current-user .has-error').removeClass('has-error'); $('#current-user .is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
var missingRequired = false; var missingRequired = false;
$('#current-user .required').each(function (index, requiredField) { $('#current-user .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -105,18 +105,18 @@
// Validate passwords (if provided). // Validate passwords (if provided).
if ($('#password').val() !== $('#retype-password').val()) { if ($('#password').val() !== $('#retype-password').val()) {
$('#password, #retype-password').closest('.form-group').addClass('has-error'); $('#password, #retype-password').addClass('is-invalid');
throw new Error(EALang.passwords_mismatch); throw new Error(EALang.passwords_mismatch);
} }
// Validate user email. // Validate user email.
if (!GeneralFunctions.validateEmail($('#email').val())) { if (!GeneralFunctions.validateEmail($('#email').val())) {
$('#email').closest('.form-group').addClass('has-error'); $('#email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }
if ($('#username').attr('already-exists') === 'true') { if ($('#username').attr('already-exists') === 'true') {
$('#username').closest('.form-group').addClass('has-error'); $('#username').addClass('is-invalid');
throw new Error(EALang.username_already_exists); throw new Error(EALang.username_already_exists);
} }

View file

@ -95,14 +95,14 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
SystemSettingsGeneralHelper.prototype.validate = function () { SystemSettingsGeneralHelper.prototype.validate = function () {
$('#general .has-error').removeClass('has-error'); $('#general .is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
var missingRequired = false; var missingRequired = false;
$('#general .required').each(function (index, requiredField) { $('#general .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -113,7 +113,7 @@
// Validate company email address. // Validate company email address.
if (!GeneralFunctions.validateEmail($('#company-email').val())) { if (!GeneralFunctions.validateEmail($('#company-email').val())) {
$('#company-email').closest('.form-group').addClass('has-error'); $('#company-email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }

View file

@ -97,14 +97,14 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
SystemSettingsLegalContentsHelper.prototype.validate = function () { SystemSettingsLegalContentsHelper.prototype.validate = function () {
$('#legal-contents .has-error').removeClass('has-error'); $('#legal-contents .is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
var missingRequired = false; var missingRequired = false;
$('#general .required').each(function (index, requiredField) { $('#general .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });

View file

@ -219,12 +219,12 @@ window.BackendUsers = window.BackendUsers || {};
$.post(url, data).done(function (response) { $.post(url, data).done(function (response) {
if (response.is_valid === 'false') { if (response.is_valid === 'false') {
$input.closest('.form-group').addClass('has-error'); $input.addClass('is-invalid');
$input.attr('already-exists', 'true'); $input.attr('already-exists', 'true');
$input.parents().eq(3).find('.form-message').text(EALang.username_already_exists); $input.parents().eq(3).find('.form-message').text(EALang.username_already_exists);
$input.parents().eq(3).find('.form-message').show(); $input.parents().eq(3).find('.form-message').show();
} else { } else {
$input.closest('.form-group').removeClass('has-error'); $input.removeClass('is-invalid');
$input.attr('already-exists', 'false'); $input.attr('already-exists', 'false');
if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) { if ($input.parents().eq(3).find('.form-message').text() === EALang.username_already_exists) {
$input.parents().eq(3).find('.form-message').hide(); $input.parents().eq(3).find('.form-message').hide();

View file

@ -276,7 +276,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
AdminsHelper.prototype.validate = function () { AdminsHelper.prototype.validate = function () {
$('#admins .has-error').removeClass('has-error'); $('#admins .is-invalid').removeClass('is-invalid');
try { try {
// Validate required fields. // Validate required fields.
@ -284,7 +284,7 @@
$('#admins .required').each(function (index, requiredField) { $('#admins .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -295,7 +295,7 @@
// Validate passwords. // Validate passwords.
if ($('#admin-password').val() !== $('#admin-password-confirm').val()) { if ($('#admin-password').val() !== $('#admin-password-confirm').val()) {
$('#admin-password, #admin-password-confirm').closest('.form-group').addClass('has-error'); $('#admin-password, #admin-password-confirm').addClass('is-invalid');
throw new Error(EALang.passwords_mismatch); throw new Error(EALang.passwords_mismatch);
} }
@ -303,19 +303,19 @@
$('#admin-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH && $('#admin-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH &&
$('#admin-password').val() !== '' $('#admin-password').val() !== ''
) { ) {
$('#admin-password, #admin-password-confirm').closest('.form-group').addClass('has-error'); $('#admin-password, #admin-password-confirm').addClass('is-invalid');
throw new Error(EALang.password_length_notice.replace('$number', BackendUsers.MIN_PASSWORD_LENGTH)); throw new Error(EALang.password_length_notice.replace('$number', BackendUsers.MIN_PASSWORD_LENGTH));
} }
// Validate user email. // Validate user email.
if (!GeneralFunctions.validateEmail($('#admin-email').val())) { if (!GeneralFunctions.validateEmail($('#admin-email').val())) {
$('#admin-email').closest('.form-group').addClass('has-error'); $('#admin-email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }
// Check if username exists // Check if username exists
if ($('#admin-username').attr('already-exists') === 'true') { if ($('#admin-username').attr('already-exists') === 'true') {
$('#admin-username').closest('.form-group').addClass('has-error'); $('#admin-username').addClass('is-invalid');
throw new Error(EALang.username_already_exists); throw new Error(EALang.username_already_exists);
} }
@ -341,7 +341,7 @@
$('#admins .record-details #admin-timezone').val('UTC'); $('#admins .record-details #admin-timezone').val('UTC');
$('#edit-admin, #delete-admin').prop('disabled', true); $('#edit-admin, #delete-admin').prop('disabled', true);
$('#admins .has-error').removeClass('has-error'); $('#admins .is-invalid').removeClass('is-invalid');
$('#admins .form-message').hide(); $('#admins .form-message').hide();
}; };

View file

@ -321,7 +321,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
ProvidersHelper.prototype.validate = function () { ProvidersHelper.prototype.validate = function () {
$('#providers .has-error').removeClass('has-error'); $('#providers .is-invalid').removeClass('is-invalid');
$('#providers .form-message').removeClass('alert-danger').hide(); $('#providers .form-message').removeClass('alert-danger').hide();
try { try {
@ -329,7 +329,7 @@
var missingRequired = false; var missingRequired = false;
$('#providers .required').each(function (index, requiredField) { $('#providers .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -339,7 +339,7 @@
// Validate passwords. // Validate passwords.
if ($('#provider-password').val() !== $('#provider-password-confirm').val()) { if ($('#provider-password').val() !== $('#provider-password-confirm').val()) {
$('#provider-password, #provider-password-confirm').closest('.form-group').addClass('has-error'); $('#provider-password, #provider-password-confirm').addClass('is-invalid');
throw new Error(EALang.passwords_mismatch); throw new Error(EALang.passwords_mismatch);
} }
@ -347,19 +347,19 @@
$('#provider-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH && $('#provider-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH &&
$('#provider-password').val() !== '' $('#provider-password').val() !== ''
) { ) {
$('#provider-password, #provider-password-confirm').closest('.form-group').addClass('has-error'); $('#provider-password, #provider-password-confirm').addClass('is-invalid');
throw new Error(EALang.password_length_notice.replace('$number', BackendUsers.MIN_PASSWORD_LENGTH)); throw new Error(EALang.password_length_notice.replace('$number', BackendUsers.MIN_PASSWORD_LENGTH));
} }
// Validate user email. // Validate user email.
if (!GeneralFunctions.validateEmail($('#provider-email').val())) { if (!GeneralFunctions.validateEmail($('#provider-email').val())) {
$('#provider-email').closest('.form-group').addClass('has-error'); $('#provider-email').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }
// Check if username exists // Check if username exists
if ($('#provider-username').attr('already-exists') === 'true') { if ($('#provider-username').attr('already-exists') === 'true') {
$('#provider-username').closest('.form-group').addClass('has-error'); $('#provider-username').addClass('is-invalid');
throw new Error(EALang.username_already_exists); throw new Error(EALang.username_already_exists);
} }
@ -393,7 +393,7 @@
.find('.edit-working-plan-exception, .delete-working-plan-exception') .find('.edit-working-plan-exception, .delete-working-plan-exception')
.prop('disabled', true); .prop('disabled', true);
$('#providers .record-details .has-error').removeClass('has-error'); $('#providers .record-details .is-invalid').removeClass('is-invalid');
$('#providers .record-details .form-message').hide(); $('#providers .record-details .form-message').hide();
$('#edit-provider, #delete-provider').prop('disabled', true); $('#edit-provider, #delete-provider').prop('disabled', true);

View file

@ -289,7 +289,7 @@
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
SecretariesHelper.prototype.validate = function () { SecretariesHelper.prototype.validate = function () {
$('#secretaries .has-error').removeClass('has-error'); $('#secretaries .is-invalid').removeClass('is-invalid');
$('#secretaries .form-message').removeClass('alert-danger'); $('#secretaries .form-message').removeClass('alert-danger');
try { try {
@ -297,7 +297,7 @@
var missingRequired = false; var missingRequired = false;
$('#secretaries .required').each(function (index, requiredField) { $('#secretaries .required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).closest('.form-group').addClass('has-error'); $(requiredField).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -307,7 +307,7 @@
// Validate passwords. // Validate passwords.
if ($('#secretary-password').val() !== $('#secretary-password-confirm').val()) { if ($('#secretary-password').val() !== $('#secretary-password-confirm').val()) {
$('#secretary-password, #secretary-password-confirm').closest('.form-group').addClass('has-error'); $('#secretary-password, #secretary-password-confirm').addClass('is-invalid');
throw new Error('Passwords mismatch!'); throw new Error('Passwords mismatch!');
} }
@ -315,19 +315,19 @@
$('#secretary-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH && $('#secretary-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH &&
$('#secretary-password').val() !== '' $('#secretary-password').val() !== ''
) { ) {
$('#secretary-password, #secretary-password-confirm').closest('.form-group').addClass('has-error'); $('#secretary-password, #secretary-password-confirm').addClass('is-invalid');
throw new Error('Password must be at least ' + BackendUsers.MIN_PASSWORD_LENGTH + ' characters long.'); throw new Error('Password must be at least ' + BackendUsers.MIN_PASSWORD_LENGTH + ' characters long.');
} }
// Validate user email. // Validate user email.
if (!GeneralFunctions.validateEmail($('#secretary-email').val())) { if (!GeneralFunctions.validateEmail($('#secretary-email').val())) {
$('#secretary-email').closest('.form-group').addClass('has-error'); $('#secretary-email').addClass('is-invalid');
throw new Error('Invalid email address!'); throw new Error('Invalid email address!');
} }
// Check if username exists // Check if username exists
if ($('#secretary-username').attr('already-exists') === 'true') { if ($('#secretary-username').attr('already-exists') === 'true') {
$('#secretary-username').closest('.form-group').addClass('has-error'); $('#secretary-username').addClass('is-invalid');
throw new Error('Username already exists.'); throw new Error('Username already exists.');
} }
@ -354,7 +354,7 @@
$('#edit-secretary, #delete-secretary').prop('disabled', true); $('#edit-secretary, #delete-secretary').prop('disabled', true);
$('#secretaries .form-message').hide(); $('#secretaries .form-message').hide();
$('#secretary-providers input:checkbox').prop('checked', false); $('#secretary-providers input:checkbox').prop('checked', false);
$('#secretaries .has-error').removeClass('has-error'); $('#secretaries .is-invalid').removeClass('is-invalid');
}; };
/** /**

View file

@ -501,7 +501,7 @@ window.FrontendBook = window.FrontendBook || {};
* @return {Boolean} Returns the validation result. * @return {Boolean} Returns the validation result.
*/ */
function validateCustomerForm() { function validateCustomerForm() {
$('#wizard-frame-3 .has-error').removeClass('has-error'); $('#wizard-frame-3 .is-invalid').removeClass('is-invalid');
$('#wizard-frame-3 label.text-danger').removeClass('text-danger'); $('#wizard-frame-3 label.text-danger').removeClass('text-danger');
try { try {
@ -509,7 +509,7 @@ window.FrontendBook = window.FrontendBook || {};
var missingRequiredField = false; var missingRequiredField = false;
$('.required').each(function (index, requiredField) { $('.required').each(function (index, requiredField) {
if (!$(requiredField).val()) { if (!$(requiredField).val()) {
$(requiredField).parents('.form-group').addClass('has-error'); $(requiredField).parents('.form-group').addClass('is-invalid');
missingRequiredField = true; missingRequiredField = true;
} }
}); });
@ -531,7 +531,7 @@ window.FrontendBook = window.FrontendBook || {};
// Validate email address. // Validate email address.
if (!GeneralFunctions.validateEmail($('#email').val())) { if (!GeneralFunctions.validateEmail($('#email').val())) {
$('#email').parents('.form-group').addClass('has-error'); $('#email').parents('.form-group').addClass('is-invalid');
throw new Error(EALang.invalid_email); throw new Error(EALang.invalid_email);
} }

View file

@ -151,9 +151,9 @@ window.FrontendBookApi = window.FrontendBookApi || {};
var $captchaText = $('.captcha-text'); var $captchaText = $('.captcha-text');
if ($captchaText.length > 0) { if ($captchaText.length > 0) {
$captchaText.closest('.form-group').removeClass('has-error'); $captchaText.removeClass('is-invalid');
if ($captchaText.val() === '') { if ($captchaText.val() === '') {
$captchaText.closest('.form-group').addClass('has-error'); $captchaText.addClass('is-invalid');
return; return;
} }
} }
@ -204,7 +204,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
$('.captcha-title button').trigger('click'); $('.captcha-title button').trigger('click');
$captchaText.closest('.form-group').addClass('has-error'); $captchaText.addClass('is-invalid');
return false; return false;
} }

View file

@ -68,13 +68,13 @@ $(function () {
function validate() { function validate() {
try { try {
$alert.removeClass('alert-danger').prop('hidden', true); $alert.removeClass('alert-danger').prop('hidden', true);
$('input').closest('.form-group').removeClass('has-error'); $('input').removeClass('is-invalid');
// Check for empty fields. // Check for empty fields.
var missingRequired = false; var missingRequired = false;
$('input').each(function (index, field) { $('input').each(function (index, field) {
if (!$(field).val()) { if (!$(field).val()) {
$(field).closest('.form-group').addClass('has-error'); $(field).addClass('is-invalid');
missingRequired = true; missingRequired = true;
} }
}); });
@ -85,25 +85,25 @@ $(function () {
// Validate Passwords // Validate Passwords
if ($('#password').val() !== $('#retype-password').val()) { if ($('#password').val() !== $('#retype-password').val()) {
$('#password').closest('.form-group').addClass('has-error'); $('#password').addClass('is-invalid');
$('#retype-password').closest('.form-group').addClass('has-error'); $('#retype-password').addClass('is-invalid');
throw new Error('Passwords do not match!'); throw new Error('Passwords do not match!');
} }
if ($('#password').val().length < MIN_PASSWORD_LENGTH) { if ($('#password').val().length < MIN_PASSWORD_LENGTH) {
$('#password').closest('.form-group').addClass('has-error'); $('#password').addClass('is-invalid');
$('#retype-password').closest('.form-group').addClass('has-error'); $('#retype-password').addClass('is-invalid');
throw new Error('The password must be at least ' + MIN_PASSWORD_LENGTH + ' characters long.'); throw new Error('The password must be at least ' + MIN_PASSWORD_LENGTH + ' characters long.');
} }
// Validate Email // Validate Email
if (!GeneralFunctions.validateEmail($('#email').val())) { if (!GeneralFunctions.validateEmail($('#email').val())) {
$('#email').closest('.form-group').addClass('has-error'); $('#email').addClass('is-invalid');
throw new Error('The email address is invalid!'); throw new Error('The email address is invalid!');
} }
if (!GeneralFunctions.validateEmail($('#company-email').val())) { if (!GeneralFunctions.validateEmail($('#company-email').val())) {
$('#company-email').closest('.form-group').addClass('has-error'); $('#company-email').addClass('is-invalid');
throw new Error('The email address is invalid!'); throw new Error('The email address is invalid!');
} }