diff --git a/accountant/frontend/static/js/entries.js b/accountant/frontend/static/js/entries.js index bd1381c..038d6a9 100644 --- a/accountant/frontend/static/js/entries.js +++ b/accountant/frontend/static/js/entries.js @@ -333,56 +333,11 @@ accountantApp }); }; - // Returns the CSS class for an entry row. - $scope.entryRowClass = function(entry) { - if($scope.isSaved(entry)) { - cssclass=""; - } else { - cssclass="italic"; - } - - if(entry.canceled) { - cssclass += " stroke"; - } - - if(entry.sold < $scope.account.authorized_overdraft) { - cssclass += " danger"; - } else if (entry.sold < 0) { - cssclass += " warning"; - } - - return cssclass; - }; - - // Returns the CSS class for an entry sold. - $scope.entryValueClass = function(sold) { - if(sold && sold < $scope.account.authorized_overdraft) { - return 'text-danger'; - } else if (sold && sold < 0) { - return 'text-warning'; - } - }; - // Starts editing an entry $scope.editEntry = function(entry) { // Enter edit state. entry.confirmed=true; - entry.state='edit'; - }; - - // Returns true if the entry is in editing state. - $scope.isEditing = function(entry) { - return entry.state === 'edit'; - }; - - // Returns true if the entry is in displaying state. - $scope.isDisplaying = function(entry) { - return !entry.state || entry.state === 'display'; - }; - - // Returns true if the entry is a scheduled one. - $scope.isSaved = function(entry) { - return entry.confirmed; + entry.editing=true; }; // Cancel current editing entry or clears field if a new one. @@ -394,7 +349,7 @@ accountantApp }; // Points an entry. - $scope.pointEntry = function(entry) { + $scope.togglePointedEntry = function(entry) { entry.confirmed = true; entry.pointed = !entry.pointed; @@ -408,6 +363,13 @@ accountantApp $scope.saveEntry(entry); }; + // Confirm an entry. + $scope.toggleCanceledEntry = function(entry) { + entry.canceled = !entry.canceled; + + $scope.saveEntry(entry); + }; + // Create an new entry. $scope.createEntry = function(entry) { entry.account_id = $scope.account.id; diff --git a/accountant/frontend/static/templates/entries.html b/accountant/frontend/static/templates/entries.html index 5caf851..e69f2cc 100644 --- a/accountant/frontend/static/templates/entries.html +++ b/accountant/frontend/static/templates/entries.html @@ -71,14 +71,14 @@ @@ -86,8 +86,8 @@