mirror of
https://github.com/frappe/books.git
synced 2024-12-24 11:55:46 +00:00
Merge pull request #269 from 18alantom/make-onboarding-completeable
fix: make onboarding completable
This commit is contained in:
commit
46af6cebc4
@ -5,52 +5,62 @@ export default {
|
|||||||
{
|
{
|
||||||
fieldname: 'onboardingComplete',
|
fieldname: 'onboardingComplete',
|
||||||
label: 'Onboarding Complete',
|
label: 'Onboarding Complete',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'companySetup',
|
fieldname: 'companySetup',
|
||||||
label: 'Company Setup',
|
label: 'Company Setup',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'systemSetup',
|
fieldname: 'systemSetup',
|
||||||
label: 'System Setup',
|
label: 'System Setup',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'invoiceSetup',
|
fieldname: 'invoiceSetup',
|
||||||
label: 'Invoice Setup',
|
label: 'Invoice Setup',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'itemCreated',
|
fieldname: 'itemCreated',
|
||||||
label: 'Item Created',
|
label: 'Item Created',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'customerCreated',
|
fieldname: 'customerCreated',
|
||||||
label: 'Customer Created',
|
label: 'Customer Created',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'supplierCreated',
|
fieldname: 'supplierCreated',
|
||||||
label: 'Supplier Created',
|
label: 'Supplier Created',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'invoiceCreated',
|
fieldname: 'invoiceCreated',
|
||||||
label: 'Invoice Created',
|
label: 'Invoice Created',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'billCreated',
|
fieldname: 'billCreated',
|
||||||
label: 'Bill Created',
|
label: 'Bill Created',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'chartOfAccountsReviewed',
|
fieldname: 'chartOfAccountsReviewed',
|
||||||
label: 'Chart Of Accounts Reviewed',
|
label: 'Chart Of Accounts Reviewed',
|
||||||
fieldtype: 'Check'
|
fieldtype: 'Check',
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
fieldname: 'openingBalanceChecked',
|
||||||
|
label: 'Opening Balances',
|
||||||
|
fieldtype: 'Check',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: 'taxesAdded',
|
||||||
|
label: 'Add Taxes',
|
||||||
|
fieldtype: 'Check',
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,16 @@
|
|||||||
:key="item.label"
|
:key="item.label"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col justify-between h-full p-6 border rounded-lg cursor-pointer hover:shadow-md"
|
class="
|
||||||
|
flex flex-col
|
||||||
|
justify-between
|
||||||
|
h-full
|
||||||
|
p-6
|
||||||
|
border
|
||||||
|
rounded-lg
|
||||||
|
cursor-pointer
|
||||||
|
hover:shadow-md
|
||||||
|
"
|
||||||
@mouseenter="() => (activeCard = item.key)"
|
@mouseenter="() => (activeCard = item.key)"
|
||||||
@mouseleave="() => (activeCard = null)"
|
@mouseleave="() => (activeCard = null)"
|
||||||
>
|
>
|
||||||
@ -47,16 +56,7 @@
|
|||||||
v-if="item.action"
|
v-if="item.action"
|
||||||
class="leading-tight"
|
class="leading-tight"
|
||||||
type="primary"
|
type="primary"
|
||||||
v-on="
|
@click="handleAction(item)"
|
||||||
item.action
|
|
||||||
? {
|
|
||||||
click: () => {
|
|
||||||
item.action();
|
|
||||||
activeCard = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<span class="text-base text-white">
|
<span class="text-base text-white">
|
||||||
{{ item.actionLabel || _('Setup') }}
|
{{ item.actionLabel || _('Setup') }}
|
||||||
@ -66,7 +66,7 @@
|
|||||||
v-if="item.documentation"
|
v-if="item.documentation"
|
||||||
class="leading-tight"
|
class="leading-tight"
|
||||||
:class="{ 'ml-4': item.action }"
|
:class="{ 'ml-4': item.action }"
|
||||||
@click="visitLink(item.documentation)"
|
@click="handleDocumentation(item)"
|
||||||
>
|
>
|
||||||
<span class="text-base">
|
<span class="text-base">
|
||||||
{{ _('Documentation') }}
|
{{ _('Documentation') }}
|
||||||
@ -97,7 +97,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
PageHeader,
|
PageHeader,
|
||||||
Button,
|
Button,
|
||||||
Icon
|
Icon,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
sections() {
|
sections() {
|
||||||
@ -113,7 +113,10 @@ export default {
|
|||||||
icon: 'general',
|
icon: 'general',
|
||||||
description:
|
description:
|
||||||
'Setup your company information, email, country and fiscal year',
|
'Setup your company information, email, country and fiscal year',
|
||||||
fieldname: 'companySetup'
|
fieldname: 'companySetup',
|
||||||
|
action() {
|
||||||
|
openSettings('General');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'System',
|
key: 'System',
|
||||||
@ -124,7 +127,7 @@ export default {
|
|||||||
fieldname: 'systemSetup',
|
fieldname: 'systemSetup',
|
||||||
action() {
|
action() {
|
||||||
openSettings('System');
|
openSettings('System');
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'Invoice',
|
key: 'Invoice',
|
||||||
@ -135,9 +138,9 @@ export default {
|
|||||||
fieldname: 'invoiceSetup',
|
fieldname: 'invoiceSetup',
|
||||||
action() {
|
action() {
|
||||||
openSettings('Invoice');
|
openSettings('Invoice');
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: _('Accounts'),
|
label: _('Accounts'),
|
||||||
@ -151,32 +154,33 @@ export default {
|
|||||||
'Review your chart of accounts, add any account or tax heads as needed',
|
'Review your chart of accounts, add any account or tax heads as needed',
|
||||||
action: () => {
|
action: () => {
|
||||||
routeTo('/chart-of-accounts');
|
routeTo('/chart-of-accounts');
|
||||||
this.updateChecks({ chartOfAccountsReviewed: 1 });
|
|
||||||
},
|
},
|
||||||
fieldname: 'chartOfAccountsReviewed',
|
fieldname: 'chartOfAccountsReviewed',
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#1-enter-bank-accounts'
|
'https://frappebooks.com/docs/setting-up#1-enter-bank-accounts',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'Opening Balances',
|
key: 'Opening Balances',
|
||||||
label: _('Opening Balances'),
|
label: _('Opening Balances'),
|
||||||
icon: 'opening-ac',
|
icon: 'opening-ac',
|
||||||
|
fieldname: 'openingBalanceChecked',
|
||||||
description:
|
description:
|
||||||
'Setup your opening balances before performing any accounting entries',
|
'Setup your opening balances before performing any accounting entries',
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#5-setup-opening-balances'
|
'https://frappebooks.com/docs/setting-up#5-setup-opening-balances',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'Add Taxes',
|
key: 'Add Taxes',
|
||||||
label: _('Add Taxes'),
|
label: _('Add Taxes'),
|
||||||
icon: 'percentage',
|
icon: 'percentage',
|
||||||
|
fieldname: 'taxesAdded',
|
||||||
description:
|
description:
|
||||||
'Setup your tax templates for your sales or purchase transactions',
|
'Setup your tax templates for your sales or purchase transactions',
|
||||||
action: () => routeTo('/list/Tax'),
|
action: () => routeTo('/list/Tax'),
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#2-add-taxes'
|
'https://frappebooks.com/docs/setting-up#2-add-taxes',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: _('Sales'),
|
label: _('Sales'),
|
||||||
@ -191,7 +195,7 @@ export default {
|
|||||||
action: () => routeTo('/list/Item'),
|
action: () => routeTo('/list/Item'),
|
||||||
fieldname: 'itemCreated',
|
fieldname: 'itemCreated',
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#3-add-items'
|
'https://frappebooks.com/docs/setting-up#3-add-items',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'Add Customers',
|
key: 'Add Customers',
|
||||||
@ -201,7 +205,7 @@ export default {
|
|||||||
action: () => routeTo('/list/Customer'),
|
action: () => routeTo('/list/Customer'),
|
||||||
fieldname: 'customerCreated',
|
fieldname: 'customerCreated',
|
||||||
documentation:
|
documentation:
|
||||||
'https://frappebooks.com/docs/setting-up#4-add-customers'
|
'https://frappebooks.com/docs/setting-up#4-add-customers',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'Create Invoice',
|
key: 'Create Invoice',
|
||||||
@ -211,9 +215,9 @@ export default {
|
|||||||
'Create your first invoice and mail it to your customer',
|
'Create your first invoice and mail it to your customer',
|
||||||
action: () => routeTo('/list/SalesInvoice'),
|
action: () => routeTo('/list/SalesInvoice'),
|
||||||
fieldname: 'invoiceCreated',
|
fieldname: 'invoiceCreated',
|
||||||
documentation: 'https://frappebooks.com/docs/invoices'
|
documentation: 'https://frappebooks.com/docs/invoices',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: _('Purchase'),
|
label: _('Purchase'),
|
||||||
@ -226,7 +230,7 @@ export default {
|
|||||||
description:
|
description:
|
||||||
'Add products or services that you buy from your suppliers',
|
'Add products or services that you buy from your suppliers',
|
||||||
action: () => routeTo('/list/Item'),
|
action: () => routeTo('/list/Item'),
|
||||||
fieldname: 'itemCreated'
|
fieldname: 'itemCreated',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'Add Suppliers',
|
key: 'Add Suppliers',
|
||||||
@ -234,7 +238,7 @@ export default {
|
|||||||
icon: 'supplier',
|
icon: 'supplier',
|
||||||
description: 'Add a few suppliers to create your first bill',
|
description: 'Add a few suppliers to create your first bill',
|
||||||
action: () => routeTo('/list/Supplier'),
|
action: () => routeTo('/list/Supplier'),
|
||||||
fieldname: 'supplierCreated'
|
fieldname: 'supplierCreated',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'Create Bill',
|
key: 'Create Bill',
|
||||||
@ -244,16 +248,16 @@ export default {
|
|||||||
'Create your first bill and mail it to your supplier',
|
'Create your first bill and mail it to your supplier',
|
||||||
action: () => routeTo('/list/PurchaseInvoice'),
|
action: () => routeTo('/list/PurchaseInvoice'),
|
||||||
fieldname: 'billCreated',
|
fieldname: 'billCreated',
|
||||||
documentation: 'https://frappebooks.com/docs/bills'
|
documentation: 'https://frappebooks.com/docs/bills',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeCard: null
|
activeCard: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async activated() {
|
async activated() {
|
||||||
@ -261,9 +265,61 @@ export default {
|
|||||||
this.checkForCompletedTasks();
|
this.checkForCompletedTasks();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async handleDocumentation({ key, documentation }) {
|
||||||
|
if (documentation) {
|
||||||
|
ipcRenderer.send(IPC_MESSAGES.OPEN_EXTERNAL, documentation);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 'Opening Balances':
|
||||||
|
await this.updateChecks({ openingBalanceChecked: 1 });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handleAction({ key, action }) {
|
||||||
|
if (action) {
|
||||||
|
action();
|
||||||
|
this.activeCard = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 'General':
|
||||||
|
await this.updateChecks({ companySetup: 1 });
|
||||||
|
break;
|
||||||
|
case 'System':
|
||||||
|
await this.updateChecks({ systemSetup: 1 });
|
||||||
|
break;
|
||||||
|
case 'Review Accounts':
|
||||||
|
await this.updateChecks({ chartOfAccountsReviewed: 1 });
|
||||||
|
break;
|
||||||
|
case 'Add Taxes':
|
||||||
|
await this.updateChecks({ taxesAdded: 1 });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async checkIsOnboardingComplete() {
|
||||||
|
if (frappe.GetStarted.onboardingComplete) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = await frappe.getMeta('GetStarted');
|
||||||
|
const doc = await frappe.getSingle('GetStarted');
|
||||||
|
const onboardingComplete = !!meta.fields
|
||||||
|
.filter(({ fieldname }) => fieldname !== 'onboardingComplete')
|
||||||
|
.map(({ fieldname }) => doc.get(fieldname))
|
||||||
|
.every(Boolean);
|
||||||
|
|
||||||
|
if (onboardingComplete) {
|
||||||
|
await this.updateChecks({ onboardingComplete });
|
||||||
|
const systemSettings = await frappe.getSingle('SystemSettings');
|
||||||
|
await systemSettings.update({ hideGetStarted: 1 });
|
||||||
|
}
|
||||||
|
|
||||||
|
return onboardingComplete;
|
||||||
|
},
|
||||||
async checkForCompletedTasks() {
|
async checkForCompletedTasks() {
|
||||||
let toUpdate = {};
|
let toUpdate = {};
|
||||||
if (frappe.GetStarted.onboardingCompleted) {
|
if (await this.checkIsOnboardingComplete()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,11 +384,6 @@ export default {
|
|||||||
await frappe.GetStarted.update(toUpdate);
|
await frappe.GetStarted.update(toUpdate);
|
||||||
frappe.GetStarted = await frappe.getSingle('GetStarted');
|
frappe.GetStarted = await frappe.getSingle('GetStarted');
|
||||||
},
|
},
|
||||||
visitLink(link) {
|
|
||||||
if (link) {
|
|
||||||
ipcRenderer.send(IPC_MESSAGES.OPEN_EXTERNAL, link);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isCompleted(item) {
|
isCompleted(item) {
|
||||||
return frappe.GetStarted.get(item.fieldname) || 0;
|
return frappe.GetStarted.get(item.fieldname) || 0;
|
||||||
},
|
},
|
||||||
@ -347,14 +398,14 @@ export default {
|
|||||||
props: Object.assign(
|
props: Object.assign(
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
size
|
size,
|
||||||
},
|
},
|
||||||
this.$attrs
|
this.$attrs
|
||||||
)
|
),
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -41,7 +41,6 @@ export default async function setupCompany(setupWizardValues) {
|
|||||||
await setupRegionalChanges(country);
|
await setupRegionalChanges(country);
|
||||||
updateCompanyNameInConfig();
|
updateCompanyNameInConfig();
|
||||||
|
|
||||||
await frappe.GetStarted.update({ systemSetup: 1, companySetup: 1 });
|
|
||||||
await accountingSettings.update({ setupComplete: 1 });
|
await accountingSettings.update({ setupComplete: 1 });
|
||||||
frappe.AccountingSettings = accountingSettings;
|
frappe.AccountingSettings = accountingSettings;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user