From e7f88c67e635726d7ec38b42bff0c84c2ab34a6f Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Wed, 22 Apr 2026 14:39:04 +0200 Subject: [PATCH] feat: add filter to Issues column in Pricing view Co-Authored-By: Claude Sonnet 4.6 --- src/components/PricingView.tsx | 41 +++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/components/PricingView.tsx b/src/components/PricingView.tsx index 76378be..d49aaf0 100644 --- a/src/components/PricingView.tsx +++ b/src/components/PricingView.tsx @@ -82,6 +82,7 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit, const [outerLFilter, setOuterLFilter] = useState([]); const [outerHFilter, setOuterHFilter] = useState([]); const [dynamicColFilters, setDynamicColFilters] = useState>({}); + const [weightIssueFilter, setWeightIssueFilter] = useState<'all' | 'with' | 'without'>('all'); const [editingType, setEditingType] = useState<{ rowIndex: number; value: string } | null>(null); const [typeSuggestions, setTypeSuggestions] = useState([]); const typeInputRef = useRef(null); @@ -345,8 +346,15 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit, } }); + // Weight issue filter + if (weightIssueFilter === 'with') { + result = result.filter(r => r.unitErrors.some(e => e.startsWith('NW'))); + } else if (weightIssueFilter === 'without') { + result = result.filter(r => !r.unitErrors.some(e => e.startsWith('NW'))); + } + return result; - }, [analyzedRows, filterMode, search, nameColFilter, lineMultiFilter, classificationFilter, unitsOuterFilter, outerWFilter, outerLFilter, outerHFilter, dynamicColFilters]); + }, [analyzedRows, filterMode, search, nameColFilter, lineMultiFilter, classificationFilter, unitsOuterFilter, outerWFilter, outerLFilter, outerHFilter, dynamicColFilters, weightIssueFilter]); // ── Sorted rows ────────────────────────────────────────────────────────── const sortedRows = useMemo(() => { @@ -1057,8 +1065,35 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit, ); })} - - Issues + +
+ Issues + +
+ {openFilter === 'weightIssue' && ( +
+ {(['all', 'with', 'without'] as const).map(opt => ( + + ))} +
+ )} handleSort(COLUMNS.VALIDATED_CHECK)}>