Replace the global App.Lang with the "lang" helper method, which is more appropriate due to the dynamic load of script translation strings.

This commit is contained in:
Alex Tselegidis 2022-01-18 08:22:25 +01:00
parent e93565500d
commit 8dad2d9624
28 changed files with 663 additions and 655 deletions

View file

@ -4,6 +4,16 @@
*/
?>
<script <?= $attributes ?>>
window.App.Lang = <?= json_encode($this->lang->language) ?>
window.lang = (function () {
const lang = <?= json_encode($this->lang->language) ?>;
return (key) => {
if (!key) {
return lang;
}
return lang[key] || undefined;
};
})();
</script>

View file

@ -1,7 +1,6 @@
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) Alex Tselegidis
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
@ -18,7 +17,6 @@ window.App = (function () {
return {
Components: {},
Http: {},
Lang: {},
Layouts: {},
Pages: {},
Utils: {}

View file

@ -113,7 +113,7 @@ App.Components.AppointmentsModal = (function () {
// Define success callback.
const successCallback = () => {
// Display success message to the user.
App.Layouts.Backend.displayNotification(App.Lang.appointment_saved);
App.Layouts.Backend.displayNotification(lang('appointment_saved'));
// Close the modal dialog and refresh the calendar appointments.
$appointmentsModal.find('.alert').addClass('d-none');
@ -123,7 +123,7 @@ App.Components.AppointmentsModal = (function () {
// Define error callback.
const errorCallback = () => {
$appointmentsModal.find('.modal-message').text(App.Lang.service_communication_error);
$appointmentsModal.find('.modal-message').text(lang('service_communication_error'));
$appointmentsModal.find('.modal-message').addClass('alert-danger').removeClass('d-none');
$appointmentsModal.find('.modal-body').scrollTop(0);
};
@ -197,7 +197,7 @@ App.Components.AppointmentsModal = (function () {
);
// Display modal form.
$appointmentsModal.find('.modal-header h3').text(App.Lang.new_appointment_title);
$appointmentsModal.find('.modal-header h3').text(lang('new_appointment_title'));
$appointmentsModal.modal('show');
});
@ -209,7 +209,7 @@ App.Components.AppointmentsModal = (function () {
*/
$selectCustomer.on('click', (event) => {
if (!$existingCustomersList.is(':visible')) {
$(event.target).find('span').text(App.Lang.hide);
$(event.target).find('span').text(lang('hide'));
$existingCustomersList.empty();
$existingCustomersList.slideDown('slow');
$filterExistingCustomers.fadeIn('slow').val('');
@ -222,7 +222,7 @@ App.Components.AppointmentsModal = (function () {
} else {
$existingCustomersList.slideUp('slow');
$filterExistingCustomers.fadeOut('slow');
$(event.target).find('span').text(App.Lang.select);
$(event.target).find('span').text(lang('select'));
}
});
@ -420,7 +420,7 @@ App.Components.AppointmentsModal = (function () {
// Close existing customers-filter frame.
$existingCustomersList.slideUp('slow');
$filterExistingCustomers.fadeOut('slow');
$selectCustomer.find('span').text(App.Lang.select);
$selectCustomer.find('span').text(lang('select'));
// Setup start and datetimepickers.
// Get the selected service duration. It will be needed in order to calculate the appointment end datetime.
@ -458,54 +458,54 @@ App.Components.AppointmentsModal = (function () {
// Translation
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
prevText: App.Lang.previous,
nextText: App.Lang.next,
currentText: App.Lang.now,
closeText: App.Lang.close,
timeOnlyTitle: App.Lang.select_time,
timeText: App.Lang.time,
hourText: App.Lang.hour,
minuteText: App.Lang.minutes,
prevText: lang('previous'),
nextText: lang('next'),
currentText: lang('now'),
closeText: lang('close'),
timeOnlyTitle: lang('select_time'),
timeText: lang('time'),
hourText: lang('hour'),
minuteText: lang('minutes'),
firstDay: firstWeekDayNumber,
onClose: function () {
const serviceId = $selectService.val();
@ -527,54 +527,54 @@ App.Components.AppointmentsModal = (function () {
// Translation
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
prevText: App.Lang.previous,
nextText: App.Lang.next,
currentText: App.Lang.now,
closeText: App.Lang.close,
timeOnlyTitle: App.Lang.select_time,
timeText: App.Lang.time,
hourText: App.Lang.hour,
minuteText: App.Lang.minutes,
prevText: lang('previous'),
nextText: lang('next'),
currentText: lang('now'),
closeText: lang('close'),
timeOnlyTitle: lang('select_time'),
timeText: lang('time'),
hourText: lang('hour'),
minuteText: lang('minutes'),
firstDay: firstWeekDayNumber
});
$endDatetime.datetimepicker('setDate', endDatetime);
@ -604,13 +604,13 @@ App.Components.AppointmentsModal = (function () {
});
if (missingRequiredField) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
// Check email address.
if (!App.Utils.Validation.email($appointmentsModal.find('#email').val())) {
$appointmentsModal.find('#email').addClass('is-invalid');
throw new Error(App.Lang.invalid_email);
throw new Error(lang('invalid_email'));
}
// Check appointment start and end time.
@ -619,7 +619,7 @@ App.Components.AppointmentsModal = (function () {
if (start > end) {
$startDatetime.addClass('is-invalid');
$endDatetime.addClass('is-invalid');
throw new Error(App.Lang.start_date_before_end_error);
throw new Error(lang('start_date_before_end_error'));
}
return true;

View file

@ -59,7 +59,7 @@ App.Components.UnavailabilitiesModal = (function () {
// Start time is after end time - display message to user.
$unavailabilitiesModal
.find('.modal-message')
.text(App.Lang.start_date_before_end_error)
.text(lang('start_date_before_end_error'))
.addClass('alert-danger')
.removeClass('d-none');
@ -85,7 +85,7 @@ App.Components.UnavailabilitiesModal = (function () {
const successCallback = () => {
// Display success message to the user.
App.Layouts.Backend.displayNotification(App.Lang.unavailable_saved);
App.Layouts.Backend.displayNotification(lang('unavailable_saved'));
// Close the modal dialog and refresh the calendar appointments.
$unavailabilitiesModal.find('.alert').addClass('d-none');
@ -139,7 +139,7 @@ App.Components.UnavailabilitiesModal = (function () {
true
)
);
$dialog.find('.modal-header h3').text(App.Lang.new_unavailable_title);
$dialog.find('.modal-header h3').text(lang('new_unavailable_title'));
$dialog.modal('show');
});
}
@ -187,54 +187,54 @@ App.Components.UnavailabilitiesModal = (function () {
// Translation
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
prevText: App.Lang.previous,
nextText: App.Lang.next,
currentText: App.Lang.now,
closeText: App.Lang.close,
timeOnlyTitle: App.Lang.select_time,
timeText: App.Lang.time,
hourText: App.Lang.hour,
minuteText: App.Lang.minutes,
prevText: lang('previous'),
nextText: lang('next'),
currentText: lang('now'),
closeText: lang('close'),
timeOnlyTitle: lang('select_time'),
timeText: lang('time'),
hourText: lang('hour'),
minuteText: lang('minutes'),
firstDay: firstWeekdayId
});
$unavailabilityStart.val(start);
@ -245,54 +245,54 @@ App.Components.UnavailabilitiesModal = (function () {
// Translation
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
prevText: App.Lang.previous,
nextText: App.Lang.next,
currentText: App.Lang.now,
closeText: App.Lang.close,
timeOnlyTitle: App.Lang.select_time,
timeText: App.Lang.time,
hourText: App.Lang.hour,
minuteText: App.Lang.minutes,
prevText: lang('previous'),
nextText: lang('next'),
currentText: lang('now'),
closeText: lang('close'),
timeOnlyTitle: lang('select_time'),
timeText: lang('time'),
hourText: lang('hour'),
minuteText: lang('minutes'),
firstDay: firstWeekdayId
});
$unavailabilityEnd.val(end);

View file

@ -151,12 +151,12 @@ App.Components.WorkingPlanExceptionsModal = (function () {
submit: $('<button/>', {
'type': 'button',
'class': 'd-none submit-editable',
'text': App.Lang.save
'text': lang('save')
}).get(0).outerHTML,
cancel: $('<button/>', {
'type': 'button',
'class': 'd-none cancel-editable',
'text': App.Lang.cancel
'text': lang('cancel')
}).get(0).outerHTML,
onblur: 'ignore',
onreset: function () {
@ -243,7 +243,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm me-2 working-plan-exceptions-edit-break',
'title': App.Lang.edit,
'title': lang('edit'),
'html': [
$('<span/>', {
'class': 'fas fa-edit'
@ -253,7 +253,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm working-plan-exceptions-delete-break',
'title': App.Lang.delete,
'title': lang('delete'),
'html': [
$('<span/>', {
'class': 'fas fa-trash-alt'
@ -263,7 +263,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm me-2 working-plan-exceptions-save-break d-none',
'title': App.Lang.save,
'title': lang('save'),
'html': [
$('<span/>', {
'class': 'fas fa-check-circle'
@ -273,7 +273,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm working-plan-exceptions-cancel-break d-none',
'title': App.Lang.cancel,
'title': lang('cancel'),
'html': [
$('<span/>', {
'class': 'fas fa-ban'
@ -417,50 +417,50 @@ App.Components.WorkingPlanExceptionsModal = (function () {
minDate: 0,
defaultDate: moment().toDate(),
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
prevText: App.Lang.previous,
nextText: App.Lang.next,
currentText: App.Lang.now,
closeText: App.Lang.close
prevText: lang('previous'),
nextText: lang('next'),
currentText: lang('now'),
closeText: lang('close')
});
}
@ -472,12 +472,12 @@ App.Components.WorkingPlanExceptionsModal = (function () {
function initializeTimepicker($target) {
$target.timepicker({
timeFormat: vars('time_format') === 'regular' ? 'h:mm tt' : 'HH:mm',
currentText: App.Lang.now,
closeText: App.Lang.close,
timeOnlyTitle: App.Lang.select_time,
timeText: App.Lang.time,
hourText: App.Lang.hour,
minuteText: App.Lang.minutes
currentText: lang('now'),
closeText: lang('close'),
timeOnlyTitle: lang('select_time'),
timeText: lang('time'),
hourText: lang('hour'),
minuteText: lang('minutes')
});
}

View file

@ -133,7 +133,7 @@ App.Http.Booking = (function () {
}
if (!$availableHours.find('.available-hour').length) {
$availableHours.text(App.Lang.no_available_hours);
$availableHours.text(lang('no_available_hours'));
}
});
}
@ -193,7 +193,7 @@ App.Http.Booking = (function () {
})
.done((response) => {
if (response.captcha_verification === false) {
$captchaHint.text(App.Lang.captcha_is_wrong).fadeTo(400, 1);
$captchaHint.text(lang('captcha_is_wrong')).fadeTo(400, 1);
setTimeout(() => {
$captchaHint.fadeTo(400, 0);
@ -288,7 +288,7 @@ App.Http.Booking = (function () {
// If all the days are unavailable then hide the appointments hours.
if (unavailableDates.length === numberOfDays) {
$availableHours.text(App.Lang.no_available_hours);
$availableHours.text(lang('no_available_hours'));
}
// Grey out unavailable dates.

View file

@ -58,7 +58,7 @@ App.Pages.Account = (function () {
});
if (missingRequiredFields) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
// Validate passwords (if values provided).
@ -66,7 +66,7 @@ App.Pages.Account = (function () {
if ($password.val() && $password.val() !== $retypePassword.val()) {
$password.addClass('is-invalid');
$retypePassword.addClass('is-invalid');
throw new Error(App.Lang.passwords_mismatch);
throw new Error(lang('passwords_mismatch'));
}
// Validate user email.
@ -75,11 +75,11 @@ App.Pages.Account = (function () {
if (!App.Utils.Validation.email(emailValue)) {
$email.addClass('is-invalid');
throw new Error(App.Lang.invalid_email);
throw new Error(lang('invalid_email'));
}
if ($username.hasClass('is-invalid')) {
throw new Error(App.Lang.username_already_exists);
throw new Error(lang('username_already_exists'));
}
return false;
@ -147,7 +147,7 @@ App.Pages.Account = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
App.Layouts.Backend.displayNotification(App.Lang.user_settings_are_invalid);
App.Layouts.Backend.displayNotification(lang('user_settings_are_invalid'));
return;
}
@ -155,7 +155,7 @@ App.Pages.Account = (function () {
const account = serialize();
App.Http.Account.save(account).done(() => {
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(lang('settings_saved'));
$footerUserDisplayName.text('Hello, ' + $firstName.val() + ' ' + $lastName.val() + '!');
});
@ -171,7 +171,7 @@ App.Pages.Account = (function () {
const isValid = response.is_valid;
$username.toggleClass('is-invalid', !isValid);
if (!isValid) {
App.Layouts.Backend.displayNotification(App.Lang.username_already_exists);
App.Layouts.Backend.displayNotification(lang('username_already_exists'));
}
});
}

View file

@ -66,12 +66,12 @@ App.Pages.Admins = (function () {
if (response.is_valid === 'false') {
$input.addClass('is-invalid');
$input.attr('already-exists', 'true');
$input.parents().eq(3).find('.form-message').text(App.Lang.username_already_exists);
$input.parents().eq(3).find('.form-message').text(lang('username_already_exists'));
$input.parents().eq(3).find('.form-message').show();
} else {
$input.removeClass('is-invalid');
$input.attr('already-exists', 'false');
if ($input.parents().eq(3).find('.form-message').text() === App.Lang.username_already_exists) {
if ($input.parents().eq(3).find('.form-message').text() === lang('username_already_exists')) {
$input.parents().eq(3).find('.form-message').hide();
}
}
@ -151,13 +151,13 @@ App.Pages.Admins = (function () {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: function () {
$('#message-box').dialog('close');
}
},
{
text: App.Lang.delete,
text: lang('delete'),
click: function () {
remove(adminId);
$('#message-box').dialog('close');
@ -165,7 +165,7 @@ App.Pages.Admins = (function () {
}
];
App.Utils.Message.show(App.Lang.delete_admin, App.Lang.delete_record_prompt, buttons);
App.Utils.Message.show(lang('delete_admin'), lang('delete_record_prompt'), buttons);
});
/**
@ -232,7 +232,7 @@ App.Pages.Admins = (function () {
*/
function save(admin) {
App.Http.Admins.save(admin).then((response) => {
App.Layouts.Backend.displayNotification(App.Lang.admin_saved);
App.Layouts.Backend.displayNotification(lang('admin_saved'));
resetForm();
$('#filter-admins .key').val('');
filter('', response.id, true);
@ -246,7 +246,7 @@ App.Pages.Admins = (function () {
*/
function remove(id) {
App.Http.Admins.destroy(id).then(() => {
App.Layouts.Backend.displayNotification(App.Lang.admin_deleted);
App.Layouts.Backend.displayNotification(lang('admin_deleted'));
resetForm();
filter($('#filter-admins .key').val());
});
@ -278,24 +278,24 @@ App.Pages.Admins = (function () {
// Validate passwords.
if ($password.val() !== $passwordConfirmation.val()) {
$('#admin-password, #admin-password-confirm').addClass('is-invalid');
throw new Error(App.Lang.passwords_mismatch);
throw new Error(lang('passwords_mismatch'));
}
if ($password.val().length < vars('min_password_length') && $password.val() !== '') {
$('#admin-password, #admin-password-confirm').addClass('is-invalid');
throw new Error(App.Lang.password_length_notice.replace('$number', vars('min_password_length')));
throw new Error(lang('password_length_notice').replace('$number', vars('min_password_length')));
}
// Validate user email.
if (!App.Utils.Validation.email($email.val())) {
$email.addClass('is-invalid');
throw new Error(App.Lang.invalid_email);
throw new Error(lang('invalid_email'));
}
// Check if username exists
if ($username.attr('already-exists') === 'true') {
$username.addClass('is-invalid');
throw new Error(App.Lang.username_already_exists);
throw new Error(lang('username_already_exists'));
}
return true;
@ -370,14 +370,14 @@ App.Pages.Admins = (function () {
if (!response.length) {
$filterAdmins.find('.results').append(
$('<em/>', {
'text': App.Lang.no_records_found
'text': lang('no_records_found')
})
);
} else if (response.length === filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary w-100 load-more text-center',
'text': App.Lang.load_more,
'text': lang('load_more'),
'click': function () {
filterLimit += 20;
filter(keyword, selectId, show);

View file

@ -73,7 +73,7 @@ App.Pages.Booking = (function () {
}
},
content: {
message: App.Lang.website_using_cookies_to_ensure_best_experience,
message: lang('website_using_cookies_to_ensure_best_experience'),
dismiss: 'OK'
}
});
@ -103,50 +103,50 @@ App.Pages.Booking = (function () {
defaultDate: moment().toDate(),
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
prevText: App.Lang.previous,
nextText: App.Lang.next,
currentText: App.Lang.now,
closeText: App.Lang.close,
prevText: lang('previous'),
nextText: lang('next'),
currentText: lang('now'),
closeText: lang('close'),
onSelect: () => {
App.Http.Booking.getAvailableHours(moment($selectDate.datepicker('getDate')).format('YYYY-MM-DD'));
@ -262,7 +262,7 @@ App.Pages.Booking = (function () {
// Add the "Any Provider" entry.
if ($selectProvider.find('option').length >= 1 && vars('display_any_provider') === '1') {
$selectProvider.prepend(new Option('- ' + App.Lang.any_provider + ' -', 'any-provider', true, true));
$selectProvider.prepend(new Option('- ' + lang('any_provider') + ' -', 'any-provider', true, true));
}
App.Http.Booking.getUnavailableDates(
@ -297,7 +297,7 @@ App.Pages.Booking = (function () {
$('<div/>', {
'id': 'select-hour-prompt',
'class': 'text-danger mb-4',
'text': App.Lang.appointment_hour_missing
'text': lang('appointment_hour_missing')
}).prependTo('#available-hours');
}
return;
@ -406,7 +406,7 @@ App.Pages.Booking = (function () {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
@ -425,8 +425,8 @@ App.Pages.Booking = (function () {
];
App.Utils.Message.show(
App.Lang.cancel_appointment_title,
App.Lang.write_appointment_removal_reason,
lang('cancel_appointment_title'),
lang('write_appointment_removal_reason'),
buttons
);
@ -445,13 +445,13 @@ App.Pages.Booking = (function () {
$deletePersonalInformation.on('click', () => {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
},
{
text: App.Lang.delete,
text: lang('delete'),
click: () => {
App.Http.Booking.deletePersonalInformation(vars('customer_token'));
}
@ -459,8 +459,8 @@ App.Pages.Booking = (function () {
];
App.Utils.Message.show(
App.Lang.delete_personal_information,
App.Lang.delete_personal_information_prompt,
lang('delete_personal_information'),
lang('delete_personal_information_prompt'),
buttons
);
});
@ -515,25 +515,25 @@ App.Pages.Booking = (function () {
});
if (missingRequiredField) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
const $acceptToTermsAndConditions = $('#accept-to-terms-and-conditions');
if ($acceptToTermsAndConditions.length && !$acceptToTermsAndConditions.prop('checked')) {
$acceptToTermsAndConditions.parents('.form-check').addClass('text-danger');
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
const $acceptToPrivacyPolicy = $('#accept-to-privacy-policy');
if ($acceptToPrivacyPolicy.length && !$acceptToPrivacyPolicy.prop('checked')) {
$acceptToPrivacyPolicy.parents('.form-check').addClass('text-danger');
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
// Validate email address.
if ($email.val() && !App.Utils.Validation.email($email.val())) {
$email.parents('.form-group').addClass('is-invalid');
throw new Error(App.Lang.invalid_email);
throw new Error(lang('invalid_email'));
}
return true;
@ -576,21 +576,21 @@ App.Pages.Booking = (function () {
$('<div/>', {
'html': [
$('<h4/>', {
'text': App.Lang.appointment
'text': lang('appointment')
}),
$('<p/>', {
'html': [
$('<span/>', {
'text': App.Lang.service + ': ' + $selectService.find('option:selected').text()
'text': lang('service') + ': ' + $selectService.find('option:selected').text()
}),
$('<br/>'),
$('<span/>', {
'text': App.Lang.provider + ': ' + $selectProvider.find('option:selected').text()
'text': lang('provider') + ': ' + $selectProvider.find('option:selected').text()
}),
$('<br/>'),
$('<span/>', {
'text':
App.Lang.start +
lang('start') +
': ' +
selectedDate +
' ' +
@ -598,11 +598,11 @@ App.Pages.Booking = (function () {
}),
$('<br/>'),
$('<span/>', {
'text': App.Lang.timezone + ': ' + $selectTimezone.find('option:selected').text()
'text': lang('timezone') + ': ' + $selectTimezone.find('option:selected').text()
}),
$('<br/>'),
$('<span/>', {
'text': App.Lang.price + ': ' + servicePrice + ' ' + serviceCurrency,
'text': lang('price') + ': ' + servicePrice + ' ' + serviceCurrency,
'prop': {
'hidden': !servicePrice
}
@ -626,32 +626,32 @@ App.Pages.Booking = (function () {
$('<div/>', {
'html': [
$('<h4/>)', {
'text': App.Lang.customer
'text': lang('customer')
}),
$('<p/>', {
'html': [
$('<span/>', {
'text': App.Lang.customer + ': ' + firstName + ' ' + lastName
'text': lang('customer') + ': ' + firstName + ' ' + lastName
}),
$('<br/>'),
$('<span/>', {
'text': App.Lang.phone_number + ': ' + phoneNumber
'text': lang('phone_number') + ': ' + phoneNumber
}),
$('<br/>'),
$('<span/>', {
'text': App.Lang.email + ': ' + email
'text': lang('email') + ': ' + email
}),
$('<br/>'),
$('<span/>', {
'text': address ? App.Lang.address + ': ' + address : ''
'text': address ? lang('address') + ': ' + address : ''
}),
$('<br/>'),
$('<span/>', {
'text': city ? App.Lang.city + ': ' + city : ''
'text': city ? lang('city') + ': ' + city : ''
}),
$('<br/>'),
$('<span/>', {
'text': zipCode ? App.Lang.zip_code + ': ' + zipCode : ''
'text': zipCode ? lang('zip_code') + ': ' + zipCode : ''
}),
$('<br/>')
]
@ -810,19 +810,19 @@ App.Pages.Booking = (function () {
if (service.duration) {
$('<span/>', {
'text': '[' + App.Lang.duration + ' ' + service.duration + ' ' + App.Lang.minutes + ']'
'text': '[' + lang('duration') + ' ' + service.duration + ' ' + lang('minutes') + ']'
}).appendTo($serviceDescription);
}
if (Number(service.price) > 0) {
$('<span/>', {
'text': '[' + App.Lang.price + ' ' + service.price + ' ' + service.currency + ']'
'text': '[' + lang('price') + ' ' + service.price + ' ' + service.currency + ']'
}).appendTo($serviceDescription);
}
if (service.location) {
$('<span/>', {
'text': '[' + App.Lang.location + ' ' + service.location + ']'
'text': '[' + lang('location') + ' ' + service.location + ']'
}).appendTo($serviceDescription);
}
}

View file

@ -72,14 +72,14 @@ App.Pages.BookingConfirmation = (function () {
'class': 'alert alert-success col-xs-12',
'html': [
$('<h4/>', {
'text': App.Lang.success
'text': lang('success')
}),
$('<p/>', {
'text': App.Lang.appointment_added_to_google_calendar
'text': lang('appointment_added_to_google_calendar')
}),
$('<a/>', {
'href': response.htmlLink,
'text': App.Lang.view_appointment_in_google_calendar
'text': lang('view_appointment_in_google_calendar')
})
]
})
@ -95,10 +95,10 @@ App.Pages.BookingConfirmation = (function () {
'class': 'alert alert-danger col-xs-12',
'html': [
$('<h4/>', {
'text': App.Lang.oops_something_went_wrong
'text': lang('oops_something_went_wrong')
}),
$('<p/>', {
'text': App.Lang.could_not_add_to_google_calendar
'text': lang('could_not_add_to_google_calendar')
}),
$('<pre/>', {
'text': error.message

View file

@ -41,7 +41,7 @@ App.Pages.BookingSettings = (function () {
});
if (missingRequiredFields) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
return false;
@ -143,7 +143,7 @@ App.Pages.BookingSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(lang('settings_are_invalid'));
return;
}
@ -151,7 +151,7 @@ App.Pages.BookingSettings = (function () {
const bookingSettings = serialize();
App.Http.BookingSettings.save(bookingSettings).done(() => {
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(lang('settings_saved'));
});
}

View file

@ -42,7 +42,7 @@ App.Pages.BusinessSettings = (function () {
});
if (missingRequiredFields) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
return false;
@ -85,7 +85,7 @@ App.Pages.BusinessSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(lang('settings_are_invalid'));
return;
}
@ -93,7 +93,7 @@ App.Pages.BusinessSettings = (function () {
const businessSettings = serialize();
App.Http.BusinessSettings.save(businessSettings).done(() => {
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(lang('settings_saved'));
});
}
@ -103,7 +103,7 @@ App.Pages.BusinessSettings = (function () {
function onApplyGlobalWorkingPlan() {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
@ -115,7 +115,7 @@ App.Pages.BusinessSettings = (function () {
App.Http.BusinessSettings.applyGlobalWorkingPlan(workingPlan)
.done(() => {
App.Layouts.Backend.displayNotification(App.Lang.working_plans_got_updated);
App.Layouts.Backend.displayNotification(lang('working_plans_got_updated'));
})
.always(function () {
$('#message-box').dialog('close');
@ -124,7 +124,7 @@ App.Pages.BusinessSettings = (function () {
}
];
App.Utils.Message.show(App.Lang.working_plan, App.Lang.overwrite_existing_working_plans, buttons);
App.Utils.Message.show(lang('working_plan'), lang('overwrite_existing_working_plans'), buttons);
}
/**

View file

@ -69,7 +69,7 @@ App.Pages.Calendar = (function () {
App.Components.WorkingPlanExceptionsModal.add().done((date, workingPlanException) => {
const successCallback = () => {
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_saved);
App.Layouts.Backend.displayNotification(lang('working_plan_exception_saved'));
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};

View file

@ -94,13 +94,13 @@ App.Pages.Categories = (function () {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
},
{
text: App.Lang.delete,
text: lang('delete'),
click: () => {
remove(categoryId);
$('#message-box').dialog('close');
@ -108,7 +108,7 @@ App.Pages.Categories = (function () {
}
];
App.Utils.Message.show(App.Lang.delete_category, App.Lang.delete_record_prompt, buttons);
App.Utils.Message.show(lang('delete_category'), lang('delete_record_prompt'), buttons);
});
/**
@ -164,14 +164,14 @@ App.Pages.Categories = (function () {
if (response.length === 0) {
$('#filter-categories .results').append(
$('<em/>', {
'text': App.Lang.no_records_found
'text': lang('no_records_found')
})
);
} else if (response.length === filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary w-100 load-more text-center',
'text': App.Lang.load_more,
'text': lang('load_more'),
'click': () => {
filterLimit += 20;
filter(keyword, selectId, show);
@ -192,7 +192,7 @@ App.Pages.Categories = (function () {
*/
function save(category) {
App.Http.Categories.save(category).then((response) => {
App.Layouts.Backend.displayNotification(App.Lang.category_saved);
App.Layouts.Backend.displayNotification(lang('category_saved'));
resetForm();
$filterCategories.find('.key').val('');
filter('', response.id, true);
@ -206,7 +206,7 @@ App.Pages.Categories = (function () {
*/
function remove(id) {
App.Http.Categories.destroy(id).then(() => {
App.Layouts.Backend.displayNotification(App.Lang.category_deleted);
App.Layouts.Backend.displayNotification(lang('category_deleted'));
resetForm();
filter($('#filter-categories .key').val());
});
@ -243,7 +243,7 @@ App.Pages.Categories = (function () {
});
if (missingRequired) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
return true;

View file

@ -143,13 +143,13 @@ App.Pages.Customers = (function () {
const customerId = $id.val();
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
},
{
text: App.Lang.delete,
text: lang('delete'),
click: () => {
remove(customerId);
$('#message-box').dialog('close');
@ -157,7 +157,7 @@ App.Pages.Customers = (function () {
}
];
App.Utils.Message.show(App.Lang.delete_customer, App.Lang.delete_record_prompt, buttons);
App.Utils.Message.show(lang('delete_customer'), lang('delete_record_prompt'), buttons);
});
}
@ -168,7 +168,7 @@ App.Pages.Customers = (function () {
*/
function save(customer) {
App.Http.Customers.save(customer).then((response) => {
App.Layouts.Backend.displayNotification(App.Lang.customer_saved);
App.Layouts.Backend.displayNotification(lang('customer_saved'));
resetForm();
$('#filter-customers .key').val('');
filter('', response.id, true);
@ -182,7 +182,7 @@ App.Pages.Customers = (function () {
*/
function remove(id) {
App.Http.Customers.destroy(id).then(() => {
App.Layouts.Backend.displayNotification(App.Lang.customer_deleted);
App.Layouts.Backend.displayNotification(lang('customer_deleted'));
resetForm();
filter($('#filter-customers .key').val());
});
@ -207,13 +207,13 @@ App.Pages.Customers = (function () {
});
if (missingRequired) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
// Validate email address.
if (!App.Utils.Validation.email($email.val())) {
$email.addClass('is-invalid');
throw new Error(App.Lang.invalid_email);
throw new Error(lang('invalid_email'));
}
return true;
@ -268,7 +268,7 @@ App.Pages.Customers = (function () {
if (!customer.appointments.length) {
$('<p/>', {
'text': App.Lang.no_records_found
'text': lang('no_records_found')
}).appendTo($customerAppointments);
}
@ -370,14 +370,14 @@ App.Pages.Customers = (function () {
if (!response.length) {
$filterCustomers.find('.results').append(
$('<em/>', {
'text': App.Lang.no_records_found
'text': lang('no_records_found')
})
);
} else if (response.length === filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary w-100 load-more text-center',
'text': App.Lang.load_more,
'text': lang('load_more'),
'click': () => {
filterLimit += 20;
filter(keyword, selectId, show);

View file

@ -40,7 +40,7 @@ App.Pages.GeneralSettings = (function () {
});
if (missingRequiredFields) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
return false;
@ -76,7 +76,7 @@ App.Pages.GeneralSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(lang('settings_are_invalid'));
return;
}
@ -84,7 +84,7 @@ App.Pages.GeneralSettings = (function () {
const generalSettings = serialize();
App.Http.GeneralSettings.save(generalSettings).done(() => {
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(lang('settings_saved'));
});
}

View file

@ -46,7 +46,7 @@ App.Pages.LegalSettings = (function () {
});
if (missingRequiredFields) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
return false;
@ -125,7 +125,7 @@ App.Pages.LegalSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(lang('settings_are_invalid'));
return;
}
@ -133,7 +133,7 @@ App.Pages.LegalSettings = (function () {
const legalSettings = serialize();
App.Http.LegalSettings.save(legalSettings).done(() => {
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(lang('settings_saved'));
});
}

View file

@ -40,7 +40,7 @@ App.Pages.Login = (function () {
if (response.success) {
window.location.href = vars('dest_url');
} else {
$alert.text(App.Lang.login_failed);
$alert.text(lang('login_failed'));
$alert.removeClass('d-none alert-danger alert-success').addClass('alert-danger');
}
});

View file

@ -131,13 +131,13 @@ App.Pages.Providers = (function () {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: function () {
$('#message-box').dialog('close');
}
},
{
text: App.Lang.delete,
text: lang('delete'),
click: function () {
remove(providerId);
$('#message-box').dialog('close');
@ -145,7 +145,7 @@ App.Pages.Providers = (function () {
}
];
App.Utils.Message.show(App.Lang.delete_provider, App.Lang.delete_record_prompt, buttons);
App.Utils.Message.show(lang('delete_provider'), lang('delete_record_prompt'), buttons);
});
/**
@ -239,7 +239,7 @@ App.Pages.Providers = (function () {
*/
function save(provider) {
App.Http.Providers.save(provider).then((response) => {
App.Layouts.Backend.displayNotification(App.Lang.provider_saved);
App.Layouts.Backend.displayNotification(lang('provider_saved'));
resetForm();
$('#filter-providers .key').val('');
filter('', response.id, true);
@ -253,7 +253,7 @@ App.Pages.Providers = (function () {
*/
function remove(id) {
App.Http.Providers.destroy(id).then(() => {
App.Layouts.Backend.displayNotification(App.Lang.provider_deleted);
App.Layouts.Backend.displayNotification(lang('provider_deleted'));
resetForm();
filter($('#filter-providers .key').val());
});
@ -280,30 +280,30 @@ App.Pages.Providers = (function () {
});
if (missingRequired) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
// Validate passwords.
if ($password.val() !== $passwordConfirmation.val()) {
$('#provider-password, #provider-password-confirm').addClass('is-invalid');
throw new Error(App.Lang.passwords_mismatch);
throw new Error(lang('passwords_mismatch'));
}
if ($password.val().length < vars('min_password_length') && $password.val() !== '') {
$('#provider-password, #provider-password-confirm').addClass('is-invalid');
throw new Error(App.Lang.password_length_notice.replace('$number', MIN_PASSWORD_LENGTH));
throw new Error(lang('password_length_notice').replace('$number', MIN_PASSWORD_LENGTH));
}
// Validate user email.
if (!App.Utils.Validation.email($email.val())) {
$email.addClass('is-invalid');
throw new Error(App.Lang.invalid_email);
throw new Error(lang('invalid_email'));
}
// Check if username exists
if ($username.attr('already-exists') === 'true') {
$username.addClass('is-invalid');
throw new Error(App.Lang.username_already_exists);
throw new Error(lang('username_already_exists'));
}
return true;
@ -447,14 +447,14 @@ App.Pages.Providers = (function () {
if (!response.length) {
$filterProviders.find('.results').append(
$('<em/>', {
'text': App.Lang.no_records_found
'text': lang('no_records_found')
})
);
} else if (response.length === filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary w-100 load-more text-center',
'text': App.Lang.load_more,
'text': lang('load_more'),
'click': function () {
filterLimit += 20;
filter(keyword, selectId, show);

View file

@ -45,7 +45,7 @@ App.Pages.Recovery = (function () {
if (response.success) {
$alert.addClass('alert-success');
$alert.text(App.Lang.new_password_sent_with_email);
$alert.text(lang('new_password_sent_with_email'));
} else {
$alert.addClass('alert-danger');
$alert.text(

View file

@ -68,12 +68,12 @@ App.Pages.Secretaries = (function () {
if (response.is_valid === 'false') {
$input.addClass('is-invalid');
$input.attr('already-exists', 'true');
$input.parents().eq(3).find('.form-message').text(App.Lang.username_already_exists);
$input.parents().eq(3).find('.form-message').text(lang('username_already_exists'));
$input.parents().eq(3).find('.form-message').show();
} else {
$input.removeClass('is-invalid');
$input.attr('already-exists', 'false');
if ($input.parents().eq(3).find('.form-message').text() === App.Lang.username_already_exists) {
if ($input.parents().eq(3).find('.form-message').text() === lang('username_already_exists')) {
$input.parents().eq(3).find('.form-message').hide();
}
}
@ -155,13 +155,13 @@ App.Pages.Secretaries = (function () {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
},
{
text: App.Lang.delete,
text: lang('delete'),
click: () => {
remove(secretaryId);
$('#message-box').dialog('close');
@ -169,7 +169,7 @@ App.Pages.Secretaries = (function () {
}
];
App.Utils.Message.show(App.Lang.delete_secretary, App.Lang.delete_record_prompt, buttons);
App.Utils.Message.show(lang('delete_secretary'), lang('delete_record_prompt'), buttons);
});
/**
@ -243,7 +243,7 @@ App.Pages.Secretaries = (function () {
*/
function save(secretary) {
App.Http.Secretaries.save(secretary).done((response) => {
App.Layouts.Backend.displayNotification(App.Lang.secretary_saved);
App.Layouts.Backend.displayNotification(lang('secretary_saved'));
resetForm();
$('#filter-secretaries .key').val('');
filter('', response.id, true);
@ -257,7 +257,7 @@ App.Pages.Secretaries = (function () {
*/
function remove(id) {
App.Http.Secretaries.destroy(id).done(() => {
App.Layouts.Backend.displayNotification(App.Lang.secretary_deleted);
App.Layouts.Backend.displayNotification(lang('secretary_deleted'));
resetForm();
filter($('#filter-secretaries .key').val());
});
@ -393,14 +393,14 @@ App.Pages.Secretaries = (function () {
if (!response.length) {
$('#filter-secretaries .results').append(
$('<em/>', {
'text': App.Lang.no_records_found
'text': lang('no_records_found')
})
);
} else if (response.length === filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary w-100 load-more text-center',
'text': App.Lang.load_more,
'text': lang('load_more'),
'click': () => {
filterLimit += 20;
filter(keyword, selectId, show);

View file

@ -163,13 +163,13 @@ App.Pages.Services = (function () {
const serviceId = $id.val();
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
},
{
text: App.Lang.delete,
text: lang('delete'),
click: () => {
remove(serviceId);
$('#message-box').dialog('close');
@ -177,7 +177,7 @@ App.Pages.Services = (function () {
}
];
App.Utils.Message.show(App.Lang.delete_service, App.Lang.delete_record_prompt, buttons);
App.Utils.Message.show(lang('delete_service'), lang('delete_record_prompt'), buttons);
});
}
@ -189,7 +189,7 @@ App.Pages.Services = (function () {
*/
function save(service) {
App.Http.Services.save(service).then((response) => {
App.Layouts.Backend.displayNotification(App.Lang.service_saved);
App.Layouts.Backend.displayNotification(lang('service_saved'));
resetForm();
$filterServices.find('.key').val('');
filter('', response.id, true);
@ -203,7 +203,7 @@ App.Pages.Services = (function () {
*/
function remove(id) {
App.Http.Services.destroy(id).then(() => {
App.Layouts.Backend.displayNotification(App.Lang.service_deleted);
App.Layouts.Backend.displayNotification(lang('service_deleted'));
resetForm();
filter($filterServices.find('.key').val());
});
@ -230,13 +230,13 @@ App.Pages.Services = (function () {
});
if (missingRequired) {
throw new Error(App.Lang.fields_are_required);
throw new Error(lang('fields_are_required'));
}
// Validate the duration.
if (Number($duration.val()) < 5) {
$duration.addClass('is-invalid');
throw new Error(App.Lang.invalid_duration);
throw new Error(lang('invalid_duration'));
}
return true;
@ -306,14 +306,14 @@ App.Pages.Services = (function () {
if (response.length === 0) {
$filterServices.find('.results').append(
$('<em/>', {
'text': App.Lang.no_records_found
'text': lang('no_records_found')
})
);
} else if (response.length === filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary w-100 load-more text-center',
'text': App.Lang.load_more,
'text': lang('load_more'),
'click': () => {
filterLimit += 20;
filter(keyword, selectId, show);
@ -393,7 +393,7 @@ App.Pages.Services = (function () {
$select.append(new Option(category.name, category.id));
});
$select.append(new Option('- ' + App.Lang.no_category + ' -', '')).val('');
$select.append(new Option('- ' + lang('no_category') + ' -', '')).val('');
});
}

View file

@ -84,7 +84,7 @@ App.Utils.CalendarDefaultView = (function () {
App.Components.WorkingPlanExceptionsModal.edit(date, workingPlanException).done(
(date, workingPlanException) => {
const successCallback = () => {
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_saved);
App.Layouts.Backend.displayNotification(lang('working_plan_exception_saved'));
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
@ -118,7 +118,7 @@ App.Utils.CalendarDefaultView = (function () {
App.Components.AppointmentsModal.resetModal();
// Apply appointment data and show modal dialog.
$appointmentsModal.find('.modal-header h3').text(App.Lang.edit_appointment_title);
$appointmentsModal.find('.modal-header h3').text(lang('edit_appointment_title'));
$appointmentsModal.find('#appointment-id').val(appointment.id);
$appointmentsModal.find('#select-service').val(appointment.id_services).trigger('change');
$appointmentsModal.find('#select-provider').val(appointment.id_users_provider);
@ -190,7 +190,7 @@ App.Utils.CalendarDefaultView = (function () {
}
const successCallback = () => {
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_deleted);
App.Layouts.Backend.displayNotification(lang('working_plan_exception_deleted'));
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
delete workingPlanExceptions[date];
@ -213,7 +213,7 @@ App.Utils.CalendarDefaultView = (function () {
} else if (!lastFocusedEventData.data.is_unavailable) {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
@ -236,8 +236,8 @@ App.Utils.CalendarDefaultView = (function () {
];
App.Utils.Message.show(
App.Lang.delete_appointment_title,
App.Lang.write_appointment_removal_reason,
lang('delete_appointment_title'),
lang('write_appointment_removal_reason'),
buttons
);
@ -293,11 +293,11 @@ App.Utils.CalendarDefaultView = (function () {
// If the user has already the sync enabled then apply the proper style changes.
if ($selectFilterItem.find('option:selected').attr('google-sync') === 'true') {
$('#enable-sync').removeClass('btn-light').addClass('btn-secondary enabled');
$('#enable-sync span').text(App.Lang.disable_sync);
$('#enable-sync span').text(lang('disable_sync'));
$('#google-sync').prop('disabled', false);
} else {
$('#enable-sync').removeClass('btn-secondary enabled').addClass('btn-light');
$('#enable-sync span').text(App.Lang.enable_sync);
$('#enable-sync span').text(lang('enable_sync'));
$('#google-sync').prop('disabled', true);
}
}
@ -373,7 +373,7 @@ App.Utils.CalendarDefaultView = (function () {
'html': [
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.start
'text': lang('start')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -387,7 +387,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.end
'text': lang('end')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -400,7 +400,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.notes
'text': lang('notes')
}),
$('<span/>', {
'text': getEventNotes(event)
@ -419,7 +419,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-ban me-2'
}),
$('<span/>', {
'text': App.Lang.close
'text': lang('close')
})
]
}),
@ -430,7 +430,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-trash-alt me-2'
}),
$('<span/>', {
'text': App.Lang.delete
'text': lang('delete')
})
]
}),
@ -441,7 +441,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-edit me-2'
}),
$('<span/>', {
'text': App.Lang.edit
'text': lang('edit')
})
]
})
@ -464,7 +464,7 @@ App.Utils.CalendarDefaultView = (function () {
'html': [
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.provider
'text': lang('provider')
}),
$('<span/>', {
'text': event.data ? event.data.provider.first_name + ' ' + event.data.provider.last_name : '-'
@ -473,7 +473,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.start
'text': lang('start')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -487,7 +487,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.end
'text': lang('end')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -501,7 +501,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.timezone
'text': lang('timezone')
}),
$('<span/>', {
'text': vars('timezones')[event.data.provider.timezone]
@ -520,7 +520,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-ban me-2'
}),
$('<span/>', {
'text': App.Lang.close
'text': lang('close')
})
]
}),
@ -531,7 +531,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-trash-alt me-2'
}),
$('<span/>', {
'text': App.Lang.delete
'text': lang('delete')
})
]
}),
@ -542,7 +542,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-edit me-2'
}),
$('<span/>', {
'text': App.Lang.edit
'text': lang('edit')
})
]
})
@ -558,7 +558,7 @@ App.Utils.CalendarDefaultView = (function () {
'html': [
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.start
'text': lang('start')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -572,7 +572,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.end
'text': lang('end')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -586,7 +586,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.timezone
'text': lang('timezone')
}),
$('<span/>', {
'text': vars('timezones')[event.data.provider.timezone]
@ -595,7 +595,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.service
'text': lang('service')
}),
$('<span/>', {
'text': event.data.service.name
@ -604,7 +604,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.provider
'text': lang('provider')
}),
App.Utils.CalendarEventPopover.renderMapIcon(event.data.provider),
$('<span/>', {
@ -614,7 +614,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.customer
'text': lang('customer')
}),
App.Utils.CalendarEventPopover.renderMapIcon(event.data.customer),
$('<span/>', {
@ -625,7 +625,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.email
'text': lang('email')
}),
App.Utils.CalendarEventPopover.renderMailIcon(event.data.customer.email),
$('<span/>', {
@ -636,7 +636,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<strong/>', {
'class': 'd-inline-block me-2',
'text': App.Lang.phone
'text': lang('phone')
}),
App.Utils.CalendarEventPopover.renderPhoneIcon(event.data.customer.phone_number),
$('<span/>', {
@ -646,7 +646,7 @@ App.Utils.CalendarDefaultView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.notes
'text': lang('notes')
}),
$('<span/>', {
'text': getEventNotes(event)
@ -665,7 +665,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-ban me-2'
}),
$('<span/>', {
'text': App.Lang.close
'text': lang('close')
})
]
}),
@ -676,7 +676,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-trash-alt me-2'
}),
$('<span/>', {
'text': App.Lang.delete
'text': lang('delete')
})
]
}),
@ -687,7 +687,7 @@ App.Utils.CalendarDefaultView = (function () {
'class': 'fas fa-edit me-2'
}),
$('<span/>', {
'text': App.Lang.edit
'text': lang('edit')
})
]
})
@ -729,7 +729,7 @@ App.Utils.CalendarDefaultView = (function () {
function calendarEventResize(event, delta, revertFunc) {
if (vars('privileges').appointments.edit === false) {
revertFunc();
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments'));
return;
}
@ -769,9 +769,9 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(lang('appointment_updated'), [
{
'label': App.Lang.undo,
'label': lang('undo'),
'function': undoFunction
}
]);
@ -811,9 +811,9 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(lang('unavailable_updated'), [
{
'label': App.Lang.undo,
'label': lang('undo'),
'function': undoFunction
}
]);
@ -868,7 +868,7 @@ App.Utils.CalendarDefaultView = (function () {
function calendarEventDrop(event, delta, revertFunc) {
if (vars('privileges').appointments.edit === false) {
revertFunc();
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments'));
return;
}
@ -922,9 +922,9 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(lang('appointment_updated'), [
{
'label': App.Lang.undo,
'label': lang('undo'),
'function': undoFunction
}
]);
@ -965,9 +965,9 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(lang('unavailable_updated'), [
{
label: App.Lang.undo,
label: lang('undo'),
function: undoFunction
}
]);
@ -1082,7 +1082,7 @@ App.Utils.CalendarDefaultView = (function () {
}
const unavailabilityEvent = {
title: App.Lang.unavailable + notes,
title: lang('unavailable') + notes,
start: moment(unavailable.start_datetime),
end: moment(unavailable.end_datetime),
allDay: false,
@ -1142,7 +1142,7 @@ App.Utils.CalendarDefaultView = (function () {
workingPlanExceptionEnd = weekdayDate + ' ' + sortedWorkingPlan[weekdayName].end;
workingPlanExceptionEvent = {
title: App.Lang.working_plan_exception,
title: lang('working_plan_exception'),
start: moment(workingPlanExceptionStart, 'YYYY-MM-DD HH:mm', true),
end: moment(workingPlanExceptionEnd, 'YYYY-MM-DD HH:mm', true).add(1, 'day'),
allDay: true,
@ -1163,7 +1163,7 @@ App.Utils.CalendarDefaultView = (function () {
if (sortedWorkingPlan[weekdayName] === null) {
// Working plan exception.
unavailabilityEvent = {
title: App.Lang.not_working,
title: lang('not_working'),
start: calendarView.intervalStart.clone(),
end: calendarView.intervalEnd.clone(),
allDay: false,
@ -1186,7 +1186,7 @@ App.Utils.CalendarDefaultView = (function () {
if (viewStart < workDateStart) {
const unavailablePeriodBeforeWorkStarts = {
title: App.Lang.not_working,
title: lang('not_working'),
start: viewStart,
end: workDateStart,
allDay: false,
@ -1207,7 +1207,7 @@ App.Utils.CalendarDefaultView = (function () {
if (viewEnd > workDateEnd) {
const unavailablePeriodAfterWorkEnds = {
title: App.Lang.not_working,
title: lang('not_working'),
start: workDateEnd,
end: viewEnd,
allDay: false,
@ -1232,7 +1232,7 @@ App.Utils.CalendarDefaultView = (function () {
breakEnd.minute(parseInt(breakEndString[1]));
const unavailablePeriod = {
title: App.Lang.break,
title: lang('break'),
start: breakStart,
end: breakEnd,
allDay: false,
@ -1263,7 +1263,7 @@ App.Utils.CalendarDefaultView = (function () {
workingPlanExceptionEnd = weekdayDate + ' ' + sortedWorkingPlan[weekdayName].end;
workingPlanExceptionEvent = {
title: App.Lang.working_plan_exception,
title: lang('working_plan_exception'),
start: moment(workingPlanExceptionStart, 'YYYY-MM-DD HH:mm', true),
end: moment(workingPlanExceptionEnd, 'YYYY-MM-DD HH:mm', true).add(1, 'day'),
allDay: true,
@ -1284,7 +1284,7 @@ App.Utils.CalendarDefaultView = (function () {
if (sortedWorkingPlan[weekdayName] === null) {
// Add a full day unavailable event.
unavailabilityEvent = {
title: App.Lang.not_working,
title: lang('not_working'),
start: calendarDate.clone(),
end: calendarDate.clone().add(1, 'day'),
allDay: false,
@ -1308,7 +1308,7 @@ App.Utils.CalendarDefaultView = (function () {
if (calendarDate < workDateStart) {
unavailabilityEvent = {
title: App.Lang.not_working,
title: lang('not_working'),
start: calendarDate.clone(),
end: moment(
calendarDate.format('YYYY-MM-DD') +
@ -1333,7 +1333,7 @@ App.Utils.CalendarDefaultView = (function () {
if (calendarView.end > workDateEnd) {
unavailabilityEvent = {
title: App.Lang.not_working,
title: lang('not_working'),
start: moment(
calendarDate.format('YYYY-MM-DD') +
' ' +
@ -1363,7 +1363,7 @@ App.Utils.CalendarDefaultView = (function () {
breakEnd.minute(parseInt(breakEndString[1]));
const unavailabilityEvent = {
title: App.Lang.break,
title: lang('break'),
start: moment(calendarDate.format('YYYY-MM-DD') + ' ' + breakPeriod.start),
end: moment(calendarDate.format('YYYY-MM-DD') + ' ' + breakPeriod.end),
allDay: false,
@ -1439,7 +1439,7 @@ App.Utils.CalendarDefaultView = (function () {
slotLabelInterval: '01:00',
timeFormat: timeFormat,
slotLabelFormat: slotTimeFormat,
allDayText: App.Lang.all_day,
allDayText: lang('all_day'),
columnFormat: columnFormat,
header: {
left: 'prev,next today',
@ -1504,65 +1504,65 @@ App.Utils.CalendarDefaultView = (function () {
// Translations
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
monthNamesShort: [
App.Lang.january.substr(0, 3),
App.Lang.february.substr(0, 3),
App.Lang.march.substr(0, 3),
App.Lang.april.substr(0, 3),
App.Lang.may.substr(0, 3),
App.Lang.june.substr(0, 3),
App.Lang.july.substr(0, 3),
App.Lang.august.substr(0, 3),
App.Lang.september.substr(0, 3),
App.Lang.october.substr(0, 3),
App.Lang.november.substr(0, 3),
App.Lang.december.substr(0, 3)
lang('january').substr(0, 3),
lang('february').substr(0, 3),
lang('march').substr(0, 3),
lang('april').substr(0, 3),
lang('may').substr(0, 3),
lang('june').substr(0, 3),
lang('july').substr(0, 3),
lang('august').substr(0, 3),
lang('september').substr(0, 3),
lang('october').substr(0, 3),
lang('november').substr(0, 3),
lang('december').substr(0, 3)
],
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
buttonText: {
today: App.Lang.today,
day: App.Lang.day,
week: App.Lang.week,
month: App.Lang.month
today: lang('today'),
day: lang('day'),
week: lang('week'),
month: lang('month')
},
// Calendar events need to be declared on initialization.
@ -1581,7 +1581,7 @@ App.Utils.CalendarDefaultView = (function () {
// Fill the select list boxes of the page.
if (vars('available_providers').length > 0) {
$('<optgroup/>', {
'label': App.Lang.providers,
'label': lang('providers'),
'type': 'providers-group',
'html': vars('available_providers').map((availableProvider) => {
const hasGoogleSync = availableProvider.settings.google_sync === '1' ? 'true' : 'false';
@ -1598,7 +1598,7 @@ App.Utils.CalendarDefaultView = (function () {
if (vars('available_services').length > 0) {
$('<optgroup/>', {
'label': App.Lang.services,
'label': lang('services'),
'type': 'services-group',
'html': vars('available_services').map((availableService) =>
$('<option/>', {
@ -1649,7 +1649,7 @@ App.Utils.CalendarDefaultView = (function () {
App.Components.AppointmentsModal.resetModal();
$appointmentsModal.find('.modal-header h3').text(App.Lang.edit_appointment_title);
$appointmentsModal.find('.modal-header h3').text(lang('edit_appointment_title'));
$appointmentsModal.find('#appointment-id').val(appointment.id);
$appointmentsModal.find('#select-service').val(appointment.id_services).trigger('change');
$appointmentsModal.find('#select-provider').val(appointment.id_users_provider);

View file

@ -49,7 +49,7 @@ App.Utils.CalendarGoogleSync = (function () {
windowHandle.close();
window.clearInterval(authInterval);
$('#enable-sync').addClass('btn-secondary enabled').removeClass('btn-light');
$('#enable-sync span').text(App.Lang.disable_sync);
$('#enable-sync span').text(lang('disable_sync'));
$('#google-sync').prop('disabled', false);
$('#select-filter-item option:selected').attr('google-sync', 'true');
@ -78,7 +78,7 @@ App.Utils.CalendarGoogleSync = (function () {
} else {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
@ -103,7 +103,7 @@ App.Utils.CalendarGoogleSync = (function () {
App.Http.Google.disableProviderSync(provider.id);
$('#enable-sync').removeClass('btn-secondary enabled').addClass('btn-light');
$('#enable-sync span').text(App.Lang.enable_sync);
$('#enable-sync span').text(lang('enable_sync'));
$('#google-sync').prop('disabled', true);
$('#select-filter-item option:selected').attr('google-sync', 'false');
@ -112,7 +112,7 @@ App.Utils.CalendarGoogleSync = (function () {
}
];
App.Utils.Message.show(App.Lang.disable_sync, App.Lang.disable_sync_prompt, buttons);
App.Utils.Message.show(lang('disable_sync'), lang('disable_sync_prompt'), buttons);
}
});
@ -125,7 +125,7 @@ App.Utils.CalendarGoogleSync = (function () {
const calendarId = $('#google-calendar').val();
App.Http.Google.selectGoogleCalendar(providerId, calendarId).done(() => {
App.Layouts.Backend.displayNotification(App.Lang.google_calendar_selected);
App.Layouts.Backend.displayNotification(lang('google_calendar_selected'));
$('#select-google-calendar').modal('hide');
});
});
@ -140,11 +140,11 @@ App.Utils.CalendarGoogleSync = (function () {
App.Http.Google.syncWithGoogle(providerId)
.done(() => {
App.Layouts.Backend.displayNotification(App.Lang.google_sync_completed);
App.Layouts.Backend.displayNotification(lang('google_sync_completed'));
$('#reload-appointments').trigger('click');
})
.fail(() => {
App.Layouts.Backend.displayNotification(App.Lang.google_sync_failed);
App.Layouts.Backend.displayNotification(lang('google_sync_failed'));
});
});
}

View file

@ -158,7 +158,7 @@ App.Utils.CalendarTableView = (function () {
App.Components.WorkingPlanExceptionsModal.edit(date, workingPlanException).done(
(date, workingPlanException) => {
const successCallback = () => {
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_saved);
App.Layouts.Backend.displayNotification(lang('working_plan_exception_saved'));
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
@ -191,7 +191,7 @@ App.Utils.CalendarTableView = (function () {
BackendCalendarAppointmentsModal.resetAppointmentDialog();
// Apply appointment data and show modal dialog.
$appointmentsModal.find('.modal-header h3').text(App.Lang.edit_appointment_title);
$appointmentsModal.find('.modal-header h3').text(lang('edit_appointment_title'));
$appointmentsModal.find('#appointment-id').val(appointment.id);
$appointmentsModal.find('#select-service').val(appointment.id_services).trigger('change');
$appointmentsModal.find('#select-provider').val(appointment.id_users_provider);
@ -274,7 +274,7 @@ App.Utils.CalendarTableView = (function () {
} else if (lastFocusedEventData.data.is_unavailable === '0') {
const buttons = [
{
text: App.Lang.cancel,
text: lang('cancel'),
click: () => {
$('#message-box').dialog('close');
}
@ -297,8 +297,8 @@ App.Utils.CalendarTableView = (function () {
];
App.Utils.Message.show(
App.Lang.delete_appointment_title,
App.Lang.write_appointment_removal_reason,
lang('delete_appointment_title'),
lang('write_appointment_removal_reason'),
buttons
);
@ -332,8 +332,8 @@ App.Utils.CalendarTableView = (function () {
$calendarFilter
.find('select')
.empty()
.append(new Option('1 ' + App.Lang.day, 1))
.append(new Option('3 ' + App.Lang.days, 3));
.append(new Option('1 ' + lang('day'), 1))
.append(new Option('3 ' + lang('days'), 3));
const $calendarHeader = $('<div/>', {
'class': 'calendar-header'
@ -403,7 +403,7 @@ App.Utils.CalendarTableView = (function () {
// Create providers and service filters.
$('<label/>', {
'text': App.Lang.provider
'text': lang('provider')
}).appendTo($calendarHeader);
$filterProvider = $('<select/>', {
@ -442,7 +442,7 @@ App.Utils.CalendarTableView = (function () {
});
$('<label/>', {
'text': App.Lang.service
'text': lang('service')
}).appendTo($calendarHeader);
$filterService = $('<select/>', {
@ -749,67 +749,67 @@ App.Utils.CalendarTableView = (function () {
// Translations
monthNames: [
App.Lang.january,
App.Lang.february,
App.Lang.march,
App.Lang.april,
App.Lang.may,
App.Lang.june,
App.Lang.july,
App.Lang.august,
App.Lang.september,
App.Lang.october,
App.Lang.november,
App.Lang.december
lang('january'),
lang('february'),
lang('march'),
lang('april'),
lang('may'),
lang('june'),
lang('july'),
lang('august'),
lang('september'),
lang('october'),
lang('november'),
lang('december')
],
monthNamesShort: [
App.Lang.january.substr(0, 3),
App.Lang.february.substr(0, 3),
App.Lang.march.substr(0, 3),
App.Lang.april.substr(0, 3),
App.Lang.may.substr(0, 3),
App.Lang.june.substr(0, 3),
App.Lang.july.substr(0, 3),
App.Lang.august.substr(0, 3),
App.Lang.september.substr(0, 3),
App.Lang.october.substr(0, 3),
App.Lang.november.substr(0, 3),
App.Lang.december.substr(0, 3)
lang('january').substr(0, 3),
lang('february').substr(0, 3),
lang('march').substr(0, 3),
lang('april').substr(0, 3),
lang('may').substr(0, 3),
lang('june').substr(0, 3),
lang('july').substr(0, 3),
lang('august').substr(0, 3),
lang('september').substr(0, 3),
lang('october').substr(0, 3),
lang('november').substr(0, 3),
lang('december').substr(0, 3)
],
dayNames: [
App.Lang.sunday,
App.Lang.monday,
App.Lang.tuesday,
App.Lang.wednesday,
App.Lang.thursday,
App.Lang.friday,
App.Lang.saturday
lang('sunday'),
lang('monday'),
lang('tuesday'),
lang('wednesday'),
lang('thursday'),
lang('friday'),
lang('saturday')
],
dayNamesShort: [
App.Lang.sunday.substr(0, 3),
App.Lang.monday.substr(0, 3),
App.Lang.tuesday.substr(0, 3),
App.Lang.wednesday.substr(0, 3),
App.Lang.thursday.substr(0, 3),
App.Lang.friday.substr(0, 3),
App.Lang.saturday.substr(0, 3)
lang('sunday').substr(0, 3),
lang('monday').substr(0, 3),
lang('tuesday').substr(0, 3),
lang('wednesday').substr(0, 3),
lang('thursday').substr(0, 3),
lang('friday').substr(0, 3),
lang('saturday').substr(0, 3)
],
dayNamesMin: [
App.Lang.sunday.substr(0, 2),
App.Lang.monday.substr(0, 2),
App.Lang.tuesday.substr(0, 2),
App.Lang.wednesday.substr(0, 2),
App.Lang.thursday.substr(0, 2),
App.Lang.friday.substr(0, 2),
App.Lang.saturday.substr(0, 2)
lang('sunday').substr(0, 2),
lang('monday').substr(0, 2),
lang('tuesday').substr(0, 2),
lang('wednesday').substr(0, 2),
lang('thursday').substr(0, 2),
lang('friday').substr(0, 2),
lang('saturday').substr(0, 2)
],
buttonText: {
today: App.Lang.today,
day: App.Lang.day,
week: App.Lang.week,
month: App.Lang.month,
agendaDay: App.Lang.calendar,
listDay: App.Lang.list
today: lang('today'),
day: lang('day'),
week: lang('week'),
month: lang('month'),
agendaDay: lang('calendar'),
listDay: lang('list')
},
// Calendar events need to be declared on initialization.
@ -847,7 +847,7 @@ App.Utils.CalendarTableView = (function () {
const workingPlanExceptionEnd = selDayDate + ' ' + workingPlan[selDayName].end;
const workingPlanExceptionEvent = {
title: App.Lang.working_plan_exception,
title: lang('working_plan_exception'),
start: moment(workingPlanExceptionStart, 'YYYY-MM-DD HH:mm', true),
end: moment(workingPlanExceptionEnd, 'YYYY-MM-DD HH:mm', true).add(1, 'day'),
allDay: true,
@ -866,7 +866,7 @@ App.Utils.CalendarTableView = (function () {
if (workingPlan[selDayName] === null) {
const nonWorkingDay = {
title: App.Lang.not_working,
title: lang('not_working'),
start: start,
end: end,
allDay: false,
@ -886,7 +886,7 @@ App.Utils.CalendarTableView = (function () {
if (start < workDateStart) {
unavailablePeriod = {
title: App.Lang.not_working,
title: lang('not_working'),
start: start,
end: workDateStart,
allDay: false,
@ -903,7 +903,7 @@ App.Utils.CalendarTableView = (function () {
if (end > workDateEnd) {
const unavailablePeriod = {
title: App.Lang.not_working,
title: lang('not_working'),
start: workDateEnd,
end: end,
allDay: false,
@ -924,7 +924,7 @@ App.Utils.CalendarTableView = (function () {
breakEnd = moment(start.format('YYYY-MM-DD') + ' ' + currentBreak.end);
const unavailablePeriod = {
title: App.Lang.break,
title: lang('break'),
start: breakStart,
end: breakEnd,
allDay: false,
@ -1008,7 +1008,7 @@ App.Utils.CalendarTableView = (function () {
}
const event = {
title: App.Lang.unavailable,
title: lang('unavailable'),
start: moment(unavailability.start_datetime),
end: moment(unavailability.end_datetime),
allDay: false,
@ -1062,7 +1062,7 @@ App.Utils.CalendarTableView = (function () {
});
$event.html(
App.Lang.break +
lang('break') +
' <span class="hour">' +
moment(eventDate).format('HH:mm') +
'</span> (' +
@ -1154,7 +1154,7 @@ App.Utils.CalendarTableView = (function () {
$html = $('<div/>', {
'html': [
$('<strong/>', {
'text': App.Lang.start
'text': lang('start')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -1167,7 +1167,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.end
'text': lang('end')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -1180,7 +1180,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.notes
'text': lang('notes')
}),
$('<span/>', {
'text': getEventNotes(event)
@ -1199,7 +1199,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-ban me-2'
}),
$('<span/>', {
'text': App.Lang.close
'text': lang('close')
})
]
}),
@ -1210,7 +1210,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-trash-alt me-2'
}),
$('<span/>', {
'text': App.Lang.delete
'text': lang('delete')
})
]
}),
@ -1221,7 +1221,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-edit me-2'
}),
$('<span/>', {
'text': App.Lang.edit
'text': lang('edit')
})
]
})
@ -1249,7 +1249,7 @@ App.Utils.CalendarTableView = (function () {
$html = $('<div/>', {
'html': [
$('<strong/>', {
'text': App.Lang.provider
'text': lang('provider')
}),
$('<span/>', {
'text': event.data ? event.data.provider.first_name + ' ' + event.data.provider.last_name : '-'
@ -1257,7 +1257,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.start
'text': lang('start')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -1270,7 +1270,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.end
'text': lang('end')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -1283,7 +1283,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.timezone
'text': lang('timezone')
}),
$('<span/>', {
'text': vars('timezones')[event.data.provider.timezone]
@ -1302,7 +1302,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-ban me-2'
}),
$('<span/>', {
'text': App.Lang.close
'text': lang('close')
})
]
}),
@ -1313,7 +1313,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-trash-alt me-2'
}),
$('<span/>', {
'text': App.Lang.delete
'text': lang('delete')
})
]
}),
@ -1324,7 +1324,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-edit me-2'
}),
$('<span/>', {
'text': App.Lang.edit
'text': lang('edit')
})
]
})
@ -1339,7 +1339,7 @@ App.Utils.CalendarTableView = (function () {
$html = $('<div/>', {
'html': [
$('<strong/>', {
'text': App.Lang.start
'text': lang('start')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -1352,7 +1352,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.end
'text': lang('end')
}),
$('<span/>', {
'text': App.Utils.Date.format(
@ -1365,7 +1365,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.timezone
'text': lang('timezone')
}),
$('<span/>', {
'text': vars('timezones')[event.data.provider.timezone]
@ -1373,7 +1373,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.service
'text': lang('service')
}),
$('<span/>', {
'text': event.data.service.name
@ -1381,7 +1381,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.provider
'text': lang('provider')
}),
App.Utils.CalendarEventPopover.renderMapIcon(event.data.provider),
$('<span/>', {
@ -1390,7 +1390,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.customer
'text': lang('customer')
}),
App.Utils.CalendarEventPopover.renderMapIcon(event.data.customer),
$('<span/>', {
@ -1399,7 +1399,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.email
'text': lang('email')
}),
App.Utils.CalendarEventPopover.renderMailIcon(event.data.customer.email),
$('<span/>', {
@ -1408,7 +1408,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.phone
'text': lang('phone')
}),
App.Utils.CalendarEventPopover.renderPhoneIcon(event.data.customer.phone_number),
$('<span/>', {
@ -1417,7 +1417,7 @@ App.Utils.CalendarTableView = (function () {
$('<br/>'),
$('<strong/>', {
'text': App.Lang.notes
'text': lang('notes')
}),
$('<span/>', {
'text': getEventNotes(event)
@ -1436,7 +1436,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-ban me-2'
}),
$('<span/>', {
'text': App.Lang.close
'text': lang('close')
})
]
}),
@ -1447,7 +1447,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-trash-alt me-2'
}),
$('<span/>', {
'text': App.Lang.delete
'text': lang('delete')
})
]
}),
@ -1458,7 +1458,7 @@ App.Utils.CalendarTableView = (function () {
'class': 'fas fa-edit me-2'
}),
$('<span/>', {
'text': App.Lang.edit
'text': lang('edit')
})
]
})
@ -1498,7 +1498,7 @@ App.Utils.CalendarTableView = (function () {
function onEventResize(event, delta, revertFunc) {
if (vars('privileges').appointments.edit === false) {
revertFunc();
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments'));
return;
}
@ -1540,9 +1540,9 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(lang('appointment_updated'), [
{
'label': App.Lang.undo,
'label': lang('undo'),
'function': undoFunction
}
]);
@ -1580,9 +1580,9 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(lang('unavailable_updated'), [
{
'label': App.Lang.undo,
'label': lang('undo'),
'function': undoFunction
}
]);
@ -1606,7 +1606,7 @@ App.Utils.CalendarTableView = (function () {
function onEventDrop(event, delta, revertFunc) {
if (vars('privileges').appointments.edit === false) {
revertFunc();
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(lang('no_privileges_edit_appointments'));
return;
}
@ -1660,9 +1660,9 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(lang('appointment_updated'), [
{
'label': App.Lang.undo,
'label': lang('undo'),
'function': undoFunction
}
]);
@ -1701,9 +1701,9 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(lang('unavailable_updated'), [
{
label: App.Lang.undo,
label: lang('undo'),
function: undoFunction
}
]);

View file

@ -50,7 +50,7 @@ window.GeneralFunctions = window.GeneralFunctions || {};
if (!buttons) {
buttons = [
{
text: App.Lang.close,
text: lang('close'),
click: function () {
$('#message-box').dialog('close');
}
@ -284,7 +284,7 @@ window.GeneralFunctions = window.GeneralFunctions || {};
return;
}
GeneralFunctions.displayMessageBox(App.Lang.unexpected_issues, App.Lang.unexpected_issues_message);
GeneralFunctions.displayMessageBox(lang('unexpected_issues'), lang('unexpected_issues_message'));
$('<div/>', {
'class': 'card',

View file

@ -29,7 +29,7 @@ window.App.Utils.Message = (function () {
if (!buttons) {
buttons = [
{
text: App.Lang.close,
text: lang('close'),
click: function () {
$('#message-box').dialog('close');
}

View file

@ -135,7 +135,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm edit-break',
'title': App.Lang.edit,
'title': lang('edit'),
'html': [
$('<span/>', {
'class': 'fas fa-edit'
@ -145,7 +145,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm delete-break',
'title': App.Lang.delete,
'title': lang('delete'),
'html': [
$('<span/>', {
'class': 'fas fa-trash-alt'
@ -155,7 +155,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm save-break d-none',
'title': App.Lang.save,
'title': lang('save'),
'html': [
$('<span/>', {
'class': 'fas fa-check-circle'
@ -165,7 +165,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm cancel-break d-none',
'title': App.Lang.cancel,
'title': lang('cancel'),
'html': [
$('<span/>', {
'class': 'fas fa-ban'
@ -212,13 +212,13 @@ App.Utils.WorkingPlan = (function () {
*/
editableDayCell($selector) {
const weekDays = {};
weekDays[App.Lang.sunday] = App.Lang.sunday; //'Sunday';
weekDays[App.Lang.monday] = App.Lang.monday; //'Monday';
weekDays[App.Lang.tuesday] = App.Lang.tuesday; //'Tuesday';
weekDays[App.Lang.wednesday] = App.Lang.wednesday; //'Wednesday';
weekDays[App.Lang.thursday] = App.Lang.thursday; //'Thursday';
weekDays[App.Lang.friday] = App.Lang.friday; //'Friday';
weekDays[App.Lang.saturday] = App.Lang.saturday; //'Saturday';
weekDays[lang('sunday')] = lang('sunday'); //'Sunday';
weekDays[lang('monday')] = lang('monday'); //'Monday';
weekDays[lang('tuesday')] = lang('tuesday'); //'Tuesday';
weekDays[lang('wednesday')] = lang('wednesday'); //'Wednesday';
weekDays[lang('thursday')] = lang('thursday'); //'Thursday';
weekDays[lang('friday')] = lang('friday'); //'Friday';
weekDays[lang('saturday')] = lang('saturday'); //'Saturday';
$selector.editable(
function (value) {
@ -264,12 +264,12 @@ App.Utils.WorkingPlan = (function () {
submit: $('<button/>', {
'type': 'button',
'class': 'd-none submit-editable',
'text': App.Lang.save
'text': lang('save')
}).get(0).outerHTML,
cancel: $('<button/>', {
'type': 'button',
'class': 'd-none cancel-editable',
'text': App.Lang.cancel
'text': lang('cancel')
}).get(0).outerHTML,
onblur: 'ignore',
onreset: function () {
@ -319,7 +319,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm edit-working-plan-exception',
'title': App.Lang.edit,
'title': lang('edit'),
'html': [
$('<span/>', {
'class': 'fas fa-edit'
@ -329,7 +329,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm delete-working-plan-exception',
'title': App.Lang.delete,
'title': lang('delete'),
'html': [
$('<span/>', {
'class': 'fas fa-trash-alt'
@ -385,7 +385,7 @@ App.Utils.WorkingPlan = (function () {
'html': [
$('<td/>', {
'class': 'break-day editable',
'text': App.Lang.sunday
'text': lang('sunday')
}),
$('<td/>', {
'class': 'break-start editable',
@ -400,7 +400,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm edit-break',
'title': App.Lang.edit,
'title': lang('edit'),
'html': [
$('<span/>', {
'class': 'fas fa-edit'
@ -410,7 +410,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm delete-break',
'title': App.Lang.delete,
'title': lang('delete'),
'html': [
$('<span/>', {
'class': 'fas fa-trash-alt'
@ -420,7 +420,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm save-break d-none',
'title': App.Lang.save,
'title': lang('save'),
'html': [
$('<span/>', {
'class': 'fas fa-check-circle'
@ -430,7 +430,7 @@ App.Utils.WorkingPlan = (function () {
$('<button/>', {
'type': 'button',
'class': 'btn btn-outline-secondary btn-sm cancel-break d-none',
'title': App.Lang.cancel,
'title': lang('cancel'),
'html': [
$('<span/>', {
'class': 'fas fa-ban'
@ -472,12 +472,12 @@ App.Utils.WorkingPlan = (function () {
.find('.break-start input, .break-end input')
.timepicker({
timeFormat: vars('time_format') === 'regular' ? 'h:mm tt' : 'HH:mm',
currentText: App.Lang.now,
closeText: App.Lang.close,
timeOnlyTitle: App.Lang.select_time,
timeText: App.Lang.time,
hourText: App.Lang.hour,
minuteText: App.Lang.minutes
currentText: lang('now'),
closeText: lang('close'),
timeOnlyTitle: lang('select_time'),
timeText: lang('time'),
hourText: lang('hour'),
minuteText: lang('minutes')
});
$(this).parent().parent().find('.break-day select').focus();
@ -703,12 +703,12 @@ App.Utils.WorkingPlan = (function () {
// Set timepickers where needed.
$('.working-plan input:text').timepicker({
timeFormat: vars('time_format') === 'regular' ? 'h:mm tt' : 'HH:mm',
currentText: App.Lang.now,
closeText: App.Lang.close,
timeOnlyTitle: App.Lang.select_time,
timeText: App.Lang.time,
hourText: App.Lang.hour,
minuteText: App.Lang.minutes,
currentText: lang('now'),
closeText: lang('close'),
timeOnlyTitle: lang('select_time'),
timeText: lang('time'),
hourText: lang('hour'),
minuteText: lang('minutes'),
onSelect: function () {
// Start time must be earlier than end time.
@ -746,19 +746,19 @@ App.Utils.WorkingPlan = (function () {
convertValueToDay(value) {
switch (value) {
case 'sunday':
return App.Lang.sunday;
return lang('sunday');
case 'monday':
return App.Lang.monday;
return lang('monday');
case 'tuesday':
return App.Lang.tuesday;
return lang('tuesday');
case 'wednesday':
return App.Lang.wednesday;
return lang('wednesday');
case 'thursday':
return App.Lang.thursday;
return lang('thursday');
case 'friday':
return App.Lang.friday;
return lang('friday');
case 'saturday':
return App.Lang.saturday;
return lang('saturday');
}
}
/**
@ -768,19 +768,19 @@ App.Utils.WorkingPlan = (function () {
*/
convertDayToValue(day) {
switch (day) {
case App.Lang.sunday:
case lang('sunday'):
return 'sunday';
case App.Lang.monday:
case lang('monday'):
return 'monday';
case App.Lang.tuesday:
case lang('tuesday'):
return 'tuesday';
case App.Lang.wednesday:
case lang('wednesday'):
return 'wednesday';
case App.Lang.thursday:
case lang('thursday'):
return 'thursday';
case App.Lang.friday:
case lang('friday'):
return 'friday';
case App.Lang.saturday:
case lang('saturday'):
return 'saturday';
}
}