Quitar basurilla

This commit is contained in:
David Arranz 2026-04-01 18:00:30 +02:00
parent 7f6dc09b7e
commit 32bbc96c51
2 changed files with 0 additions and 138 deletions

View File

@ -1,137 +0,0 @@
import { SimpleSearchInput } from "@erp/core/components";
import { DataTable, SkeletonDataTable } from "@repo/rdx-ui/components";
import { useCallback, useState } from "react";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "../../../i18n";
import type { CustomerSummaryFormData, CustomersPageFormData } from "../../schemas";
import { useCustomersListColumns } from "./use-customers-list-columns";
export type CustomerUpdateCompProps = {
customersPage: CustomersPageFormData;
loading?: boolean;
pageIndex: number;
pageSize: number;
onPageChange?: (pageNumber: number) => void;
onPageSizeChange?: (pageSize: number) => void;
searchValue: string;
onSearchChange: (value: string) => void;
onRowClick?: (
row: CustomerSummaryFormData,
index: number,
event: React.MouseEvent<HTMLTableRowElement>
) => void;
};
export const CustomersListGrid = ({
customersPage,
loading,
pageIndex,
pageSize,
onPageChange,
onPageSizeChange,
searchValue,
onSearchChange,
onRowClick,
}: CustomerUpdateCompProps) => {
const { t } = useTranslation();
const navigate = useNavigate();
const { items, total_items } = customersPage;
const [statusFilter, setStatusFilter] = useState("todas");
const columns = useCustomersListColumns({
onEdit: (customer) => navigate(`/customers/${customer.id}/edit`),
onView: (customer) => navigate(`/customers/${customer.id}`),
onDelete: (customer) => null, //confirmDelete(inv.id),
});
// Navegación centralizada (click/teclado)
const goToRow = useCallback(
(id: string, newTab = false) => {
const url = `/customers/${id}`;
if (newTab) {
window.open(url, "_blank", "noopener,noreferrer");
} else {
navigate(url);
}
},
[navigate]
);
// Handlers de búsqueda
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) =>
onSearchChange(e.target.value);
const handleClear = () => onSearchChange("");
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === "Enter") {
// Envío inmediato: forzar “salto” del debounce
onSearchChange((e.target as HTMLInputElement).value);
}
};
/*const handleRowClick = useCallback(
(customer: CustomerSummaryFormData, _i: number, e: React.MouseEvent) => {
const url = `/customer-invoices/${customer.id}/edit`;
if (e.metaKey || e.ctrlKey) { window.open(url, "_blank", "noopener,noreferrer"); return; }
preview.open(customer);
},
[preview]
);*/
if (loading) {
return (
<div className="flex flex-col gap-4">
<SkeletonDataTable
columns={columns.length}
footerProps={{ pageIndex, pageSize, totalItems: total_items ?? 0 }}
rows={Math.max(6, pageSize)}
showFooter
/>
</div>
);
}
// Render principal
return (
<div className="flex flex-col gap-4">
{/* Barra de filtros */}
<div className="flex flex-col sm:flex-row gap-4 mb-6">
<SimpleSearchInput loading={loading} onSearchChange={onSearchChange} />
</div>
<div className="relative flex">
<div className={/*preview.isPinned ? "flex-1 mr-[500px]" : */ "flex-1"}>
<DataTable
columns={columns}
data={items}
enablePagination
enableRowSelection
manualPagination
onPageChange={onPageChange}
onPageSizeChange={onPageSizeChange}
onRowClick={() => null /*handleRowClick*/}
pageIndex={pageIndex}
pageSize={pageSize}
readOnly
totalItems={total_items}
/>
</div>
{/*<preview.Preview>
{({ item, isPinned, close, togglePin }) => (
<InvoicePreviewPanel
invoice={item}
isPinned={isPinned}
onClose={close}
onTogglePin={togglePin}
/>
)}
</preview.Preview>*/}
</div>
</div>
);
};

View File

@ -1 +0,0 @@
export * from "../../../list/ui/pages/list-customers-page";