#84 refactor(front): moved to api purchases_for_reconciliation to.
This commit is contained in:
		| @@ -83,6 +83,7 @@ | |||||||
|   </v-container> |   </v-container> | ||||||
| </template> | </template> | ||||||
| <script> | <script> | ||||||
|  |   import { inject } from 'vue'; | ||||||
|   import CurrencyText from './CurrencyText.vue'; |   import CurrencyText from './CurrencyText.vue'; | ||||||
|   import SummaryPurchaseModal from './SummaryPurchaseModal.vue'; |   import SummaryPurchaseModal from './SummaryPurchaseModal.vue'; | ||||||
|  |  | ||||||
| @@ -96,6 +97,7 @@ | |||||||
|     }, |     }, | ||||||
|     data () { |     data () { | ||||||
|       return { |       return { | ||||||
|  |         api: inject('api'), | ||||||
|         valid: null, |         valid: null, | ||||||
|         selectedPurchaseId: null, |         selectedPurchaseId: null, | ||||||
|         selectedTab: 'CASH', |         selectedTab: 'CASH', | ||||||
| @@ -171,9 +173,7 @@ | |||||||
|         this.$refs.summaryModal.dialog = true; |         this.$refs.summaryModal.dialog = true; | ||||||
|       }, |       }, | ||||||
|       fetchPurchases() { |       fetchPurchases() { | ||||||
|         const endpoint = '/don_confiao/purchases/for_reconciliation'; |         this.api.getPurchasesForReconciliation() | ||||||
|         fetch(endpoint) |  | ||||||
|           .then(response => response.json()) |  | ||||||
|             .then(data => { |             .then(data => { | ||||||
|               this.summary.purchases = data; |               this.summary.purchases = data; | ||||||
|               this.reconciliation.cash_purchases = this.idsBymethod('CASH'); |               this.reconciliation.cash_purchases = this.idsBymethod('CASH'); | ||||||
|   | |||||||
| @@ -19,6 +19,10 @@ class Api { | |||||||
|     return this.apiImplementation.getSummaryPurchase(purchaseId); |     return this.apiImplementation.getSummaryPurchase(purchaseId); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   getPurchasesForReconciliation() { | ||||||
|  |     return this.apiImplementation.getPurchasesForReconciliation(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   createPurchase(purchase) { |   createPurchase(purchase) { | ||||||
|     return this.apiImplementation.createPurchase(purchase); |     return this.apiImplementation.createPurchase(purchase); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -19,6 +19,11 @@ class DjangoApi { | |||||||
|     return this.getRequest(url); |     return this.getRequest(url); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   getPurchasesForReconciliation() { | ||||||
|  |     const url = '/don_confiao/purchases/for_reconciliation'; | ||||||
|  |     return this.getRequest(url); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   createPurchase(purchase) { |   createPurchase(purchase) { | ||||||
|     return new Promise((resolve, reject) => { |     return new Promise((resolve, reject) => { | ||||||
|       console.log('compra a enviar:', purchase); |       console.log('compra a enviar:', purchase); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user