From 841aadc107d9f3675641f170fe9bc25418fc9b58 Mon Sep 17 00:00:00 2001 From: randy-ar Date: Tue, 6 Jan 2026 13:29:05 +0700 Subject: [PATCH 1/6] fix(FE): fixing issue reject modal show up when creating project flock --- .../project-flock/ProjectFlockTable.tsx | 5 +- .../project-flock/form/ProjectFlockForm.tsx | 133 +----------------- 2 files changed, 5 insertions(+), 133 deletions(-) diff --git a/src/components/pages/production/project-flock/ProjectFlockTable.tsx b/src/components/pages/production/project-flock/ProjectFlockTable.tsx index 7d9ce7da..f6888c3d 100644 --- a/src/components/pages/production/project-flock/ProjectFlockTable.tsx +++ b/src/components/pages/production/project-flock/ProjectFlockTable.tsx @@ -308,7 +308,10 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => { - - - - - - )} +
- {/*
-
- {JSON.stringify(formik.values)} -
-
- {JSON.stringify(formik.errors)} -
-
*/} {formType !== 'detail' && ( - - { - confirmApprovalHandler(notes, approvalAction); - }, - }} - /> ); }; From 0af612703a5066a0d7a8eaf96350b9d0d28a1955 Mon Sep 17 00:00:00 2001 From: randy-ar Date: Tue, 6 Jan 2026 13:46:18 +0700 Subject: [PATCH 2/6] fix(FE): remove pullet table, change doc table to conditional data base on project flock category --- .../pages/closing/ClosingDetail.tsx | 7 ++- .../ClosingSapronakCalculationTabContent.tsx | 10 +++-- .../ClosingSapronakCalculationTable.tsx | 45 +++++++------------ 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/components/pages/closing/ClosingDetail.tsx b/src/components/pages/closing/ClosingDetail.tsx index 94647f87..3de2ffe9 100644 --- a/src/components/pages/closing/ClosingDetail.tsx +++ b/src/components/pages/closing/ClosingDetail.tsx @@ -45,7 +45,12 @@ const ClosingDetail: React.FC = ({ { id: 'perhitunganSapronak', label: 'Perhitungan Sapronak', - content: , + content: ( + + ), }, { id: 'penjualan', diff --git a/src/components/pages/closing/ClosingSapronakCalculationTabContent.tsx b/src/components/pages/closing/ClosingSapronakCalculationTabContent.tsx index 15e43bbc..b8add15b 100644 --- a/src/components/pages/closing/ClosingSapronakCalculationTabContent.tsx +++ b/src/components/pages/closing/ClosingSapronakCalculationTabContent.tsx @@ -1,21 +1,25 @@ 'use client'; -import ClosingIncomingSapronaksTable from '@/components/pages/closing/ClosingIncomingSapronaksTable'; -import ClosingOutgoingSapronaksTable from '@/components/pages/closing/ClosingOutgoingSapronaksTable'; import ClosingSapronakCalculationTable from '@/components/pages/closing/ClosingSapronakCalculationTable'; +import { ClosingGeneralInformation } from '@/types/api/closing'; interface ClosingSapronakCalculationTabContentProps { projectFlockId?: number; + closingGeneralInformation?: ClosingGeneralInformation; } const ClosingSapronakCalculationTabContent = ({ projectFlockId, + closingGeneralInformation, }: ClosingSapronakCalculationTabContentProps) => { return (
{projectFlockId && ( <> - + )}
diff --git a/src/components/pages/closing/ClosingSapronakCalculationTable.tsx b/src/components/pages/closing/ClosingSapronakCalculationTable.tsx index 22b4d2e2..6e3b1a95 100644 --- a/src/components/pages/closing/ClosingSapronakCalculationTable.tsx +++ b/src/components/pages/closing/ClosingSapronakCalculationTable.tsx @@ -13,15 +13,16 @@ import { useMemo } from 'react'; import useSWR from 'swr'; import { ClosingApi } from '@/services/api/closing'; import { isResponseSuccess } from '@/lib/api-helper'; +import { ClosingGeneralInformation } from '@/types/api/closing'; interface ClosingSapronakCalculationTableProps { - type?: 'detail'; projectFlockId: number; + closingGeneralInformation?: ClosingGeneralInformation; } const ClosingSapronakCalculationTable = ({ - type, projectFlockId, + closingGeneralInformation, }: ClosingSapronakCalculationTableProps) => { const { data: sapronakCalculation, isLoading } = useSWR( `/closing/sapronak-calculation/${projectFlockId}`, @@ -182,8 +183,13 @@ const ClosingSapronakCalculationTable = ({ return (
+ {/* Table DOC jika kategori Project Flock Growing */} data={ isResponseSuccess(sapronakCalculation) - ? (sapronakCalculation.data?.doc?.rows ?? []) + ? ((closingGeneralInformation?.project_category === 'GROWING' + ? sapronakCalculation.data?.doc?.rows + : sapronakCalculation.data?.pullet?.rows) ?? []) : [] } - columns={docColumns} + columns={ + closingGeneralInformation?.project_category === 'GROWING' + ? docColumns + : pulletColumns + } className={{ containerClassName: 'my-4', }} @@ -250,29 +262,6 @@ const ClosingSapronakCalculationTable = ({ renderFooter={isResponseSuccess(sapronakCalculation)} /> - - - - data={ - isResponseSuccess(sapronakCalculation) - ? (sapronakCalculation.data?.pullet?.rows ?? []) - : [] - } - columns={pulletColumns} - className={{ - containerClassName: 'my-4', - }} - renderFooter={isResponseSuccess(sapronakCalculation)} - /> -
); }; From aee0ad8a20774cfece12209efc2a4732d09f8443 Mon Sep 17 00:00:00 2001 From: randy-ar Date: Tue, 6 Jan 2026 14:42:52 +0700 Subject: [PATCH 3/6] feat(FE): adding stok information in form repeater SO and DO --- .../pages/marketing/MarketingTable.tsx | 3 +- .../delivery-order/DeliverOrderProduct.tsx | 17 +++++++++-- .../sales-order/SalesOrderProductForm.tsx | 30 +++++++++++++++++-- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/components/pages/marketing/MarketingTable.tsx b/src/components/pages/marketing/MarketingTable.tsx index 507819e3..1c37dbbb 100644 --- a/src/components/pages/marketing/MarketingTable.tsx +++ b/src/components/pages/marketing/MarketingTable.tsx @@ -682,7 +682,7 @@ const MarketingTable = () => { @@ -724,6 +724,7 @@ const MarketingTable = () => { }, ]} className={{ + containerClassName: 'p-6', tableWrapperClassName: 'overflow-x-auto min-h-full!', tableClassName: 'font-inter w-full table-auto min-h-full!', headerRowClassName: 'border-b border-b-gray-200', diff --git a/src/components/pages/marketing/form/repeater/delivery-order/DeliverOrderProduct.tsx b/src/components/pages/marketing/form/repeater/delivery-order/DeliverOrderProduct.tsx index a0eed811..5c81396e 100644 --- a/src/components/pages/marketing/form/repeater/delivery-order/DeliverOrderProduct.tsx +++ b/src/components/pages/marketing/form/repeater/delivery-order/DeliverOrderProduct.tsx @@ -15,6 +15,7 @@ import { BaseSalesOrder } from '@/types/api/marketing/marketing'; import Badge from '@/components/Badge'; import { SalesProductToFieldValues } from '@/components/pages/marketing/form/MarketingForm'; import * as Yup from 'yup'; +import { isResponseSuccess } from '@/lib/api-helper'; const DeliveryOrderProductForm = ({ formState, @@ -208,7 +209,7 @@ const DeliveryOrderProductForm = ({ ...formik.values, marketing_product_id: undefined, marketing_product: null, - qty: formik.values.qty || '', + qty: '', unit_price: '', total_price: '', avg_weight: '', @@ -222,7 +223,7 @@ const DeliveryOrderProductForm = ({ ...formik.values, marketing_product_id: selected.value as number, marketing_product: SalesProductToFieldValues(so), - qty: formik.values.qty || so.qty, + qty: so.qty, unit_price: so.unit_price, total_price: so.total_price, avg_weight: so.avg_weight, @@ -298,8 +299,18 @@ const DeliveryOrderProductForm = ({ isError={Boolean(formik.errors.qty)} errorMessage={formik.errors.qty} placeholder='Masukan Kuantitas' + bottomLabel={ + formik.values.marketing_product_id + ? 'Stok dijual: ' + + salesOrders?.find( + (item) => item.id === formik.values.marketing_product_id + )?.qty + : '' + } /> - +
+
+
(''); + // ============ Formik ============ const formik = useFormik({ enableReinitialize: true, initialValues: { @@ -58,6 +63,7 @@ const SalesOrderProductForm = ({ isInitialValid: false, }); + // ===== Options ===== const { options: kandangSourceOptions, isLoadingOptions: isLoadingKandangSourceOptions, @@ -86,12 +92,13 @@ const SalesOrderProductForm = ({ ); }, [warehouseSourceOptions, exisitingValues]); + // ===== Handler ===== const kandangChangeHandler = (val: OptionType | OptionType[] | null) => { formik.setFieldValue('kandang', val as OptionType); formik.setFieldValue('kandang_id', (val as OptionType)?.value); formik.setFieldValue('product_warehouse_id', null); formik.setFieldValue('product_warehouse', null); - formik.setFieldValue('qty', null); + formik.setFieldValue('qty', ''); }; const warehouseChangeHandler = (val: OptionType | OptionType[] | null) => { @@ -106,7 +113,7 @@ const SalesOrderProductForm = ({ formik.setFieldValue('qty', productWarehouse?.quantity); handleBlurField('qty'); } else { - formik.setFieldValue('qty', null); + formik.setFieldValue('qty', ''); } }; @@ -248,7 +255,24 @@ const SalesOrderProductForm = ({ isError={formik.touched.qty && Boolean(formik.errors.qty)} errorMessage={formik.errors.qty} placeholder='Masukan Kuantitas' + bottomLabel={ + isResponseSuccess(warehouseSourceRawData) && + formik.values.product_warehouse_id + ? `Stok tersedia: ${formatNumber( + warehouseSourceRawData?.data?.find( + (item) => item.id === formik.values.product_warehouse_id + )?.quantity ?? 0 + )} ${ + warehouseSourceRawData?.data?.find( + (item) => item.id === formik.values.product_warehouse_id + )?.product?.uom?.name ?? '' + }` + : '' + } /> +
+
+
Date: Tue, 6 Jan 2026 16:06:26 +0700 Subject: [PATCH 4/6] fix(FE): shows delivery number when status marketing is delivery in marketing detail page --- .../marketing/detail/MarketingDetail.tsx | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/components/pages/marketing/detail/MarketingDetail.tsx b/src/components/pages/marketing/detail/MarketingDetail.tsx index 677ea422..12ebda20 100644 --- a/src/components/pages/marketing/detail/MarketingDetail.tsx +++ b/src/components/pages/marketing/detail/MarketingDetail.tsx @@ -124,7 +124,10 @@ const MarketingDetail = ({ return ( <>
- + 2 ? 'Delivery Order' : 'Sales Order'}`} + backUrl='/marketing' + /> {!isLoadingApproval && approvals && ( )} @@ -202,8 +205,23 @@ const MarketingDetail = ({ No. Sales Order : - {initialValues?.so_number} + + {initialValues?.so_number} + + {Number(initialValues?.latest_approval?.step_number) > 2 && ( + + + No. Delivery Order + + : + + {initialValues?.delivery_order + ?.map((item) => item.do_number) + .join(', ')} + + + )} Nama Pelanggan : @@ -230,12 +248,27 @@ const MarketingDetail = ({ {initialValues?.notes ?? '-'} - Dokumen + Dokumen Penjualan : + {Number(initialValues?.latest_approval?.step_number) > 2 && ( + + Dokumen Pengiriman + : + + {initialValues?.delivery_order?.map((item, index) => ( + + ))} + + + )}
From f7986149e8d1e683c86ab10fd9b1d1113e5b251d Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Wed, 7 Jan 2026 13:01:32 +0700 Subject: [PATCH 5/6] fix: adjust marketing report endpoint --- src/services/api/report/marketing-report.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/api/report/marketing-report.ts b/src/services/api/report/marketing-report.ts index b1bcafae..5d81605e 100644 --- a/src/services/api/report/marketing-report.ts +++ b/src/services/api/report/marketing-report.ts @@ -13,7 +13,7 @@ export class MarketingReportApiService extends BaseApiService< unknown, unknown > { - constructor(basePath: string = '/reports/marketings/daily-marketing') { + constructor(basePath: string = '/reports/marketing') { super(basePath); } @@ -71,5 +71,5 @@ export class MarketingReportApiService extends BaseApiService< } export const MarketingReportApi = new MarketingReportApiService( - '/reports/marketings/daily-marketing' + '/reports/marketing' ); From 50d499005d988f898ccbdc7771bce4ac1811fc1d Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Wed, 7 Jan 2026 13:57:00 +0700 Subject: [PATCH 6/6] fix: format pathname --- src/components/MainDrawer.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/MainDrawer.tsx b/src/components/MainDrawer.tsx index fc8cbb18..eaf1e2c1 100644 --- a/src/components/MainDrawer.tsx +++ b/src/components/MainDrawer.tsx @@ -67,7 +67,9 @@ const MainDrawer = ({ const pathname = usePathname(); const { permissionCheck } = useAuth(); - const isPermitted = ROUTE_PERMISSIONS[pathname]?.some((permission) => + const formattedPathname = pathname.endsWith('/') ? pathname : `${pathname}/`; + + const isPermitted = ROUTE_PERMISSIONS[formattedPathname]?.some((permission) => permissionCheck(permission) );