2
0
mirror of https://github.com/frappe/books.git synced 2024-11-15 17:57:08 +00:00
books/src/router.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

172 lines
4.1 KiB
TypeScript
Raw Normal View History

import { ModelNameEnum } from 'models/types';
2022-04-28 06:34:55 +00:00
import ChartOfAccounts from 'src/pages/ChartOfAccounts.vue';
2022-04-20 06:38:47 +00:00
import Dashboard from 'src/pages/Dashboard/Dashboard.vue';
import DataImport from 'src/pages/DataImport.vue';
import GeneralForm from 'src/pages/GeneralForm.vue';
2022-04-25 10:37:25 +00:00
import GetStarted from 'src/pages/GetStarted.vue';
2022-05-01 04:45:47 +00:00
import InvoiceForm from 'src/pages/InvoiceForm.vue';
2022-04-29 19:04:08 +00:00
import JournalEntryForm from 'src/pages/JournalEntryForm.vue';
2022-04-27 12:02:43 +00:00
import ListView from 'src/pages/ListView/ListView.vue';
import PrintView from 'src/pages/PrintView/PrintView.vue';
2022-04-27 12:02:43 +00:00
import QuickEditForm from 'src/pages/QuickEditForm.vue';
import Report from 'src/pages/Report.vue';
import Settings from 'src/pages/Settings/Settings.vue';
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
2018-06-27 14:36:42 +00:00
function getGeneralFormItems(): RouteRecordRaw[] {
return [ModelNameEnum.Shipment, ModelNameEnum.PurchaseReceipt].map(
(schemaName) => {
return {
path: `/edit/${schemaName}/:name`,
name: `${schemaName}Form`,
components: {
default: GeneralForm,
edit: QuickEditForm,
},
props: {
default: (route) => {
route.params.schemaName = schemaName;
return {
schemaName,
name: route.params.name,
};
},
edit: (route) => route.query,
},
};
}
);
}
const routes: RouteRecordRaw[] = [
2019-07-25 09:50:48 +00:00
{
path: '/',
component: Dashboard,
2019-07-25 09:50:48 +00:00
},
{
path: '/get-started',
component: GetStarted,
},
...getGeneralFormItems(),
2019-11-19 19:10:01 +00:00
{
path: '/edit/JournalEntry/:name',
name: 'JournalEntryForm',
components: {
default: JournalEntryForm,
edit: QuickEditForm,
2019-11-19 19:10:01 +00:00
},
props: {
default: (route) => {
// for sidebar item active state
2022-04-29 19:04:08 +00:00
route.params.schemaName = 'JournalEntry';
return {
2022-05-01 04:45:47 +00:00
schemaName: 'JournalEntry',
name: route.params.name,
};
},
edit: (route) => route.query,
},
2019-11-19 19:10:01 +00:00
},
2018-06-27 14:36:42 +00:00
{
2022-05-01 04:45:47 +00:00
path: '/edit/:schemaName/:name',
name: 'InvoiceForm',
components: {
default: InvoiceForm,
edit: QuickEditForm,
},
props: {
default: true,
edit: (route) => route.query,
},
},
{
path: '/list/:schemaName/:fieldname?/:value?/:pageTitle?',
name: 'ListView',
components: {
default: ListView,
edit: QuickEditForm,
2019-10-04 20:18:10 +00:00
},
props: {
default: (route) => {
const { schemaName, fieldname, value, pageTitle } = route.params;
let { filters } = route.params;
2022-03-10 06:36:37 +00:00
if (filters === undefined && fieldname && value) {
// @ts-ignore
filters = { [fieldname as string]: value };
2022-03-10 06:36:37 +00:00
}
return {
2022-04-27 12:02:43 +00:00
schemaName,
filters,
pageTitle: pageTitle ?? '',
};
},
2022-04-28 06:34:55 +00:00
edit: (route) => {
return route.query;
},
},
2018-06-27 14:36:42 +00:00
},
2018-10-15 12:05:01 +00:00
{
2022-05-01 04:45:47 +00:00
path: '/print/:schemaName/:name',
2018-10-15 12:05:01 +00:00
name: 'PrintView',
component: PrintView,
props: true,
2018-10-22 18:10:22 +00:00
},
2018-06-27 14:36:42 +00:00
{
2022-05-18 07:04:33 +00:00
path: '/report/:reportClassName',
2018-06-27 14:36:42 +00:00
name: 'Report',
component: Report,
props: true,
2018-10-10 10:32:56 +00:00
},
Winter Sprint: Work (#79) * init() * Country-wise Chart of accounts on setup * Add a sample invoice template * Some error fixes * [fix] missing COA - move importCOA.js from models/doctype/account to models/doctype/Account * All Account initial balance zero * setup Bank Reconciliation * New chart of accounts tree component * GST taxes added. initialized gst reports. * [chore] add *.db to .gitignore * [fix] importCOA path error * fix error + bank reconciliation fields * [feat] add gst taxes * GST report initialized * GST report finalized * GST report finalized * Complete min. reconciliation * [feat] auto select tax in invoice based on states * [chore] fix merge changes * Fix date issue - Make Payment * Add invoice templates and invoice customizer panel * Restructure invoice vue components * update file with fiscal year * Fix issues in invoice designs * Add company settings. Dynamic addresses in invoice * Move invoice styles to different file and add separate components for addresses * [feat] add export-filtered-data-to-csv to reports * [feat] add Export Wizard component for customizing export * Fix invoice customizer position while scrolling. Fix address displayed as undefined in invoice if not found in db * [chore] change markup for select all chkbox * Setup config as doctype * GSTIN bug fix * Add custom google fonts * Add Send email footer * Fix DateTime * Complete Merge + Resolve * Complete Merge + Resolve * [chore] change layout of Export Wizard * [enh] optimize checkNoneSelected, style export modal footer divider * Add Tax to SideBar * Remove extra logs * [fix] db name section in sidebar showing absolute path instead of dbname in windows i.e. platform=win32 * Country-wise Chart of accounts on setup (#78) * Country-wise Chart of accounts on setup * Some error fixes * All Account initial balance zero * Update README.md - updated installation instructions with more detail * Merge #79 Winter Sprint: Work https://github.com/frappe/accounting/pull/79 * Revert "Merge #79 Winter Sprint: Work" This reverts commit 171511666817caa430af672791c8d452e3b4b680.
2019-02-18 05:42:04 +00:00
{
2019-12-23 08:26:41 +00:00
path: '/chart-of-accounts',
Winter Sprint: Work (#79) * init() * Country-wise Chart of accounts on setup * Add a sample invoice template * Some error fixes * [fix] missing COA - move importCOA.js from models/doctype/account to models/doctype/Account * All Account initial balance zero * setup Bank Reconciliation * New chart of accounts tree component * GST taxes added. initialized gst reports. * [chore] add *.db to .gitignore * [fix] importCOA path error * fix error + bank reconciliation fields * [feat] add gst taxes * GST report initialized * GST report finalized * GST report finalized * Complete min. reconciliation * [feat] auto select tax in invoice based on states * [chore] fix merge changes * Fix date issue - Make Payment * Add invoice templates and invoice customizer panel * Restructure invoice vue components * update file with fiscal year * Fix issues in invoice designs * Add company settings. Dynamic addresses in invoice * Move invoice styles to different file and add separate components for addresses * [feat] add export-filtered-data-to-csv to reports * [feat] add Export Wizard component for customizing export * Fix invoice customizer position while scrolling. Fix address displayed as undefined in invoice if not found in db * [chore] change markup for select all chkbox * Setup config as doctype * GSTIN bug fix * Add custom google fonts * Add Send email footer * Fix DateTime * Complete Merge + Resolve * Complete Merge + Resolve * [chore] change layout of Export Wizard * [enh] optimize checkNoneSelected, style export modal footer divider * Add Tax to SideBar * Remove extra logs * [fix] db name section in sidebar showing absolute path instead of dbname in windows i.e. platform=win32 * Country-wise Chart of accounts on setup (#78) * Country-wise Chart of accounts on setup * Some error fixes * All Account initial balance zero * Update README.md - updated installation instructions with more detail * Merge #79 Winter Sprint: Work https://github.com/frappe/accounting/pull/79 * Revert "Merge #79 Winter Sprint: Work" This reverts commit 171511666817caa430af672791c8d452e3b4b680.
2019-02-18 05:42:04 +00:00
name: 'Chart Of Accounts',
2019-10-13 21:18:18 +00:00
components: {
default: ChartOfAccounts,
edit: QuickEditForm,
2019-10-13 21:18:18 +00:00
},
props: {
default: true,
edit: (route) => route.query,
},
},
2022-02-21 10:56:57 +00:00
{
2022-05-01 11:34:13 +00:00
path: '/data-import',
2022-02-21 10:56:57 +00:00
name: 'Data Import',
component: DataImport,
},
{
path: '/settings',
name: 'Settings',
2022-10-12 08:35:18 +00:00
components: {
default: Settings,
edit: QuickEditForm,
},
props: {
default: true,
edit: (route) => route.query,
},
},
];
2018-06-27 14:36:42 +00:00
export function getEntryRoute(schemaName: string, name: string) {
if (
[
ModelNameEnum.SalesInvoice,
ModelNameEnum.PurchaseInvoice,
ModelNameEnum.JournalEntry,
ModelNameEnum.Shipment,
ModelNameEnum.PurchaseReceipt,
].includes(schemaName as ModelNameEnum)
) {
return `/edit/${schemaName}/${name}`;
}
return `/list/${schemaName}?edit=1&schemaName=${schemaName}&name=${name}`;
}
2022-04-20 06:38:47 +00:00
const router = createRouter({ routes, history: createWebHistory() });
export default router;