#84 refactor(front): moved to api purchases_for_reconciliation to.
This commit is contained in:
parent
34259921d9
commit
d9f6be8b54
@ -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,18 +173,16 @@
|
|||||||
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(data => {
|
||||||
.then(response => response.json())
|
this.summary.purchases = data;
|
||||||
.then(data => {
|
this.reconciliation.cash_purchases = this.idsBymethod('CASH');
|
||||||
this.summary.purchases = data;
|
this.reconciliation.total_cash_purchases = this.totalByMethod('CASH');
|
||||||
this.reconciliation.cash_purchases = this.idsBymethod('CASH');
|
this.processOtherMethods();
|
||||||
this.reconciliation.total_cash_purchases = this.totalByMethod('CASH');
|
})
|
||||||
this.processOtherMethods();
|
.catch(error => {
|
||||||
})
|
console.error(error);
|
||||||
.catch(error => {
|
});
|
||||||
console.error(error);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
async submit() {
|
async submit() {
|
||||||
this.$refs.taker.validate();
|
this.$refs.taker.validate();
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user