diff --git a/fyo/core/authHandler.ts b/fyo/core/authHandler.ts index e304e59c..8f8c2b10 100644 --- a/fyo/core/authHandler.ts +++ b/fyo/core/authHandler.ts @@ -40,6 +40,14 @@ export class AuthHandler { } } + set user(value: string) { + this.#session.user = value; + } + + get user(): string { + return this.#session.user; + } + get session(): Readonly { return { ...this.#session }; } diff --git a/src/initFyo.ts b/src/initFyo.ts index 73fec946..721d5450 100644 --- a/src/initFyo.ts +++ b/src/initFyo.ts @@ -30,6 +30,7 @@ export async function initializeInstance( await fyo.initializeAndRegister(models, regionalModels); await setSingles(fyo); + await setCreds(fyo); await setCurrencySymbols(fyo); } @@ -38,6 +39,15 @@ async function setSingles(fyo: Fyo) { await fyo.doc.getSingle(ModelNameEnum.GetStarted); } +async function setCreds(fyo: Fyo) { + const email = (await fyo.getValue( + ModelNameEnum.AccountingSettings, + 'email' + )) as string | undefined; + const user = fyo.auth.user; + fyo.auth.user = email ?? user; +} + async function setCurrencySymbols(fyo: Fyo) { const currencies = (await fyo.db.getAll(ModelNameEnum.Currency, { fields: ['name', 'symbol'], diff --git a/src/utils/search.ts b/src/utils/search.ts index f446bdeb..1ecca7c9 100644 --- a/src/utils/search.ts +++ b/src/utils/search.ts @@ -165,6 +165,10 @@ function getListViewList(): SearchItem[] { label: t`Sales Items`, route: `/list/Item/for/Sales/${t`Sales Items`}`, }, + { + label: t`Sales Payments`, + route: `/list/Payment/paymentType/Receive/${t`Sales Payments`}`, + }, { label: t`Purchase Items`, route: `/list/Item/for/Purchases/${t`Purchase Items`}`, @@ -173,6 +177,10 @@ function getListViewList(): SearchItem[] { label: t`Common Items`, route: `/list/Item/for/Both/${t`Common Items`}`, }, + { + label: t`Purchase Payments`, + route: `/list/Payment/paymentType/Pay/${t`Purchase Payments`}`, + }, ].map((i) => ({ ...i, group: 'List' } as SearchItem)); return [standardLists, filteredLists].flat(); diff --git a/src/utils/sidebarConfig.ts b/src/utils/sidebarConfig.ts index ad6307c7..cd8fa1af 100644 --- a/src/utils/sidebarConfig.ts +++ b/src/utils/sidebarConfig.ts @@ -55,7 +55,7 @@ function getCompleteSidebar(): SidebarConfig { schemaName: 'SalesInvoice', }, { - label: t`Payments`, + label: t`Sales Payments`, name: 'payments', route: '/list/Payment/paymentType/Receive', schemaName: 'Payment', @@ -87,7 +87,7 @@ function getCompleteSidebar(): SidebarConfig { schemaName: 'PurchaseInvoice', }, { - label: t`Payments`, + label: t`Purchase Payments`, name: 'payments', route: '/list/Payment/paymentType/Pay', schemaName: 'Payment',