mirror of
https://github.com/frappe/books.git
synced 2024-12-22 10:58:59 +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 { PrintSettings } from 'models/baseModels/PrintSettings/PrintSettings';
|
||||
import type { InventorySettings } from 'models/inventory/InventorySettings';
|
||||
import { Misc } from 'models/baseModels/Misc';
|
||||
|
||||
/**
|
||||
* The functions below are used for dynamic evaluation
|
||||
@ -55,6 +56,7 @@ export interface SinglesMap {
|
||||
InventorySettings?: InventorySettings;
|
||||
PrintSettings?: PrintSettings;
|
||||
Defaults?: Defaults;
|
||||
Misc?: Misc;
|
||||
[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 { JournalEntry } from './baseModels/JournalEntry/JournalEntry';
|
||||
import { JournalEntryAccount } from './baseModels/JournalEntryAccount/JournalEntryAccount';
|
||||
import { Misc } from './baseModels/Misc';
|
||||
import { Party } from './baseModels/Party/Party';
|
||||
import { Payment } from './baseModels/Payment/Payment';
|
||||
import { PaymentFor } from './baseModels/PaymentFor/PaymentFor';
|
||||
import { PriceList } from './baseModels/PriceList/PriceList';
|
||||
import { PriceListItem } from './baseModels/PriceList/PriceListItem';
|
||||
import { PrintSettings } from './baseModels/PrintSettings/PrintSettings';
|
||||
import { PrintTemplate } from './baseModels/PrintTemplate';
|
||||
import { PurchaseInvoice } from './baseModels/PurchaseInvoice/PurchaseInvoice';
|
||||
import { PurchaseInvoiceItem } from './baseModels/PurchaseInvoiceItem/PurchaseInvoiceItem';
|
||||
import { SalesInvoice } from './baseModels/SalesInvoice/SalesInvoice';
|
||||
@ -32,7 +34,6 @@ import { StockLedgerEntry } from './inventory/StockLedgerEntry';
|
||||
import { StockMovement } from './inventory/StockMovement';
|
||||
import { StockMovementItem } from './inventory/StockMovementItem';
|
||||
|
||||
import { PrintTemplate } from './baseModels/PrintTemplate';
|
||||
export const models = {
|
||||
Account,
|
||||
AccountingLedgerEntry,
|
||||
@ -43,6 +44,7 @@ export const models = {
|
||||
Item,
|
||||
JournalEntry,
|
||||
JournalEntryAccount,
|
||||
Misc,
|
||||
Party,
|
||||
Payment,
|
||||
PaymentFor,
|
||||
|
@ -232,13 +232,15 @@ export default defineComponent({
|
||||
const { onboardingComplete } = await fyo.doc.getDoc('GetStarted');
|
||||
const { hideGetStarted } = await fyo.doc.getDoc('SystemSettings');
|
||||
|
||||
let route = '/get-started';
|
||||
if (hideGetStarted || onboardingComplete) {
|
||||
await routeTo('/');
|
||||
} else {
|
||||
await routeTo('/get-started');
|
||||
route = '/';
|
||||
}
|
||||
|
||||
await routeTo(localStorage.getItem('lastRoute') || route);
|
||||
},
|
||||
async showDbSelector(): Promise<void> {
|
||||
localStorage.clear();
|
||||
fyo.config.set('lastSelectedFilePath', null);
|
||||
fyo.telemetry.stop();
|
||||
await fyo.purgeCache();
|
||||
|
@ -10,9 +10,9 @@ 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 type { HistoryState } from 'vue-router';
|
||||
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
||||
import { historyState } from './utils/refs';
|
||||
import type { HistoryState } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
@ -122,10 +122,12 @@ const routes: RouteRecordRaw[] = [
|
||||
|
||||
const router = createRouter({ routes, history: createWebHistory() });
|
||||
|
||||
router.afterEach(() => {
|
||||
router.afterEach(({ fullPath }) => {
|
||||
const state = history.state as HistoryState;
|
||||
historyState.forward = !!state.forward;
|
||||
historyState.back = !!state.back;
|
||||
|
||||
localStorage.setItem('lastRoute', fullPath);
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
Loading…
Reference in New Issue
Block a user