Make sure at least one field is displayed in the booking page

This commit is contained in:
Alex Tselegidis 2022-07-27 02:26:19 +03:00
parent dcc5084807
commit d408b6040a
32 changed files with 37 additions and 2 deletions

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -404,4 +404,5 @@ $lang['limit_days'] = 'Limit (Days)';
$lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.'; $lang['future_booking_limit_hint'] = 'Set the future limit in days customers can make appointments via the public booking page.';
$lang['api_token'] = 'API Token'; $lang['api_token'] = 'API Token';
$lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before'; $lang['allow_rescheduling_cancellation_before'] = 'Allow Rescheduling/Cancellation Before';
$lang['at_least_one_field'] = 'At least one field must be displayed in the booking page.';
// End // End

View file

@ -46,6 +46,12 @@ App.Pages.BookingSettings = (function () {
throw new Error(lang('fields_are_required')); throw new Error(lang('fields_are_required'));
} }
// Ensure there is at least one field displayed.
if (!$('.display-switch:checked').length) {
throw new Error(lang('at_least_one_field'));
}
return false; return false;
} catch (error) { } catch (error) {
App.Layouts.Backend.displayNotification(error.message); App.Layouts.Backend.displayNotification(error.message);
@ -157,8 +163,6 @@ App.Pages.BookingSettings = (function () {
*/ */
function onSaveSettingsClick() { function onSaveSettingsClick() {
if (isInvalid()) { if (isInvalid()) {
App.Layouts.Backend.displayNotification(lang('settings_are_invalid'));
return; return;
} }