Compare commits
No commits in common. "3d49fca2d28c67ba7cf3fe49f12f23f68eec07fd" and "727543f14fa03bcdb25f50f0d31313ab6748f262" have entirely different histories.
3d49fca2d2
...
727543f14f
@ -73,19 +73,6 @@ V1 NO incluye:
|
|||||||
- timezone por recurrencia;
|
- timezone por recurrencia;
|
||||||
- historial completo de intentos de ejecución.
|
- historial completo de intentos de ejecución.
|
||||||
|
|
||||||
## Columna Acciones
|
|
||||||
|
|
||||||
La columna `Acciones` de `recurring-proformas` debe reutilizar `RdxRowActions`,
|
|
||||||
la misma primitive visual utilizada por el listado de Proformas. Debe aparecer
|
|
||||||
como última columna, con trigger compacto, menú accesible, alineación a la
|
|
||||||
derecha y acciones destructivas separadas visualmente.
|
|
||||||
|
|
||||||
La celda solo representa acciones preparadas por el controller o la página:
|
|
||||||
no llama a la API, no utiliza DTOs y no reconstruye reglas de lifecycle.
|
|
||||||
Las acciones disponibles siguen el lifecycle de `RecurringProforma`; la
|
|
||||||
presentación e interacción siguen el estándar global de columnas de acciones
|
|
||||||
del ERP.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 3. Ubicación funcional
|
## 3. Ubicación funcional
|
||||||
@ -3552,4 +3539,4 @@ para cada occurrence lógica
|
|||||||
|
|
||||||
por encima de cualquier automatización adicional.
|
por encima de cualquier automatización adicional.
|
||||||
|
|
||||||
La evolución posterior hacia emisión automática, períodos avanzados, variables dinámicas o conceptos de suscripción deberá diseñarse como extensión explícita y no condicionar innecesariamente V1.
|
La evolución posterior hacia emisión automática, períodos avanzados, variables dinámicas o conceptos de suscripción deberá diseñarse como extensión explícita y no condicionar innecesariamente V1.
|
||||||
@ -68,8 +68,7 @@
|
|||||||
"complete": "Complete",
|
"complete": "Complete",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"duplicate": "Duplicate",
|
"duplicate": "Duplicate",
|
||||||
"delete": "Delete",
|
"delete": "Delete"
|
||||||
"operation_in_progress": "Operation in progress"
|
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"all": "All",
|
"all": "All",
|
||||||
|
|||||||
@ -68,8 +68,7 @@
|
|||||||
"complete": "Completar",
|
"complete": "Completar",
|
||||||
"archive": "Archivar",
|
"archive": "Archivar",
|
||||||
"duplicate": "Duplicar",
|
"duplicate": "Duplicar",
|
||||||
"delete": "Eliminar",
|
"delete": "Eliminar"
|
||||||
"operation_in_progress": "Operación en curso"
|
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"all": "Todos",
|
"all": "Todos",
|
||||||
|
|||||||
@ -1,22 +1,15 @@
|
|||||||
import { PageErrorState, SimpleSearchInput } from "@erp/core/components";
|
import { PageErrorState, SimpleSearchInput } from "@erp/core/components";
|
||||||
|
import { DataTable, DataTableColumnHeader, RdxPageContainer } from "@repo/rdx-ui/components";
|
||||||
import {
|
import {
|
||||||
DataTable,
|
Badge,
|
||||||
DataTableColumnHeader,
|
Button,
|
||||||
RdxPageContainer,
|
DropdownMenu,
|
||||||
RdxRowActions,
|
DropdownMenuContent,
|
||||||
type RdxRowAction,
|
DropdownMenuItem,
|
||||||
} from "@repo/rdx-ui/components";
|
DropdownMenuTrigger,
|
||||||
import { Badge, Button } from "@repo/shadcn-ui/components";
|
} from "@repo/shadcn-ui/components";
|
||||||
import type { ColumnDef } from "@tanstack/react-table";
|
import type { ColumnDef } from "@tanstack/react-table";
|
||||||
import {
|
import { CircleIcon, MoreHorizontalIcon } from "lucide-react";
|
||||||
ArchiveIcon,
|
|
||||||
CheckCircle2Icon,
|
|
||||||
CircleIcon,
|
|
||||||
CirclePauseIcon,
|
|
||||||
CopyIcon,
|
|
||||||
PlayCircleIcon,
|
|
||||||
Trash2Icon,
|
|
||||||
} from "lucide-react";
|
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
@ -53,37 +46,6 @@ const getActions = (status: RecurringProformaListRow["status"]): RecurringProfor
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const actionIcons = {
|
|
||||||
activate: PlayCircleIcon,
|
|
||||||
pause: CirclePauseIcon,
|
|
||||||
resume: PlayCircleIcon,
|
|
||||||
complete: CheckCircle2Icon,
|
|
||||||
archive: ArchiveIcon,
|
|
||||||
duplicate: CopyIcon,
|
|
||||||
delete: Trash2Icon,
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
const buildRowActions = (params: {
|
|
||||||
recurringProforma: RecurringProformaListRow;
|
|
||||||
execute: (id: string, action: RecurringProformaAction) => void;
|
|
||||||
isPending: boolean;
|
|
||||||
t: (key: string) => string;
|
|
||||||
}): RdxRowAction[] =>
|
|
||||||
getActions(params.recurringProforma.status).map((action) => {
|
|
||||||
const Icon = actionIcons[action];
|
|
||||||
return {
|
|
||||||
id: action,
|
|
||||||
label: params.t(`recurring_proformas.actions.${action}`),
|
|
||||||
icon: <Icon className="size-4" />,
|
|
||||||
destructive: action === "archive" || action === "delete",
|
|
||||||
disabled: params.isPending,
|
|
||||||
disabledReason: params.isPending
|
|
||||||
? params.t("recurring_proformas.actions.operation_in_progress")
|
|
||||||
: undefined,
|
|
||||||
onSelect: () => params.execute(params.recurringProforma.id, action),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export const ListRecurringProformasPage = () => {
|
export const ListRecurringProformasPage = () => {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const [isSearchPending, setIsSearchPending] = useState(false);
|
const [isSearchPending, setIsSearchPending] = useState(false);
|
||||||
@ -99,9 +61,6 @@ 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) => {
|
|
||||||
actionMutation.mutate({ id, action });
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = useMemo<ColumnDef<RecurringProformaListRow>[]>(
|
const columns = useMemo<ColumnDef<RecurringProformaListRow>[]>(
|
||||||
() => [
|
() => [
|
||||||
@ -229,27 +188,45 @@ export const ListRecurringProformasPage = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "actions",
|
id: "actions",
|
||||||
meta: {
|
header: ({ column }) => (
|
||||||
isActionsColumn: true,
|
<DataTableColumnHeader
|
||||||
headerClassName: "text-right",
|
column={column}
|
||||||
cellClassName: "flex justify-end",
|
title={t("recurring_proformas.list.columns.actions")}
|
||||||
},
|
|
||||||
header: "",
|
|
||||||
enableSorting: false,
|
|
||||||
cell: ({ row }) => (
|
|
||||||
<RdxRowActions
|
|
||||||
overflowActions={buildRowActions({
|
|
||||||
recurringProforma: row.original,
|
|
||||||
execute: executeAction,
|
|
||||||
isPending: actionMutation.isPending,
|
|
||||||
t,
|
|
||||||
})}
|
|
||||||
overflowLabel={t("common.more_actions")}
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
cell: ({ row }) => (
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger
|
||||||
|
render={
|
||||||
|
<Button
|
||||||
|
aria-label={t("recurring_proformas.list.columns.actions")}
|
||||||
|
size="icon"
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
>
|
||||||
|
<MoreHorizontalIcon className="size-4" />
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<DropdownMenuContent align="end">
|
||||||
|
{getActions(row.original.status).map((action) => (
|
||||||
|
<DropdownMenuItem
|
||||||
|
disabled={actionMutation.isPending}
|
||||||
|
key={action}
|
||||||
|
onClick={(event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
actionMutation.mutate({ id: row.original.id, action });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t(`recurring_proformas.actions.${action}`)}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
))}
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[actionMutation.isPending, dateLocale, t]
|
[actionMutation, dateLocale, t]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hasBlockingError && pageError) {
|
if (hasBlockingError && pageError) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user