Merge branch 'enddatetime-according-to-start-and-service' of https://github.com/Caine85/easyappointments into Caine85-enddatetime-according-to-start-and-service

# Conflicts:
#	src/assets/js/backend_calendar_appointments_modal.js
This commit is contained in:
Alex Tselegidis 2020-03-10 20:44:51 +01:00
commit 6b86d357ef

View file

@ -427,7 +427,19 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
timeText: EALang.time,
hourText: EALang.hour,
minuteText: EALang.minutes,
firstDay: fDaynum
firstDay: fDaynum,
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);
@ -515,4 +527,4 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
_bindEventHandlers();
};
})(window.BackendCalendarAppointmentsModal);
})(window.BackendCalendarAppointmentsModal);