From 939577dbec8df253752880ae20c104f27920ef08 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 15 Sep 2026 12:37:44 +0200 Subject: [PATCH] =?UTF-8?q?feat(ui):=20mejorar=20el=20filtro=20segmentado?= =?UTF-8?q?=20de=20estado=20de=20proforma=20con=20iconos=20y=20soporte=20p?= =?UTF-8?q?ara=20m=C3=BAltiples=20valores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../proforma-status-segmented-filter.tsx | 85 +++++++++++-------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx b/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx index 9d32f32f..d28b73d9 100644 --- a/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx +++ b/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx @@ -11,7 +11,8 @@ import { import type { ElementType } from "react"; import { useTranslation } from "../../../../i18n"; -import type { ProformaStatusCounts } from "../../../shared"; +import { getProformaStatusDisplayIcon } from "../../../change-status/helpers"; +import type { ProformaStatus, ProformaStatusCounts } from "../../../shared"; import type { ProformaListStatusFilter } from "../../types/proforma-list-filters"; export type ProformaStatusFilter = ProformaListStatusFilter; @@ -92,7 +93,9 @@ export const ProformaStatusSegmentedFilter = ({ }: ProformaStatusSegmentedFilterProps) => { const { t } = useTranslation(); - const handleValueChange = (nextValue: string) => { + const handleValueChange = (nextValues: string[]) => { + const nextValue = nextValues[0]; + if (!(nextValue && isProformaStatusFilter(nextValue)) || nextValue === value) { return; } @@ -103,47 +106,55 @@ export const ProformaStatusSegmentedFilter = ({ return ( - {PROFORMA_STATUS_FILTER_OPTIONS.map((option) => ( - { - if (option.value === value) { - event.preventDefault(); - } - }} - value={option.value} - > - - {option.icon ? : null} - {t(option.labelKey)} - - {counts[option.countKey]} - - - - ))} + {PROFORMA_STATUS_FILTER_OPTIONS.map((option) => { + const normalizedStatus = option.value.toLowerCase() as ProformaStatus; + const Icon = getProformaStatusDisplayIcon(normalizedStatus); + + const disabled = + "text-muted-foreground hover:border-border hover:bg-muted/60 hover:text-foreground"; + + return ( + { + if (option.value === value) { + event.preventDefault(); + } + }} + value={option.value} + > + + {option.icon ? : null} + {t(option.labelKey)} + + {counts[option.countKey]} + + + + ); + })} ); };