+
{
]"
:series="[
{
- data: true
- ? []
- : [
- quotationStats.issued || 0,
- quotationStats.accepted +
- quotationStats.paymentInProcess +
- quotationStats.paymentSuccess || 1,
- quotationStats.processComplete || 1,
- quotationStats.canceled || 1,
- ],
+ data: [
+ (quotationStats.issued || 0) +
+ (quotationStats.accepted || 0),
+ (quotationStats.paymentInProcess || 0) +
+ (quotationStats.paymentSuccess || 0),
+ quotationStats.processComplete || 0,
+ quotationStats.canceled || 0,
+ ],
},
]"
/>
-
+
diff --git a/src/pages/15_dash-board/chart/ChartReceipt.vue b/src/pages/15_dash-board/chart/ChartReceipt.vue
index b48db65a..8b470064 100644
--- a/src/pages/15_dash-board/chart/ChartReceipt.vue
+++ b/src/pages/15_dash-board/chart/ChartReceipt.vue
@@ -6,19 +6,20 @@ import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
const { locale } = useI18n({ useScope: 'global' });
-withDefaults(
+const prop = withDefaults(
defineProps<{
series: { name: string; data: number[] }[];
summary: number[];
+ categories: string[];
}>(),
{
series: () => [
{ name: 'series-1', data: [0, 0] },
{ name: 'series-2', data: [1, 1] },
{ name: 'series-3', data: [2, 2] },
- { name: 'series-4', data: [3, 3] },
],
summary: () => [0, 0, 0, 0],
+ categories: () => ['Jan', 'Feb', 'Mar'],
},
);
const chartOptions = computed(() => {
@@ -50,23 +51,7 @@ const chartOptions = computed(() => {
position: 'right',
},
xaxis: {
- categories:
- locale.value === 'tha'
- ? thaiMonths
- : [
- 'Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec',
- ],
+ categories: prop.categories,
},
};
});
@@ -87,11 +72,6 @@ const detail = [
color: 'var(--orange-4)',
icon: 'material-symbols-light:credit-card-outline',
},
- {
- label: 'cancel',
- color: 'var(--pink-7)',
- icon: 'hugeicons:wallet-remove-02',
- },
];
diff --git a/src/stores/report/index.ts b/src/stores/report/index.ts
index 0f0ab14f..7686236c 100644
--- a/src/stores/report/index.ts
+++ b/src/stores/report/index.ts
@@ -2,7 +2,13 @@ import { ref } from 'vue';
import { defineStore } from 'pinia';
import { Pagination, Status } from '../types';
import { api } from 'src/boot/axios';
-import { Report, ReportProduct, ReportQuotation, ReportSale } from './types';
+import {
+ Report,
+ ReportPayment,
+ ReportProduct,
+ ReportQuotation,
+ ReportSale,
+} from './types';
const ENDPOINT = 'report';
@@ -48,12 +54,21 @@ export async function getReportProduct() {
return null;
}
+export async function getReportPayment() {
+ const res = await api.get(`/${ENDPOINT}/payment`);
+ if (res.status < 400) {
+ return res.data;
+ }
+ return null;
+}
+
export const useReportStore = defineStore('report-store', () => {
const dataReportQuotation = ref([]);
const dataReportInvoice = ref([]);
const dataReportReceipt = ref([]);
const dataReportSale = ref();
const dataReportProduct = ref([]);
+ const dataReportPayment = ref([]);
return {
dataReportQuotation,
@@ -61,11 +76,13 @@ export const useReportStore = defineStore('report-store', () => {
dataReportReceipt,
dataReportSale,
dataReportProduct,
+ dataReportPayment,
getReportQuotation,
getReportInvoice,
getReportReceipt,
getReportSale,
getReportProduct,
+ getReportPayment,
};
});
diff --git a/src/stores/report/types.ts b/src/stores/report/types.ts
index 92215ae3..1f057af2 100644
--- a/src/stores/report/types.ts
+++ b/src/stores/report/types.ts
@@ -2,6 +2,7 @@ import { QuotationStatus } from 'src/stores/quotations/types';
import { ProductGroup } from '../product-service/types';
import { User } from '../user';
import { CustomerBranch } from '../customer';
+import { PaymentDataStatus } from '../payment/types';
export type ReportQuotation = {
updatedAt: Date | null;
@@ -34,6 +35,12 @@ export type ReportProduct = {
code: string;
};
+export type ReportPayment = {
+ year: string;
+ month: string;
+ data: Partial>;
+};
+
export type ReportSale = {
byCustomer: (Omit & { _count: number })[];
bySale: (User & { _count: number })[];