En una cotización, poder mover las líneas de detalle

This commit is contained in:
David Arranz 2025-02-18 12:27:08 +01:00
parent d432fb90d2
commit 1396c70d1f
15 changed files with 266 additions and 241 deletions

View File

@ -1,7 +1,7 @@
{
"name": "@uecko-presupuestador/client",
"private": true,
"version": "1.1.1",
"version": "1.1.2",
"author": "Rodax Software <dev@rodax-software.com>",
"type": "module",
"scripts": {

View File

@ -351,6 +351,25 @@ export function QuoteItemsSortableDataTable<TData extends RowData & RowIdData, T
</Table>
{createPortal(
<DragOverlay dropAnimation={dropAnimationConfig} className={"z-40 opacity-100"}>
{activeId && (
<div className='relative flex flex-wrap'>
{table.getSelectedRowModel().rows.length ? (
<Badge
variant='destructive'
className='absolute z-50 flex items-center justify-center w-2 h-2 p-3 rounded-full top left -left-2 -top-2'
>
{table.getSelectedRowModel().rows.length}
</Badge>
) : null}
</div>
)}
</DragOverlay>,
document.body
)}
{false &&
createPortal(
<DragOverlay dropAnimation={dropAnimationConfig} className={"z-40 opacity-100"}>
{activeId && (
<div className='relative flex flex-wrap'>

View File

@ -62,7 +62,7 @@ export function QuoteItemsSortableTableRow({
key={id}
id={String(id)}
className={cn(
isDragging ? "opacity-40" : "opacity-100",
isDragging ? "opacity-60" : "opacity-100",
"m-0 hover:bg-muted hover:focus-within:bg-accent focus-within:bg-accent"
)}
ref={setNodeRef}

View File

@ -177,7 +177,7 @@ export const QuoteDetailsCardEditor = ({
},
],
{
enableDragHandleColumn: false, // <--- Desactivado temporalmente
enableDragHandleColumn: true,
enableSelectionColumn: true,
enableActionsColumn: true,
rowActionFn: (props) => {

View File

@ -245,7 +245,7 @@ export const QuoteEdit = () => {
};
if (isSubmitting || isPending) {
return <LoadingOverlay title='Guardando cotización' />;
//return <LoadingOverlay title='Guardando cotización' />;
}
if (status === "error") {
@ -257,6 +257,8 @@ export const QuoteEdit = () => {
}
return (
<>
{(isSubmitting || isPending) && <LoadingOverlay title='Guardando cotización' />}
<Form {...form}>
<form onSubmit={handleSubmit((data) => onSubmit(data, false))}>
<div className='mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6'>
@ -311,7 +313,11 @@ export const QuoteEdit = () => {
{/* <TabsTrigger value='history'>{t("quotes.create.tabs.history")}</TabsTrigger>*/}
</TabsList>
<TabsContent value='general' forceMount hidden={"general" !== activeTab}></TabsContent>
<TabsContent
value='general'
forceMount
hidden={"general" !== activeTab}
></TabsContent>
<TabsContent value='items' forceMount hidden={"items" !== activeTab}></TabsContent>
</Tabs>
@ -324,5 +330,6 @@ export const QuoteEdit = () => {
</div>
</form>
</Form>
</>
);
};

View File

@ -1,6 +1,7 @@
import { cn } from "@/lib/utils";
import { Button } from "@/ui";
import { useSortable } from "@dnd-kit/sortable";
import { t } from "i18next";
import { GripVerticalIcon } from "lucide-react";
export interface DataTableRowDragHandleCellProps {
@ -33,7 +34,7 @@ export const DataTableRowDragHandleCell = ({
{...listeners}
>
<GripVerticalIcon className='w-4 h-4' />
<span className='sr-only'>Mover fila</span>
<span className='sr-only'>{t("common.move_row")}</span>
</Button>
);
};

View File

@ -14,7 +14,7 @@ export const LoadingOverlay = ({
return (
<div
className={
"fixed top-0 bottom-0 left-0 right-0 z-50 w-full h-screen overflow-hidden flex justify-center"
"fixed top-0 bottom-0 left-0 right-0 z-50 w-full h-screen overflow-hidden flex justify-center bg-background/85"
}
{...props}
>

View File

@ -41,6 +41,7 @@
"append_article_tooltip": "Select and add an item from the catalog",
"append_block": "Append text block",
"append_block_tooltip": "Select and add a text block",
"move_row": "Move row",
"remove_row": "Remove",
"remove_selected_rows": "Remove",
"remove_selected_rows_tooltip": "Remove selected row(s)",

View File

@ -41,6 +41,7 @@
"append_article_tooltip": "Elegir un artículo del catálogo y añadirlo",
"append_block": "Añadir bloque de texto",
"append_block_tooltip": "Elegir un bloque de texto y añadirlo",
"move_row": "Mover fila",
"remove_row": "Eliminar",
"remove_selected_rows": "Eliminar",
"remove_selected_rows_tooltip": "Elimina las fila(s) seleccionadas(s)",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,8 +8,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://fonts.upset.dev/css2?family=Poppins&display=swap" rel="stylesheet" />
<title>Uecko</title>
<script type="module" crossorigin src="/assets/index-he4FVkJC.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B5XW7DrB.css">
<script type="module" crossorigin src="/assets/index-C4XjvTbB.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-ChUo3IMj.css">
</head>
<body>

View File

@ -1,6 +1,6 @@
{
"name": "uecko-presupuestador",
"version": "1.1.1",
"version": "1.1.2",
"author": "Rodax Software <dev@rodax-software.com>",
"license": "ISC",
"private": true,

View File

@ -16,7 +16,7 @@ import { Router } from "express";
export const quoteRouter = (appRouter: Router): void => {
const quoteRoutes: Router = Router({ mergeParams: true });
// Users CRUD
// Quotes CRUD
quoteRoutes.get("/", checkUser, getDealerMiddleware, handleRequest(listQuotesController));
quoteRoutes.get("/:quoteId", checkUser, getDealerMiddleware, handleRequest(getQuoteController));
quoteRoutes.post("/", checkUser, getDealerMiddleware, handleRequest(createQuoteController));

View File

@ -8,14 +8,10 @@ export class Result<T, E extends Error = Error> {
protected constructor(props: { isSuccess: boolean; error?: E; object?: T }) {
const { isSuccess, error, object } = props;
if (isSuccess && error) {
throw new Error(
`InvalidOperation: A result cannot be successful and contain an error`,
);
throw new Error(`InvalidOperation: A result cannot be successful and contain an error`);
}
if (!isSuccess && !error) {
throw new Error(
`InvalidOperation: A failing result needs to contain an error message`,
);
throw new Error(`InvalidOperation: A failing result needs to contain an error message`);
}
this.isSuccess = isSuccess;