mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on time tracker
This commit is contained in:
parent
4e70e7694e
commit
49ab730b8e
@ -245,7 +245,14 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.submitBulkAction = function(data, cb) {
|
self.submitBulkAction = function(action, task) {
|
||||||
|
if (! task || ! action) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var data = {
|
||||||
|
id: task.public_id(),
|
||||||
|
action: action,
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
@ -256,18 +263,20 @@
|
|||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
cb();
|
if (action == 'archive' || action == 'delete') {
|
||||||
|
self.removeTask(task);
|
||||||
|
self.selectTask(false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.onDeleteClick = function() {
|
self.onDeleteClick = function() {
|
||||||
sweetConfirm(function() {
|
sweetConfirm(function() {
|
||||||
|
self.submitBulkAction('delete', self.selectedTask());
|
||||||
}, "{{ trans('texts.delete_task') }}");
|
}, "{{ trans('texts.delete_task') }}");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -275,20 +284,7 @@
|
|||||||
|
|
||||||
self.onArchiveClick = function() {
|
self.onArchiveClick = function() {
|
||||||
sweetConfirm(function() {
|
sweetConfirm(function() {
|
||||||
var task = self.selectedTask();
|
self.submitBulkAction('archive', self.selectedTask());
|
||||||
if (! task) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var data = {
|
|
||||||
id: task.public_id(),
|
|
||||||
action: 'archive',
|
|
||||||
}
|
|
||||||
self.submitBulkAction(data, function() {
|
|
||||||
console.log('removing: ' + task);
|
|
||||||
var task = self.selectedTask();
|
|
||||||
self.removeTask(task);
|
|
||||||
self.selectTask(false);
|
|
||||||
});
|
|
||||||
}, "{{ trans('texts.archive_task') }}");
|
}, "{{ trans('texts.archive_task') }}");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user