mirror of
https://github.com/frappe/books.git
synced 2025-01-03 15:17:30 +00:00
feat: add applied coupons count
This commit is contained in:
parent
6e2fdfc5be
commit
81cc3407f2
@ -203,6 +203,7 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
await updatePricingRule(this.sinvDoc);
|
await updatePricingRule(this.sinvDoc);
|
||||||
|
this.$emit('setCouponsCount', this.sinvDoc.coupons?.length);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
<CouponCodeModal
|
<CouponCodeModal
|
||||||
:open-modal="openCouponCodeModal"
|
:open-modal="openCouponCodeModal"
|
||||||
|
@set-coupons-count="setCouponsCount"
|
||||||
@toggle-modal="toggleModal"
|
@toggle-modal="toggleModal"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -48,6 +49,7 @@
|
|||||||
@set-cash-amount="setCashAmount"
|
@set-cash-amount="setCashAmount"
|
||||||
@set-transfer-amount="setTransferAmount"
|
@set-transfer-amount="setTransferAmount"
|
||||||
@set-transfer-ref-no="setTransferRefNo"
|
@set-transfer-ref-no="setTransferRefNo"
|
||||||
|
@set-coupons-count="setCouponsCount"
|
||||||
@set-transfer-clearance-date="setTransferClearanceDate"
|
@set-transfer-clearance-date="setTransferClearanceDate"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -691,6 +693,7 @@ export default defineComponent({
|
|||||||
async activated() {
|
async activated() {
|
||||||
toggleSidebar(false);
|
toggleSidebar(false);
|
||||||
validateIsPosSettingsSet(fyo);
|
validateIsPosSettingsSet(fyo);
|
||||||
|
this.setCouponCodeDoc();
|
||||||
this.setSinvDoc();
|
this.setSinvDoc();
|
||||||
this.setDefaultCustomer();
|
this.setDefaultCustomer();
|
||||||
await this.setItemQtyMap();
|
await this.setItemQtyMap();
|
||||||
@ -790,6 +793,14 @@ export default defineComponent({
|
|||||||
isPOS: true,
|
isPOS: true,
|
||||||
}) as SalesInvoice;
|
}) as SalesInvoice;
|
||||||
},
|
},
|
||||||
|
setCouponCodeDoc() {
|
||||||
|
this.coupons = this.fyo.doc.getNewDoc(
|
||||||
|
ModelNameEnum.AppliedCouponCodes
|
||||||
|
) as AppliedCouponCodes;
|
||||||
|
},
|
||||||
|
setAppliedCoupons() {
|
||||||
|
this.appliedCoupons = this.sinvDoc.coupons as AppliedCouponCodes[];
|
||||||
|
},
|
||||||
setTotalQuantity() {
|
setTotalQuantity() {
|
||||||
this.totalQuantity = getTotalQuantity(
|
this.totalQuantity = getTotalQuantity(
|
||||||
this.sinvDoc.items as SalesInvoiceItem[]
|
this.sinvDoc.items as SalesInvoiceItem[]
|
||||||
@ -798,6 +809,9 @@ export default defineComponent({
|
|||||||
setTotalTaxedAmount() {
|
setTotalTaxedAmount() {
|
||||||
this.totalTaxedAmount = getTotalTaxedAmount(this.sinvDoc as SalesInvoice);
|
this.totalTaxedAmount = getTotalTaxedAmount(this.sinvDoc as SalesInvoice);
|
||||||
},
|
},
|
||||||
|
setCouponsCount(value: number) {
|
||||||
|
this.appliedCouponsCount = value;
|
||||||
|
},
|
||||||
async setLoyaltyPoints(value: number) {
|
async setLoyaltyPoints(value: number) {
|
||||||
this.appliedLoyaltyPoints = value;
|
this.appliedLoyaltyPoints = value;
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@
|
|||||||
class="w-full bg-blue-500"
|
class="w-full bg-blue-500"
|
||||||
style="padding: 1.35rem"
|
style="padding: 1.35rem"
|
||||||
:disabled="disableSubmitButton"
|
:disabled="disableSubmitButton"
|
||||||
@click="$emit('createTransaction')"
|
@click="submitTransaction()"
|
||||||
>
|
>
|
||||||
<slot>
|
<slot>
|
||||||
<p class="uppercase text-lg text-white font-semibold">
|
<p class="uppercase text-lg text-white font-semibold">
|
||||||
@ -224,6 +224,7 @@ export default defineComponent({
|
|||||||
'setTransferClearanceDate',
|
'setTransferClearanceDate',
|
||||||
'setTransferRefNo',
|
'setTransferRefNo',
|
||||||
'toggleModal',
|
'toggleModal',
|
||||||
|
'setCouponsCount',
|
||||||
],
|
],
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
@ -320,6 +321,10 @@ export default defineComponent({
|
|||||||
this.$emit('setTransferAmount', fyo.pesa(0));
|
this.$emit('setTransferAmount', fyo.pesa(0));
|
||||||
this.$emit('setCashAmount', this.sinvDoc?.grandTotal);
|
this.$emit('setCashAmount', this.sinvDoc?.grandTotal);
|
||||||
},
|
},
|
||||||
|
submitTransaction() {
|
||||||
|
this.$emit('createTransaction');
|
||||||
|
this.$emit('setCouponsCount', 0);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user