.
This commit is contained in:
parent
3bc8d10f56
commit
9011e99a31
@ -29,6 +29,9 @@ import {
|
|||||||
TabsContent,
|
TabsContent,
|
||||||
TabsList,
|
TabsList,
|
||||||
TabsTrigger,
|
TabsTrigger,
|
||||||
|
Tooltip,
|
||||||
|
TooltipContent,
|
||||||
|
TooltipTrigger,
|
||||||
} from "@/ui";
|
} from "@/ui";
|
||||||
import { useToast } from "@/ui/use-toast";
|
import { useToast } from "@/ui/use-toast";
|
||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
@ -39,8 +42,8 @@ import { DownloadQuoteDialog } from "./DownloadQuoteDialog";
|
|||||||
import { QuoteStatusEditor } from "./editors";
|
import { QuoteStatusEditor } from "./editors";
|
||||||
|
|
||||||
type QuoteResumeProps = {
|
type QuoteResumeProps = {
|
||||||
quoteId: string;
|
quoteId?: string;
|
||||||
className: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
|
export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
|
||||||
@ -52,7 +55,7 @@ export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
|
|||||||
const { mutate: setStatusMutation } = useSetStatus(quoteId);
|
const { mutate: setStatusMutation } = useSetStatus(quoteId);
|
||||||
const { download, ...downloadProps } = useDownloader();
|
const { download, ...downloadProps } = useDownloader();
|
||||||
|
|
||||||
const handleOnChangeStatus = (quoteId: string, newStatus: string) => {
|
const handleOnChangeStatus = (_: string, newStatus: string) => {
|
||||||
setStatusMutation(
|
setStatusMutation(
|
||||||
{ newStatus },
|
{ newStatus },
|
||||||
|
|
||||||
@ -104,6 +107,7 @@ export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
|
|||||||
{`${t("quotes.list.preview.quote")} #${data.reference}`}
|
{`${t("quotes.list.preview.quote")} #${data.reference}`}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<CardDescription className='flex items-center gap-1 mr-auto text-foreground'>
|
<CardDescription className='flex items-center gap-1 mr-auto text-foreground'>
|
||||||
|
<QuoteStatusEditor quote={data} onChangeStatus={handleOnChangeStatus} />
|
||||||
<Button
|
<Button
|
||||||
size='sm'
|
size='sm'
|
||||||
variant='outline'
|
variant='outline'
|
||||||
@ -118,23 +122,38 @@ export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
|
|||||||
{t("quotes.list.columns.actions.edit")}
|
{t("quotes.list.columns.actions.edit")}
|
||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
<QuoteStatusEditor quote={data} onChangeStatus={handleOnChangeStatus} />
|
|
||||||
|
|
||||||
<Button size='sm' variant='outline' className='h-8 gap-1' onClick={handleDownload}>
|
<Tooltip>
|
||||||
<DownloadIcon className='h-3.5 w-3.5' />
|
<TooltipTrigger asChild>
|
||||||
<span className='sr-only lg:not-sr-only lg:whitespace-nowrap'>
|
<Button
|
||||||
{t("quotes.list.preview.download_quote")}
|
size='sm'
|
||||||
</span>
|
variant='outline'
|
||||||
</Button>
|
className='h-8 gap-1'
|
||||||
<DropdownMenu>
|
onClick={handleDownload}
|
||||||
<DropdownMenuTrigger asChild>
|
>
|
||||||
<Button size='icon' variant='outline' className='w-8 h-8'>
|
<DownloadIcon className='h-3.5 w-3.5 ' />
|
||||||
<MoreVertical className='h-3.5 w-3.5' />
|
<span className='sr-only'>{t("quotes.list.preview.download_quote")}</span>
|
||||||
<span className='sr-only'>More</span>
|
|
||||||
</Button>
|
</Button>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>{t("quotes.list.preview.download_quote")}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger>
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<Button size='icon' variant='outline' className='w-8 h-8'>
|
||||||
|
<MoreVertical className='h-3.5 w-3.5' />
|
||||||
|
<span className='sr-only'>{t("common.more")}</span>
|
||||||
|
</Button>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>{t("common.more")}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align='end'>
|
<DropdownMenuContent align='end'>
|
||||||
<DropdownMenuItem>Edit</DropdownMenuItem>
|
<DropdownMenuItem className='not-sr-only 2xl:sr-only'>
|
||||||
|
<DownloadIcon className='h-3.5 w-3.5 mr-2' />
|
||||||
|
<span>{t("quotes.list.preview.download_quote")}</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem>Export</DropdownMenuItem>
|
<DropdownMenuItem>Export</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem>Trash</DropdownMenuItem>
|
<DropdownMenuItem>Trash</DropdownMenuItem>
|
||||||
|
|||||||
@ -17,9 +17,6 @@ import {
|
|||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
ResizableHandle,
|
|
||||||
ResizablePanel,
|
|
||||||
ResizablePanelGroup,
|
|
||||||
Tooltip,
|
Tooltip,
|
||||||
TooltipContent,
|
TooltipContent,
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
@ -271,13 +268,8 @@ export const QuotesDataTable = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ResizablePanelGroup direction='horizontal' className='flex items-stretch flex-1 gap-4'>
|
<div className='flex flex-col items-stretch flex-1 gap-4 xl:flex-row'>
|
||||||
<ResizablePanel
|
<div id={tableId} className='flex items-stretch flex-1'>
|
||||||
id={tableId}
|
|
||||||
order={0}
|
|
||||||
defaultSize={preview ? 65 : 100}
|
|
||||||
className='flex items-stretch flex-1'
|
|
||||||
>
|
|
||||||
<DataTable
|
<DataTable
|
||||||
table={table}
|
table={table}
|
||||||
paginationOptions={{ visible: true }}
|
paginationOptions={{ visible: true }}
|
||||||
@ -287,20 +279,15 @@ export const QuotesDataTable = ({
|
|||||||
>
|
>
|
||||||
<DataTableToolbar table={table} />
|
<DataTableToolbar table={table} />
|
||||||
</DataTable>
|
</DataTable>
|
||||||
</ResizablePanel>
|
</div>
|
||||||
{preview && <ResizableHandle withHandle />}
|
|
||||||
{preview && (
|
{preview && (
|
||||||
<ResizablePanel
|
<div id={previewId} className='flex items-stretch'>
|
||||||
id={previewId}
|
|
||||||
order={1}
|
|
||||||
defaultSize={35}
|
|
||||||
className='flex items-stretch flex-1'
|
|
||||||
>
|
|
||||||
<QuoteResume quoteId={activeRow?.original.id} />
|
<QuoteResume quoteId={activeRow?.original.id} />
|
||||||
{/*<QuotePDFPreview quote={activeRow?.original} className='flex-1' />*/}
|
{/*<QuotePDFPreview quote={activeRow?.original} className='flex-1' />*/}
|
||||||
</ResizablePanel>
|
</div>
|
||||||
)}
|
)}
|
||||||
</ResizablePanelGroup>
|
</div>
|
||||||
<DownloadQuoteDialog {...downloadProps} onFinishDownload={handleFinishDownload} />
|
<DownloadQuoteDialog {...downloadProps} onFinishDownload={handleFinishDownload} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -59,7 +59,9 @@ export const QuoteStatusEditor = ({
|
|||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button size='sm' variant='outline' className='h-8 gap-1'>
|
<Button size='sm' variant='outline' className='h-8 gap-1'>
|
||||||
<RefreshCwIcon className='h-3.5 w-3.5' />
|
<RefreshCwIcon className='h-3.5 w-3.5' />
|
||||||
<span className='sr-only md:not-sr-only md:whitespace-nowrap'>Cambiar estado</span>
|
<span className='sr-only md:not-sr-only md:whitespace-nowrap'>
|
||||||
|
{t("quotes.quote_status_editor.trigger_button")}
|
||||||
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
|
|||||||
@ -151,7 +151,7 @@ export const useQuotes = () => {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
useSetStatus: (id: string) => {
|
useSetStatus: (id?: string) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation<void, TDataSourceError, ISetStatusQuote_Request_DTO>({
|
return useMutation<void, TDataSourceError, ISetStatusQuote_Request_DTO>({
|
||||||
|
|||||||
@ -38,13 +38,17 @@ export function DataTableToolbar<TData>({
|
|||||||
placeholder={t("common.filter_placeholder")}
|
placeholder={t("common.filter_placeholder")}
|
||||||
value={globalFilter}
|
value={globalFilter}
|
||||||
onChange={(event) => setGlobalFilter(String(event.target.value))}
|
onChange={(event) => setGlobalFilter(String(event.target.value))}
|
||||||
className={cn("h-8", fullWidthFilter ? "w-full" : "w-3/12 lg:w-6/12")}
|
className={cn("h-8 w-full transition-all")}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{isFiltered && (
|
{isFiltered && (
|
||||||
<Button variant='ghost' onClick={() => resetGlobalFilter()} className='h-8 px-2 lg:px-3'>
|
<Button
|
||||||
|
variant='outline'
|
||||||
|
onClick={() => resetGlobalFilter()}
|
||||||
|
className='h-8 px-2 transition-all lg:px-3'
|
||||||
|
>
|
||||||
|
<XIcon className='w-4 h-4 mr-2' />
|
||||||
{t("common.reset_filter")}
|
{t("common.reset_filter")}
|
||||||
<XIcon className='w-4 h-4 ml-2' />
|
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
"upload": "Upload",
|
"upload": "Upload",
|
||||||
"continue": "Continue",
|
"continue": "Continue",
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
|
"more": "More",
|
||||||
"add": "Add",
|
"add": "Add",
|
||||||
"sort_asc": "Asc",
|
"sort_asc": "Asc",
|
||||||
"sort_asc_description": "In ascending order. Click to sort descending order.",
|
"sort_asc_description": "In ascending order. Click to sort descending order.",
|
||||||
@ -29,7 +30,7 @@
|
|||||||
"go_to_next_page": "Go to next page",
|
"go_to_next_page": "Go to next page",
|
||||||
"go_to_last_page": "Go to last page",
|
"go_to_last_page": "Go to last page",
|
||||||
"filter_placeholder": "Type here to filter...",
|
"filter_placeholder": "Type here to filter...",
|
||||||
"reset_filter": "Remove the results filter",
|
"reset_filter": "Reset filter",
|
||||||
"error": "Error",
|
"error": "Error",
|
||||||
"actions": "Actions",
|
"actions": "Actions",
|
||||||
"open_menu": "Open menu",
|
"open_menu": "Open menu",
|
||||||
@ -198,6 +199,7 @@
|
|||||||
"toast_article_added": "Catalog item added:"
|
"toast_article_added": "Catalog item added:"
|
||||||
},
|
},
|
||||||
"quote_status_editor": {
|
"quote_status_editor": {
|
||||||
|
"remove the res": "Change quote status",
|
||||||
"title": "Change quote status",
|
"title": "Change quote status",
|
||||||
"status": {
|
"status": {
|
||||||
"draft": {
|
"draft": {
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
"upload": "Cargar",
|
"upload": "Cargar",
|
||||||
"continue": "Continuar",
|
"continue": "Continuar",
|
||||||
"close": "Cerrar",
|
"close": "Cerrar",
|
||||||
|
"more": "More",
|
||||||
"add": "Añadir",
|
"add": "Añadir",
|
||||||
"sort_asc": "Asc",
|
"sort_asc": "Asc",
|
||||||
"sort_asc_description": "En order ascendente. Click para ordenar descendentemente.",
|
"sort_asc_description": "En order ascendente. Click para ordenar descendentemente.",
|
||||||
@ -194,6 +195,7 @@
|
|||||||
"toast_article_added": "Artículo del catálogo añadido:"
|
"toast_article_added": "Artículo del catálogo añadido:"
|
||||||
},
|
},
|
||||||
"quote_status_editor": {
|
"quote_status_editor": {
|
||||||
|
"trigger_button": "Cambiar el estado",
|
||||||
"title": "Cambiar el estado de la cotización",
|
"title": "Cambiar el estado de la cotización",
|
||||||
"status": {
|
"status": {
|
||||||
"draft": {
|
"draft": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user