diff --git a/src/assets/js/backend_calendar_appointments_modal.js b/src/assets/js/backend_calendar_appointments_modal.js index 927ac4d1..2da125f1 100644 --- a/src/assets/js/backend_calendar_appointments_modal.js +++ b/src/assets/js/backend_calendar_appointments_modal.js @@ -389,6 +389,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa $dialog.find('#start-datetime').datetimepicker({ dateFormat: dateFormat, + timeFormat: 'h:mm TT', // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, @@ -418,6 +419,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa $dialog.find('#end-datetime').datetimepicker({ dateFormat: dateFormat, + timeFormat: 'h:mm TT', // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, diff --git a/src/assets/js/backend_calendar_default_view.js b/src/assets/js/backend_calendar_default_view.js index fb4cad0b..12ce62b3 100644 --- a/src/assets/js/backend_calendar_default_view.js +++ b/src/assets/js/backend_calendar_default_view.js @@ -1052,7 +1052,8 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; editable: true, firstDay: 1, // Monday snapDuration: '00:15:00', - timeFormat: 'HH:mm', + timeFormat: 'h:mm A', + slotLabelFormat : 'h(:mm) A', allDayText: EALang.all_day, columnFormat: columnFormat, titleFormat: 'MMMM YYYY', diff --git a/src/assets/js/backend_calendar_table_view.js b/src/assets/js/backend_calendar_table_view.js index 166b7415..0fc41783 100644 --- a/src/assets/js/backend_calendar_table_view.js +++ b/src/assets/js/backend_calendar_table_view.js @@ -686,7 +686,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $event.html( appointment.customer.first_name.charAt(0) + '. ' + appointment.customer.last_name + - ' ' + startDate.toString('HH:mm') + ' ' + ' ' + startDate.toString('h:mm tt') + ' ' + (eventDuration !== parseInt(appointment.service.duration) ? '(' + eventDuration + '\')' : '') ); @@ -708,7 +708,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $event.appendTo($(tr).prev().find('td').eq(cellIndex)); // Remove the hour from the event if it is the same as the row. - if (eventDate.toString('HH:mm') === $(tr).prev().find('td').eq(0).text()) { + if (eventDate.toString('h:mm tt') === $(tr).prev().find('td').eq(0).text()) { $event.find('.hour').remove(); } @@ -747,7 +747,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; var $event = $('
'); $event.html((unavailability.notes || EALang.unavailable) + - ' ' + eventDate.toString('HH:mm') + ' (' + eventDuration + '\')'); + ' ' + eventDate.toString('h:mm tt') + ' (' + eventDuration + '\')'); $event.data(unavailability); @@ -763,7 +763,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $event.appendTo($(tr).prev().find('td').eq(1)); // Remove the hour from the event if it is the same as the row. - if (eventDate.toString('HH:mm') === $(tr).prev().find('td').eq(0).text()) { + if (eventDate.toString('h:mm tt') === $(tr).prev().find('td').eq(0).text()) { $event.find('.hour').remove(); } @@ -798,7 +798,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $event.html( EALang.break + - ' ' + eventDate.toString('HH:mm') + ' (' + eventDuration + '\')'); + ' ' + eventDate.toString('h:mm tt') + ' (' + eventDuration + '\')'); $event.data(entry); @@ -812,7 +812,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; if (eventDate < cellDate) { // Remove the hour from the event if it is the same as the row. - if (eventDate.toString('HH:mm') === $(tr).prev().find('td').eq(0).text()) { + if (eventDate.toString('h:mm tt') === $(tr).prev().find('td').eq(0).text()) { $event.find('.hour').remove(); } diff --git a/src/assets/js/backend_calendar_unavailabilities_modal.js b/src/assets/js/backend_calendar_unavailabilities_modal.js index 1673fd9b..5b15264c 100644 --- a/src/assets/js/backend_calendar_unavailabilities_modal.js +++ b/src/assets/js/backend_calendar_unavailabilities_modal.js @@ -179,6 +179,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili $dialog.find('#unavailable-start').datetimepicker({ dateFormat: dateFormat, + timeFormat: 'h:mm TT', // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, @@ -208,6 +209,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili $dialog.find('#unavailable-end').datetimepicker({ dateFormat: dateFormat, + timeFormat: 'h:mm TT', // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, @@ -237,7 +239,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili // Clear the unavailable notes field. $dialog.find('#unavailable-notes').val(''); - } + }; exports.initialize = function() { var $unavailabilityProvider = $('#unavailable-provider'); diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index 2b2634d2..4003dbca 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -380,6 +380,10 @@ window.FrontendBook = window.FrontendBook || {}; * customer settings and input for the appointment booking. */ exports.updateConfirmFrame = function() { + if ($('.selected-hour').text() === '') { + return; + } + // Appointment Details var selectedDate = $('#select-date').datepicker('getDate'); @@ -452,7 +456,7 @@ window.FrontendBook = window.FrontendBook || {}; postData['appointment'] = { start_datetime: $('#select-date').datepicker('getDate').toString('yyyy-MM-dd') - + ' ' + $('.selected-hour').text() + ':00', + + ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm') + ':00', end_datetime: _calcEndDatetime(), notes: $('#notes').val(), is_unavailable: false, @@ -489,7 +493,7 @@ window.FrontendBook = window.FrontendBook || {}; // Add the duration to the start datetime. var startDatetime = $('#select-date').datepicker('getDate').toString('dd-MM-yyyy') - + ' ' + $('.selected-hour').text(); + + ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm'); startDatetime = Date.parseExact(startDatetime, 'dd-MM-yyyy HH:mm'); var endDatetime = undefined; diff --git a/src/assets/js/frontend_book_api.js b/src/assets/js/frontend_book_api.js index f9558611..857c9461 100644 --- a/src/assets/js/frontend_book_api.js +++ b/src/assets/js/frontend_book_api.js @@ -69,16 +69,16 @@ window.FrontendBookApi = window.FrontendBookApi || {}; // service. Fill the available hours div with response data. if (response.length > 0) { var currColumn = 1; - $('#available-hours').html(''); + $('#available-hours').html(''); $.each(response, function(index, availableHour) { if ((currColumn * 10) < (index + 1)) { currColumn++; - $('#available-hours').append(''); + $('#available-hours').append(''); } $('#available-hours div:eq(' + (currColumn - 1) + ')').append( - '' + availableHour + '