mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-25 17:33:19 +03:00
Default values in the appointment modal, when inserting a new appointment from the table view
This commit is contained in:
parent
3944309b0c
commit
23ac39797b
1 changed files with 12 additions and 4 deletions
|
@ -133,9 +133,13 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
$dialog.find('#select-service').val(providers[0].services[0]).trigger('change');
|
$dialog.find('#select-service').val(providers[0].services[0]).trigger('change');
|
||||||
$dialog.find('#select-provider').val(providerId);
|
$dialog.find('#select-provider').val(providerId);
|
||||||
}
|
}
|
||||||
|
} else if ($('#select-filter-item option:selected').attr('type') === 'service') {
|
||||||
|
$dialog.find('#select-service option[value="' + $('#select-filter-item').val() + '"]')
|
||||||
|
.prop('selected', true);
|
||||||
} else {
|
} else {
|
||||||
$dialog.find('#select-service option[value="'
|
$dialog.find('#select-service option:first')
|
||||||
+ $('#select-filter-item').val() + '"]').prop('selected', true);
|
.prop('selected', true)
|
||||||
|
.trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
var serviceId = $dialog.find('#select-service').val();
|
var serviceId = $dialog.find('#select-service').val();
|
||||||
|
@ -144,6 +148,8 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
return Number(availableService.id) === Number(serviceId);
|
return Number(availableService.id) === Number(serviceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var duration = service ? service.duration : 60;
|
||||||
|
|
||||||
var start = new Date();
|
var start = new Date();
|
||||||
var currentMin = parseInt(start.toString('mm'));
|
var currentMin = parseInt(start.toString('mm'));
|
||||||
|
|
||||||
|
@ -158,7 +164,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
}
|
}
|
||||||
|
|
||||||
$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(service.duration),
|
$dialog.find('#end-datetime').val(GeneralFunctions.formatDate(start.addMinutes(duration),
|
||||||
GlobalVariables.dateFormat, true));
|
GlobalVariables.dateFormat, true));
|
||||||
|
|
||||||
// Display modal form.
|
// Display modal form.
|
||||||
|
@ -293,8 +299,10 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
return Number(availableService.id) === Number(serviceId);
|
return Number(availableService.id) === Number(serviceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var duration = service ? service.duration : 60;
|
||||||
|
|
||||||
var start = $('#start-datetime').datetimepicker('getDate');
|
var start = $('#start-datetime').datetimepicker('getDate');
|
||||||
$('#end-datetime').datetimepicker('setDate', new Date(start.getTime() + service.duration * 60000));
|
$('#end-datetime').datetimepicker('setDate', new Date(start.getTime() + duration * 60000));
|
||||||
|
|
||||||
// Update the providers select box.
|
// Update the providers select box.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue