end-datetime accordingly with start and service

New feature

I have updated Easy!Appointments to ensure that when #start-datetime DateTimePicker closes, it also updates the #end-datetime field according to the selected service.

Have a nice day!
This commit is contained in:
Caine85 2018-11-07 17:24:08 +01:00 committed by GitHub
parent 11303acb55
commit e39928627c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -423,7 +423,19 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
timeText: EALang.time,
hourText: EALang.hour,
minuteText: EALang.minutes,
firstDay: 0
firstDay: 0,
onClose: function () {
var sid = $('#select-service').val();
// Automatically update the #end-datetime DateTimePicker based on service duration.
$.each(GlobalVariables.availableServices, function (indexService, service) {
if (service.id == sid) {
var start = $('#start-datetime').datetimepicker('getDate');
$('#end-datetime').datetimepicker('setDate', new Date(start.getTime() + service.duration * 60000));
return false; // break loop
}
});
}
});
$dialog.find('#start-datetime').datetimepicker('setDate', startDatetime);