diff --git a/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx b/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx
index 891c727c..7e58783e 100644
--- a/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx
+++ b/modules/customer-invoices/src/web/proformas/change-status/ui/change-status-dialog.tsx
@@ -8,16 +8,16 @@ import {
DialogTitle,
Spinner,
} from "@repo/shadcn-ui/components";
+import { cn } from "@repo/shadcn-ui/lib/utils";
+import { ArrowRightIcon, CheckIcon, LockIcon } from "lucide-react";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "../../../i18n";
import { PROFORMA_STATUS, type ProformaStatus } from "../../shared";
import type { ChangeProformaStatusTarget } from "../entities";
-import { getProformaStatusIcon } from "../helpers";
+import { getProformaStatusColor, getProformaStatusIcon } from "../helpers";
import { getCommonAvailableProformaStatuses } from "../utils";
-import { StatusLegend, StatusNode, TimelineConnector } from "./components";
-
interface ChangeProformaStatusDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
@@ -26,43 +26,76 @@ interface ChangeProformaStatusDialogProps {
onConfirm: (status: ProformaStatus) => void;
}
-const STATUS_FLOW = [
- {
- status: PROFORMA_STATUS.DRAFT,
- activeColor: "text-gray-700",
- activeBg: "bg-gray-100",
- activeBorder: "border-gray-300",
- activeRing: "ring-gray-200",
- },
- {
- status: PROFORMA_STATUS.SENT,
- activeColor: "text-yellow-700",
- activeBg: "bg-yellow-100",
- activeBorder: "border-yellow-300",
- activeRing: "ring-yellow-200",
- },
- {
- status: PROFORMA_STATUS.REJECTED,
- activeColor: "text-red-700",
- activeBg: "bg-red-100",
- activeBorder: "border-red-300",
- activeRing: "ring-red-200",
- },
- {
- status: PROFORMA_STATUS.APPROVED,
- activeColor: "text-green-700",
- activeBg: "bg-green-100",
- activeBorder: "border-green-300",
- activeRing: "ring-green-200",
- },
- {
- status: PROFORMA_STATUS.ISSUED,
- activeColor: "text-blue-700",
- activeBg: "bg-blue-100",
- activeBorder: "border-blue-300",
- activeRing: "ring-blue-200",
- },
-] as const;
+const STATUS_ORDER: ProformaStatus[] = [
+ PROFORMA_STATUS.DRAFT,
+ PROFORMA_STATUS.SENT,
+ PROFORMA_STATUS.APPROVED,
+ PROFORMA_STATUS.REJECTED,
+ PROFORMA_STATUS.ISSUED,
+];
+
+const StatusBadge = ({ status }: { status: ProformaStatus }) => {
+ const { t } = useTranslation();
+ const Icon = getProformaStatusIcon(status);
+
+ return (
+
+
+ {t(`catalog.proformas.status.${status}.label`)}
+
+ );
+};
+
+interface StatusOptionCardProps {
+ status: ProformaStatus;
+ selected: boolean;
+ onClick: () => void;
+}
+
+const StatusOptionCard = ({ status, selected, onClick }: StatusOptionCardProps) => {
+ const { t } = useTranslation();
+ const Icon = getProformaStatusIcon(status);
+
+ return (
+
+ );
+};
export const ChangeProformaStatusDialog = ({
open,
@@ -81,33 +114,123 @@ export const ChangeProformaStatusDialog = ({
}, [open]);
const availableStatuses = useMemo(() => getCommonAvailableProformaStatuses(targets), [targets]);
+ const orderedAvailableStatuses = useMemo(
+ () => STATUS_ORDER.filter((status) => availableStatuses.includes(status)),
+ [availableStatuses]
+ );
- const currentStatus = targets.length === 1 ? targets[0].status : null;
+ const isSingleTarget = targets.length === 1;
+ const currentTarget = isSingleTarget ? targets[0] : null;
+ const currentStatus = currentTarget?.status ?? null;
- const getStatusType = (
- status: ProformaStatus
- ): "past" | "current" | "available" | "unavailable" => {
- if (currentStatus === status) {
- return "current";
- }
+ const emptyState = (
+
+
+
+
+
+
+ {t("proformas.change_proforma_status_dialog.empty_title", "No hay cambios disponibles")}
+
+
+ {t("proformas.change_proforma_status_dialog.empty_available_statuses")}
+
+
+
+ );
- if (!currentStatus) {
- return availableStatuses.includes(status) ? "available" : "unavailable";
- }
+ const singleTargetContent = currentTarget ? (
+
+
+
+ {t("proformas.change_proforma_status_dialog.current_status", "Estado actual")}
+
+
+
- const currentIndex = STATUS_FLOW.findIndex((item) => item.status === currentStatus);
- const statusIndex = STATUS_FLOW.findIndex((item) => item.status === status);
+ {orderedAvailableStatuses.length === 0 ? (
+ emptyState
+ ) : (
+
+ )}
+
+ ) : null;
- return "unavailable";
- };
+ const bulkContent =
+ orderedAvailableStatuses.length === 0 ? (
+ emptyState
+ ) : (
+
+
+ {t(
+ "proformas.change_proforma_status_dialog.bulk_help",
+ "Selecciona el estado que quieres aplicar a todas las proformas seleccionadas."
+ )}
+
+
+
+
+ );
return (