Skip to content

Commit

Permalink
chore: refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
AbleKSaju committed Nov 22, 2024
1 parent aa7233c commit 66cad7d
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/pages/POS/KeyboardModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,9 @@ import { defineComponent, inject } from 'vue';
import Button from 'src/components/Button.vue';
import Float from 'src/components/Controls/Float.vue';
import Currency from 'src/components/Controls/Currency.vue';
import { updatePricingRule, updatePricingRuleItem } from 'models/helpers';
import { updatePricingRuleItem } from 'models/helpers';
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
import { SalesInvoiceItem } from 'models/baseModels/SalesInvoiceItem/SalesInvoiceItem';
import { AppliedCouponCodes } from 'models/baseModels/AppliedCouponCodes/AppliedCouponCodes';
export default defineComponent({
name: 'KeyboardModal',
Expand All @@ -337,7 +336,7 @@ export default defineComponent({
default: '',
},
},
emits: ['setCouponsCount', 'toggleModal'],
emits: ['toggleModal'],
setup() {
return {
sinvDoc: inject('sinvDoc') as SalesInvoice,
Expand Down Expand Up @@ -420,7 +419,9 @@ export default defineComponent({
);
}
} else {
this.selectedItemRow![this.selectedItemField] = this.selectedValue;
this.selectedItemRow![this.selectedItemField] = Number(
this.selectedValue
);
if (this.selectedItemField === 'itemDiscountPercent') {
await this.selectedItemRow?.set('setItemDiscountAmount', false);
Expand Down Expand Up @@ -450,14 +451,6 @@ export default defineComponent({
await this.$nextTick();
(this.$refs.dynamicInput as HTMLInputElement)?.focus();
},
async removeAppliedCoupon(coupon: AppliedCouponCodes) {
this.sinvDoc.coupons = this.sinvDoc.coupons?.filter(
(coup) => coup.coupons !== coupon?.coupons
);
await updatePricingRule(this.sinvDoc);
this.$emit('setCouponsCount', this.sinvDoc.coupons?.length);
},
async closeKeyboardModal() {
await this.reset();
this.$emit('toggleModal', 'Keyboard');
Expand Down

0 comments on commit 66cad7d

Please sign in to comment.