Facturas de cliente

This commit is contained in:
David Arranz 2025-11-24 16:04:24 +01:00
parent 220cc4c3a4
commit 46379e8881
5 changed files with 108 additions and 19 deletions

View File

@ -1,6 +1,6 @@
import { PageHeader, SimpleSearchInput } from "@erp/core/components";
import { ErrorAlert } from "@erp/customers/components";
import { AppContent, AppHeader, BackHistoryButton } from "@repo/rdx-ui/components";
import { AppContent, AppHeader, BackHistoryButton, LogoVerifactu } from "@repo/rdx-ui/components";
import {
Alert,
AlertDescription,
@ -12,7 +12,7 @@ import {
SelectTrigger,
SelectValue,
} from "@repo/shadcn-ui/components";
import { FilterIcon, LockIcon, PlusIcon } from "lucide-react";
import { FilterIcon, PlusIcon } from "lucide-react";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "../../../../i18n";
@ -63,6 +63,7 @@ export const IssuedInvoiceListPage = () => {
rightSlot={
<Button
aria-label={t("pages.issued_invoices.create.title")}
className="hidden"
onClick={() => navigate("/issued-invoices/create")}
>
<PlusIcon aria-hidden className="mr-2 size-4" />
@ -73,14 +74,16 @@ export const IssuedInvoiceListPage = () => {
/>
</AppHeader>
<AppContent>
<Alert className="bg-green-50 text-green-800">
<LockIcon />
<AlertTitle className="font-semibold text-green-800">¡Atención!</AlertTitle>
<AlertDescription className="text-green-800">
Las facturas de esta pantalla son de solo lectura. Se generan automáticamente al emitir
una proforma aprobada y no se pueden modificar ni eliminar. Solo puedes descargar el PDF
de cada factura.
</AlertDescription>
<Alert className="bg-green-50 text-green-800 flex items-center justify-between gap-6">
<div>
<AlertTitle className="font-semibold text-green-800">¡Atención!</AlertTitle>
<AlertDescription className="text-green-800">
Las facturas de esta pantalla son de solo lectura. Se generan automáticamente al
emitir una proforma aprobada y no se pueden modificar ni eliminar. Solo puedes
descargar el PDF de cada factura.
</AlertDescription>
</div>
<LogoVerifactu className="text-green-800 w-50" color="" />
</Alert>
{/* Search and filters */}

View File

@ -228,7 +228,7 @@ export function useProformasGridColumns(
return (
<div className="flex items-center gap-1">
{!isIssued && (
{!isIssued && actionHandlers.onEditClick && (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
@ -248,7 +248,7 @@ export function useProformasGridColumns(
)}
{/* Cambiar estado */}
{!isIssued && availableTransitions.length && (
{!isIssued && availableTransitions.length && actionHandlers.onChangeStatusClick && (
<TooltipProvider key={availableTransitions[0]}>
<Tooltip>
<TooltipTrigger asChild>
@ -272,7 +272,7 @@ export function useProformasGridColumns(
)}
{/* Emitir factura: solo si approved */}
{!isIssued && proforma.status === "approved" && (
{!isIssued && proforma.status === "approved" && actionHandlers.onIssueClick && (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
@ -291,7 +291,7 @@ export function useProformasGridColumns(
)}
{/* Eliminar */}
{!isIssued && (
{!isIssued && actionHandlers.onDeleteClick && (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>

View File

@ -37,10 +37,10 @@ export const ProformaListPage = () => {
} = useProformaListPageController();
const columns = useProformasGridColumns({
onEditClick: (proforma) => navigate(`/proformas/${proforma.id}/edit`),
onIssueClick: handleIssueProforma,
onDeleteClick: handleDeleteProforma,
onChangeStatusClick: handleChangeStatusProforma,
//onEditClick: (proforma) => navigate(`/proformas/${proforma.id}/edit`),
//onIssueClick: handleIssueProforma,
//onDeleteClick: handleDeleteProforma,
//onChangeStatusClick: handleChangeStatusProforma,
});
if (listCtrl.isError || !listCtrl.data) {
@ -63,6 +63,7 @@ export const ProformaListPage = () => {
rightSlot={
<Button
aria-label={t("pages.proformas.create.title")}
className="hidden"
onClick={() => navigate("/proformas/create")}
>
<PlusIcon aria-hidden className="mr-2 size-4" />

View File

@ -8,9 +8,9 @@ export * from "./full-screen-modal.tsx";
export * from "./grid/index.ts";
export * from "./layout/index.tsx";
export * from "./loading-overlay/index.tsx";
export * from "./logo-verifactu.tsx";
export * from "./lookup-dialog/index.tsx";
export * from "./multi-select.tsx";
export * from "./multiple-selector.tsx";
export * from "./scroll-to-top.tsx";
export * from "./tailwind-indicator.tsx";

View File

@ -0,0 +1,85 @@
export const LogoVerifactu = ({ color = "black", width = "100%", ...props }) => {
return (
<div {...props}>
<svg
{...props}
height="auto"
preserveAspectRatio="xMidYMid meet"
style={{
color,
shapeRendering: "geometricPrecision",
textRendering: "geometricPrecision",
fillRule: "evenodd",
clipRule: "evenodd",
}}
version="1.1"
viewBox="0 0 947 250"
width={width}
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<title id="verifactu-title">Verifactu</title>
<g>
<path
d="M 206.5,5.5 C 230.199,4.70303 238.699,15.703 232,38.5C 216.138,54.0286 200.638,69.8619 185.5,86C 237.643,77.4718 261.81,99.6385 258,152.5C 257.39,155.827 256.89,159.161 256.5,162.5C 227.5,162.5 198.5,162.5 169.5,162.5C 171.043,186.571 183.376,195.738 206.5,190C 213.036,186.43 217.869,181.263 221,174.5C 231.076,176.597 241.243,178.43 251.5,180C 245.366,197.128 233.366,208.795 215.5,215C 189.259,222.983 166.759,217.149 148,197.5C 138.556,183.943 134.556,168.943 136,152.5C 123.745,172.681 110.745,192.348 97,211.5C 88.7085,222.232 77.8752,226.732 64.5,225C 58.8865,223.718 54.7199,220.551 52,215.5C 48.3418,200.527 43.0085,186.193 36,172.5C 27.0419,161.206 17.7086,150.206 8,139.5C 3.51095,114.656 13.6776,104.489 38.5,109C 45.9811,112.493 52.4811,117.326 58,123.5C 65.3893,133.223 72.3893,143.223 79,153.5C 106.485,107.327 139.319,65.1599 177.5,27C 186.223,18.4277 195.889,11.2611 206.5,5.5 Z M 212.5,13.5 C 224.657,15.807 228.49,22.807 224,34.5C 200.259,56.9058 177.926,80.5725 157,105.5C 134.752,138.328 112.752,171.328 91,204.5C 85.6618,211.249 78.8285,215.582 70.5,217.5C 64.7571,216.922 60.9238,213.922 59,208.5C 55.6365,193.742 50.3031,179.742 43,166.5C 34.7461,155.575 25.7461,145.242 16,135.5C 13.7729,119.405 20.6062,113.572 36.5,118C 45.6208,123.454 53.1208,130.62 59,139.5C 65.4174,150.003 72.0841,160.337 79,170.5C 108.373,119.772 143.873,73.6053 185.5,32C 189.833,28.3333 194.167,24.6667 198.5,21C 202.826,17.6733 207.492,15.1733 212.5,13.5 Z M 198.5,109.5 C 211.684,107.835 220.518,113.168 225,125.5C 226.16,130.434 226.66,135.434 226.5,140.5C 208.83,140.667 191.164,140.5 173.5,140C 175.923,124.764 184.256,114.597 198.5,109.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 472.5,35.5 C 487.189,34.3737 501.522,36.0404 515.5,40.5C 516.631,42.0745 516.798,43.7412 516,45.5C 514.293,52.6665 512.126,59.6665 509.5,66.5C 501.517,62.8817 493.184,61.715 484.5,63C 482.622,64.5429 481.122,66.3762 480,68.5C 478.622,74.4002 477.122,80.2336 475.5,86C 483.493,86.4997 491.493,86.6664 499.5,86.5C 498.475,94.9601 496.808,103.293 494.5,111.5C 486.089,111.875 477.922,112.875 470,114.5C 463.004,147.481 456.171,180.481 449.5,213.5C 437.495,213.667 425.495,213.5 413.5,213C 415.943,203.954 417.943,194.787 419.5,185.5C 433.193,180.63 441.36,170.964 444,156.5C 445.846,143.204 442.013,131.871 432.5,122.5C 433.802,119.292 434.469,115.959 434.5,112.5C 428.5,112.5 422.5,112.5 416.5,112.5C 417.674,104.127 419.174,95.7934 421,87.5C 427.41,86.5223 433.91,86.189 440.5,86.5C 442.415,74.1716 445.582,62.1716 450,50.5C 455.548,42.4327 463.048,37.4327 472.5,35.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 377.5,37.5 C 388.833,37.5 400.167,37.5 411.5,37.5C 409.758,48.5415 407.758,59.5415 405.5,70.5C 393.833,70.5 382.167,70.5 370.5,70.5C 371.944,59.2795 374.277,48.2795 377.5,37.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 809.5,42.5 C 810.097,42.7352 810.43,43.2352 810.5,44C 807.306,58.1367 804.306,72.3033 801.5,86.5C 808.532,86.1697 815.532,86.503 822.5,87.5C 820.512,95.7878 818.678,104.121 817,112.5C 809.921,113.48 802.755,113.813 795.5,113.5C 790.772,136.641 786.105,159.808 781.5,183C 781.723,186.888 783.723,189.221 787.5,190C 792.887,190.784 798.22,190.618 803.5,189.5C 803.833,190.167 804.167,190.833 804.5,191.5C 802.671,199.815 801.004,208.148 799.5,216.5C 786.346,219.617 773.346,219.117 760.5,215C 752.836,212.002 748.003,206.502 746,198.5C 745.336,191.459 745.669,184.459 747,177.5C 751.251,156.242 755.751,135.075 760.5,114C 754.804,113.83 749.138,113.33 743.5,112.5C 745.488,104.212 747.322,95.8789 749,87.5C 754.741,86.5251 760.575,86.1918 766.5,86.5C 767.342,79.7889 768.509,73.1223 770,66.5C 783.338,58.6368 796.505,50.6368 809.5,42.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 345.5,83.5 C 351.785,83.8505 357.785,85.3505 363.5,88C 359.038,97.0908 354.705,106.257 350.5,115.5C 331.112,113.281 316.945,120.947 308,138.5C 299.736,163.652 293.569,189.318 289.5,215.5C 277.482,215.832 265.482,215.499 253.5,214.5C 262.395,172.525 271.229,130.525 280,88.5C 290.912,86.5357 302.078,85.8691 313.5,86.5C 311.998,93.4994 310.832,100.499 310,107.5C 316.251,99.2469 323.751,92.4136 332.5,87C 336.86,85.4171 341.194,84.2505 345.5,83.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 689.5,83.5 C 710.119,82.2301 726.286,89.8967 738,106.5C 741.176,113.046 743.343,119.879 744.5,127C 733.292,128.536 722.125,130.036 711,131.5C 706.259,111.048 694.425,105.548 675.5,115C 667.414,121.312 661.914,129.479 659,139.5C 655.484,150.594 654.15,161.927 655,173.5C 658.469,186.973 666.969,192.14 680.5,189C 690.603,184.797 697.269,177.464 700.5,167C 711.87,167.949 723.203,169.449 734.5,171.5C 724.935,201.207 704.435,216.874 673,218.5C 657.24,218.945 643.907,213.611 633,202.5C 634.482,206.476 636.315,210.476 638.5,214.5C 617.174,215.666 595.841,215.833 574.5,215C 571.625,210.083 568.625,205.249 565.5,200.5C 544.709,212.446 522.376,218.613 498.5,219C 495.585,215.172 492.919,211.172 490.5,207C 514.037,203.906 536.037,196.239 556.5,184C 538.086,151.836 519.419,119.836 500.5,88C 522.167,87.3333 543.833,87.3333 565.5,88C 577.207,108.582 589.04,129.082 601,149.5C 614.482,135.207 623.815,118.54 629,99.5C 631.667,102.833 634.333,106.167 637,109.5C 650.868,93.4829 668.368,84.8162 689.5,83.5 Z M 621.5,183.5 C 617.357,177.898 613.69,171.898 610.5,165.5C 613.333,161.833 616.167,158.167 619,154.5C 619.187,164.238 620.021,173.905 621.5,183.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 366.5,86.5 C 378.167,86.5 389.833,86.5 401.5,86.5C 400.117,95.5811 398.284,104.581 396,113.5C 372.948,123.27 364.615,140.27 371,164.5C 373.608,170.716 377.441,176.049 382.5,180.5C 380.008,191.469 377.674,202.469 375.5,213.5C 363.833,213.5 352.167,213.5 340.5,213.5C 348.91,171.117 357.577,128.784 366.5,86.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 826.5,86.5 C 838.167,86.5 849.833,86.5 861.5,86.5C 855.183,117.103 849.183,147.769 843.5,178.5C 843.785,187.452 848.452,192.118 857.5,192.5C 873.88,189.032 885.047,179.366 891,163.5C 897.077,137.949 902.577,112.282 907.5,86.5C 919.167,86.5 930.833,86.5 942.5,86.5C 934.091,129.544 925.425,172.544 916.5,215.5C 905.5,215.5 894.5,215.5 883.5,215.5C 884.416,210.102 885.25,204.769 886,199.5C 867.641,217.05 846.474,221.883 822.5,214C 812.227,207.123 807.227,197.456 807.5,185C 812.742,151.956 819.075,119.123 826.5,86.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 408.5,115.5 C 414.114,114.291 417.114,116.457 417.5,122C 415.066,130.535 412.066,138.868 408.5,147C 416.511,143.159 424.511,138.992 432.5,134.5C 438.775,136.543 440.109,140.376 436.5,146C 427.591,148.382 418.591,150.382 409.5,152C 417.875,156.381 425.709,161.548 433,167.5C 434.067,176.531 430.567,178.698 422.5,174C 416.972,167.773 411.806,161.273 407,154.5C 406.667,164.167 406.333,173.833 406,183.5C 403.217,187.823 399.717,188.49 395.5,185.5C 395.167,184.167 394.833,182.833 394.5,181.5C 397.064,172.314 399.897,163.314 403,154.5C 396.375,159.564 389.208,163.731 381.5,167C 373.915,168.421 371.415,165.588 374,158.5C 374.903,157.299 376.069,156.465 377.5,156C 385.53,154.273 393.53,152.44 401.5,150.5C 393.742,145.872 386.242,140.872 379,135.5C 377.167,128 380,125.167 387.5,127C 393.375,133.207 398.875,139.707 404,146.5C 405.141,137.543 405.808,128.543 406,119.5C 406.662,118.016 407.496,116.683 408.5,115.5 Z"
fill="currentColor"
/>
</g>
<g>
<path
d="M 509.5,126.5 C 510.496,126.414 511.329,126.748 512,127.5C 514.167,131.833 516.333,136.167 518.5,140.5C 501.734,156.692 491.234,176.359 487,199.5C 483.166,194.503 479.833,189.17 477,183.5C 476.333,181.833 476.333,180.167 477,178.5C 484.052,158.714 494.885,141.381 509.5,126.5 Z"
fill="currentColor"
/>
</g>
</svg>
</div>
);
};