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) {
|
$(document).on('click', '.cancel-break', function(e) {
|
||||||
var element = e.target;
|
var element = e.target;
|
||||||
|
var $modifiedRow = $(element).closest('tr');
|
||||||
this.enableCancel = true;
|
this.enableCancel = true;
|
||||||
$(element).parent().parent().find('.cancel-editable').trigger('click');
|
$modifiedRow.find('.cancel-editable').trigger('click');
|
||||||
this.enableCancel = false;
|
this.enableCancel = false;
|
||||||
|
|
||||||
$(element).closest('table').find('.edit-break, .delete-break').removeClass('hidden');
|
$(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);
|
$('.add-break').prop('disabled', false);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
@ -287,17 +288,19 @@
|
||||||
$(document).on('click', '.save-break', function(e) {
|
$(document).on('click', '.save-break', function(e) {
|
||||||
// Break's start time must always be prior to break's end.
|
// Break's start time must always be prior to break's end.
|
||||||
var element = e.target,
|
var element = e.target,
|
||||||
start = Date.parse($(element).parent().parent().find('.break-start input').val()),
|
$modifiedRow = $(element).closest('tr'),
|
||||||
end = Date.parse($(element).parent().parent().find('.break-end input').val());
|
start = Date.parse($modifiedRow.find('.break-start input').val()),
|
||||||
|
end = Date.parse($modifiedRow.find('.break-end input').val());
|
||||||
|
|
||||||
if (start > end) {
|
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;
|
this.enableSubmit = true;
|
||||||
$(element).parent().parent().find('.editable .submit-editable').trigger('click');
|
$modifiedRow.find('.editable .submit-editable').trigger('click');
|
||||||
this.enableSubmit = false;
|
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');
|
$(element).closest('table').find('.edit-break, .delete-break').removeClass('hidden');
|
||||||
$('.add-break').prop('disabled', false);
|
$('.add-break').prop('disabled', false);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -329,6 +332,11 @@
|
||||||
'end': end
|
'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));
|
}.bind(this));
|
||||||
} else {
|
} else {
|
||||||
workingPlan[id] = null;
|
workingPlan[id] = null;
|
||||||
|
|
Loading…
Reference in a new issue