From 202612b57a0e9459cd82c9f4f90a63a3d7ea26ea Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Fri, 28 Jul 2023 11:40:07 +0530 Subject: [PATCH] incr: add feature flag for custom fields - also add page and sidebar item --- .../AccountingSettings/AccountingSettings.ts | 1 + schemas/app/AccountingSettings.json | 7 +++++++ src/pages/CustomizeForm/CustomizeForm.vue | 21 +++++++++++++++++++ src/router.ts | 6 ++++++ src/utils/sidebarConfig.ts | 7 +++++++ 5 files changed, 42 insertions(+) create mode 100644 src/pages/CustomizeForm/CustomizeForm.vue diff --git a/models/baseModels/AccountingSettings/AccountingSettings.ts b/models/baseModels/AccountingSettings/AccountingSettings.ts index e1cef9da..a3224bfe 100644 --- a/models/baseModels/AccountingSettings/AccountingSettings.ts +++ b/models/baseModels/AccountingSettings/AccountingSettings.ts @@ -15,6 +15,7 @@ export class AccountingSettings extends Doc { enableDiscounting?: boolean; enableInventory?: boolean; enablePriceList?: boolean; + enableFormCustomization?: boolean; static filters: FiltersMap = { writeOffAccount: () => ({ diff --git a/schemas/app/AccountingSettings.json b/schemas/app/AccountingSettings.json index 708733fc..454d21ee 100644 --- a/schemas/app/AccountingSettings.json +++ b/schemas/app/AccountingSettings.json @@ -86,6 +86,13 @@ "default": false, "section": "Features" }, + { + "fieldname": "enableFormCustomization", + "label": "Enable Form Customization", + "fieldtype": "Check", + "default": false, + "section": "Features" + }, { "fieldname": "fiscalYearStart", "label": "Fiscal Year Start Date", diff --git a/src/pages/CustomizeForm/CustomizeForm.vue b/src/pages/CustomizeForm/CustomizeForm.vue new file mode 100644 index 00000000..bd59f277 --- /dev/null +++ b/src/pages/CustomizeForm/CustomizeForm.vue @@ -0,0 +1,21 @@ + + diff --git a/src/router.ts b/src/router.ts index e8c26bad..5b91933f 100644 --- a/src/router.ts +++ b/src/router.ts @@ -10,6 +10,7 @@ import QuickEditForm from 'src/pages/QuickEditForm.vue'; import Report from 'src/pages/Report.vue'; import Settings from 'src/pages/Settings/Settings.vue'; import TemplateBuilder from 'src/pages/TemplateBuilder/TemplateBuilder.vue'; +import CustomizeForm from 'src/pages/CustomizeForm/CustomizeForm.vue'; import type { HistoryState } from 'vue-router'; import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'; import { historyState } from './utils/refs'; @@ -106,6 +107,11 @@ const routes: RouteRecordRaw[] = [ component: TemplateBuilder, props: true, }, + { + path: '/customize-form', + name: 'Customize Form', + component: CustomizeForm, + }, { path: '/settings', name: 'Settings', diff --git a/src/utils/sidebarConfig.ts b/src/utils/sidebarConfig.ts index d477a60a..f2527d3f 100644 --- a/src/utils/sidebarConfig.ts +++ b/src/utils/sidebarConfig.ts @@ -284,6 +284,13 @@ function getCompleteSidebar(): SidebarConfig { name: 'print-template', route: `/list/PrintTemplate/${t`Print Templates`}`, }, + { + label: t`Customize Form`, + name: 'customize-form', + route: `/customize-form`, + hidden: () => + !fyo.singles.AccountingSettings?.enableFormCustomization, + }, { label: t`Settings`, name: 'settings',