diff --git a/src/components/pages/closing/ClosingProductionDataTabContent.tsx b/src/components/pages/closing/ClosingProductionDataTabContent.tsx index aabf48de..0f15d5b9 100644 --- a/src/components/pages/closing/ClosingProductionDataTabContent.tsx +++ b/src/components/pages/closing/ClosingProductionDataTabContent.tsx @@ -197,7 +197,7 @@ const ClosingProductionDataTabContent = ({ value={formatNumber(performance.mor_diff)} unitClassName='hidden' /> - + /> */} { updateFilter('end_date', e.target.value ? e.target.value : ''); }; + const [selectedMarketingDateFilterType, setSelectedMarketingDateFilterType] = + useState(null); + const marketingDateFilterTypeChangeHandler = ( + val: OptionType | OptionType[] | null + ) => { + setSelectedMarketingDateFilterType(val as OptionType); + updateFilter('filter_by', val ? ((val as OptionType).value as string) : ''); + }; + const [selectedMarketingType, setSelectedMarketingType] = useState(null); const marketingTypeChangeHandler = ( @@ -252,6 +264,23 @@ const DailyMarketingReportContent = () => { resetFilter(); }; + useEffect(() => { + if ( + tableFilterState.filter_by === 'realization_date' || + tableFilterState.filter_by === 'so_date' + ) { + setSelectedMarketingDateFilterType({ + label: + tableFilterState.filter_by === 'realization_date' + ? 'Tanggal Realisasi' + : 'Tanggal SO', + value: tableFilterState.filter_by, + }); + } else { + setSelectedMarketingDateFilterType(null); + } + }, [tableFilterState.filter_by]); + return (
@@ -341,6 +370,18 @@ const DailyMarketingReportContent = () => {
+ + `${props.row.original.aging_days} hari`, }, { - accessorKey: 'warehouse.name', + accessorKey: 'warehouse', header: 'Gudang', + cell: ({ row }) => row.original.warehouse.name, }, { - accessorKey: 'customer.name', + accessorKey: 'customer', header: 'Pelanggan', + cell: ({ row }) => row.original.customer.name, }, { accessorKey: 'do_number', header: 'No. DO', + enableSorting: false, }, { - accessorKey: 'sales', + accessorKey: 'sales_person', header: 'Sales/Marketing', cell: (props) => props.row.original.sales.name, }, @@ -97,10 +100,12 @@ const DailyMarketingsTable = ({ { accessorKey: 'marketing_type', header: 'Marketing Type', + enableSorting: false, }, { - accessorKey: 'product.name', + accessorKey: 'product', header: 'Produk', + cell: ({ row }) => row.original.product.name, }, { accessorKey: 'qty', @@ -115,12 +120,12 @@ const DailyMarketingsTable = ({ }, }, { - accessorKey: 'average_weight_kg', + accessorKey: 'average_weight', header: 'Bobot Rata-Rata (Kg)', cell: (props) => formatNumber(props.row.original.average_weight_kg), }, { - accessorKey: 'total_weight_kg', + accessorKey: 'total_weight', header: 'Bobot Total (Kg)', cell: (props) => formatNumber(props.row.original.total_weight_kg), footer: () => { @@ -132,12 +137,12 @@ const DailyMarketingsTable = ({ }, }, { - accessorKey: 'sales_price_per_kg', + accessorKey: 'sales_price', header: 'Harga Jual (Rp)', cell: (props) => formatCurrency(props.row.original.sales_price_per_kg), }, { - accessorKey: 'hpp_price_per_kg', + accessorKey: 'hpp_price', header: 'HPP (Rp)', cell: (props) => formatCurrency(props.row.original.hpp_price_per_kg), footer: () => { @@ -163,6 +168,8 @@ const DailyMarketingsTable = ({ ]; useEffect(() => { + console.log({ sorting }); + if (sorting.length === 1) { onFilterByChange(sorting[0].id); onSortByChange(sorting[0].desc ? 'desc' : 'asc'); diff --git a/src/config/constant.ts b/src/config/constant.ts index 364f1824..d3832613 100644 --- a/src/config/constant.ts +++ b/src/config/constant.ts @@ -457,3 +457,14 @@ export const MARKETING_TYPE_OPTIONS = [ value: 'trading', }, ]; + +export const MARKETING_DATE_FILTER_TYPE_OPTIONS = [ + { + label: 'Tanggal Realisasi', + value: 'realization_date', + }, + { + label: 'Tanggal SO', + value: 'so_date', + }, +];