Comments.
This commit is contained in:
@ -74,6 +74,7 @@ accountantApp
|
||||
});
|
||||
};
|
||||
|
||||
// Notify on success.
|
||||
$scope.$on("operationCreatedEvent", function(e, operation) {
|
||||
new PNotify({
|
||||
type: "success",
|
||||
@ -82,12 +83,14 @@ accountantApp
|
||||
});
|
||||
});
|
||||
|
||||
// Save operation.
|
||||
$scope.saveOperation = function(operation) {
|
||||
operation.$save(function(data) {
|
||||
$scope.$emit("operationSavedEvent", operation);
|
||||
});
|
||||
};
|
||||
|
||||
// Notify on success.
|
||||
$scope.$on("operationSavedEvent", function(e, operation) {
|
||||
new PNotify({
|
||||
type: "success",
|
||||
@ -101,36 +104,28 @@ accountantApp
|
||||
operation.state='edit';
|
||||
};
|
||||
|
||||
// Reload operation from server to cancel edition.
|
||||
$scope.cancelEditOperation = function(operation) {
|
||||
operation.$get();
|
||||
};
|
||||
|
||||
// Remove an operation.
|
||||
$scope.removeOperation = function(operation, modalScope) {
|
||||
// Cancel current editing.
|
||||
if (!$scope.isNew(operation)) {
|
||||
$http.delete("/api/scheduled_operations/" + operation.id).success(function (result) {
|
||||
$.pnotify({
|
||||
operation.$delete(function(data) {
|
||||
new PNotify({
|
||||
type: "success",
|
||||
title: "Delete",
|
||||
text: result
|
||||
text: "Operation #" + operation.id + " deleted."
|
||||
});
|
||||
|
||||
// Send the "entry removed" event.
|
||||
$scope.$emit("operationRemovedEvent", operation);
|
||||
|
||||
$scope.closeModal(modalScope);
|
||||
}).error(function (data) {
|
||||
$.pnotify({
|
||||
type: "error",
|
||||
title: "Delete",
|
||||
text: data
|
||||
});
|
||||
|
||||
$scope.closeModal(modalScope);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Close modal.
|
||||
$scope.closeModal = function(modalScope) {
|
||||
// Close the modal dialog
|
||||
if(modalScope && modalScope.dismiss) {
|
||||
@ -138,9 +133,12 @@ accountantApp
|
||||
}
|
||||
};
|
||||
|
||||
// Load operations on account selection.
|
||||
// FIXME Alexis Lahouze 2015-07-15 Deprecated.
|
||||
$rootScope.$on("accountSelectedEvent", function(event, args){
|
||||
$scope.loadOperations(args.account.id);
|
||||
});
|
||||
|
||||
// Load operations on controller initialization.
|
||||
$scope.loadOperations($routeParams.accountId);
|
||||
}]);
|
||||
|
Reference in New Issue
Block a user