diff --git a/src/components/FloatingActionsButton.tsx b/src/components/FloatingActionsButton.tsx index 974ca280..9bfbb1a1 100644 --- a/src/components/FloatingActionsButton.tsx +++ b/src/components/FloatingActionsButton.tsx @@ -39,8 +39,8 @@ const FloatingActionsButton = ({ // Jika tidak ada baris yang dipilih, jangan tampilkan FAB const positionStyles = selectedRowIds.length > 0 - ? 'bottom-[10%] opacity-100' - : 'bottom-[-10%] opacity-0'; + ? 'bottom-[5%] opacity-100' + : 'bottom-[-5%] opacity-0'; // Helper untuk menentukan gaya warna tombol approval const getApprovalColor = (action: 'APPROVED' | 'REJECTED') => { @@ -60,7 +60,7 @@ const FloatingActionsButton = ({ // Container utama FAB
; - deleteClickHandler: () => void; -}) => { - return ( -
-
- - - - {props.row.original.approval.step_name === 'Aktif' && ( - - - - )} - {props.row.original.approval.step_name === 'Pengajuan' && ( - - - - )} - - - -
-
- ); -}; - const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { const { state: tableFilterState, @@ -149,8 +71,6 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { ); const [periodInputValue, setPeriodInputValue] = useState(null); const [sorting, setSorting] = useState([]); - const [selectedProjectFlock, setSelectedProjectFlock] = - useState(); const deleteModal = useModal(); const confirmModal = useModal(); const [approvalAction, setApprovalAction] = useState<'APPROVED' | 'REJECTED'>( @@ -221,10 +141,6 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { : []; // ====== HANDLER ====== - const pageSizeChangeHandler = (val: OptionType | OptionType[] | null) => { - const newVal = val as OptionType; - setPageSize(newVal.value as number); - }; const confirmationModalDeleteClickHandler = async () => { setIsDeleteLoading(true); @@ -292,12 +208,146 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { const canApprove = useMemo(() => { if (!selectedSingleRow || isApproveLoading) return false; - const isPengajuan = selectedSingleRow.approval.step_number == 1; - const isNotRejected = selectedSingleRow.approval.action != 'REJECTED'; + const isPengajuan = selectedSingleRow.approval?.step_number == 1; + const isNotRejected = selectedSingleRow.approval?.action != 'REJECTED'; return isPengajuan && isNotRejected; }, [selectedSingleRow, isApproveLoading]); + // ====== COLUMNS ====== + const columns = useMemo[]>( + () => [ + { + id: 'select', + header: ({ table }) => { + const allRows = table.getRowModel().rows; + const selectableRows = allRows; + + const allSelected = + selectableRows.every((row) => row.getIsSelected()) && + selectableRows.length != 0; + + const someSelected = + selectableRows.some((row) => row.getIsSelected()) && !allSelected; + + const toggleSelectableRows = () => { + const shouldSelect = !allSelected; + selectableRows.forEach((row) => row.toggleSelected(shouldSelect)); + }; + + return ( +
+ +
+ ); + }, + cell: ({ row }) => { + return ( + + ); + }, + }, + + { + accessorKey: 'flock_name', + header: 'Flock', + }, + { + accessorKey: 'area.name', + header: 'Area', + }, + { + accessorKey: 'location.name', + header: 'Lokasi', + }, + { + accessorKey: 'fcr.name', + header: 'FCR', + }, + { + accessorKey: 'category', + header: 'Kategori', + }, + { + accessorKey: 'approval.step_name', + header: 'Status', + cell: (props) => { + const approval = props.row.original.approval; + + return ( + + + {approval?.step_name} + + ); + }, + }, + { + header: 'Kandang', + cell: (props) => { + const kandang = props.row.original.kandangs; + if (kandang) { + const kandangNames = kandang.map((k: Kandang) => k.name); + return ( +
+ {kandangNames.length > 0 + ? kandangNames.join(', ') + : 'Tidak ada'} +
+ ); + } else { + return '-'; + } + }, + }, + { + accessorKey: 'period', + header: 'Periode', + }, + { + accessorKey: 'created_at', + header: 'Dibuat pada', + cell: (props) => + formatDate(props.row.original.created_at, 'MMM DD, YYYY'), + }, + ], + [] + ); + return ( <>
@@ -320,7 +370,7 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => {
void }) => { type='number' label='Periode' placeholder='Masukan periode' - value={periodInputValue ?? ''} + value={periodInputValue?.toString() ?? ''} onChange={(e) => { setPeriodInputValue(parseInt(e.target.value)); updateFilter('periodFilter', e.target.value); }} /> -
data={isResponseSuccess(projectFlocks) ? projectFlocks?.data : []} - columns={[ - { - id: 'select', - header: ({ table }) => { - const allRows = table.getRowModel().rows; - const selectableRows = allRows; - - const allSelected = - selectableRows.every((row) => row.getIsSelected()) && - selectableRows.length != 0; - - const someSelected = - selectableRows.some((row) => row.getIsSelected()) && - !allSelected; - - const toggleSelectableRows = () => { - const shouldSelect = !allSelected; - selectableRows.forEach((row) => - row.toggleSelected(shouldSelect) - ); - }; - - return ( -
- -
- ); - }, - cell: ({ row }) => { - return ( - - ); - }, - }, - - { - accessorKey: 'flock_name', - header: 'Flock', - }, - { - accessorKey: 'area.name', - header: 'Area', - }, - { - accessorKey: 'location.name', - header: 'Lokasi', - }, - { - accessorKey: 'fcr.name', - header: 'FCR', - }, - { - accessorKey: 'category', - header: 'Kategori', - }, - { - accessorKey: 'approval.step_name', - header: 'Status', - cell: (props) => { - const approval = props.row.original.approval; - - return ( - - - {approval.step_name} - - ); - }, - }, - { - header: 'Kandang', - cell: (props) => { - const kandang = props.row.original.kandangs; - if (kandang) { - const kandangNames = kandang.map((k: Kandang) => k.name); - return ( -
- {kandangNames.length > 0 - ? kandangNames.join(', ') - : 'Tidak ada'} -
- ); - } else { - return '-'; - } - }, - }, - { - accessorKey: 'period', - header: 'Periode', - }, - { - accessorKey: 'created_at', - header: 'Dibuat pada', - cell: (props) => - formatDate(props.row.original.created_at, 'MMM DD, YYYY'), - }, - ]} + columns={columns} pageSize={tableFilterState.pageSize} page={ isResponseSuccess(projectFlocks) ? projectFlocks?.meta?.page : 0 @@ -545,7 +453,12 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { ? projectFlocks?.meta?.total_results : 0 } - onPageChange={setPage} + onPageChange={(page) => { + setPage(page); + }} + onPageSizeChange={(pageSize) => { + setPageSize(pageSize); + }} isLoading={isLoading} sorting={sorting} setSorting={setSorting} @@ -553,9 +466,9 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { setRowSelection={setRowSelection} className={{ containerClassName: cn({ - 'mb-20': + 'mb-40': isResponseSuccess(projectFlocks) && - projectFlocks?.data?.length === 0, + projectFlocks?.data?.length > 0, }), tableWrapperClassName: 'overflow-x-auto min-h-full!', tableClassName: 'font-inter w-full table-auto min-h-full!', diff --git a/src/components/pages/report/finance/export/DebtSupllierExportPDF.tsx b/src/components/pages/report/finance/export/DebtSupllierExportPDF.tsx index 42d27847..7f6fa45b 100644 --- a/src/components/pages/report/finance/export/DebtSupllierExportPDF.tsx +++ b/src/components/pages/report/finance/export/DebtSupllierExportPDF.tsx @@ -155,7 +155,7 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { {/* Title and Supplier Info */} - Laporan > Hutang Supplier + Laporan > Rekapitulasi Hutang ke Supplier {supplierReport.supplier.name} @@ -169,19 +169,19 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { No - + No. PR - + No. PO - Tgl PR + Tgl Terima Tgl PO - + Aging @@ -194,15 +194,15 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { Tgl Jatuh Tempo - Status JT + Status Jatuh Tempo - + Total Harga - + Pembayaran - + Hutang @@ -227,23 +227,31 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { {index + 1} - + {item.pr_number || '-'} - + {item.po_number || '-'} - {item.pr_date ? formatDate(item.pr_date, 'DD MMM YY') : '-'} + {item.received_date + ? item.received_date != '-' + ? formatDate(item.received_date, 'DD MMM YY') + : '-' + : '-'} - {item.po_date ? formatDate(item.po_date, 'DD MMM YY') : '-'} + {item.po_date + ? item.po_date != '-' + ? formatDate(item.po_date, 'DD MMM YY') + : '-' + : '-'} - + {formatNumber(item.aging)} Hari @@ -255,20 +263,43 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { {item.due_date - ? formatDate(item.due_date, 'DD MMM YY') + ? item.due_date != '-' + ? formatDate(item.due_date, 'DD MMM YY') + : '-' : '-'} {item.due_status || '-'} - + {formatCurrency(item.total_price)} - + {formatCurrency(item.payment_price)} - + {formatCurrency(item.debt_price)} @@ -286,7 +317,10 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { Total - + + + + @@ -295,10 +329,7 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { - - - - + {formatNumber(supplierReport.total.aging)} Hari @@ -313,17 +344,46 @@ const createPDFDocument = (params: DebtSupplierExportPDFParams) => { - + {formatCurrency(supplierReport.total.total_price)} - + {formatCurrency(supplierReport.total.payment_price)} - + {formatCurrency(supplierReport.total.debt_price)} diff --git a/src/components/pages/report/finance/export/DebtSupplierExportXLSX.tsx b/src/components/pages/report/finance/export/DebtSupplierExportXLSX.tsx index 820ba7ec..58b07e30 100644 --- a/src/components/pages/report/finance/export/DebtSupplierExportXLSX.tsx +++ b/src/components/pages/report/finance/export/DebtSupplierExportXLSX.tsx @@ -1,7 +1,7 @@ 'use client'; import * as XLSX from 'xlsx'; -import { formatDate, formatCurrency, formatNumber } from '@/lib/helper'; +import { formatDate } from '@/lib/helper'; import { DebtSupplier } from '@/types/api/report/debt-supplier'; interface DebtSupplierExportExcelParams { @@ -26,22 +26,28 @@ export const generateDebtSupplierExcel = ( No: index + 1, 'Nomor PR': item.pr_number || '', 'Nomor PO': item.po_number || '', - 'Tanggal PR': item.pr_date - ? formatDate(item.pr_date, 'DD MMM YYYY') - : '', + 'Tanggal Terima': item.received_date + ? item.received_date != '-' + ? formatDate(item.received_date, 'MM/DD/YYYY') + : '-' + : '-', 'Tanggal PO': item.po_date - ? formatDate(item.po_date, 'DD MMM YYYY') - : '', - 'Aging (Hari)': formatNumber(item.aging || 0), + ? item.po_date != '-' + ? formatDate(item.po_date, 'MM/DD/YYYY') + : '-' + : '-', + 'Aging (Hari)': item.aging || 0, Area: item.area?.name || '', Gudang: item.warehouse?.name || '', 'Tanggal Jatuh Tempo': item.due_date - ? formatDate(item.due_date, 'DD MMM YYYY') - : '', + ? item.due_date != '-' + ? formatDate(item.due_date, 'MM/DD/YYYY') + : '-' + : '-', 'Status Jatuh Tempo': item.due_status || '', - 'Total Harga': formatCurrency(item.total_price || 0), - 'Harga Pembayaran': formatCurrency(item.payment_price || 0), - 'Harga Hutang': formatCurrency(item.debt_price || 0), + 'Total Harga': item.total_price || 0, + 'Harga Pembayaran': item.payment_price || 0, + 'Harga Hutang': item.debt_price || 0, Status: item.status || '', 'Nomor Perjalanan': item.travel_number || '', }) @@ -52,18 +58,16 @@ export const generateDebtSupplierExcel = ( No: 'Total', 'Nomor PR': '', 'Nomor PO': '', - 'Tanggal PR': '', + 'Tanggal Terima': '', 'Tanggal PO': '', - 'Aging (Hari)': formatNumber(supplierReport.total.aging || 0), + 'Aging (Hari)': supplierReport.total.aging || 0, Area: '', Gudang: '', 'Tanggal Jatuh Tempo': '', 'Status Jatuh Tempo': '', - 'Total Harga': formatCurrency(supplierReport.total.total_price || 0), - 'Harga Pembayaran': formatCurrency( - supplierReport.total.payment_price || 0 - ), - 'Harga Hutang': formatCurrency(supplierReport.total.debt_price || 0), + 'Total Harga': supplierReport.total.total_price || 0, + 'Harga Pembayaran': supplierReport.total.payment_price || 0, + 'Harga Hutang': supplierReport.total.debt_price || 0, Status: '', 'Nomor Perjalanan': '', }); diff --git a/src/components/pages/report/finance/tab/DebtSupplierTab.tsx b/src/components/pages/report/finance/tab/DebtSupplierTab.tsx index c8df2120..1cad0397 100644 --- a/src/components/pages/report/finance/tab/DebtSupplierTab.tsx +++ b/src/components/pages/report/finance/tab/DebtSupplierTab.tsx @@ -53,7 +53,7 @@ const DebtSupplierTab = () => { const dataTypeOptions = useMemo( () => [ - { value: 'do_date', label: 'Tanggal Terima' }, + { value: 'received_date', label: 'Tanggal Terima' }, { value: 'po_date', label: 'Tanggal PO' }, ], [] @@ -96,7 +96,7 @@ const DebtSupplierTab = () => { filterSupplier.length > 0 ? filterSupplier.map((v) => String(v.value)).join(',') : undefined, - filter_by: filterDataType?.value || 'do_date', + filter_by: filterDataType?.value || 'received_date', start_date: filterStartDate || undefined, end_date: filterEndDate || undefined, page: currentPage, @@ -141,7 +141,7 @@ const DebtSupplierTab = () => { filterSupplier.length > 0 ? filterSupplier.map((v) => String(v.value)).join(',') : undefined, - filter_by: 'do_date' as const, + filter_by: 'received_date' as const, start_date: filterStartDate || undefined, end_date: filterEndDate || undefined, date_type: filterDataType ? filterDataType.value : undefined, @@ -256,12 +256,16 @@ const DebtSupplierTab = () => { }, }, { - id: 'pr_date', - header: 'Tanggal PR', - accessorKey: 'pr_date', + id: 'received_date', + header: 'Tanggal Terima', + accessorKey: 'received_date', cell: (props) => { - const value = props.row.original.pr_date; - return formatDate(value, 'DD MMM YYYY'); + const value = props.row.original.received_date; + return value + ? value != '-' + ? formatDate(value, 'DD MMM YYYY') + : '-' + : '-'; }, }, { @@ -270,7 +274,11 @@ const DebtSupplierTab = () => { accessorKey: 'po_date', cell: (props) => { const value = props.row.original.po_date; - return formatDate(value, 'DD MMM YYYY'); + return value + ? value != '-' + ? formatDate(value, 'DD MMM YYYY') + : '-' + : '-'; }, }, { @@ -310,7 +318,11 @@ const DebtSupplierTab = () => { accessorKey: 'due_date', cell: (props) => { const value = props.row.original.due_date; - return formatDate(value, 'DD MMM YYYY'); + return value + ? value != '-' + ? formatDate(value, 'DD MMM YYYY') + : '-' + : '-'; }, }, { @@ -328,11 +340,19 @@ const DebtSupplierTab = () => { accessorKey: 'total_price', cell: (props) => { const value = props.row.original.total_price; - return
{formatCurrency(value)}
; + return ( +
+ {formatCurrency(value)} +
+ ); }, footer: () => { const value = supplier.total.total_price; - return
{formatCurrency(value)}
; + return ( +
+ {formatCurrency(value)} +
+ ); }, }, { @@ -341,11 +361,19 @@ const DebtSupplierTab = () => { accessorKey: 'payment_price', cell: (props) => { const value = props.row.original.payment_price; - return
{formatCurrency(value)}
; + return ( +
+ {formatCurrency(value)} +
+ ); }, footer: () => { const value = supplier.total.payment_price; - return
{formatCurrency(value)}
; + return ( +
+ {formatCurrency(value)} +
+ ); }, }, { @@ -392,7 +420,7 @@ const DebtSupplierTab = () => { <>
diff --git a/src/dummy/report/debt-supplier.dummy.json b/src/dummy/report/debt-supplier.dummy.json new file mode 100644 index 00000000..27090eb0 --- /dev/null +++ b/src/dummy/report/debt-supplier.dummy.json @@ -0,0 +1,292 @@ +[ + { + "supplier": { + "id": 1, + "name": "PT CHAROEN POKPHAND INDONESIA Tbk", + "alias": "CPI", + "category": "SAPRONAK" + }, + "initial_balance": -9680000, + "rows": [ + { + "pr_number": "PR-TEST-202501-01", + "po_number": "PO-TEST-202501-01", + "po_date": "2025-01-15", + "received_date": "2025-01-15", + "aging": 0, + "area": { + "id": 1, + "name": "Bandung" + }, + "warehouse": { + "id": 3, + "name": "Gudang Kandang Bandung 1", + "type": "KANDANG", + "area": { + "id": 1, + "name": "Bandung" + } + }, + "due_date": "2025-02-14", + "due_status": "Sudah Jatuh Tempo", + "total_price": 5610000, + "payment_price": 0, + "debt_price": -5610000, + "status": "Belum Lunas", + "travel_number": "-", + "balance": -15290000 + }, + { + "pr_number": "PR-TEST-202501-02", + "po_number": "PO-TEST-202501-02", + "po_date": "2025-01-15", + "received_date": "2025-01-15", + "aging": 0, + "area": { + "id": 1, + "name": "Bandung" + }, + "warehouse": { + "id": 4, + "name": "Gudang Kandang Bandung 2", + "type": "KANDANG", + "area": { + "id": 1, + "name": "Bandung" + } + }, + "due_date": "2025-02-14", + "due_status": "Sudah Jatuh Tempo", + "total_price": 5035000, + "payment_price": 0, + "debt_price": -5035000, + "status": "Belum Lunas", + "travel_number": "-", + "balance": -20325000 + }, + { + "pr_number": "INIT-90001", + "po_number": "SALDO-AWAL", + "po_date": "-", + "received_date": "2026-01-05", + "aging": 0, + "due_date": "-", + "due_status": "-", + "total_price": 0, + "payment_price": -10000000, + "debt_price": -30325000, + "status": "Pembayaran", + "travel_number": "-", + "balance": -30325000 + }, + { + "pr_number": "PR-LTI-9001", + "po_number": "PO-LTI-9001", + "po_date": "2026-01-10", + "received_date": "2026-01-10", + "aging": 2, + "area": { + "id": 1, + "name": "Bandung" + }, + "warehouse": { + "id": 3, + "name": "Gudang Kandang Bandung 1", + "type": "KANDANG", + "area": { + "id": 1, + "name": "Bandung" + } + }, + "due_date": "2026-02-09", + "due_status": "Mendekati Jatuh Tempo", + "total_price": 52500000, + "payment_price": 2000000, + "debt_price": -50500000, + "status": "Belum Lunas", + "travel_number": "SJ-9001", + "balance": -82825000 + }, + { + "pr_number": "PAY-OUT-90001", + "po_number": "PO-LTI-9001", + "po_date": "-", + "received_date": "2026-01-10", + "aging": 0, + "due_date": "-", + "due_status": "-", + "total_price": 0, + "payment_price": 2000000, + "debt_price": -80825000, + "status": "Pembayaran", + "travel_number": "-", + "balance": -80825000 + }, + { + "pr_number": "PR-LTI-0001", + "po_number": "PO-LTI-0001", + "po_date": "2026-01-10", + "received_date": "2026-01-10", + "aging": 2, + "area": { + "id": 1, + "name": "Bandung" + }, + "warehouse": { + "id": 3, + "name": "Gudang Kandang Bandung 1", + "type": "KANDANG", + "area": { + "id": 1, + "name": "Bandung" + } + }, + "due_date": "2026-02-09", + "due_status": "Mendekati Jatuh Tempo", + "total_price": 52500000, + "payment_price": 1800000, + "debt_price": -50700000, + "status": "Belum Lunas", + "travel_number": "3232", + "balance": -133325000 + }, + { + "pr_number": "PAY-OUT-00003", + "po_number": "PO-LTI-0001", + "po_date": "-", + "received_date": "2026-01-10", + "aging": 0, + "due_date": "-", + "due_status": "-", + "total_price": 0, + "payment_price": 2000000, + "debt_price": -131325000, + "status": "Pembayaran", + "travel_number": "-", + "balance": -131325000 + }, + { + "pr_number": "PAY-OUT-90002", + "po_number": "2323", + "po_date": "-", + "received_date": "2026-01-11", + "aging": 0, + "due_date": "-", + "due_status": "-", + "total_price": 0, + "payment_price": 200000, + "debt_price": -131125000, + "status": "Pembayaran", + "travel_number": "-", + "balance": -131125000 + }, + { + "pr_number": "PAY-OUT-00002", + "po_number": "2323", + "po_date": "-", + "received_date": "2026-01-11", + "aging": 0, + "due_date": "-", + "due_status": "-", + "total_price": 0, + "payment_price": 200000, + "debt_price": -130925000, + "status": "Pembayaran", + "travel_number": "-", + "balance": -130925000 + }, + { + "pr_number": "INIT-00001", + "po_number": "PO-LTI-0001", + "po_date": "-", + "received_date": "2026-01-11", + "aging": 0, + "due_date": "-", + "due_status": "-", + "total_price": 0, + "payment_price": -200000, + "debt_price": -131125000, + "status": "Pembayaran", + "travel_number": "-", + "balance": -131125000 + }, + { + "pr_number": "PR-LTI-9002", + "po_number": "PO-LTI-9002", + "po_date": "2026-01-12", + "received_date": "2026-01-12", + "aging": 0, + "area": { + "id": 1, + "name": "Bandung" + }, + "warehouse": { + "id": 3, + "name": "Gudang Kandang Bandung 1", + "type": "KANDANG", + "area": { + "id": 1, + "name": "Bandung" + } + }, + "due_date": "2026-02-11", + "due_status": "Mendekati Jatuh Tempo", + "total_price": 30000000, + "payment_price": 5000000, + "debt_price": -25000000, + "status": "Belum Lunas", + "travel_number": "SJ-9002", + "balance": -161125000 + }, + { + "pr_number": "PAY-OUT-90003", + "po_number": "PO-LTI-9002", + "po_date": "-", + "received_date": "2026-01-12", + "aging": 0, + "due_date": "-", + "due_status": "-", + "total_price": 0, + "payment_price": 5000000, + "debt_price": -156125000, + "status": "Pembayaran", + "travel_number": "-", + "balance": -156125000 + }, + { + "pr_number": "PR-LTI-0002", + "po_number": "PO-LTI-0002", + "po_date": "2026-01-12", + "received_date": "2026-01-12", + "aging": 0, + "area": { + "id": 1, + "name": "Bandung" + }, + "warehouse": { + "id": 4, + "name": "Gudang Kandang Bandung 2", + "type": "KANDANG", + "area": { + "id": 1, + "name": "Bandung" + } + }, + "due_date": "2026-02-11", + "due_status": "Mendekati Jatuh Tempo", + "total_price": 45000000, + "payment_price": 0, + "debt_price": -45000000, + "status": "Belum Lunas", + "travel_number": "232", + "balance": -201125000 + } + ], + "total": { + "aging": 2, + "total_price": 190645000, + "payment_price": 8800000, + "debt_price": -181845000 + } + } +] diff --git a/src/dummy/report/debt-supplier.dummy.ts b/src/dummy/report/debt-supplier.dummy.ts new file mode 100644 index 00000000..dbc9a5c8 --- /dev/null +++ b/src/dummy/report/debt-supplier.dummy.ts @@ -0,0 +1,29 @@ +/** + * Dummy data for DebtSupplier + * Generated from: debt-supplier.dummy.json + * + * This file is auto-generated. Do not edit manually. + */ + +import { DebtSupplier } from '../../types/api/report/debt-supplier'; +import { BaseApiResponse } from '@/types/api/api-general'; +import dummyData from './debt-supplier.dummy.json'; + +/** + * Get dummy DebtSupplier data + * @returns Promise with BaseApiResponse containing DebtSupplier + */ +export async function getDummyDebtSupplier(): Promise< + BaseApiResponse | undefined +> { + return new Promise((resolve) => { + setTimeout(() => { + resolve({ + code: 200, + status: 'success', + message: 'Data retrieved successfully', + data: dummyData as unknown as DebtSupplier[], + }); + }, 500); + }); +} diff --git a/src/types/api/report/debt-supplier.d.ts b/src/types/api/report/debt-supplier.d.ts index f7342501..46849599 100644 --- a/src/types/api/report/debt-supplier.d.ts +++ b/src/types/api/report/debt-supplier.d.ts @@ -1,19 +1,26 @@ -import { BaseMetadata } from '@/types/api/api-general'; import { Area } from '@/types/api/master-data/area'; import { Supplier } from '@/types/api/master-data/supplier'; import { Warehouse } from '@/types/api/master-data/warehouse'; -export type DebtSupplier = BaseMetadata & { +export interface DebtSupplier { supplier: Supplier; + initial_balance: number; rows: DebtRow[]; total: DebtTotal; -}; +} -export type DebtRow = { +export interface DebtTotal { + aging: number; + total_price: number; + payment_price: number; + debt_price: number; +} + +export interface DebtRow { pr_number: string; po_number: string; - pr_date: string; po_date: string; + received_date: string; aging: number; area: Area; warehouse: Warehouse; @@ -24,11 +31,5 @@ export type DebtRow = { debt_price: number; status: string; travel_number: string; -}; - -export type DebtTotal = { - aging: number; - total_price: number; - payment_price: number; - debt_price: number; -}; + balance: number; +}