Corrected popover actions in both calendar view (#182).

This commit is contained in:
Alex Tselegidis 2016-07-18 22:55:05 +02:00
parent 2ac9384694
commit 6d074398d0
4 changed files with 44 additions and 11 deletions

View file

@ -354,6 +354,15 @@
<fieldset> <fieldset>
<input id="unavailable-id" type="hidden" /> <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"> <div class="form-group">
<label for="unavailable-start" class="control-label col-sm-3"> <label for="unavailable-start" class="control-label col-sm-3">
<?php echo $this->lang->line('start'); ?> <?php echo $this->lang->line('start'); ?>

View file

@ -67,7 +67,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
var appointment = lastFocusedEventData.data; var appointment = lastFocusedEventData.data;
$dialog = $('#manage-appointment'); $dialog = $('#manage-appointment');
_resetAppointmentDialog(); BackendCalendarAppointmentsModal.resetAppointmentDialog();
// Apply appointment data and show modal dialog. // Apply appointment data and show modal dialog.
$dialog.find('.modal-header h3').text(EALang['edit_appointment_title']); $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); unavailable.end_datetime = GeneralFunctions.clone(lastFocusedEventData.end);
$dialog = $('#manage-unavailable'); $dialog = $('#manage-unavailable');
_resetUnavailableDialog(); BackendCalendarUnavailabilitiesModal.resetUnavailableDialog();
// Apply unvailable data to dialog. // Apply unvailable data to dialog.
$dialog.find('.modal-header h3').text('Edit Unavailable Period'); $dialog.find('.modal-header h3').text('Edit Unavailable Period');
$dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime); $dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime);
$dialog.find('#unavailable-id').val(unavailable.id); $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-end').datetimepicker('setDate', unavailable.end_datetime);
$dialog.find('#unavailable-notes').val(unavailable.notes); $dialog.find('#unavailable-notes').val(unavailable.notes);
} }
@ -334,7 +335,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
title: event.title, title: event.title,
content: html, content: html,
html: true, html: true,
container: 'body', container: '#calendar',
trigger: 'manual' trigger: 'manual'
}); });
@ -1138,7 +1139,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
if (GlobalVariables.editAppointment != null) { if (GlobalVariables.editAppointment != null) {
var $dialog = $('#manage-appointment'); var $dialog = $('#manage-appointment');
var appointment = GlobalVariables.editAppointment; var appointment = GlobalVariables.editAppointment;
_resetAppointmentDialog(); BackendCalendarAppointmentsModal.resetAppointmentDialog();
$dialog.find('.modal-header h3').text(EALang['edit_appointment_title']); $dialog.find('.modal-header h3').text(EALang['edit_appointment_title']);
$dialog.find('#appointment-id').val(appointment['id']); $dialog.find('#appointment-id').val(appointment['id']);

View file

@ -134,9 +134,12 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
'</center>'; '</center>';
} }
var title = entry.is_unavailable ? EALang['unavailable'] : entry.service.name + ' - '
+ entry.customer.first_name + ' ' + entry.customer.last_name;
$(event.target).popover({ $(event.target).popover({
placement: 'top', placement: 'top',
title: entry.service.name + ' - ' + entry.customer.first_name + ' ' + entry.customer.last_name, title: title,
content: html, content: html,
html: true, html: true,
container: '#calendar', container: '#calendar',
@ -206,19 +209,20 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
$dialog.find('#appointment-notes').val(appointment['notes']); $dialog.find('#appointment-notes').val(appointment['notes']);
$dialog.find('#customer-notes').val(customer['notes']); $dialog.find('#customer-notes').val(customer['notes']);
} else { } else {
var unavailable = lastFocusedEventData.data; var unavailable = lastFocusedEventData;
// Replace string date values with actual date objects. // Replace string date values with actual date objects.
unavailable.start_datetime = GeneralFunctions.clone(lastFocusedEventData.start_datetime); unavailable.start_datetime = Date.parse(lastFocusedEventData.start_datetime);
unavailable.end_datetime = GeneralFunctions.clone(lastFocusedEventData.end_datetime); unavailable.end_datetime = Date.parse(lastFocusedEventData.end_datetime);
$dialog = $('#manage-unavailable'); $dialog = $('#manage-unavailable');
BackendCalendarUnavailbilities.resetUnavailableDialog(); BackendCalendarUnavailabilitiesModal.resetUnavailableDialog();
// Apply unvailable data to dialog. // Apply unvailable data to dialog.
$dialog.find('.modal-header h3').text('Edit Unavailable Period'); $dialog.find('.modal-header h3').text('Edit Unavailable Period');
$dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime); $dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime);
$dialog.find('#unavailable-id').val(unavailable.id); $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-end').datetimepicker('setDate', unavailable.end_datetime);
$dialog.find('#unavailable-notes').val(unavailable.notes); $dialog.find('#unavailable-notes').val(unavailable.notes);
} }
@ -538,6 +542,11 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
function _setCalendarSize() { function _setCalendarSize() {
var height = window.innerHeight - $('#header').outerHeight() - $('#footer').outerHeight() var height = window.innerHeight - $('#header').outerHeight() - $('#footer').outerHeight()
- $('#calendar-toolbar').outerHeight() - $('.calendar-header').outerHeight() - 50; - $('#calendar-toolbar').outerHeight() - $('.calendar-header').outerHeight() - 50;
if (height < 500) {
height = 500;
}
$('.calendar-view').height(height); $('.calendar-view').height(height);
$('.calendar-view > div').css('min-width', '1000%'); $('.calendar-view > div').css('min-width', '1000%');

View file

@ -47,7 +47,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
start_datetime: start.toString('yyyy-MM-dd HH:mm'), start_datetime: start.toString('yyyy-MM-dd HH:mm'),
end_datetime: end.toString('yyyy-MM-dd HH:mm'), end_datetime: end.toString('yyyy-MM-dd HH:mm'),
notes: $dialog.find('#unavailable-notes').val(), 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() !== '') { if ($dialog.find('#unavailable-id').val() !== '') {
@ -118,7 +118,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
* he cannot accept any appointments. * he cannot accept any appointments.
*/ */
$('#insert-unavailable').click(function() { $('#insert-unavailable').click(function() {
BackendCalendarUnavailbilities.resetUnavailableDialog(); BackendCalendarUnavailabilitiesModal.resetUnavailableDialog();
var $dialog = $('#manage-unavailable'); var $dialog = $('#manage-unavailable');
// Set the default datetime values. // Set the default datetime values.
@ -135,6 +135,12 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
start.addHours(1).set({ 'minute': 0 }); 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-start').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true));
$dialog.find('#unavailable-end').val(GeneralFunctions.formatDate(start.addHours(1), 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']); $dialog.find('.modal-header h3').text(EALang['new_unavailable_title']);
@ -234,6 +240,14 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
} }
exports.initialize = function() { 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(); _bindEventHandlers();
}; };