+
+
{{ t`Paid` }}
+
{{ invoices[idx]?.paidCount ?? 0 }}
+
+
+
{{ t`Unpaid` }}
+
{{ invoices[idx]?.unpaidCount ?? 0 }}
+
+
diff --git a/src/pages/GetStarted.vue b/src/pages/GetStarted.vue
index 0d24d407..82eff24f 100644
--- a/src/pages/GetStarted.vue
+++ b/src/pages/GetStarted.vue
@@ -166,43 +166,40 @@ export default {
return;
}
- if (!fyo.singles.GetStarted.itemCreated) {
- const count = await fyo.db.count('Item');
- if (count > 0) {
- toUpdate.itemCreated = 1;
- }
+ if (!fyo.singles.GetStarted.salesItemCreated) {
+ const count = await fyo.db.count('Item', { filters: { for: 'Sales' } });
+ toUpdate.salesItemCreated = count > 0;
+ }
+
+ if (!fyo.singles.GetStarted.purchaseItemCreated) {
+ const count = await fyo.db.count('Item', {
+ filters: { for: 'Purchases' },
+ });
+ toUpdate.purchaseItemCreated = count > 0;
}
if (!fyo.singles.GetStarted.invoiceCreated) {
const count = await fyo.db.count('SalesInvoice');
- if (count > 0) {
- toUpdate.invoiceCreated = 1;
- }
+ toUpdate.invoiceCreated = count > 0;
}
if (!fyo.singles.GetStarted.customerCreated) {
- const count = fyo.db.count('Party', {
+ const count = await fyo.db.count('Party', {
filters: { role: 'Customer' },
});
- if (count > 0) {
- toUpdate.customerCreated = 1;
- }
+ toUpdate.customerCreated = count > 0;
}
if (!fyo.singles.GetStarted.billCreated) {
const count = await fyo.db.count('SalesInvoice');
- if (count > 0) {
- toUpdate.billCreated = 1;
- }
+ toUpdate.billCreated = count > 0;
}
if (!fyo.singles.GetStarted.supplierCreated) {
- const count = fyo.db.count('Party', {
+ const count = await fyo.db.count('Party', {
filters: { role: 'Supplier' },
});
- if (count > 0) {
- toUpdate.supplierCreated = 1;
- }
+ toUpdate.supplierCreated = count > 0;
}
await this.updateChecks(toUpdate);
},
@@ -211,10 +208,10 @@ export default {
await fyo.doc.getSingle('GetStarted');
},
isCompleted(item) {
- return fyo.singles.GetStarted.get(item.fieldname) || 0;
+ return fyo.singles.GetStarted.get(item.fieldname) || false;
},
getIconComponent(item) {
- let completed = fyo.singles.GetStarted[item.fieldname] || 0;
+ let completed = fyo.singles.GetStarted[item.fieldname] || false;
let name = completed ? 'green-check' : item.icon;
let size = completed ? '24' : '18';
return {
diff --git a/src/utils/getStartedConfig.ts b/src/utils/getStartedConfig.ts
index 6f195c62..45717f15 100644
--- a/src/utils/getStartedConfig.ts
+++ b/src/utils/getStartedConfig.ts
@@ -84,8 +84,8 @@ export function getGetStartedConfig() {
label: t`Add Items`,
icon: 'item',
description: t`Add products or services that you sell to your customers`,
- action: () => routeTo('/list/Item'),
- fieldname: 'itemCreated',
+ action: () => routeTo(`/list/Item/for/Sales/${t`Sales Items`}`),
+ fieldname: 'salesItemCreated',
documentation: 'https://frappebooks.com/docs/setting-up#3-add-items',
},
{
@@ -93,7 +93,7 @@ export function getGetStartedConfig() {
label: t`Add Customers`,
icon: 'customer',
description: t`Add a few customers to create your first invoice`,
- action: () => routeTo('/list/Customer'),
+ action: () => routeTo(`/list/Party/role/Customer/${t`Customers`}`),
fieldname: 'customerCreated',
documentation:
'https://frappebooks.com/docs/setting-up#4-add-customers',
@@ -118,15 +118,16 @@ export function getGetStartedConfig() {
label: t`Add Items`,
icon: 'item',
description: t`Add products or services that you buy from your suppliers`,
- action: () => routeTo('/list/Item'),
- fieldname: 'itemCreated',
+ action: () =>
+ routeTo(`/list/Item/for/Purchases/${t`Purchase Items`}`),
+ fieldname: 'purchaseItemCreated',
},
{
key: 'Add Suppliers',
label: t`Add Suppliers`,
icon: 'supplier',
description: t`Add a few suppliers to create your first bill`,
- action: () => routeTo('/list/Supplier'),
+ action: () => routeTo(`/list/Party/role/Supplier/${t`Suppliers`}`),
fieldname: 'supplierCreated',
},
{
diff --git a/src/utils/misc.ts b/src/utils/misc.ts
index 92965fa4..f4e18e18 100644
--- a/src/utils/misc.ts
+++ b/src/utils/misc.ts
@@ -7,9 +7,9 @@ import SetupWizardSchema from 'schemas/app/SetupWizard.json';
import { Schema } from 'schemas/types';
import { fyo } from 'src/initFyo';
-export function getDatesAndPeriodicity(
+export function getDatesAndPeriodList(
period: 'This Year' | 'This Quarter' | 'This Month'
-): { fromDate: string; toDate: string } {
+): { periodList: DateTime[]; fromDate: string; toDate: string } {
const toDate: DateTime = DateTime.now();
let fromDate: DateTime;
@@ -23,7 +23,22 @@ export function getDatesAndPeriodicity(
fromDate = toDate.minus({ days: 1 });
}
+ /**
+ * periodList: Monthly decrements before toDate until fromDate
+ */
+ const periodList: DateTime[] = [toDate];
+ while (true) {
+ const nextDate = periodList.at(0)!.minus({ months: 1 });
+ if (nextDate.toMillis() < fromDate.toMillis()) {
+ break;
+ }
+
+ periodList.unshift(nextDate);
+ }
+ periodList.shift();
+
return {
+ periodList,
fromDate: fromDate.toISO(),
toDate: toDate.toISO(),
};
diff --git a/src/utils/vueUtils.ts b/src/utils/vueUtils.ts
index 93b2c88d..8a476256 100644
--- a/src/utils/vueUtils.ts
+++ b/src/utils/vueUtils.ts
@@ -29,3 +29,21 @@ export function useKeys(callback?: (keys: Set
) => void) {
return keys;
}
+
+export function useMouseLocation() {
+ const loc = ref({ clientX: 0, clientY: 0 });
+
+ const mousemoveListener = (e: MouseEvent) => {
+ loc.value.clientX = e.clientX;
+ loc.value.clientY = e.clientY;
+ };
+
+ onMounted(() => {
+ window.addEventListener('mousemove', mousemoveListener);
+ });
+ onUnmounted(() => {
+ window.removeEventListener('mousemove', mousemoveListener);
+ });
+
+ return loc;
+}