From a29684f0ddce009cff12700fbd4cb76f19810029 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Sun, 19 Jun 2022 01:47:19 +0530 Subject: [PATCH] feat: _dynamic_ help --- src/components/SearchBar.vue | 9 +++++++++ src/components/Sidebar.vue | 20 ++++++++++---------- src/pages/Dashboard/Dashboard.vue | 7 +++++++ src/pages/DataImport.vue | 7 ++++++- src/pages/InvoiceForm.vue | 16 ++++++++++++---- src/pages/JournalEntryForm.vue | 8 ++++++++ src/pages/ListView/ListView.vue | 7 ++++++- src/pages/Report.vue | 6 ++++++ src/pages/Settings/Settings.vue | 5 ++++- src/utils/getStartedConfig.ts | 26 +++++++++++++++----------- src/utils/misc.ts | 28 ++++++++++++++++++++++++++++ src/utils/ui.ts | 4 +++- 12 files changed, 114 insertions(+), 29 deletions(-) diff --git a/src/components/SearchBar.vue b/src/components/SearchBar.vue index 2354016f..d7c65c09 100644 --- a/src/components/SearchBar.vue +++ b/src/components/SearchBar.vue @@ -149,6 +149,10 @@
↑↓ {{ t`Navigate` }}
↩ {{ t`Select` }}
esc {{ t`Close` }}
+
@@ -181,6 +185,8 @@
diff --git a/src/pages/DataImport.vue b/src/pages/DataImport.vue
index 84fee82a..ca11ac9e 100644
--- a/src/pages/DataImport.vue
+++ b/src/pages/DataImport.vue
@@ -355,7 +355,8 @@ import PageHeader from 'src/components/PageHeader.vue';
import { importable, Importer } from 'src/dataImport';
import { fyo } from 'src/initFyo';
import { getSavePath, saveData } from 'src/utils/ipcCalls';
-import { showMessageDialog } from 'src/utils/ui';
+import { docsPathMap } from 'src/utils/misc';
+import { docsPath, showMessageDialog } from 'src/utils/ui';
import { IPC_ACTIONS } from 'utils/messages';
import Loading from '../components/Loading.vue';
@@ -484,7 +485,11 @@ export default {
return !!(this.file || this.importType);
},
},
+ activated() {
+ docsPath.value = docsPathMap.DataImport;
+ },
deactivated() {
+ docsPath.value = '';
if (!this.complete) {
return;
}
diff --git a/src/pages/InvoiceForm.vue b/src/pages/InvoiceForm.vue
index 7d575713..589a464c 100644
--- a/src/pages/InvoiceForm.vue
+++ b/src/pages/InvoiceForm.vue
@@ -188,11 +188,13 @@ import DropdownWithActions from 'src/components/DropdownWithActions.vue';
import FormContainer from 'src/components/FormContainer.vue';
import StatusBadge from 'src/components/StatusBadge.vue';
import { fyo } from 'src/initFyo';
+import { docsPathMap } from 'src/utils/misc';
import {
- getActionsForDocument,
- openSettings,
- routeTo,
- showMessageDialog,
+docsPath,
+getActionsForDocument,
+openSettings,
+routeTo,
+showMessageDialog
} from 'src/utils/ui';
import { handleErrorWithDialog } from '../errorHandling';
@@ -235,6 +237,12 @@ export default {
return getDocStatus(this.doc);
},
},
+ activated() {
+ docsPath.value = docsPathMap[this.schemaName];
+ },
+ deactivated() {
+ docsPath.value = '';
+ },
async mounted() {
try {
this.doc = await fyo.doc.getDoc(this.schemaName, this.name);
diff --git a/src/pages/JournalEntryForm.vue b/src/pages/JournalEntryForm.vue
index dbc8a200..15e2ee54 100644
--- a/src/pages/JournalEntryForm.vue
+++ b/src/pages/JournalEntryForm.vue
@@ -149,7 +149,9 @@ import DropdownWithActions from 'src/components/DropdownWithActions.vue';
import FormContainer from 'src/components/FormContainer.vue';
import StatusBadge from 'src/components/StatusBadge.vue';
import { fyo } from 'src/initFyo';
+import { docsPathMap } from 'src/utils/misc';
import {
+docsPath,
getActionsForDocument,
routeTo,
showMessageDialog
@@ -180,6 +182,12 @@ export default {
doc: null,
};
},
+ activated() {
+ docsPath.value = docsPathMap.JournalEntry
+ },
+ deactivated() {
+ docsPath.value = '';
+ },
async mounted() {
try {
this.doc = await fyo.doc.getDoc(this.schemaName, this.name);
diff --git a/src/pages/ListView/ListView.vue b/src/pages/ListView/ListView.vue
index d5bd4fcf..89bcac2b 100644
--- a/src/pages/ListView/ListView.vue
+++ b/src/pages/ListView/ListView.vue
@@ -31,7 +31,8 @@ import Button from 'src/components/Button.vue';
import FilterDropdown from 'src/components/FilterDropdown.vue';
import PageHeader from 'src/components/PageHeader.vue';
import { fyo } from 'src/initFyo';
-import { routeTo } from 'src/utils/ui';
+import { docsPathMap } from 'src/utils/misc';
+import { docsPath, routeTo } from 'src/utils/ui';
import List from './List';
export default {
@@ -56,6 +57,10 @@ export default {
}
this.listConfig = getListConfig(this.schemaName);
+ docsPath.value = docsPathMap[this.schemaName] ?? docsPathMap.Entries;
+ },
+ deactivated() {
+ docsPath.value = '';
},
methods: {
async makeNewDoc() {
diff --git a/src/pages/Report.vue b/src/pages/Report.vue
index 7c3b7084..1053c742 100644
--- a/src/pages/Report.vue
+++ b/src/pages/Report.vue
@@ -43,6 +43,8 @@ import DropdownWithActions from 'src/components/DropdownWithActions.vue';
import PageHeader from 'src/components/PageHeader.vue';
import ListReport from 'src/components/Report/ListReport.vue';
import { fyo } from 'src/initFyo';
+import { docsPathMap } from 'src/utils/misc';
+import { docsPath } from 'src/utils/ui';
import { defineComponent } from 'vue';
export default defineComponent({
@@ -66,6 +68,7 @@ export default defineComponent({
},
components: { PageHeader, FormControl, ListReport, DropdownWithActions },
async activated() {
+ docsPath.value = docsPathMap[this.reportClassName] ?? docsPathMap.Reports;
await this.setReportData();
const filters = JSON.parse(this.defaultFilters);
@@ -82,6 +85,9 @@ export default defineComponent({
window.rep = this;
}
},
+ deactivated() {
+ docsPath.value = '';
+ },
computed: {
title() {
return reports[this.reportClassName]?.title ?? t`Report`;
diff --git a/src/pages/Settings/Settings.vue b/src/pages/Settings/Settings.vue
index d4386b11..da39e8ec 100644
--- a/src/pages/Settings/Settings.vue
+++ b/src/pages/Settings/Settings.vue
@@ -37,7 +37,8 @@ import Icon from 'src/components/Icon.vue';
import PageHeader from 'src/components/PageHeader.vue';
import Row from 'src/components/Row.vue';
import StatusBadge from 'src/components/StatusBadge.vue';
-import { showToast } from 'src/utils/ui';
+import { docsPathMap } from 'src/utils/misc';
+import { docsPath, showToast } from 'src/utils/ui';
import { IPC_MESSAGES } from 'utils/messages';
import { h, markRaw } from 'vue';
import TabGeneral from './TabGeneral.vue';
@@ -82,8 +83,10 @@ export default {
},
activated() {
this.setActiveTab();
+ docsPath.value = docsPathMap.Settings;
},
deactivated() {
+ docsPath.value = '';
if (this.fieldsChanged.length === 0) {
return;
}
diff --git a/src/utils/getStartedConfig.ts b/src/utils/getStartedConfig.ts
index 45717f15..3d9ab882 100644
--- a/src/utils/getStartedConfig.ts
+++ b/src/utils/getStartedConfig.ts
@@ -53,7 +53,7 @@ export function getGetStartedConfig() {
},
fieldname: 'chartOfAccountsReviewed',
documentation:
- 'https://frappebooks.com/docs/setting-up#1-enter-bank-accounts',
+ 'https://docs.frappebooks.com/setting-up/initial-entries.html#add-additional-bank-accounts',
},
{
key: 'Opening Balances',
@@ -62,7 +62,7 @@ export function getGetStartedConfig() {
fieldname: 'openingBalanceChecked',
description: t`Setup your opening balances before performing any accounting entries`,
documentation:
- 'https://frappebooks.com/docs/setting-up#5-setup-opening-balances',
+ 'https://docs.frappebooks.com/setting-up/opening-balances.html',
},
{
key: 'Add Taxes',
@@ -71,7 +71,8 @@ export function getGetStartedConfig() {
fieldname: 'taxesAdded',
description: t`Setup your tax templates for your sales or purchase transactions`,
action: () => routeTo('/list/Tax'),
- documentation: 'https://frappebooks.com/docs/setting-up#2-add-taxes',
+ documentation:
+ 'https://docs.frappebooks.com/setting-up/initial-entries.html#add-taxes',
},
],
},
@@ -86,7 +87,8 @@ export function getGetStartedConfig() {
description: t`Add products or services that you sell to your customers`,
action: () => routeTo(`/list/Item/for/Sales/${t`Sales Items`}`),
fieldname: 'salesItemCreated',
- documentation: 'https://frappebooks.com/docs/setting-up#3-add-items',
+ documentation:
+ 'https://docs.frappebooks.com/setting-up/initial-entries.html#add-sales-items',
},
{
key: 'Add Customers',
@@ -96,16 +98,17 @@ export function getGetStartedConfig() {
action: () => routeTo(`/list/Party/role/Customer/${t`Customers`}`),
fieldname: 'customerCreated',
documentation:
- 'https://frappebooks.com/docs/setting-up#4-add-customers',
+ 'https://docs.frappebooks.com/setting-up/initial-entries.html#add-customers',
},
{
- key: 'Create Invoice',
- label: t`Create Invoice`,
+ key: 'Create Sales Invoice',
+ label: t`Create Sales Invoice`,
icon: 'sales-invoice',
description: t`Create your first invoice and mail it to your customer`,
action: () => routeTo('/list/SalesInvoice'),
fieldname: 'invoiceCreated',
- documentation: 'https://frappebooks.com/docs/invoices',
+ documentation:
+ 'https://docs.frappebooks.com/transactions/sales-invoices.html',
},
],
},
@@ -131,13 +134,14 @@ export function getGetStartedConfig() {
fieldname: 'supplierCreated',
},
{
- key: 'Create Bill',
- label: t`Create Bill`,
+ key: 'Create Purchase Invoice',
+ label: t`Create Purchase Invoice`,
icon: 'purchase-invoice',
description: t`Create your first bill and mail it to your supplier`,
action: () => routeTo('/list/PurchaseInvoice'),
fieldname: 'billCreated',
- documentation: 'https://frappebooks.com/docs/bills',
+ documentation:
+ 'https://docs.frappebooks.com/transactions/purchase-invoices.html',
},
],
},
diff --git a/src/utils/misc.ts b/src/utils/misc.ts
index 6f416ea6..9cd79d27 100644
--- a/src/utils/misc.ts
+++ b/src/utils/misc.ts
@@ -79,3 +79,31 @@ export async function incrementOpenCount(dbPath: string) {
fyo.config.set(ConfigKeys.Files, files);
return openCount;
}
+
+export const docsPathMap: Record