Sfoglia il codice sorgente

Transactions fully updated to a working state

Lee Morgan 5 anni fa
parent
commit
0d6decbf1a

+ 8 - 1
views/dashboardPage/bundle.js

@@ -407,13 +407,17 @@ class Merchant{
     }
 
     getTransactions(from = 0, to = new Date()){
+        if(merchant._transactions.length <= 0){
+            return [];
+        }
+
         if(from === 0){
             from = this._transactions[this._transactions.length-1].date;
         }
 
         const {start, end} = this.getTransactionIndices(from, to);
 
-        return this._transactions.slice(start, end);
+        return this._transactions.slice(start, end + 1);
     }
 
     addTransaction(transaction){
@@ -3609,10 +3613,13 @@ let transactionDetails = {
                     banner.createError(response);
                 }else{
                     merchant.removeTransaction(this.transaction);
+
+                    controller.openStrand("transactions");
                     banner.createNotification("TRANSACTION REMOVED");
                 }
             })
             .catch((err)=>{
+                console.log(err);
                 banner.createError("SOMETHING WENT WRONG. PLEASE REFRESH THE PAGE");
             })
             .finally(()=>{

+ 5 - 1
views/dashboardPage/js/Merchant.js

@@ -280,13 +280,17 @@ class Merchant{
     }
 
     getTransactions(from = 0, to = new Date()){
+        if(merchant._transactions.length <= 0){
+            return [];
+        }
+
         if(from === 0){
             from = this._transactions[this._transactions.length-1].date;
         }
 
         const {start, end} = this.getTransactionIndices(from, to);
 
-        return this._transactions.slice(start, end);
+        return this._transactions.slice(start, end + 1);
     }
 
     addTransaction(transaction){

+ 3 - 0
views/dashboardPage/js/transactionDetails.js

@@ -56,10 +56,13 @@ let transactionDetails = {
                     banner.createError(response);
                 }else{
                     merchant.removeTransaction(this.transaction);
+
+                    controller.openStrand("transactions");
                     banner.createNotification("TRANSACTION REMOVED");
                 }
             })
             .catch((err)=>{
+                console.log(err);
                 banner.createError("SOMETHING WENT WRONG. PLEASE REFRESH THE PAGE");
             })
             .finally(()=>{