mirror of
https://github.com/frappe/books.git
synced 2024-11-09 15:20:56 +00:00
incr: route to lastRoute on open
- add file Misc singles doc
This commit is contained in:
parent
71dfe903a4
commit
826a72e1e5
@ -9,6 +9,7 @@ import type { AccountingSettings } from 'models/baseModels/AccountingSettings/Ac
|
|||||||
import type { Defaults } from 'models/baseModels/Defaults/Defaults';
|
import type { Defaults } from 'models/baseModels/Defaults/Defaults';
|
||||||
import type { PrintSettings } from 'models/baseModels/PrintSettings/PrintSettings';
|
import type { PrintSettings } from 'models/baseModels/PrintSettings/PrintSettings';
|
||||||
import type { InventorySettings } from 'models/inventory/InventorySettings';
|
import type { InventorySettings } from 'models/inventory/InventorySettings';
|
||||||
|
import { Misc } from 'models/baseModels/Misc';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The functions below are used for dynamic evaluation
|
* The functions below are used for dynamic evaluation
|
||||||
@ -55,6 +56,7 @@ export interface SinglesMap {
|
|||||||
InventorySettings?: InventorySettings;
|
InventorySettings?: InventorySettings;
|
||||||
PrintSettings?: PrintSettings;
|
PrintSettings?: PrintSettings;
|
||||||
Defaults?: Defaults;
|
Defaults?: Defaults;
|
||||||
|
Misc?: Misc;
|
||||||
[key: string]: Doc | undefined;
|
[key: string]: Doc | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
models/baseModels/Misc.ts
Normal file
8
models/baseModels/Misc.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { Doc } from 'fyo/model/doc';
|
||||||
|
import { HiddenMap } from 'fyo/model/types';
|
||||||
|
|
||||||
|
export class Misc extends Doc {
|
||||||
|
openCount?: number;
|
||||||
|
useFullWidth?: boolean;
|
||||||
|
override hidden: HiddenMap = {};
|
||||||
|
}
|
@ -7,12 +7,14 @@ import { Defaults } from './baseModels/Defaults/Defaults';
|
|||||||
import { Item } from './baseModels/Item/Item';
|
import { Item } from './baseModels/Item/Item';
|
||||||
import { JournalEntry } from './baseModels/JournalEntry/JournalEntry';
|
import { JournalEntry } from './baseModels/JournalEntry/JournalEntry';
|
||||||
import { JournalEntryAccount } from './baseModels/JournalEntryAccount/JournalEntryAccount';
|
import { JournalEntryAccount } from './baseModels/JournalEntryAccount/JournalEntryAccount';
|
||||||
|
import { Misc } from './baseModels/Misc';
|
||||||
import { Party } from './baseModels/Party/Party';
|
import { Party } from './baseModels/Party/Party';
|
||||||
import { Payment } from './baseModels/Payment/Payment';
|
import { Payment } from './baseModels/Payment/Payment';
|
||||||
import { PaymentFor } from './baseModels/PaymentFor/PaymentFor';
|
import { PaymentFor } from './baseModels/PaymentFor/PaymentFor';
|
||||||
import { PriceList } from './baseModels/PriceList/PriceList';
|
import { PriceList } from './baseModels/PriceList/PriceList';
|
||||||
import { PriceListItem } from './baseModels/PriceList/PriceListItem';
|
import { PriceListItem } from './baseModels/PriceList/PriceListItem';
|
||||||
import { PrintSettings } from './baseModels/PrintSettings/PrintSettings';
|
import { PrintSettings } from './baseModels/PrintSettings/PrintSettings';
|
||||||
|
import { PrintTemplate } from './baseModels/PrintTemplate';
|
||||||
import { PurchaseInvoice } from './baseModels/PurchaseInvoice/PurchaseInvoice';
|
import { PurchaseInvoice } from './baseModels/PurchaseInvoice/PurchaseInvoice';
|
||||||
import { PurchaseInvoiceItem } from './baseModels/PurchaseInvoiceItem/PurchaseInvoiceItem';
|
import { PurchaseInvoiceItem } from './baseModels/PurchaseInvoiceItem/PurchaseInvoiceItem';
|
||||||
import { SalesInvoice } from './baseModels/SalesInvoice/SalesInvoice';
|
import { SalesInvoice } from './baseModels/SalesInvoice/SalesInvoice';
|
||||||
@ -32,7 +34,6 @@ import { StockLedgerEntry } from './inventory/StockLedgerEntry';
|
|||||||
import { StockMovement } from './inventory/StockMovement';
|
import { StockMovement } from './inventory/StockMovement';
|
||||||
import { StockMovementItem } from './inventory/StockMovementItem';
|
import { StockMovementItem } from './inventory/StockMovementItem';
|
||||||
|
|
||||||
import { PrintTemplate } from './baseModels/PrintTemplate';
|
|
||||||
export const models = {
|
export const models = {
|
||||||
Account,
|
Account,
|
||||||
AccountingLedgerEntry,
|
AccountingLedgerEntry,
|
||||||
@ -43,6 +44,7 @@ export const models = {
|
|||||||
Item,
|
Item,
|
||||||
JournalEntry,
|
JournalEntry,
|
||||||
JournalEntryAccount,
|
JournalEntryAccount,
|
||||||
|
Misc,
|
||||||
Party,
|
Party,
|
||||||
Payment,
|
Payment,
|
||||||
PaymentFor,
|
PaymentFor,
|
||||||
|
@ -232,13 +232,15 @@ export default defineComponent({
|
|||||||
const { onboardingComplete } = await fyo.doc.getDoc('GetStarted');
|
const { onboardingComplete } = await fyo.doc.getDoc('GetStarted');
|
||||||
const { hideGetStarted } = await fyo.doc.getDoc('SystemSettings');
|
const { hideGetStarted } = await fyo.doc.getDoc('SystemSettings');
|
||||||
|
|
||||||
|
let route = '/get-started';
|
||||||
if (hideGetStarted || onboardingComplete) {
|
if (hideGetStarted || onboardingComplete) {
|
||||||
await routeTo('/');
|
route = '/';
|
||||||
} else {
|
|
||||||
await routeTo('/get-started');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await routeTo(localStorage.getItem('lastRoute') || route);
|
||||||
},
|
},
|
||||||
async showDbSelector(): Promise<void> {
|
async showDbSelector(): Promise<void> {
|
||||||
|
localStorage.clear();
|
||||||
fyo.config.set('lastSelectedFilePath', null);
|
fyo.config.set('lastSelectedFilePath', null);
|
||||||
fyo.telemetry.stop();
|
fyo.telemetry.stop();
|
||||||
await fyo.purgeCache();
|
await fyo.purgeCache();
|
||||||
|
@ -10,9 +10,9 @@ import QuickEditForm from 'src/pages/QuickEditForm.vue';
|
|||||||
import Report from 'src/pages/Report.vue';
|
import Report from 'src/pages/Report.vue';
|
||||||
import Settings from 'src/pages/Settings/Settings.vue';
|
import Settings from 'src/pages/Settings/Settings.vue';
|
||||||
import TemplateBuilder from 'src/pages/TemplateBuilder/TemplateBuilder.vue';
|
import TemplateBuilder from 'src/pages/TemplateBuilder/TemplateBuilder.vue';
|
||||||
|
import type { HistoryState } from 'vue-router';
|
||||||
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
||||||
import { historyState } from './utils/refs';
|
import { historyState } from './utils/refs';
|
||||||
import type { HistoryState } from 'vue-router';
|
|
||||||
|
|
||||||
const routes: RouteRecordRaw[] = [
|
const routes: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
@ -122,10 +122,12 @@ const routes: RouteRecordRaw[] = [
|
|||||||
|
|
||||||
const router = createRouter({ routes, history: createWebHistory() });
|
const router = createRouter({ routes, history: createWebHistory() });
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(({ fullPath }) => {
|
||||||
const state = history.state as HistoryState;
|
const state = history.state as HistoryState;
|
||||||
historyState.forward = !!state.forward;
|
historyState.forward = !!state.forward;
|
||||||
historyState.back = !!state.back;
|
historyState.back = !!state.back;
|
||||||
|
|
||||||
|
localStorage.setItem('lastRoute', fullPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
Loading…
Reference in New Issue
Block a user