Agregar columna de acciones en el listado de proformas recurrentes y mejorar la gestión de acciones
This commit is contained in:
parent
3d49fca2d2
commit
5775378ca6
@ -75,16 +75,15 @@ V1 NO incluye:
|
|||||||
|
|
||||||
## Columna Acciones
|
## Columna Acciones
|
||||||
|
|
||||||
La columna `Acciones` de `recurring-proformas` debe reutilizar `RdxRowActions`,
|
La columna `Acciones` de `recurring-proformas` reutiliza `RdxRowActions`, la
|
||||||
la misma primitive visual utilizada por el listado de Proformas. Debe aparecer
|
misma primitive visual del listado de Proformas. Se presenta como última
|
||||||
como última columna, con trigger compacto, menú accesible, alineación a la
|
columna, alineada a la derecha, con trigger compacto, menú accesible y
|
||||||
derecha y acciones destructivas separadas visualmente.
|
separación visual para acciones destructivas.
|
||||||
|
|
||||||
La celda solo representa acciones preparadas por el controller o la página:
|
La celda solo representa callbacks preparados por la página; no invoca APIs
|
||||||
no llama a la API, no utiliza DTOs y no reconstruye reglas de lifecycle.
|
directamente, no consume DTOs y no reconstruye reglas de dominio. El contenido
|
||||||
Las acciones disponibles siguen el lifecycle de `RecurringProforma`; la
|
del menú depende del lifecycle de `RecurringProforma`, mientras que su
|
||||||
presentación e interacción siguen el estándar global de columnas de acciones
|
presentación e interacción siguen el estándar global del ERP.
|
||||||
del ERP.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@ import {
|
|||||||
DataTable,
|
DataTable,
|
||||||
DataTableColumnHeader,
|
DataTableColumnHeader,
|
||||||
RdxPageContainer,
|
RdxPageContainer,
|
||||||
RdxRowActions,
|
|
||||||
type RdxRowAction,
|
type RdxRowAction,
|
||||||
|
RdxRowActions,
|
||||||
} from "@repo/rdx-ui/components";
|
} from "@repo/rdx-ui/components";
|
||||||
import { Badge, Button } from "@repo/shadcn-ui/components";
|
import { Badge, Button } from "@repo/shadcn-ui/components";
|
||||||
import type { ColumnDef } from "@tanstack/react-table";
|
import type { ColumnDef } from "@tanstack/react-table";
|
||||||
@ -17,22 +17,22 @@ import {
|
|||||||
PlayCircleIcon,
|
PlayCircleIcon,
|
||||||
Trash2Icon,
|
Trash2Icon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useMemo, useState } from "react";
|
import { useCallback, useMemo, useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
import { useTranslation } from "../../i18n";
|
import { useTranslation } from "../../i18n";
|
||||||
import type { RecurringProformaListRow } from "../shared/recurring-proforma-list";
|
|
||||||
import { buildRecurringProformaDetailPath } from "../shared/recurring-proforma-navigation";
|
|
||||||
import {
|
import {
|
||||||
type RecurringProformaAction,
|
type RecurringProformaAction,
|
||||||
useRecurringProformaActionMutation,
|
useRecurringProformaActionMutation,
|
||||||
} from "../shared/hooks/use-recurring-proforma-action-mutation";
|
} from "../shared/hooks/use-recurring-proforma-action-mutation";
|
||||||
import { useListRecurringProformasPageController } from "./controllers/use-list-recurring-proformas-page-controller";
|
import type { RecurringProformaListRow } from "../shared/recurring-proforma-list";
|
||||||
|
import { buildRecurringProformaDetailPath } from "../shared/recurring-proforma-navigation";
|
||||||
|
|
||||||
|
import { useListRecurringProformasPageController } from "./controllers/use-list-recurring-proformas-page-controller";
|
||||||
import {
|
import {
|
||||||
formatRecurringProformaSchedule,
|
|
||||||
formatRecurringProformaDateOnly,
|
formatRecurringProformaDateOnly,
|
||||||
formatRecurringProformaDateTime,
|
formatRecurringProformaDateTime,
|
||||||
|
formatRecurringProformaSchedule,
|
||||||
getRecurringProformaStatusKey,
|
getRecurringProformaStatusKey,
|
||||||
} from "./recurring-proforma-list-utils";
|
} from "./recurring-proforma-list-utils";
|
||||||
import { RecurringProformaStatusSegmentedFilter } from "./ui/components/recurring-proforma-status-segmented-filter";
|
import { RecurringProformaStatusSegmentedFilter } from "./ui/components/recurring-proforma-status-segmented-filter";
|
||||||
@ -99,9 +99,12 @@ export const ListRecurringProformasPage = () => {
|
|||||||
} = useListRecurringProformasPageController();
|
} = useListRecurringProformasPageController();
|
||||||
const actionMutation = useRecurringProformaActionMutation();
|
const actionMutation = useRecurringProformaActionMutation();
|
||||||
const dateLocale = i18n.language === "en" ? "en-US" : "es-ES";
|
const dateLocale = i18n.language === "en" ? "en-US" : "es-ES";
|
||||||
const executeAction = (id: string, action: RecurringProformaAction) => {
|
const executeAction = useCallback(
|
||||||
actionMutation.mutate({ id, action });
|
(id: string, action: RecurringProformaAction) => {
|
||||||
};
|
actionMutation.mutate({ id, action });
|
||||||
|
},
|
||||||
|
[actionMutation]
|
||||||
|
);
|
||||||
|
|
||||||
const columns = useMemo<ColumnDef<RecurringProformaListRow>[]>(
|
const columns = useMemo<ColumnDef<RecurringProformaListRow>[]>(
|
||||||
() => [
|
() => [
|
||||||
@ -249,7 +252,7 @@ export const ListRecurringProformasPage = () => {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[actionMutation.isPending, dateLocale, t]
|
[actionMutation.isPending, dateLocale, executeAction, t]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hasBlockingError && pageError) {
|
if (hasBlockingError && pageError) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user