diff --git a/client/src/app/quotes/components/AppendEmptyRowButton.tsx b/client/src/app/quotes/components/AppendEmptyRowButton.tsx
index 9524d9a..3c2b1ed 100644
--- a/client/src/app/quotes/components/AppendEmptyRowButton.tsx
+++ b/client/src/app/quotes/components/AppendEmptyRowButton.tsx
@@ -1,21 +1,23 @@
import { Button, ButtonProps } from "@/ui";
import { t } from "i18next";
import { PlusCircleIcon } from "lucide-react";
+import { forwardRef } from "react";
export interface AppendEmptyRowButtonProps extends ButtonProps {
label?: string;
className?: string;
}
-export const AppendEmptyRowButton = ({
- label = t("common.append_empty_row"),
- className,
- ...props
-}: AppendEmptyRowButtonProps): JSX.Element => (
-
+export const AppendEmptyRowButton = forwardRef(
+ (
+ { label = t("common.append_empty_row"), className, ...props }: AppendEmptyRowButtonProps,
+ ref
+ ): JSX.Element => (
+
+ )
);
AppendEmptyRowButton.displayName = "AddNewRowButton";
diff --git a/client/src/app/quotes/components/QuotePDFPreview.tsx b/client/src/app/quotes/components/QuotePDFPreview.tsx
index e7568a6..e05e4f0 100644
--- a/client/src/app/quotes/components/QuotePDFPreview.tsx
+++ b/client/src/app/quotes/components/QuotePDFPreview.tsx
@@ -1,35 +1,19 @@
import { PDFViewer } from "@/components";
import { cn } from "@/lib/utils";
-import {
- Button,
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
- Skeleton,
-} from "@/ui";
+import { Card, CardContent, CardHeader, Skeleton } from "@/ui";
import { useToast } from "@/ui/use-toast";
import { IListQuotes_Response_DTO } from "@shared/contexts";
import { t } from "i18next";
-import { DownloadIcon, MoreVerticalIcon } from "lucide-react";
import { useCallback, useEffect, useState } from "react";
-import { Trans } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { useQuotes } from "../hooks";
-import { DownloadQuoteDialog } from "./DownloadQuoteDialog";
const QuotePDFPreview = ({
quote,
className,
}: {
quote?: IListQuotes_Response_DTO;
- className: string;
+ className?: string;
}) => {
const navigate = useNavigate();
const { toast } = useToast();
@@ -99,84 +83,7 @@ const QuotePDFPreview = ({
}
return (
- <>
-
-
-
- {t("quotes.list.preview.quote")}
-
-
- {/*
*/}
-
-
-
-
-
-
- {
- e.preventDefault();
- navigate(`/quotes/edit/${quote.id}`, { relative: "path" });
- }}
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
- {false && (
-
- {quote?.reference}
- {quote?.date.toString()}
-
- )}
-
-
-
-
-
-
- >
+
);
};
diff --git a/client/src/app/quotes/components/QuoteResume.tsx b/client/src/app/quotes/components/QuoteResume.tsx
index 07583da..d3ee70a 100644
--- a/client/src/app/quotes/components/QuoteResume.tsx
+++ b/client/src/app/quotes/components/QuoteResume.tsx
@@ -28,6 +28,7 @@ import { useNavigate } from "react-router-dom";
import { useQuotes } from "../hooks";
import { DownloadQuoteDialog } from "./DownloadQuoteDialog";
import { QuoteStatusEditor } from "./editors";
+import { QuotePDFPreview } from "./QuotePDFPreview";
type QuoteResumeProps = {
quoteId?: string;
@@ -43,7 +44,7 @@ export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
const { mutate: setStatusMutation } = useSetStatus(quoteId);
const { download, ...downloadProps } = useDownloader();
- const { formatCurrency } = useCustomLocalization({
+ const { formatCurrency, formatNumber } = useCustomLocalization({
locale: data?.lang_code || "ES",
});
@@ -58,15 +59,21 @@ export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
return data
? {
subtotal_price: formatCurrency(data.subtotal_price),
+
+ discount: formatNumber(data.discount),
discount_price: formatCurrency(data.discount_price),
+
+ tax: formatNumber(data.tax),
tax_price: formatCurrency(data.tax_price),
total_price: formatCurrency(data.total_price),
}
: {
- subtotal_price: "0,00",
- discount_price: "0,00",
- tax_price: "0,00",
- total_price: "0,00",
+ subtotal_price: "0,00 €",
+ discount: "0",
+ discount_price: "0,00 €",
+ tax: "0",
+ tax_price: "0,00 €",
+ total_price: "0,00 €",
};
}, [data]);
@@ -228,43 +235,32 @@ export const QuoteResume = ({ quoteId, className }: QuoteResumeProps) => {
- {t("quotes.form_fields.discount.label")}
+ {t("quotes.form_fields.discount_value.label", { value: totals.discount })}
- $5.00
-
-
-
- {t("quotes.form_fields.discount_price.label")}
-
- $25.00
+ {totals.discount_price}
- {t("quotes.form_fields.tax.label")}
+ {t("quotes.form_fields.tax_value.label", { value: totals.tax })}
- $5.00
+ {totals.tax_price}
-
-
- {t("quotes.form_fields.tax_price.label")}
-
- $25.00
-
-
{t("quotes.form_fields.total_price.label")}
- $329.00
+ {totals.total_price}
-
+
+
+
- Updated...
+
diff --git a/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx b/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx
index 0ab32ae..27634b3 100644
--- a/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx
+++ b/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx
@@ -15,14 +15,13 @@ export const QuoteGeneralCardEditor = () => {
>
{
const navigate = useNavigate();
const quoteId = useUrlId();
+ const { toast } = useToast();
const [activeTab, setActiveTab] = useState("general");
@@ -142,14 +143,13 @@ export const QuoteEdit = () => {
mutate(data, {
onError: (error) => {
console.debug(error);
- toast.error(error.message);
+ toast({ description: error.message });
//alert(error.message);
},
//onSettled: () => {},
onSuccess: () => {
- console.log("onsuccess 2");
reset(getValues());
- toast.success("Cotización guardada");
+ toast({ description: "Cotización guardada" });
if (shouldRedirect) {
navigate("/quotes");
}
@@ -161,7 +161,6 @@ export const QuoteEdit = () => {
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { unsubscribe } = watch((_, { name, type }) => {
- console.log("useEffect");
const quote = getValues();
if (name) {
diff --git a/client/src/components/PDFViewer/PDFViewer.tsx b/client/src/components/PDFViewer/PDFViewer.tsx
index 8cc5ed1..5d0efcf 100644
--- a/client/src/components/PDFViewer/PDFViewer.tsx
+++ b/client/src/components/PDFViewer/PDFViewer.tsx
@@ -1,5 +1,5 @@
import { cn } from "@/lib/utils";
-import { Button, Pagination, PaginationContent, PaginationItem } from "@/ui";
+import { Button } from "@/ui";
import { useResizeObserver } from "@wojtekmaj/react-hooks";
import { t } from "i18next";
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
@@ -132,7 +132,7 @@ export const PDFViewer = ({ file, onThumbnailClick, className }: PDFViewerProps)
/>
-
+ {/*
-
+ */}