diff --git a/src/components/pages/closing/ClosingSapronakCalculationTable.tsx b/src/components/pages/closing/ClosingSapronakCalculationTable.tsx index b6703549..1ec3c971 100644 --- a/src/components/pages/closing/ClosingSapronakCalculationTable.tsx +++ b/src/components/pages/closing/ClosingSapronakCalculationTable.tsx @@ -3,7 +3,7 @@ import Card from '@/components/Card'; import Table from '@/components/Table'; -import { formatCurrency, formatNumber } from '@/lib/helper'; +import { formatCurrency, formatDate, formatNumber } from '@/lib/helper'; import { RowSapronakCalculation, TotalSapronakCalculation, @@ -38,23 +38,29 @@ const ClosingSapronakCalculationTable = ({ { header: 'Tanggal', accessorKey: 'tanggal', - cell: (props) => (props.getValue() as string) || '-', + cell: (props) => + props.row.original.tanggal + ? formatDate(props.row.original.tanggal, 'DD MMM YYYY') + : '-', footer: 'Total', }, { header: 'No. Referensi', accessorKey: 'no_referensi', - cell: (props) => (props.getValue() as string) || '-', + cell: (props) => (props.row.original.no_referensi as string) || '-', footer: '', }, { header: 'QTY Masuk', accessorKey: 'qty_masuk', - cell: (props) => formatNumber(props.getValue() as number), + cell: (props) => + props.row.original.qty_masuk + ? formatNumber(props.row.original.qty_masuk as number) + : '-', footer: total ? () => (
- {formatNumber(total?.qty_masuk)} + {total?.qty_masuk ? formatNumber(total?.qty_masuk) : '-'}
) : '', @@ -62,11 +68,14 @@ const ClosingSapronakCalculationTable = ({ { header: 'QTY Keluar', accessorKey: 'qty_keluar', - cell: (props) => formatNumber(props.getValue() as number), + cell: (props) => + props.row.original.qty_keluar + ? formatNumber(props.row.original.qty_keluar as number) + : '-', footer: total ? () => (
- {formatNumber(total?.qty_keluar)} + {total?.qty_keluar ? formatNumber(total?.qty_keluar) : '-'}
) : '', @@ -74,11 +83,14 @@ const ClosingSapronakCalculationTable = ({ { header: 'QTY Pakai', accessorKey: 'qty_pakai', - cell: (props) => formatNumber(props.getValue() as number), + cell: (props) => + props.row.original.qty_pakai + ? formatNumber(props.row.original.qty_pakai as number) + : '-', footer: total ? () => (
- {formatNumber(total?.qty_pakai)} + {total?.qty_pakai ? formatNumber(total?.qty_pakai) : '-'}
) : '', @@ -86,23 +98,28 @@ const ClosingSapronakCalculationTable = ({ { header: 'Uraian', accessorKey: 'uraian', - cell: (props) => (props.getValue() as string) || '-', + cell: (props) => (props.row.original.uraian as string) || '-', footer: '', }, { header: 'Kategori Produk', accessorKey: 'kategori_produk', - cell: (props) => (props.getValue() as string) || '-', + cell: (props) => (props.row.original.kategori_produk as string) || '-', footer: '', }, { header: 'Harga Beli/Qty (Rp)', accessorKey: 'harga_beli_per_qty', - cell: (props) => formatCurrency(props.getValue() as number), + cell: (props) => + props.row.original.harga_beli_per_qty + ? formatCurrency(props.row.original.harga_beli_per_qty as number) + : '-', footer: total ? () => (
- {formatCurrency(total?.harga_beli_per_qty)} + {total?.harga_beli_per_qty + ? formatCurrency(total?.harga_beli_per_qty) + : '-'}
) : '', @@ -110,11 +127,14 @@ const ClosingSapronakCalculationTable = ({ { header: 'Total Harga (Rp)', accessorKey: 'total_harga', - cell: (props) => formatCurrency(props.getValue() as number), + cell: (props) => + props.row.original.total_harga + ? formatCurrency(props.row.original.total_harga as number) + : '-', footer: total ? () => (
- {formatCurrency(total?.total_harga)} + {total?.total_harga ? formatCurrency(total?.total_harga) : '-'}
) : '', @@ -122,7 +142,7 @@ const ClosingSapronakCalculationTable = ({ { header: 'Keterangan', accessorKey: 'keterangan', - cell: (props) => (props.getValue() as string) || '-', + cell: (props) => (props.row.original.keterangan as string) || '-', footer: '', }, ]; diff --git a/src/components/pages/finance/add/FormFinanceAdd.tsx b/src/components/pages/finance/add/FormFinanceAdd.tsx index f7fdf446..c835740e 100644 --- a/src/components/pages/finance/add/FormFinanceAdd.tsx +++ b/src/components/pages/finance/add/FormFinanceAdd.tsx @@ -188,6 +188,8 @@ const FormFinanceAdd = ({ value={formik.values.party_type_option} onChange={(value) => { formik.setFieldValue('party_type_option', value); + formik.setFieldValue('party_id_option', null); + formik.setFieldValue('party_account_number', ''); }} isError={Boolean( formik.touched.party_type_option && diff --git a/src/components/pages/finance/add/initial-balance/FormFinanceAddInitialBalance.tsx b/src/components/pages/finance/add/initial-balance/FormFinanceAddInitialBalance.tsx index aa185647..f8fd51d5 100644 --- a/src/components/pages/finance/add/initial-balance/FormFinanceAddInitialBalance.tsx +++ b/src/components/pages/finance/add/initial-balance/FormFinanceAddInitialBalance.tsx @@ -189,6 +189,8 @@ const FormFinanceAddInitialBalance = ({ value={formik.values.party_type_option} onChange={(value) => { formik.setFieldValue('party_type_option', value); + formik.setFieldValue('party_id_option', null); + formik.setFieldValue('party_account_number', ''); }} isError={Boolean( formik.touched.party_type_option && diff --git a/src/components/pages/marketing/MarketingTable.tsx b/src/components/pages/marketing/MarketingTable.tsx index f9cbdbfe..0247fc75 100644 --- a/src/components/pages/marketing/MarketingTable.tsx +++ b/src/components/pages/marketing/MarketingTable.tsx @@ -52,7 +52,7 @@ const RowsOptionsMenu = ({ )} >
- + {/* - + */} + {props.row.original.latest_approval.step_number != 1 && ( - + <> + {/* + + */} - + )} {props.row.original.latest_approval.step_number != 3 && ( - + <> + {/* + + */} - + )} - + {/* - + */} +
); @@ -302,7 +353,7 @@ const MarketingTable = () => { }} />
- + {/* - + */} + - + {/* - + */} +
{initialValues?.latest_approval?.step_number == 1 && ( <> - + {/* - + */} + - + {/* - + */} + )} {initialValues?.latest_approval?.step_number != 1 && ( - + <> + {/* + + */} + */} - + )} - + {/* - + */} + - + {/* - + */} + )} diff --git a/src/components/pages/master-data/warehouse/form/WarehouseForm.tsx b/src/components/pages/master-data/warehouse/form/WarehouseForm.tsx index 5ee1d4f4..227af3c6 100644 --- a/src/components/pages/master-data/warehouse/form/WarehouseForm.tsx +++ b/src/components/pages/master-data/warehouse/form/WarehouseForm.tsx @@ -421,8 +421,8 @@ const WarehouseForm = ({ type = 'add', initialValues }: WarehouseFormProps) => { value={formik.values.kandang ?? undefined} onChange={kandangChangeHandler} options={kandangOptions} - onInputChange={setLocationSelectInputValue} - isLoading={isLoadingLocations} + onInputChange={setKandangSelectInputValue} + isLoading={isLoadingKandangs} isError={ formik.touched.kandangId && Boolean(formik.errors.kandangId) } diff --git a/src/components/pages/production/project-flock/ProjectFlockTable.tsx b/src/components/pages/production/project-flock/ProjectFlockTable.tsx index 025e7186..7d9ce7da 100644 --- a/src/components/pages/production/project-flock/ProjectFlockTable.tsx +++ b/src/components/pages/production/project-flock/ProjectFlockTable.tsx @@ -228,11 +228,18 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { const confirmationModalDeleteClickHandler = async () => { setIsDeleteLoading(true); - await ProjectFlockApi.delete(selectedSingleRow?.id as number); + const response = await ProjectFlockApi.delete( + selectedSingleRow?.id as number + ); + if (isResponseSuccess(response)) { + toast.success(response?.message as string); + } + if (isResponseError(response)) { + toast.error(response?.message as string); + } refreshProjectFlocks(); deleteModal.closeModal(); - toast.success('Successfully delete Project Flock!'); setIsDeleteLoading(false); setRowSelection({}); }; diff --git a/src/config/route-permission.ts b/src/config/route-permission.ts index 0a17175d..7c7ab0ac 100644 --- a/src/config/route-permission.ts +++ b/src/config/route-permission.ts @@ -58,14 +58,27 @@ export const ROUTE_PERMISSIONS: Record = { '/purchase/detail/edit/': ['lti.purchase.update'], // Marketing - '/marketing/': ['lti.marketing.delivery_order.list'], - '/marketing/add/delivery-orders/': ['lti.marketing.delivery_order.create'], - '/marketing/add/sales-orders/': ['lti.marketing.sales_order.create'], - '/marketing/detail/': ['lti.marketing.delivery_order.detail'], + '/marketing/': ['lti.dashboard.list', 'lti.marketing.delivery_order.list'], + '/marketing/add/delivery-orders/': [ + 'lti.dashboard.list', + 'lti.marketing.delivery_order.create', + ], + '/marketing/add/sales-orders/': [ + 'lti.dashboard.list', + 'lti.marketing.sales_order.create', + ], + '/marketing/detail/': [ + 'lti.dashboard.list', + 'lti.marketing.delivery_order.detail', + ], '/marketing/detail/delivery-orders/edit/': [ + 'lti.dashboard.list', 'lti.marketing.delivery_order.update', ], - '/marketing/detail/sales-orders/edit/': ['lti.marketing.sales_order.update'], + '/marketing/detail/sales-orders/edit/': [ + 'lti.dashboard.list', + 'lti.marketing.sales_order.update', + ], // Expense '/expense/': ['lti.expense.list'],