From a1679ba5ff5401225e5b82c5728c95d26e5e3107 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Tue, 9 Dec 2025 21:49:26 +0700 Subject: [PATCH] feat(FE-363): Add data type and date range filters --- .../PurchasesPerSupplierTab.tsx | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx b/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx index b82e8e32..c930970e 100644 --- a/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx +++ b/src/components/pages/report/logistic-stock/PurchasesPerSupplierTab.tsx @@ -1,6 +1,7 @@ import { useState, useMemo } from 'react'; import Card from '@/components/Card'; import SelectInput, { useSelect } from '@/components/input/SelectInput'; +import DateInput from '@/components/input/DateInput'; import { AreaApi } from '@/services/api/master-data'; import { SupplierApi } from '@/services/api/master-data'; import { ProductApi } from '@/services/api/master-data'; @@ -12,6 +13,11 @@ const PurchasesPerSupplierTab = () => { const [selectedArea, setSelectedArea] = useState(null); const [selectedSupplier, setSelectedSupplier] = useState(null); const [selectedProduct, setSelectedProduct] = useState(null); + const [dataType, setDataType] = useState<'received_date' | 'po_date'>( + 'received_date' + ); + const [startDate, setStartDate] = useState(null); + const [endDate, setEndDate] = useState(null); const { options: areaOptions, isLoadingOptions: isLoadingAreas } = useSelect( AreaApi.basePath, @@ -26,6 +32,14 @@ const PurchasesPerSupplierTab = () => { const { options: productOptions, isLoadingOptions: isLoadingProducts } = useSelect(ProductApi.basePath, 'id', 'name', 'search'); + const dataTypeOptions = useMemo( + () => [ + { value: 'received_date', label: 'Tanggal Terima' }, + { value: 'po_date', label: 'Tanggal PO' }, + ], + [] + ); + const data = useMemo( () => [ { @@ -352,6 +366,35 @@ const PurchasesPerSupplierTab = () => { isLoading={isLoadingProducts} isClearable /> + option.value === dataType) || + null + } + // @ts-expect-error TS2345 + onChange={(val) => setDataType(val?.value || 'received_date')} + isLoading={false} + isClearable={false} + /> + + {/* TODO END */}