Compare commits
No commits in common. "ec1dd1099fe8dbba91fadbef0959b4d9692a5a4f" and "a7543497b09141082887359c7adbd6f37f6ae304" have entirely different histories.
ec1dd1099f
...
a7543497b0
@ -160,13 +160,6 @@
|
|||||||
"single_description": "Select the new status for proforma {{reference}}.",
|
"single_description": "Select the new status for proforma {{reference}}.",
|
||||||
"multiple_description": "Select the new status for {{count}} selected proformas.",
|
"multiple_description": "Select the new status for {{count}} selected proformas.",
|
||||||
"empty_available_statuses": "No status transitions are available for the selected proformas.",
|
"empty_available_statuses": "No status transitions are available for the selected proformas.",
|
||||||
"status_explanations": {
|
|
||||||
"draft": "An unfinished proforma that is still pending changes.",
|
|
||||||
"sent": "The proforma has been sent to the customer for approval.",
|
|
||||||
"approved": "The proforma has been approved by the customer and can be turned into an invoice.",
|
|
||||||
"rejected": "The proforma has been rejected by the customer. It can stay like this or return to \"draft\".",
|
|
||||||
"issued": "The proforma has already been turned into an invoice."
|
|
||||||
},
|
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"confirm": "Change status",
|
"confirm": "Change status",
|
||||||
"submitting": "Changing...",
|
"submitting": "Changing...",
|
||||||
|
|||||||
@ -161,13 +161,6 @@
|
|||||||
"single_description": "Selecciona el nuevo estado para la proforma {{reference}}.",
|
"single_description": "Selecciona el nuevo estado para la proforma {{reference}}.",
|
||||||
"multiple_description": "Selecciona el nuevo estado para {{count}} proformas seleccionadas.",
|
"multiple_description": "Selecciona el nuevo estado para {{count}} proformas seleccionadas.",
|
||||||
"empty_available_statuses": "No hay transiciones de estado disponibles para las proformas seleccionadas.",
|
"empty_available_statuses": "No hay transiciones de estado disponibles para las proformas seleccionadas.",
|
||||||
"status_explanations": {
|
|
||||||
"draft": "Una proforma sin terminar y pendiente de modificaciones.",
|
|
||||||
"sent": "Se ha enviado la proforma al cliente para su aprobación.",
|
|
||||||
"approved": "La proforma ha sido aprobada por el cliente y puede pasar a factura.",
|
|
||||||
"rejected": "La proforma ha sido rechazada por el cliente. Puede quedarse así o volver a \"borrador\".",
|
|
||||||
"issued": "La proforma ya ha sido pasada a factura."
|
|
||||||
},
|
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
"confirm": "Cambiar estado",
|
"confirm": "Cambiar estado",
|
||||||
"submitting": "Cambiando...",
|
"submitting": "Cambiando...",
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import {
|
|||||||
FileCheckIcon,
|
FileCheckIcon,
|
||||||
FileQuestionIcon,
|
FileQuestionIcon,
|
||||||
FileTextIcon,
|
FileTextIcon,
|
||||||
ReceiptTextIcon,
|
|
||||||
SendIcon,
|
SendIcon,
|
||||||
XCircleIcon,
|
XCircleIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
@ -63,24 +62,3 @@ export const getProformaStatusIcon = (status: ProformaStatus) => {
|
|||||||
return FileQuestionIcon;
|
return FileQuestionIcon;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getProformaStatusDisplayIcon = (status: ProformaStatus) => {
|
|
||||||
return status === "issued" ? ReceiptTextIcon : getProformaStatusIcon(status);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getProformaStatusBadgeClassName = (status: ProformaStatus): string => {
|
|
||||||
switch (status) {
|
|
||||||
case "draft":
|
|
||||||
return "border-gray-200 bg-gray-50 text-gray-600 ring-1 ring-inset ring-gray-200/90";
|
|
||||||
case "sent":
|
|
||||||
return "border-amber-300 bg-amber-50 text-amber-800 ring-1 ring-inset ring-amber-300/90";
|
|
||||||
case "approved":
|
|
||||||
return "border-emerald-300 bg-emerald-100/70 text-emerald-700 ring-1 ring-inset ring-emerald-300/90";
|
|
||||||
case "rejected":
|
|
||||||
return "border-red-300 bg-red-50 text-red-600 ring-1 ring-inset ring-red-300/90";
|
|
||||||
case "issued":
|
|
||||||
return "border-sky-300 bg-sky-100/70 text-sky-700 ring-1 ring-inset ring-sky-300/90";
|
|
||||||
default:
|
|
||||||
return "border-gray-200 bg-gray-50 text-gray-600 ring-1 ring-inset ring-gray-200/90";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@ -15,11 +15,7 @@ import { useEffect, useMemo, useState } from "react";
|
|||||||
import { useTranslation } from "../../../i18n";
|
import { useTranslation } from "../../../i18n";
|
||||||
import { PROFORMA_STATUS, type ProformaStatus } from "../../shared";
|
import { PROFORMA_STATUS, type ProformaStatus } from "../../shared";
|
||||||
import type { ChangeProformaStatusTarget } from "../entities";
|
import type { ChangeProformaStatusTarget } from "../entities";
|
||||||
import {
|
import { getProformaStatusColor, getProformaStatusIcon } from "../helpers";
|
||||||
getProformaStatusColor,
|
|
||||||
getProformaStatusDisplayIcon,
|
|
||||||
getProformaStatusIcon,
|
|
||||||
} from "../helpers";
|
|
||||||
import { getCommonAvailableProformaStatuses } from "../utils";
|
import { getCommonAvailableProformaStatuses } from "../utils";
|
||||||
|
|
||||||
interface ChangeProformaStatusDialogProps {
|
interface ChangeProformaStatusDialogProps {
|
||||||
@ -63,7 +59,7 @@ interface StatusOptionCardProps {
|
|||||||
|
|
||||||
const StatusOptionCard = ({ status, selected, onClick }: StatusOptionCardProps) => {
|
const StatusOptionCard = ({ status, selected, onClick }: StatusOptionCardProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const Icon = getProformaStatusDisplayIcon(status);
|
const Icon = getProformaStatusIcon(status);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
@ -94,7 +90,7 @@ const StatusOptionCard = ({ status, selected, onClick }: StatusOptionCardProps)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{t(`proformas.change_proforma_status_dialog.status_explanations.${status}`)}
|
{t(`catalog.proformas.status.${status}.description`)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@repo/shadcn-ui/components";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@repo/shadcn-ui/components";
|
||||||
import { cn } from "@repo/shadcn-ui/lib/utils";
|
import { cn } from "@repo/shadcn-ui/lib/utils";
|
||||||
|
import { ReceiptTextIcon } from "lucide-react";
|
||||||
|
|
||||||
import { useTranslation } from "../../../../i18n";
|
import { useTranslation } from "../../../../i18n";
|
||||||
import {
|
import { getProformaStatusIcon } from "../../../change-status/helpers";
|
||||||
getProformaStatusBadgeClassName,
|
|
||||||
getProformaStatusDisplayIcon,
|
|
||||||
} from "../../../change-status/helpers";
|
|
||||||
import type { ProformaStatus } from "../../../shared";
|
import type { ProformaStatus } from "../../../shared";
|
||||||
|
|
||||||
export type ProformaStatusBadgeProps = {
|
export type ProformaStatusBadgeProps = {
|
||||||
@ -16,7 +14,20 @@ export type ProformaStatusBadgeProps = {
|
|||||||
export const ProformaStatusBadge = ({ status, className }: ProformaStatusBadgeProps) => {
|
export const ProformaStatusBadge = ({ status, className }: ProformaStatusBadgeProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const normalizedStatus = status.toLowerCase() as ProformaStatus;
|
const normalizedStatus = status.toLowerCase() as ProformaStatus;
|
||||||
const Icon = getProformaStatusDisplayIcon(normalizedStatus);
|
const Icon = normalizedStatus === "issued" ? ReceiptTextIcon : getProformaStatusIcon(normalizedStatus);
|
||||||
|
|
||||||
|
const stylesByStatus: Record<ProformaStatus, string> = {
|
||||||
|
draft:
|
||||||
|
"border-gray-200 bg-gray-50 text-gray-600 ring-1 ring-inset ring-gray-200/90",
|
||||||
|
sent:
|
||||||
|
"border-amber-300 bg-amber-50 text-amber-800 ring-1 ring-inset ring-amber-300/90",
|
||||||
|
approved:
|
||||||
|
"border-emerald-300 bg-emerald-100/70 text-emerald-700 ring-1 ring-inset ring-emerald-300/90",
|
||||||
|
rejected:
|
||||||
|
"border-red-300 bg-red-50 text-red-600 ring-1 ring-inset ring-red-300/90",
|
||||||
|
issued:
|
||||||
|
"border-sky-300 bg-sky-100/70 text-sky-700 ring-1 ring-inset ring-sky-300/90",
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@ -26,7 +37,7 @@ export const ProformaStatusBadge = ({ status, className }: ProformaStatusBadgePr
|
|||||||
className={cn(
|
className={cn(
|
||||||
"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium leading-none whitespace-nowrap",
|
"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium leading-none whitespace-nowrap",
|
||||||
"[&>svg]:pointer-events-none [&>svg]:shrink-0 [&>svg]:size-3.5",
|
"[&>svg]:pointer-events-none [&>svg]:shrink-0 [&>svg]:size-3.5",
|
||||||
getProformaStatusBadgeClassName(normalizedStatus),
|
stylesByStatus[normalizedStatus],
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -71,9 +71,6 @@ export function useCustomersGridColumns(
|
|||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
size: 140,
|
size: 140,
|
||||||
minSize: 120,
|
minSize: 120,
|
||||||
meta: {
|
|
||||||
title: t("list.columns.customer"),
|
|
||||||
},
|
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const customer = row.original;
|
const customer = row.original;
|
||||||
|
|
||||||
@ -134,9 +131,6 @@ export function useCustomersGridColumns(
|
|||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
size: 140,
|
size: 140,
|
||||||
minSize: 120,
|
minSize: 120,
|
||||||
meta: {
|
|
||||||
title: t("list.columns.contact"),
|
|
||||||
},
|
|
||||||
cell: ({ row }) => <ContactCell contact={row.original.contact} />,
|
cell: ({ row }) => <ContactCell contact={row.original.contact} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -153,16 +147,12 @@ export function useCustomersGridColumns(
|
|||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
size: 140,
|
size: 140,
|
||||||
minSize: 120,
|
minSize: 120,
|
||||||
meta: {
|
|
||||||
title: t("list.columns.address"),
|
|
||||||
},
|
|
||||||
cell: ({ row }) => <AddressCell address={row.original.address} />,
|
cell: ({ row }) => <AddressCell address={row.original.address} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "actions",
|
id: "actions",
|
||||||
meta: {
|
meta: {
|
||||||
isActionsColumn: true,
|
isActionsColumn: true,
|
||||||
title: t("common.actions"),
|
|
||||||
headerClassName: "text-right",
|
headerClassName: "text-right",
|
||||||
},
|
},
|
||||||
header: "Acciones",
|
header: "Acciones",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { EmptyCellValue } from "@erp/core/components";
|
|
||||||
import { ExternalLinkIcon, MapPinIcon } from "lucide-react";
|
import { ExternalLinkIcon, MapPinIcon } from "lucide-react";
|
||||||
|
|
||||||
import { useTranslation } from "../../../i18n";
|
import { useTranslation } from "../../../i18n";
|
||||||
@ -38,11 +37,6 @@ export const AddressCell = ({ address }: { address: CustomerAddress }) => {
|
|||||||
const line2 = join([address.postalCode, address.city], " ");
|
const line2 = join([address.postalCode, address.city], " ");
|
||||||
const line3 = join([address.province, address.country], ", ");
|
const line3 = join([address.province, address.country], ", ");
|
||||||
const line23 = join([line2, line3], " - ");
|
const line23 = join([line2, line3], " - ");
|
||||||
const hasAddress = Boolean(line1 || line23);
|
|
||||||
|
|
||||||
if (!hasAddress) {
|
|
||||||
return <EmptyCellValue />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<address className="not-italic flex items-start gap-2 text-muted-foreground hover:text-primary transition-colors">
|
<address className="not-italic flex items-start gap-2 text-muted-foreground hover:text-primary transition-colors">
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { EmptyCellValue } from "@erp/core/components";
|
|
||||||
import { GlobeIcon, MailIcon, PhoneIcon, PrinterIcon, SmartphoneIcon } from "lucide-react";
|
import { GlobeIcon, MailIcon, PhoneIcon, PrinterIcon, SmartphoneIcon } from "lucide-react";
|
||||||
|
|
||||||
interface ContactCellData {
|
interface ContactCellData {
|
||||||
@ -67,9 +66,7 @@ export const ContactCell = ({ contact }: { contact: ContactCellData }) => {
|
|||||||
: []),
|
: []),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (items.length === 0) {
|
if (items.length === 0) return null;
|
||||||
return <EmptyCellValue />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-1.5 text-sm text-muted-foreground transition-colors">
|
<div className="flex flex-col gap-1.5 text-sm text-muted-foreground transition-colors">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user