mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 16:02:54 +03:00
Added dynamic date format support into all the backend/calendar occurences.
This commit is contained in:
parent
e7b9b80264
commit
896260838a
1 changed files with 32 additions and 15 deletions
|
@ -618,8 +618,8 @@ var BackendCalendar = {
|
||||||
$('#manage-unavailable #save-unavailable').click(function() {
|
$('#manage-unavailable #save-unavailable').click(function() {
|
||||||
var $dialog = $('#manage-unavailable');
|
var $dialog = $('#manage-unavailable');
|
||||||
|
|
||||||
var start = Date.parseExact($dialog.find('#unavailable-start').val(), 'dd/MM/yyyy HH:mm');
|
var start = $dialog.find('#unavailable-start').datetimepicker('getDate');
|
||||||
var end = Date.parseExact($dialog.find('#unavailable-end').val(), 'dd/MM/yyyy HH:mm');
|
var end = $dialog.find('#unavailable-end').datetimepicker('getDate');
|
||||||
|
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
// Start time is after end time - display message to user.
|
// Start time is after end time - display message to user.
|
||||||
|
@ -836,7 +836,7 @@ var BackendCalendar = {
|
||||||
start.addHours(1).set({ 'minute': 0 });
|
start.addHours(1).set({ 'minute': 0 });
|
||||||
|
|
||||||
$dialog.find('#start-datetime').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true));
|
$dialog.find('#start-datetime').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true));
|
||||||
$dialog.find('#end-datetime').val(GeneralFunctions.formatDate(start.addMinutes(serviceDuration),
|
$dialog.find('#end-datetime').val(GeneralFunctions.formatDate(start.addMinutes(serviceDuration),
|
||||||
GlobalVariables.dateFormat, true));
|
GlobalVariables.dateFormat, true));
|
||||||
|
|
||||||
// Display modal form.
|
// Display modal form.
|
||||||
|
@ -867,9 +867,8 @@ var BackendCalendar = {
|
||||||
else
|
else
|
||||||
start.addHours(1).set({ 'minute': 0 });
|
start.addHours(1).set({ 'minute': 0 });
|
||||||
|
|
||||||
$dialog.find('#unavailable-start').val(start.toString('dd/MM/yyyy HH:mm'));
|
$dialog.find('#unavailable-start').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true));
|
||||||
$dialog.find('#unavailable-end').val(start.addHours(1).toString('dd/MM/yyyy HH:mm'));
|
$dialog.find('#unavailable-end').val(GeneralFunctions.formatDate(start.addHours(1), GlobalVariables.dateFormat, true));
|
||||||
|
|
||||||
$dialog.find('.modal-header h3').text(EALang['new_unavailable_title']);
|
$dialog.find('.modal-header h3').text(EALang['new_unavailable_title']);
|
||||||
$dialog.modal('show');
|
$dialog.modal('show');
|
||||||
});
|
});
|
||||||
|
@ -1569,10 +1568,10 @@ var BackendCalendar = {
|
||||||
+ '.popover-content button {margin-right: 10px;}'
|
+ '.popover-content button {margin-right: 10px;}'
|
||||||
+ '</style>' +
|
+ '</style>' +
|
||||||
'<strong>' + EALang['start'] + '</strong> '
|
'<strong>' + EALang['start'] + '</strong> '
|
||||||
+ event.start.toString('dd/MM/yyyy HH:mm')
|
+ GeneralFunctions.formatDate(event.start, GlobalVariables.dateFormat, true)
|
||||||
+ '<br>' +
|
+ '<br>' +
|
||||||
'<strong>' + EALang['end'] + '</strong> '
|
'<strong>' + EALang['end'] + '</strong> '
|
||||||
+ event.end.toString('dd/MM/yyyy HH:mm')
|
+ GeneralFunctions.formatDate(event.end, GlobalVariables.dateFormat, true)
|
||||||
+ '<br>'
|
+ '<br>'
|
||||||
+ notes
|
+ notes
|
||||||
+ '<hr>' +
|
+ '<hr>' +
|
||||||
|
@ -1593,10 +1592,10 @@ var BackendCalendar = {
|
||||||
+ '.popover-content button {margin-right: 10px;}'
|
+ '.popover-content button {margin-right: 10px;}'
|
||||||
+ '</style>' +
|
+ '</style>' +
|
||||||
'<strong>' + EALang['start'] + '</strong> '
|
'<strong>' + EALang['start'] + '</strong> '
|
||||||
+ event.start.toString('dd/MM/yyyy HH:mm')
|
+ GeneralFunctions.formatDate(event.start, GlobalVariables.dateFormat, true)
|
||||||
+ '<br>' +
|
+ '<br>' +
|
||||||
'<strong>' + EALang['end'] + '</strong> '
|
'<strong>' + EALang['end'] + '</strong> '
|
||||||
+ event.end.toString('dd/MM/yyyy HH:mm')
|
+ GeneralFunctions.formatDate(event.end, GlobalVariables.dateFormat, true)
|
||||||
+ '<br>' +
|
+ '<br>' +
|
||||||
'<strong>' + EALang['service'] + '</strong> '
|
'<strong>' + EALang['service'] + '</strong> '
|
||||||
+ event.data['service']['name']
|
+ event.data['service']['name']
|
||||||
|
@ -1931,7 +1930,8 @@ var BackendCalendar = {
|
||||||
}
|
}
|
||||||
|
|
||||||
$dialog.find('#start-datetime').datetimepicker({
|
$dialog.find('#start-datetime').datetimepicker({
|
||||||
'dateFormat': dateFormat,
|
dateFormat: dateFormat,
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
||||||
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
||||||
|
@ -1960,6 +1960,7 @@ var BackendCalendar = {
|
||||||
|
|
||||||
$dialog.find('#end-datetime').datetimepicker({
|
$dialog.find('#end-datetime').datetimepicker({
|
||||||
'dateFormat': dateFormat,
|
'dateFormat': dateFormat,
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
||||||
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
||||||
|
@ -2045,11 +2046,26 @@ var BackendCalendar = {
|
||||||
$dialog.find('#unavailable-id').val('');
|
$dialog.find('#unavailable-id').val('');
|
||||||
|
|
||||||
// Set default time values
|
// Set default time values
|
||||||
var start = new Date().toString('dd/MM/yyyy HH:mm');
|
var start = GeneralFunctions.formatDate(new Date(), GlobalVariables.dateFormat, true),
|
||||||
var end = new Date().addHours(1).toString('dd/MM/yyyy HH:mm');
|
end = GeneralFunctions.formatDate(new Date().addHours(1), GlobalVariables.dateFormat, true),
|
||||||
|
dateFormat;
|
||||||
|
|
||||||
|
switch(GlobalVariables.dateFormat) {
|
||||||
|
case 'DMY':
|
||||||
|
dateFormat = 'dd/mm/yy';
|
||||||
|
break;
|
||||||
|
case 'MDY':
|
||||||
|
dateFormat = 'mm/dd/yy';
|
||||||
|
break;
|
||||||
|
case 'YMD':
|
||||||
|
dateFormat = 'yy/mm/dd';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$dialog.find('#unavailable-start').datetimepicker({
|
$dialog.find('#unavailable-start').datetimepicker({
|
||||||
'dateFormat': 'dd/mm/yy',
|
dateFormat: dateFormat,
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
||||||
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
||||||
|
@ -2077,7 +2093,8 @@ var BackendCalendar = {
|
||||||
$dialog.find('#unavailable-start').val(start);
|
$dialog.find('#unavailable-start').val(start);
|
||||||
|
|
||||||
$dialog.find('#unavailable-end').datetimepicker({
|
$dialog.find('#unavailable-end').datetimepicker({
|
||||||
'dateFormat': 'dd/mm/yy',
|
dateFormat: dateFormat,
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
dayNames: [EALang['sunday'], EALang['monday'], EALang['tuesday'], EALang['wednesday'],
|
||||||
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
EALang['thursday'], EALang['friday'], EALang['saturday']],
|
||||||
|
|
Loading…
Reference in a new issue