From f762f9b32ebaed20def97a6eb9c4b43568bfe792 Mon Sep 17 00:00:00 2001
From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com>
Date: Fri, 27 Sep 2024 17:23:29 +0530
Subject: [PATCH 1/8] feat: toggle button for redeeming loyalty points
---
src/pages/POS/POS.vue | 126 ++++++++++++++++++++++++++++++++++++++----
1 file changed, 116 insertions(+), 10 deletions(-)
diff --git a/src/pages/POS/POS.vue b/src/pages/POS/POS.vue
index df899668..42bba95a 100644
--- a/src/pages/POS/POS.vue
+++ b/src/pages/POS/POS.vue
@@ -22,6 +22,14 @@
@toggle-modal="toggleModal"
/>
+
+
-
-
+
+
+
+
+
+
+
+ {{ tableView ? 'Grid View' : 'List View' }}
+
+
+
+
+
+
+
+ Loyalty Program
+
+
@@ -125,7 +208,7 @@
:border="true"
:value="sinvDoc.party"
:df="sinvDoc.fieldMap.party"
- @change="(value:string) => (sinvDoc.party = value)"
+ @change="(value:string) => setCustomer(value)"
/>
@@ -270,7 +353,8 @@ import {
validateSinv,
} from 'src/utils/pos';
import Barcode from 'src/components/Controls/Barcode.vue';
-import { getPricingRule } from 'models/helpers';
+import { getAddedLPWithGrandTotal, getPricingRule } from 'models/helpers';
+import LoyaltyProgramModal from './LoyaltyprogramModal.vue';
export default defineComponent({
name: 'POS',
@@ -285,6 +369,7 @@ export default defineComponent({
OpenPOSShiftModal,
PageHeader,
PaymentModal,
+ LoyaltyProgramModal,
SelectedItemTable,
Barcode,
},
@@ -311,6 +396,7 @@ export default defineComponent({
isItemsSeeded: false,
openPaymentModal: false,
+ openLoyaltyProgramModal: false,
openShiftCloseModal: false,
openShiftOpenModal: false,
@@ -322,6 +408,10 @@ export default defineComponent({
totalQuantity: 0,
+ loyaltyPoints: 0,
+ appliedLoyaltyPoints: 0,
+ loyaltyProgram: '' as string,
+
defaultCustomer: undefined as string | undefined,
itemSearchTerm: '',
transferRefNo: undefined as string | undefined,
@@ -385,6 +475,22 @@ export default defineComponent({
toggleSidebar(true);
},
methods: {
+ async setCustomer(value: string) {
+ if (!value) {
+ this.sinvDoc.party = '';
+ return;
+ }
+
+ this.sinvDoc.party = value;
+
+ const party = await this.fyo.db.getAll(ModelNameEnum.Party, {
+ fields: ['loyaltyProgram', 'loyaltyPoints'],
+ filters: { name: value as string },
+ });
+
+ this.loyaltyProgram = party[0]?.loyaltyProgram as string;
+ this.loyaltyPoints = party[0].loyaltyPoints as number;
+ },
async setItems() {
const items = (await fyo.db.getAll(ModelNameEnum.Item, {
fields: [],
From 2bcd63b3c99032543672a675e070fd6b9fa3cd12 Mon Sep 17 00:00:00 2001
From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com>
Date: Fri, 27 Sep 2024 17:24:02 +0530
Subject: [PATCH 2/8] feat: update types for loyalty program
---
src/components/POS/types.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/POS/types.ts b/src/components/POS/types.ts
index bc96bebe..a88c0ae5 100644
--- a/src/components/POS/types.ts
+++ b/src/components/POS/types.ts
@@ -8,7 +8,7 @@ export type ItemSerialNumbers = { [item: string]: string };
export type DiscountType = "percent" | "amount";
-export type ModalName = 'ShiftOpen' | 'ShiftClose' | 'Payment'
+export type ModalName = 'ShiftOpen' | 'ShiftClose' | 'Payment' | 'LoyaltyProgram'
export interface POSItem {
image?:string,
From 8d8c85ea88ba627934231cc2970ebb589853613b Mon Sep 17 00:00:00 2001
From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com>
Date: Fri, 27 Sep 2024 17:25:26 +0530
Subject: [PATCH 3/8] feat(ui): modal for redeeming loyalty points
---
src/pages/POS/LoyaltyprogramModal.vue | 116 ++++++++++++++++++++++++++
1 file changed, 116 insertions(+)
create mode 100644 src/pages/POS/LoyaltyprogramModal.vue
diff --git a/src/pages/POS/LoyaltyprogramModal.vue b/src/pages/POS/LoyaltyprogramModal.vue
new file mode 100644
index 00000000..50237e5d
--- /dev/null
+++ b/src/pages/POS/LoyaltyprogramModal.vue
@@ -0,0 +1,116 @@
+
+
+ Redeem Loyalty Points
+
+
+
+
+
+
+
{{ loyaltyPoints }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 57d32084371f42fc115baa533b089af0f7c18188 Mon Sep 17 00:00:00 2001
From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com>
Date: Fri, 27 Sep 2024 17:26:06 +0530
Subject: [PATCH 4/8] feat: add loyalty point earning and redemption in POS
---
src/pages/POS/LoyaltyprogramModal.vue | 53 ++++++++++++++++++++++++++-
src/pages/POS/POS.vue | 18 +++++++++
2 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/src/pages/POS/LoyaltyprogramModal.vue b/src/pages/POS/LoyaltyprogramModal.vue
index 50237e5d..21b681ef 100644
--- a/src/pages/POS/LoyaltyprogramModal.vue
+++ b/src/pages/POS/LoyaltyprogramModal.vue
@@ -27,6 +27,7 @@
:border="true"
:value="sinvDoc.loyaltyPoints"
:df="sinvDoc.fieldMap.loyaltyPoints"
+ @change="updateLoyaltyPoints"
/>
@@ -34,6 +35,7 @@