This commit is contained in:
2026-05-17 08:44:11 +03:30
parent 60ee6a0c24
commit 73df354f9b
2 changed files with 20 additions and 10 deletions
@@ -83,14 +83,24 @@ export class PosLandingStore {
readonly payments = computed(() => this.state$().payments);
readonly orderPricingInfo = computed(() => {
const totalAmount = 0;
const taxAmount = totalAmount * 0.1;
let totalAmount = 0;
let taxAmount = 0;
let totalBaseAmount = 0;
let discountAmount = 0;
this.inOrderGoods().forEach((inOrderGood) => {
totalBaseAmount += parseInt(inOrderGood.base_total_amount + '') || 0;
totalAmount += parseInt(inOrderGood.total_amount + '') || 0;
taxAmount += parseInt(inOrderGood.tax_amount + '') || 0;
discountAmount += parseInt(inOrderGood.discount_amount + '') || 0;
});
return {
totalItems: this.inOrderGoods().length,
totalBaseAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.base_total_amount, 0),
totalAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.total_amount, 0),
taxAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.tax_amount, 0),
discountAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.discount_amount, 0),
totalBaseAmount,
totalAmount,
taxAmount,
discountAmount,
payableAmount: totalAmount + taxAmount,
};
});
@@ -168,8 +168,8 @@ export class AmountPercentageInputComponent {
const amountValue = (this.baseAmount * percentageValue) / 100;
this.lastValidAmount = Number.isFinite(amountValue) ? amountValue : 0;
this.percentageControl.setValue(this.lastValidPercentage);
this.amountControl.setValue(this.lastValidAmount);
this.percentageControl.setValue(this.lastValidPercentage, { emitEvent: false });
this.amountControl.setValue(this.lastValidAmount, { emitEvent: false });
this.preparedLabel.set(this.prepareLabel(true));
}
@@ -189,8 +189,8 @@ export class AmountPercentageInputComponent {
: '0';
this.lastValidPercentage = this.parseValue(percentageValue);
this.amountControl.setValue(this.lastValidAmount);
this.percentageControl.setValue(percentageValue);
this.amountControl.setValue(this.lastValidAmount, { emitEvent: false });
this.percentageControl.setValue(percentageValue, { emitEvent: false });
this.preparedLabel.set(this.prepareLabel(false));
}