Corrected popover actions in both calendar view (#182).
This commit is contained in:
parent
2ac9384694
commit
6d074398d0
4 changed files with 44 additions and 11 deletions
|
@ -353,6 +353,15 @@
|
|||
<form class="form-horizontal">
|
||||
<fieldset>
|
||||
<input id="unavailable-id" type="hidden" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="unavailable-provider" class="control-label col-sm-3">
|
||||
<?php echo $this->lang->line('provider'); ?>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<select type="text" id="unavailable-provider" class="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="unavailable-start" class="control-label col-sm-3">
|
||||
|
|
|
@ -67,7 +67,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
|||
var appointment = lastFocusedEventData.data;
|
||||
$dialog = $('#manage-appointment');
|
||||
|
||||
_resetAppointmentDialog();
|
||||
BackendCalendarAppointmentsModal.resetAppointmentDialog();
|
||||
|
||||
// Apply appointment data and show modal dialog.
|
||||
$dialog.find('.modal-header h3').text(EALang['edit_appointment_title']);
|
||||
|
@ -103,12 +103,13 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
|||
unavailable.end_datetime = GeneralFunctions.clone(lastFocusedEventData.end);
|
||||
|
||||
$dialog = $('#manage-unavailable');
|
||||
_resetUnavailableDialog();
|
||||
BackendCalendarUnavailabilitiesModal.resetUnavailableDialog();
|
||||
|
||||
// Apply unvailable data to dialog.
|
||||
$dialog.find('.modal-header h3').text('Edit Unavailable Period');
|
||||
$dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime);
|
||||
$dialog.find('#unavailable-id').val(unavailable.id);
|
||||
$dialog.find('#unavailable-provider').val(unavailable.id_users_provider);
|
||||
$dialog.find('#unavailable-end').datetimepicker('setDate', unavailable.end_datetime);
|
||||
$dialog.find('#unavailable-notes').val(unavailable.notes);
|
||||
}
|
||||
|
@ -334,7 +335,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
|||
title: event.title,
|
||||
content: html,
|
||||
html: true,
|
||||
container: 'body',
|
||||
container: '#calendar',
|
||||
trigger: 'manual'
|
||||
});
|
||||
|
||||
|
@ -1138,7 +1139,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
|||
if (GlobalVariables.editAppointment != null) {
|
||||
var $dialog = $('#manage-appointment');
|
||||
var appointment = GlobalVariables.editAppointment;
|
||||
_resetAppointmentDialog();
|
||||
BackendCalendarAppointmentsModal.resetAppointmentDialog();
|
||||
|
||||
$dialog.find('.modal-header h3').text(EALang['edit_appointment_title']);
|
||||
$dialog.find('#appointment-id').val(appointment['id']);
|
||||
|
|
|
@ -134,9 +134,12 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
|
|||
'</center>';
|
||||
}
|
||||
|
||||
var title = entry.is_unavailable ? EALang['unavailable'] : entry.service.name + ' - '
|
||||
+ entry.customer.first_name + ' ' + entry.customer.last_name;
|
||||
|
||||
$(event.target).popover({
|
||||
placement: 'top',
|
||||
title: entry.service.name + ' - ' + entry.customer.first_name + ' ' + entry.customer.last_name,
|
||||
title: title,
|
||||
content: html,
|
||||
html: true,
|
||||
container: '#calendar',
|
||||
|
@ -206,19 +209,20 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
|
|||
$dialog.find('#appointment-notes').val(appointment['notes']);
|
||||
$dialog.find('#customer-notes').val(customer['notes']);
|
||||
} else {
|
||||
var unavailable = lastFocusedEventData.data;
|
||||
var unavailable = lastFocusedEventData;
|
||||
|
||||
// Replace string date values with actual date objects.
|
||||
unavailable.start_datetime = GeneralFunctions.clone(lastFocusedEventData.start_datetime);
|
||||
unavailable.end_datetime = GeneralFunctions.clone(lastFocusedEventData.end_datetime);
|
||||
unavailable.start_datetime = Date.parse(lastFocusedEventData.start_datetime);
|
||||
unavailable.end_datetime = Date.parse(lastFocusedEventData.end_datetime);
|
||||
|
||||
$dialog = $('#manage-unavailable');
|
||||
BackendCalendarUnavailbilities.resetUnavailableDialog();
|
||||
BackendCalendarUnavailabilitiesModal.resetUnavailableDialog();
|
||||
|
||||
// Apply unvailable data to dialog.
|
||||
$dialog.find('.modal-header h3').text('Edit Unavailable Period');
|
||||
$dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime);
|
||||
$dialog.find('#unavailable-id').val(unavailable.id);
|
||||
$dialog.find('#unavailable-provider').val(unavailable.id_users_provider);
|
||||
$dialog.find('#unavailable-end').datetimepicker('setDate', unavailable.end_datetime);
|
||||
$dialog.find('#unavailable-notes').val(unavailable.notes);
|
||||
}
|
||||
|
@ -538,6 +542,11 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
|
|||
function _setCalendarSize() {
|
||||
var height = window.innerHeight - $('#header').outerHeight() - $('#footer').outerHeight()
|
||||
- $('#calendar-toolbar').outerHeight() - $('.calendar-header').outerHeight() - 50;
|
||||
|
||||
if (height < 500) {
|
||||
height = 500;
|
||||
}
|
||||
|
||||
$('.calendar-view').height(height);
|
||||
|
||||
$('.calendar-view > div').css('min-width', '1000%');
|
||||
|
|
|
@ -47,7 +47,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
|||
start_datetime: start.toString('yyyy-MM-dd HH:mm'),
|
||||
end_datetime: end.toString('yyyy-MM-dd HH:mm'),
|
||||
notes: $dialog.find('#unavailable-notes').val(),
|
||||
id_users_provider: $('#select-filter-item').val() // curr provider
|
||||
id_users_provider: $('#unavailable-provider').val() // curr provider
|
||||
};
|
||||
|
||||
if ($dialog.find('#unavailable-id').val() !== '') {
|
||||
|
@ -118,7 +118,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
|||
* he cannot accept any appointments.
|
||||
*/
|
||||
$('#insert-unavailable').click(function() {
|
||||
BackendCalendarUnavailbilities.resetUnavailableDialog();
|
||||
BackendCalendarUnavailabilitiesModal.resetUnavailableDialog();
|
||||
var $dialog = $('#manage-unavailable');
|
||||
|
||||
// Set the default datetime values.
|
||||
|
@ -135,6 +135,12 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
|||
start.addHours(1).set({ 'minute': 0 });
|
||||
}
|
||||
|
||||
if ($('.calendar-view').length === 0) {
|
||||
$dialog.find('#unavailable-provider').val($('#select-filter-item').val())
|
||||
.parents('.form-group')
|
||||
.hide();
|
||||
}
|
||||
|
||||
$dialog.find('#unavailable-start').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true));
|
||||
$dialog.find('#unavailable-end').val(GeneralFunctions.formatDate(start.addHours(1), GlobalVariables.dateFormat, true));
|
||||
$dialog.find('.modal-header h3').text(EALang['new_unavailable_title']);
|
||||
|
@ -234,6 +240,14 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
|||
}
|
||||
|
||||
exports.initialize = function() {
|
||||
var $unavailabilityProvider = $('#unavailable-provider');
|
||||
|
||||
for (var index in GlobalVariables.availableProviders) {
|
||||
var provider = GlobalVariables.availableProviders[index];
|
||||
|
||||
$unavailabilityProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
|
||||
}
|
||||
|
||||
_bindEventHandlers();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue