From e6f2a8df4e2c93c8c5bcb431f72c4c5014ef6af1 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 6 Mar 2025 11:11:17 +0700 Subject: [PATCH] feat: download report --- src/components/14_report/Expansion.vue | 4 +- src/pages/14_report/MainPage.vue | 61 +++++++++++++++++++++++--- src/stores/report/index.ts | 50 ++++++++++++++++++++- 3 files changed, 106 insertions(+), 9 deletions(-) diff --git a/src/components/14_report/Expansion.vue b/src/components/14_report/Expansion.vue index 581c677b..9f119bbf 100644 --- a/src/components/14_report/Expansion.vue +++ b/src/components/14_report/Expansion.vue @@ -15,9 +15,7 @@ defineProps<{ :default-opened="defaultOpened" > - - - + diff --git a/src/pages/14_report/MainPage.vue b/src/pages/14_report/MainPage.vue index e59a3f55..c96fbe2d 100644 --- a/src/pages/14_report/MainPage.vue +++ b/src/pages/14_report/MainPage.vue @@ -24,6 +24,7 @@ import useFlowStore from 'src/stores/flow'; import { useReportStore } from 'src/stores/report'; import BadgeComponent from 'src/components/BadgeComponent.vue'; import Expansion from 'src/components/14_report/Expansion.vue'; +import { SaveButton } from 'src/components/button'; // NOTE: Variable const navigatorStore = useNavigator(); @@ -166,7 +167,17 @@ watch([() => pageState.currentTab], async () => { - {{ $t('quotation.title') }} + + + {{ $t('quotation.title') }} + + + pageState.currentTab], async () => { - {{ $t('invoice.title') }} + + + {{ $t('invoice.title') }} + + + @@ -200,7 +221,17 @@ watch([() => pageState.currentTab], async () => { - {{ $t('receipt.title') }} + + + {{ $t('receipt.title') }} + + + @@ -217,7 +248,17 @@ watch([() => pageState.currentTab], async () => { - {{ $t('invoice.title') }} + + + {{ $t('invoice.title') }} + + + @@ -233,7 +274,17 @@ watch([() => pageState.currentTab], async () => { - {{ $t('productService.title') }} + + + {{ $t('productService.title') }} + + + (`/${ENDPOINT}/quotation`); if (res.status < 400) { @@ -21,6 +44,13 @@ export async function getReportQuotation() { return null; } +export async function downloadReportInvoice() { + await _download( + baseUrl + '/' + ENDPOINT + '/invoice/download', + 'invoice-report', + ); +} + export async function getReportInvoice() { const res = await api.get(`/${ENDPOINT}/invoice`); if (res.status < 400) { @@ -29,6 +59,13 @@ export async function getReportInvoice() { return null; } +export async function downloadReportReceipt() { + await _download( + baseUrl + '/' + ENDPOINT + '/receipt/download', + 'receipt-report', + ); +} + export async function getReportReceipt() { const res = await api.get(`/${ENDPOINT}/receipt`); if (res.status < 400) { @@ -46,6 +83,13 @@ export async function getReportSale() { return null; } +export async function downloadReportProduct() { + await _download( + baseUrl + '/' + ENDPOINT + '/receipt/download', + 'product-report', + ); +} + export async function getReportProduct() { const res = await api.get(`/${ENDPOINT}/product`); if (res.status < 400) { @@ -78,10 +122,14 @@ export const useReportStore = defineStore('report-store', () => { dataReportProduct, dataReportPayment, + downloadReportQuotation, getReportQuotation, + downloadReportInvoice, getReportInvoice, + downloadReportReceipt, getReportReceipt, getReportSale, + downloadReportProduct, getReportProduct, getReportPayment, };