From 6ec7a1b9a17881e88f4cce38acc93a2053c7bef8 Mon Sep 17 00:00:00 2001 From: Konstantin Sharlaimov Date: Thu, 2 Nov 2023 22:21:12 +0100 Subject: [PATCH] Add regional schemas for Switzerland. --- .gitignore | 1 + schemas/regional/ch/AccountingSettings.json | 21 +++++++++++++++++++++ schemas/regional/ch/index.ts | 4 ++++ schemas/regional/index.ts | 6 +++++- src/utils/printTemplates.ts | 2 +- 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 schemas/regional/ch/AccountingSettings.json create mode 100644 schemas/regional/ch/index.ts diff --git a/.gitignore b/.gitignore index c56e8d3e..fdd7227d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ yarn-error.log* *.njsproj *.sln *.sw? +*.code-workspace #Electron-builder output /dist_electron diff --git a/schemas/regional/ch/AccountingSettings.json b/schemas/regional/ch/AccountingSettings.json new file mode 100644 index 00000000..b024733d --- /dev/null +++ b/schemas/regional/ch/AccountingSettings.json @@ -0,0 +1,21 @@ +{ + "name": "AccountingSettings", + "fields": [ + { + "fieldname": "taxId", + "label": "Tax ID", + "fieldtype": "Data", + "placeholder": "CHE-123.456.789", + "section": "Default" + } + ], + "quickEditFields": [ + "fullname", + "email", + "companyName", + "country", + "fiscalYearStart", + "fiscalYearEnd", + "taxId" + ] +} diff --git a/schemas/regional/ch/index.ts b/schemas/regional/ch/index.ts new file mode 100644 index 00000000..3287e390 --- /dev/null +++ b/schemas/regional/ch/index.ts @@ -0,0 +1,4 @@ +import { SchemaStub } from '../../types'; +import AccountingSettings from './AccountingSettings.json'; + +export default [AccountingSettings] as SchemaStub[]; diff --git a/schemas/regional/index.ts b/schemas/regional/index.ts index de55493e..6c9b8e88 100644 --- a/schemas/regional/index.ts +++ b/schemas/regional/index.ts @@ -1,7 +1,11 @@ import { SchemaStub } from 'schemas/types'; import IndianSchemas from './in'; +import SwissSchemas from './ch'; /** * Regional Schemas are exported by country code. */ -export default { in: IndianSchemas } as Record; +export default { in: IndianSchemas, ch: SwissSchemas } as Record< + string, + SchemaStub[] +>; diff --git a/src/utils/printTemplates.ts b/src/utils/printTemplates.ts index 867f89ad..0eaa41f5 100644 --- a/src/utils/printTemplates.ts +++ b/src/utils/printTemplates.ts @@ -29,7 +29,7 @@ const printSettingsFields = [ 'address', 'companyName', ]; -const accountingSettingsFields = ['gstin']; +const accountingSettingsFields = ['gstin', 'taxId']; export async function getPrintTemplatePropValues( doc: Doc