mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 23:35:45 +00:00
feat(FE): Show sales report on closing detail page
This commit is contained in:
@@ -4,6 +4,7 @@ import { useRouter, useSearchParams } from 'next/navigation';
|
|||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
import ClosingDetail from '@/components/pages/closing/ClosingDetail';
|
import ClosingDetail from '@/components/pages/closing/ClosingDetail';
|
||||||
|
import SalesReportTable from '@/components/pages/closing/sale/SalesReportTable';
|
||||||
|
|
||||||
import { ClosingApi } from '@/services/api/closing';
|
import { ClosingApi } from '@/services/api/closing';
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
@@ -19,6 +20,11 @@ const ClosingDetailPage = () => {
|
|||||||
(id: number) => ClosingApi.getGeneralInfo(id)
|
(id: number) => ClosingApi.getGeneralInfo(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { data: salesReport, isLoading: isLoadingSalesReport } = useSWR(
|
||||||
|
closingId,
|
||||||
|
(id: number) => ClosingApi.getPenjualan(id)
|
||||||
|
);
|
||||||
|
|
||||||
if (!closingId) {
|
if (!closingId) {
|
||||||
router.back();
|
router.back();
|
||||||
|
|
||||||
@@ -43,6 +49,9 @@ const ClosingDetailPage = () => {
|
|||||||
{!isLoadingClosing && isResponseSuccess(closing) && (
|
{!isLoadingClosing && isResponseSuccess(closing) && (
|
||||||
<ClosingDetail id={Number(closingId)} initialValue={closing.data} />
|
<ClosingDetail id={Number(closingId)} initialValue={closing.data} />
|
||||||
)}
|
)}
|
||||||
|
{!isLoadingSalesReport && isResponseSuccess(salesReport) && (
|
||||||
|
<SalesReportTable type='detail' initialValues={salesReport.data} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user