From e278f9aa329b388e33c9c5b70555ceb1357c87ac Mon Sep 17 00:00:00 2001 From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:38:50 +0530 Subject: [PATCH] feat: added coupon codes to sidebar and formatted --- schemas/app/CouponCode.json | 137 ++++++++++++++++++------------------ src/utils/sidebarConfig.ts | 7 ++ 2 files changed, 75 insertions(+), 69 deletions(-) diff --git a/schemas/app/CouponCode.json b/schemas/app/CouponCode.json index 10c36ac2..a31b2372 100644 --- a/schemas/app/CouponCode.json +++ b/schemas/app/CouponCode.json @@ -1,71 +1,70 @@ { - "name": "CouponCode", - "label": "Coupon Code", - "naming": "manual", + "name": "CouponCode", + "label": "Coupon Code", + "naming": "manual", - "fields": [ - { - "fieldname": "name", - "label": "Name", - "fieldtype": "Data", - "required": true, - "placeholder": "Coupon Name", - "section": "Default" - }, - { - "fieldname": "couponCode", - "label": "Coupon Code", - "fieldtype": "Data", - "required": true - }, - { - "fieldname": "isEnabled", - "label": "Is Enabled", - "fieldtype": "Check", - "default": true, - "required": true, - "section": "Validity and Usage" - }, - { - "fieldname": "validFrom", - "label": "Valid From", - "fieldtype": "Date", - "required": true, - "section": "Validity and Usage" - }, - { - "fieldname": "validTo", - "label": "Valid To", - "fieldtype": "Date", - "required": true, - "section": "Validity and Usage" - }, - { - "fieldname": "maximumUse", - "label": "Maximum Use", - "fieldtype": "Int", - "default":0, - "required": true, - "section": "Validity and Usage" - }, - { - "fieldname": "used", - "label": "Used", - "fieldtype": "Int", - "default":0, - "required": true, - "readOnly": true, - "section": "Validity and Usage" - } - ], - "quickEditFields": [ - "name", - "couponCode", - "validFrom", - "validTo", - "maximumUse", - "used" - ], - "keywordFields": ["name"] - } - \ No newline at end of file + "fields": [ + { + "fieldname": "name", + "label": "Name", + "fieldtype": "Data", + "required": true, + "placeholder": "Coupon Name", + "section": "Default" + }, + { + "fieldname": "couponCode", + "label": "Coupon Code", + "fieldtype": "Data", + "required": true + }, + { + "fieldname": "isEnabled", + "label": "Is Enabled", + "fieldtype": "Check", + "default": true, + "required": true, + "section": "Validity and Usage" + }, + { + "fieldname": "validFrom", + "label": "Valid From", + "fieldtype": "Date", + "required": true, + "section": "Validity and Usage" + }, + { + "fieldname": "validTo", + "label": "Valid To", + "fieldtype": "Date", + "required": true, + "section": "Validity and Usage" + }, + { + "fieldname": "maximumUse", + "label": "Maximum Use", + "fieldtype": "Int", + "default": 0, + "required": true, + "section": "Validity and Usage" + }, + { + "fieldname": "used", + "label": "Used", + "fieldtype": "Int", + "default": 0, + "required": true, + "readOnly": true, + "section": "Validity and Usage" + } + ], + "quickEditFields": [ + "name", + "couponCode", + "validFrom", + "validTo", + "maximumUse", + "used" + ], + "keywordFields": ["name"] +} diff --git a/src/utils/sidebarConfig.ts b/src/utils/sidebarConfig.ts index 64738381..d506bc07 100644 --- a/src/utils/sidebarConfig.ts +++ b/src/utils/sidebarConfig.ts @@ -216,6 +216,13 @@ function getCompleteSidebar(): SidebarConfig { schemaName: 'Lead', hidden: () => !fyo.singles.AccountingSettings?.enableLead, }, + { + label: t`Coupon Code`, + name: 'coupon-code', + route: `/list/CouponCode/CouponCode`, + schemaName: 'CouponCode', + hidden: () => !fyo.singles.AccountingSettings?.enableCouponCode, + }, ] as SidebarItem[], }, {