mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
refactor(FE): Enable sales tab and fetch sales data
This commit is contained in:
@@ -19,10 +19,10 @@ const ClosingDetailPage = () => {
|
||||
(id: number) => ClosingApi.getGeneralInfo(id)
|
||||
);
|
||||
|
||||
// const { data: salesData, isLoading: isLoadingSales } = useSWR(
|
||||
// closingId ? `sales-${closingId}` : null,
|
||||
// () => ClosingApi.getPenjualan(Number(closingId))
|
||||
// );
|
||||
const { data: salesData, isLoading: isLoadingSales } = useSWR(
|
||||
closingId ? `sales-${closingId}` : null,
|
||||
() => ClosingApi.getPenjualan(Number(closingId))
|
||||
);
|
||||
|
||||
const { data: hppEkspedisiData, isLoading: isLoadingHppEkspedisi } = useSWR(
|
||||
closingId ? `hpp-ekspedisi-${closingId}` : null,
|
||||
@@ -55,7 +55,7 @@ const ClosingDetailPage = () => {
|
||||
<ClosingDetail
|
||||
id={Number(closingId)}
|
||||
initialValue={closing.data}
|
||||
// salesData={isResponseSuccess(salesData) ? salesData.data : undefined}
|
||||
salesData={isResponseSuccess(salesData) ? salesData.data : undefined}
|
||||
hppExpeditionData={
|
||||
isResponseSuccess(hppEkspedisiData)
|
||||
? hppEkspedisiData.data
|
||||
|
||||
@@ -52,11 +52,11 @@ const ClosingDetail: React.FC<ClosingDetailProps> = ({
|
||||
/>
|
||||
),
|
||||
},
|
||||
// {
|
||||
// id: 'penjualan',
|
||||
// label: 'Penjualan',
|
||||
// content: <SalesReportTable initialValues={salesData} />,
|
||||
// },
|
||||
{
|
||||
id: 'penjualan',
|
||||
label: 'Penjualan',
|
||||
content: <SalesReportTable initialValues={salesData} />,
|
||||
},
|
||||
{
|
||||
id: 'overhead',
|
||||
label: 'Overhead',
|
||||
|
||||
@@ -215,31 +215,31 @@ const SalesReportTable = ({
|
||||
return kandang?.name || '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'payment_status',
|
||||
accessorKey: 'payment_status',
|
||||
header: 'Status Pembayaran',
|
||||
cell: (props) => {
|
||||
const status = props.getValue() as string;
|
||||
const getStatusColor = (status: string) => {
|
||||
if (!status) return 'neutral';
|
||||
switch (status.toLowerCase()) {
|
||||
case 'paid':
|
||||
return 'success';
|
||||
case 'tempo':
|
||||
return 'warning';
|
||||
default:
|
||||
return 'neutral';
|
||||
}
|
||||
};
|
||||
// {
|
||||
// id: 'payment_status',
|
||||
// accessorKey: 'payment_status',
|
||||
// header: 'Status Pembayaran',
|
||||
// cell: (props) => {
|
||||
// const status = props.getValue() as string;
|
||||
// const getStatusColor = (status: string) => {
|
||||
// if (!status) return 'neutral';
|
||||
// switch (status.toLowerCase()) {
|
||||
// case 'paid':
|
||||
// return 'success';
|
||||
// case 'tempo':
|
||||
// return 'warning';
|
||||
// default:
|
||||
// return 'neutral';
|
||||
// }
|
||||
// };
|
||||
|
||||
return (
|
||||
<Badge variant='soft' size='sm' color={getStatusColor(status)}>
|
||||
{status || '-'}
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
},
|
||||
// return (
|
||||
// <Badge variant='soft' size='sm' color={getStatusColor(status)}>
|
||||
// {status || '-'}
|
||||
// </Badge>
|
||||
// );
|
||||
// },
|
||||
// },
|
||||
],
|
||||
[]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user