mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-22 22:52:35 +03:00
Merge branch 'p0zi-develop' into develop
This commit is contained in:
commit
863a61886b
1 changed files with 15 additions and 7 deletions
|
@ -268,12 +268,13 @@
|
|||
*/
|
||||
$(document).on('click', '.cancel-break', function(e) {
|
||||
var element = e.target;
|
||||
var $modifiedRow = $(element).closest('tr');
|
||||
this.enableCancel = true;
|
||||
$(element).parent().parent().find('.cancel-editable').trigger('click');
|
||||
$modifiedRow.find('.cancel-editable').trigger('click');
|
||||
this.enableCancel = false;
|
||||
|
||||
$(element).closest('table').find('.edit-break, .delete-break').removeClass('hidden');
|
||||
$(element).parent().find('.save-break, .cancel-break').addClass('hidden');
|
||||
$modifiedRow.find('.save-break, .cancel-break').addClass('hidden');
|
||||
$('.add-break').prop('disabled', false);
|
||||
}.bind(this));
|
||||
|
||||
|
@ -287,17 +288,19 @@
|
|||
$(document).on('click', '.save-break', function(e) {
|
||||
// Break's start time must always be prior to break's end.
|
||||
var element = e.target,
|
||||
start = Date.parse($(element).parent().parent().find('.break-start input').val()),
|
||||
end = Date.parse($(element).parent().parent().find('.break-end input').val());
|
||||
$modifiedRow = $(element).closest('tr'),
|
||||
start = Date.parse($modifiedRow.find('.break-start input').val()),
|
||||
end = Date.parse($modifiedRow.find('.break-end input').val());
|
||||
|
||||
if (start > end) {
|
||||
$(element).parent().parent().find('.break-end input').val(start.addHours(1).toString('HH:mm'));
|
||||
$modifiedRow.find('.break-end input').val(start.addHours(1).toString('HH:mm'));
|
||||
}
|
||||
|
||||
this.enableSubmit = true;
|
||||
$(element).parent().parent().find('.editable .submit-editable').trigger('click');
|
||||
$modifiedRow.find('.editable .submit-editable').trigger('click');
|
||||
this.enableSubmit = false;
|
||||
|
||||
$(element).parent().find('.save-break, .cancel-break').addClass('hidden');
|
||||
$modifiedRow.find('.save-break, .cancel-break').addClass('hidden');
|
||||
$(element).closest('table').find('.edit-break, .delete-break').removeClass('hidden');
|
||||
$('.add-break').prop('disabled', false);
|
||||
}.bind(this));
|
||||
|
@ -329,6 +332,11 @@
|
|||
'end': end
|
||||
});
|
||||
}
|
||||
|
||||
workingPlan[id].breaks.sort(function(break1, break2) {
|
||||
// We can do a direct string comparison since we have time based on 24 hours clock
|
||||
return break1.start - break2.start;
|
||||
});
|
||||
}.bind(this));
|
||||
} else {
|
||||
workingPlan[id] = null;
|
||||
|
|
Loading…
Reference in a new issue