From aa81ab566144788858f3336355b6af57b9944c2a Mon Sep 17 00:00:00 2001 From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:32:45 +0530 Subject: [PATCH] feat: loyalty program schemas --- schemas/app/AccountingSettings.json | 7 +++ schemas/app/CollectionRulesItems.json | 23 +++++++++ schemas/app/LoyaltyPointEntry.json | 70 ++++++++++++++++++++++++++ schemas/app/LoyaltyProgram.json | 72 +++++++++++++++++++++++++++ schemas/app/Party.json | 18 +++++++ schemas/app/SalesInvoice.json | 21 ++++++++ 6 files changed, 211 insertions(+) create mode 100644 schemas/app/CollectionRulesItems.json create mode 100644 schemas/app/LoyaltyPointEntry.json create mode 100644 schemas/app/LoyaltyProgram.json diff --git a/schemas/app/AccountingSettings.json b/schemas/app/AccountingSettings.json index eda1a88b4..80fd83127 100644 --- a/schemas/app/AccountingSettings.json +++ b/schemas/app/AccountingSettings.json @@ -114,6 +114,13 @@ "default": false, "section": "Features" }, + { + "fieldname": "enableLoyaltyProgram", + "label": "Enable Loyalty Program", + "fieldtype": "Check", + "default": false, + "section": "Features" + }, { "fieldname": "fiscalYearStart", "label": "Fiscal Year Start Date", diff --git a/schemas/app/CollectionRulesItems.json b/schemas/app/CollectionRulesItems.json new file mode 100644 index 000000000..6ae4c5c9f --- /dev/null +++ b/schemas/app/CollectionRulesItems.json @@ -0,0 +1,23 @@ +{ + "name": "CollectionRulesItems", + "label": "Collection Rules", + "isChild": true, + "fields": [ + { + "fieldname": "tierName", + "label": "Tier Name", + "fieldtype": "Data" + }, + { + "fieldname": "collectionFactor", + "label": "Collection Factor (=1 LP)", + "fieldtype": "Float" + }, + { + "fieldname": "minimumTotalSpent", + "label": "Minimum Total Spent", + "fieldtype": "Currency" + } + ], + "tableFields": ["tierName", "collectionFactor", "minimumTotalSpent"] +} diff --git a/schemas/app/LoyaltyPointEntry.json b/schemas/app/LoyaltyPointEntry.json new file mode 100644 index 000000000..e2ac634f2 --- /dev/null +++ b/schemas/app/LoyaltyPointEntry.json @@ -0,0 +1,70 @@ +{ + "name": "LoyaltyPointEntry", + "label": "Loyalty Point Entry", + "create": false, + "naming": "random", + "fields": [ + { + "label": "Entry No.", + "fieldname": "name", + "fieldtype": "Data", + "required": true, + "readOnly": true, + "section": "Default" + }, + { + "fieldname": "loyaltyProgram", + "readOnly": true, + "label": "Loyalty Program", + "fieldtype": "Data", + "required": true + }, + { + "fieldname": "loyaltyProgramTier", + "readOnly": true, + "label": "Loyalty Program Tier", + "fieldtype": "Data" + }, + { + "fieldname": "customer", + "readOnly": true, + "label": "Customer", + "fieldtype": "Link", + "target": "Party", + "required": true + }, + { + "fieldname": "invoice", + "readOnly": true, + "label": "Invoice", + "fieldtype": "Link", + "target": "SalesInvoice", + "required": true + }, + { + "fieldname": "loyaltyPoints", + "readOnly": true, + "label": "Loyalty Points", + "fieldtype": "Int" + }, + { + "fieldname": "purchaseAmount", + "readOnly": true, + "label": "Purchase Amount", + "fieldtype": "Currency", + "required": true + }, + { + "fieldname": "expiryDate", + "readOnly": true, + "label": "Expiry Date", + "fieldtype": "Date" + }, + { + "fieldname": "postingDate", + "readOnly": true, + "label": "Posting Date", + "fieldtype": "Date" + } + ] +} diff --git a/schemas/app/LoyaltyProgram.json b/schemas/app/LoyaltyProgram.json new file mode 100644 index 000000000..09296a01e --- /dev/null +++ b/schemas/app/LoyaltyProgram.json @@ -0,0 +1,72 @@ +{ + "name": "LoyaltyProgram", + "label": "Loyalty Program", + "naming": "manual", + + "fields": [ + { + "fieldname": "name", + "label": "Name", + "fieldtype": "Data", + "required": true, + "placeholder": "Full Name", + "section": "Default" + }, + { + "fieldname": "fromDate", + "label": "From Date", + "fieldtype": "Date", + "required": true + }, + { + "fieldname": "toDate", + "label": "To Date", + "fieldtype": "Date", + "required": true + }, + { + "fieldname": "isEnabled", + "label": "Is Enabled", + "fieldtype": "Check", + "default": true, + "required": true + }, + { + "fieldname": "collectionRules", + "label": "Collection Rules", + "fieldtype": "Table", + "target": "CollectionRulesItems", + "required": false + }, + { + "fieldname": "conversionFactor", + "label": "Conversion Factor", + "fieldtype": "Float", + "default": 1, + "required": true + }, + { + "fieldname": "expiryDuration", + "label": "Expiry Duration", + "fieldtype": "Int", + "default": 1, + "required": true + }, + { + "fieldname": "expenseAccount", + "label": "Expense Account", + "fieldtype": "Link", + "target": "Account", + "required": true + } + ], + "quickEditFields": [ + "name", + "fromDate", + "toDate", + "conversionFactor", + "expenseAccount", + "expiryDuration" + ], + "keywordFields": ["name"] +} diff --git a/schemas/app/Party.json b/schemas/app/Party.json index f6ccf25b3..6dca775b1 100644 --- a/schemas/app/Party.json +++ b/schemas/app/Party.json @@ -86,6 +86,23 @@ "readOnly": true, "section": "References" }, + + { + "fieldname": "loyaltyProgram", + "label": "Loyalty Program", + "fieldtype": "Link", + "target": "LoyaltyProgram", + "create": true, + "section": "Loyalty Program" + }, + { + "fieldname": "loyaltyPoints", + "label": "Loyalty Points", + "fieldtype": "Int", + "readOnly": true, + "default": 0, + "section": "Loyalty Program" + }, { "fieldname": "taxId", "label": "Tax ID", @@ -104,6 +121,7 @@ "phone", "address", "defaultAccount", + "loyaltyProgram", "currency", "role", "taxId" diff --git a/schemas/app/SalesInvoice.json b/schemas/app/SalesInvoice.json index 9b8de0fcb..b196f2b8e 100644 --- a/schemas/app/SalesInvoice.json +++ b/schemas/app/SalesInvoice.json @@ -70,6 +70,27 @@ "label": "Return Against", "section": "References" }, + { + "fieldname": "loyaltyProgram", + "fieldtype": "Link", + "target": "LoyaltyProgram", + "label": "Loyalty Program", + "section": "References", + "readOnly": true + }, + { + "fieldname": "redeemLoyaltyPoints", + "fieldtype": "Check", + "default": false, + "label": "Redeem Loyalty Points", + "section": "Loyalty Points Redemption" + }, + { + "fieldname": "loyaltyPoints", + "fieldtype": "Int", + "label": "Loyalty Points", + "section": "Loyalty Points Redemption" + }, { "fieldname": "isPOS", "fieldtype": "Check",