Uecko_ERP/modules/customer-invoices/src/web/pages/list.tsx

108 lines
3.8 KiB
TypeScript
Raw Normal View History

2025-05-19 16:39:12 +00:00
import { AppBreadcrumb, AppContent } from "@repo/rdx-ui/components";
import { Button } from "@repo/shadcn-ui/components";
2025-05-17 19:12:01 +00:00
import { PlusIcon } from "lucide-react";
import { useState } from "react";
2025-05-19 16:39:12 +00:00
import { useTranslation } from "react-i18next";
2025-05-17 19:12:01 +00:00
import { useNavigate } from "react-router-dom";
2025-06-11 15:13:44 +00:00
import { CustomerInvoicesGrid } from "../components";
import { MODULE_NAME } from "../manifest";
2025-05-17 19:12:01 +00:00
2025-06-11 15:13:44 +00:00
export const CustomerInvoicesList = () => {
const { t } = useTranslation(MODULE_NAME);
2025-05-17 19:12:01 +00:00
const navigate = useNavigate();
const [status, setStatus] = useState("all");
2025-06-17 16:18:25 +00:00
/*const CustomerInvoiceStatuses = [
2025-06-11 15:13:44 +00:00
{ value: "all", label: t("customerInvoices.list.tabs.all") },
{ value: "draft", label: t("customerInvoices.list.tabs.draft") },
{ value: "ready", label: t("customerInvoices.list.tabs.ready") },
{ value: "delivered", label: t("customerInvoices.list.tabs.delivered") },
{ value: "accepted", label: t("customerInvoices.list.tabs.accepted") },
{ value: "rejected", label: t("customerInvoices.list.tabs.rejected") },
{ value: "archived", label: t("customerInvoices.list.tabs.archived") },
2025-06-17 16:18:25 +00:00
];*/
2025-05-17 19:12:01 +00:00
2025-05-19 16:39:12 +00:00
return (
<>
<AppBreadcrumb />
<AppContent>
<div className='flex items-center justify-between space-y-2'>
<div>
2025-06-11 15:13:44 +00:00
<h2 className='text-2xl font-bold tracking-tight'>
{t("customerInvoices.list.title")}
</h2>
<p className='text-muted-foreground'>{t("customerInvoices.list.description")}</p>
2025-05-19 16:39:12 +00:00
</div>
<div className='flex items-center space-x-2'>
2025-06-24 18:38:57 +00:00
<Button onClick={() => navigate("/customer-invoices/create")}>
2025-05-19 16:39:12 +00:00
<PlusIcon className='w-4 h-4 mr-2' />
2025-06-11 15:13:44 +00:00
{t("customerInvoices.create.title")}
2025-05-19 16:39:12 +00:00
</Button>
</div>
</div>
2025-05-20 10:08:24 +00:00
<div className='flex flex-col w-full h-full py-4'>
2025-06-11 15:13:44 +00:00
<CustomerInvoicesGrid />
2025-05-20 10:08:24 +00:00
</div>
2025-05-19 16:39:12 +00:00
</AppContent>
</>
);
};
/*
2025-05-17 19:12:01 +00:00
return (
<>
<div className='flex items-center justify-between space-y-2'>
<div>
<h2 className='text-2xl font-bold tracking-tight'>
2025-06-11 15:13:44 +00:00
{t('customerInvoices.list.title' />
2025-05-17 19:12:01 +00:00
</h2>
<p className='text-muted-foreground'>
2025-06-11 15:13:44 +00:00
{t('CustomerInvoices.list.subtitle' />
2025-05-17 19:12:01 +00:00
</p>
</div>
<div className='flex items-center space-x-2'>
2025-06-11 15:13:44 +00:00
<Button onClick={() => navigate("/CustomerInvoices/add")}>
2025-05-17 19:12:01 +00:00
<PlusIcon className='w-4 h-4 mr-2' />
2025-06-11 15:13:44 +00:00
{t("customerInvoices.create.title")}
2025-05-17 19:12:01 +00:00
</Button>
</div>
</div>
<Tabs value={status} onValueChange={setStatus}>
<div className='flex flex-col items-start justify-between mb-4 sm:flex-row sm:items-center'>
<div className='w-full mb-4 sm:w-auto sm:mb-0'>
<TabsList className='hidden sm:flex'>
2025-06-11 15:13:44 +00:00
{CustomerInvoiceStatuses.map((s) => (
2025-05-17 19:12:01 +00:00
<TabsTrigger key={s.value} value={s.value}>
{s.label}
</TabsTrigger>
))}
</TabsList>
<div className='flex items-center w-full space-x-2 sm:hidden'>
2025-06-11 15:13:44 +00:00
<Label>{t("customerInvoices.list.tabs_title")}</Label>
2025-05-17 19:12:01 +00:00
<Select value={status} onValueChange={setStatus}>
<SelectTrigger>
<SelectValue placeholder='Seleccionar estado' />
</SelectTrigger>
<SelectContent>
2025-06-11 15:13:44 +00:00
{CustomerInvoiceStatuses.map((s) => (
2025-05-17 19:12:01 +00:00
<SelectItem key={s.value} value={s.value}>
{s.label}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
</div>
</div>
2025-06-11 15:13:44 +00:00
{CustomerInvoiceStatuses.map((s) => (
2025-05-17 19:12:01 +00:00
<TabsContent key={s.value} value={s.value}>
2025-06-11 15:13:44 +00:00
<CustomerInvoicesGrid />
2025-05-17 19:12:01 +00:00
</TabsContent>
))}
</Tabs>
</>
);
};
2025-05-19 16:39:12 +00:00
*/