Rename ui.js methods
This commit is contained in:
parent
c7f2e7f831
commit
02162ee232
8 changed files with 30 additions and 30 deletions
|
@ -481,7 +481,7 @@ App.Components.AppointmentsModal = (function () {
|
|||
const startDatetime = new Date();
|
||||
const endDatetime = moment().add(duration, 'minutes').toDate();
|
||||
|
||||
App.Utils.UI.initializeDatetimepicker($startDatetime, {
|
||||
App.Utils.UI.initializeDateTimePicker($startDatetime, {
|
||||
onClose: () => {
|
||||
const serviceId = $selectService.val();
|
||||
|
||||
|
@ -497,7 +497,7 @@ App.Components.AppointmentsModal = (function () {
|
|||
|
||||
$startDatetime[0]._flatpickr.setDate(startDatetime);
|
||||
|
||||
App.Utils.UI.initializeDatetimepicker($endDatetime);
|
||||
App.Utils.UI.initializeDateTimePicker($endDatetime);
|
||||
$endDatetime[0]._flatpickr.setDate(endDatetime);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,11 +183,11 @@ App.Components.UnavailabilitiesModal = (function () {
|
|||
true,
|
||||
);
|
||||
|
||||
App.Utils.UI.initializeDatetimepicker($startDatetime);
|
||||
App.Utils.UI.initializeDateTimePicker($startDatetime);
|
||||
|
||||
$startDatetime.val(start);
|
||||
|
||||
App.Utils.UI.initializeDatetimepicker($endDatetime);
|
||||
App.Utils.UI.initializeDateTimePicker($endDatetime);
|
||||
|
||||
$endDatetime.val(end);
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
|
|||
// Make all cells in current row editable.
|
||||
let $tr = $(this).closest('tr');
|
||||
$tr.children().trigger('edit');
|
||||
App.Utils.UI.initializeTimepicker(
|
||||
App.Utils.UI.initializeTimePicker(
|
||||
$tr.find('.working-plan-exceptions-break-start input, .working-plan-exceptions-break-end input'),
|
||||
);
|
||||
$(this).closest('tr').find('.working-plan-exceptions-break-start').focus();
|
||||
|
@ -462,9 +462,9 @@ App.Components.WorkingPlanExceptionsModal = (function () {
|
|||
* Initialize the module.
|
||||
*/
|
||||
function initialize() {
|
||||
App.Utils.UI.initializeDatepicker($date);
|
||||
App.Utils.UI.initializeTimepicker($start);
|
||||
App.Utils.UI.initializeTimepicker($end);
|
||||
App.Utils.UI.initializeDatePicker($date);
|
||||
App.Utils.UI.initializeTimePicker($start);
|
||||
App.Utils.UI.initializeTimePicker($end);
|
||||
|
||||
$modal
|
||||
.on('hidden.bs.modal', onModalHidden)
|
||||
|
|
|
@ -123,9 +123,9 @@ App.Pages.BlockedPeriods = (function () {
|
|||
* Event: Blocked period Save Button "Click"
|
||||
*/
|
||||
$blockedPeriods.on('click', '#save-blocked-period', () => {
|
||||
const startDateTimeObject = App.Utils.UI.getDatetimepickerValue($startDateTime);
|
||||
const startDateTimeObject = App.Utils.UI.getDateTimePickerValue($startDateTime);
|
||||
const startDateTimeMoment = moment(startDateTimeObject);
|
||||
const endDateTimeObject = App.Utils.UI.getDatetimepickerValue($endDateTime);
|
||||
const endDateTimeObject = App.Utils.UI.getDateTimePickerValue($endDateTime);
|
||||
const endDateTimeMoment = moment(endDateTimeObject);
|
||||
|
||||
const blockedPeriod = {
|
||||
|
@ -235,8 +235,8 @@ App.Pages.BlockedPeriods = (function () {
|
|||
function display(blockedPeriod) {
|
||||
$id.val(blockedPeriod.id);
|
||||
$name.val(blockedPeriod.name);
|
||||
App.Utils.UI.setDatetimepickerValue($startDateTime, new Date(blockedPeriod.start_datetime));
|
||||
App.Utils.UI.setDatetimepickerValue($endDateTime, new Date(blockedPeriod.end_datetime));
|
||||
App.Utils.UI.setDateTimePickerValue($startDateTime, new Date(blockedPeriod.start_datetime));
|
||||
App.Utils.UI.setDateTimePickerValue($endDateTime, new Date(blockedPeriod.end_datetime));
|
||||
$notes.val(blockedPeriod.notes);
|
||||
}
|
||||
|
||||
|
@ -263,8 +263,8 @@ App.Pages.BlockedPeriods = (function () {
|
|||
throw new Error(lang('fields_are_required'));
|
||||
}
|
||||
|
||||
const startDateTimeObject = App.Utils.UI.getDatetimepickerValue($startDateTime);
|
||||
const endDateTimeObject = App.Utils.UI.getDatetimepickerValue($endDateTime);
|
||||
const startDateTimeObject = App.Utils.UI.getDateTimePickerValue($startDateTime);
|
||||
const endDateTimeObject = App.Utils.UI.getDateTimePickerValue($endDateTime);
|
||||
|
||||
if (startDateTimeObject >= endDateTimeObject) {
|
||||
$startDateTime.addClass('is-invalid');
|
||||
|
@ -346,8 +346,8 @@ App.Pages.BlockedPeriods = (function () {
|
|||
resetForm();
|
||||
filter('');
|
||||
addEventListeners();
|
||||
App.Utils.UI.initializeDatetimepicker($startDateTime);
|
||||
App.Utils.UI.initializeDatetimepicker($endDateTime);
|
||||
App.Utils.UI.initializeDateTimePicker($startDateTime);
|
||||
App.Utils.UI.initializeDateTimePicker($endDateTime);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initialize);
|
||||
|
|
|
@ -82,7 +82,7 @@ App.Pages.Booking = (function () {
|
|||
// Initialize page's components (tooltips, date pickers etc).
|
||||
tippy('[data-tippy-content]');
|
||||
|
||||
App.Utils.UI.initializeDatepicker($selectDate, {
|
||||
App.Utils.UI.initializeDatePicker($selectDate, {
|
||||
inline: true,
|
||||
minDate: moment().subtract(1, 'day').set({hours: 23, minutes: 59, seconds: 59}).toDate(),
|
||||
maxDate: moment().add(vars('future_booking_limit'), 'days').toDate(),
|
||||
|
|
|
@ -389,7 +389,7 @@ App.Utils.CalendarTableView = (function () {
|
|||
],
|
||||
}).appendTo($calendarHeader);
|
||||
|
||||
App.Utils.UI.initializeDatepicker($calendarHeader.find('.select-date'), {
|
||||
App.Utils.UI.initializeDatePicker($calendarHeader.find('.select-date'), {
|
||||
onChange(selectedDates) {
|
||||
const startDate = selectedDates[0];
|
||||
const endDate = moment(startDate)
|
||||
|
|
|
@ -148,7 +148,7 @@ window.App.Utils.UI = (function () {
|
|||
* @param {jQuery} $target
|
||||
* @param {Object} [params]
|
||||
*/
|
||||
function initializeDatetimepicker($target, params = {}) {
|
||||
function initializeDateTimePicker($target, params = {}) {
|
||||
$target.flatpickr({
|
||||
enableTime: true,
|
||||
allowInput: true,
|
||||
|
@ -168,7 +168,7 @@ window.App.Utils.UI = (function () {
|
|||
* @param {jQuery} $target
|
||||
* @param {Object} [params]
|
||||
*/
|
||||
function initializeDatepicker($target, params = {}) {
|
||||
function initializeDatePicker($target, params = {}) {
|
||||
$target.flatpickr({
|
||||
allowInput: true,
|
||||
dateFormat: getDateFormat(),
|
||||
|
@ -186,7 +186,7 @@ window.App.Utils.UI = (function () {
|
|||
* @param {jQuery} $target
|
||||
* @param {Object} [params]
|
||||
*/
|
||||
function initializeTimepicker($target, params = {}) {
|
||||
function initializeTimePicker($target, params = {}) {
|
||||
$target.flatpickr({
|
||||
noCalendar: true,
|
||||
enableTime: true,
|
||||
|
@ -230,7 +230,7 @@ window.App.Utils.UI = (function () {
|
|||
*
|
||||
* @return {Date}
|
||||
*/
|
||||
function getDatetimepickerValue($target) {
|
||||
function getDateTimePickerValue($target) {
|
||||
if (!$target?.length) {
|
||||
throw new Error('Empty $target argument provided.');
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ window.App.Utils.UI = (function () {
|
|||
* @param {jQuery} $target
|
||||
* @param {Date} value
|
||||
*/
|
||||
function setDatetimepickerValue($target, value) {
|
||||
function setDateTimePickerValue($target, value) {
|
||||
if (!$target?.length) {
|
||||
throw new Error('Empty $target argument provided.');
|
||||
}
|
||||
|
@ -253,12 +253,12 @@ window.App.Utils.UI = (function () {
|
|||
}
|
||||
|
||||
return {
|
||||
initializeDatetimepicker,
|
||||
initializeDatepicker,
|
||||
initializeTimepicker,
|
||||
initializeDateTimePicker,
|
||||
initializeDatePicker,
|
||||
initializeTimePicker,
|
||||
initializeDropdown,
|
||||
initializeTextEditor,
|
||||
getDatetimepickerValue,
|
||||
setDatetimepickerValue,
|
||||
getDateTimePickerValue,
|
||||
setDateTimePickerValue,
|
||||
};
|
||||
})();
|
||||
|
|
|
@ -480,7 +480,7 @@ App.Utils.WorkingPlan = (function () {
|
|||
|
||||
$tr.children().trigger('edit');
|
||||
|
||||
App.Utils.UI.initializeTimepicker($tr.find('.break-start input, .break-end input'));
|
||||
App.Utils.UI.initializeTimePicker($tr.find('.break-start input, .break-end input'));
|
||||
|
||||
$tr.find('.break-day select').focus();
|
||||
|
||||
|
@ -686,7 +686,7 @@ App.Utils.WorkingPlan = (function () {
|
|||
disabled = disabled || false;
|
||||
|
||||
if (disabled === false) {
|
||||
App.Utils.UI.initializeTimepicker($('.working-plan input:text'), {
|
||||
App.Utils.UI.initializeTimePicker($('.working-plan input:text'), {
|
||||
onChange: (selectedDates, dateStr, instance) => {
|
||||
const startMoment = moment(selectedDates[0]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue