diff --git a/client/package.json b/client/package.json index f6d3835..90ab9c5 100644 --- a/client/package.json +++ b/client/package.json @@ -58,7 +58,7 @@ "react-day-picker": "^8.10.1", "react-dom": "^18.2.0", "react-hook-form": "^7.51.5", - "react-hook-form-persist": "^3.0.0", + "react-hook-form-persist": "^2.1.0", "react-i18next": "^14.1.2", "react-resizable-panels": "^2.0.19", "react-router-dom": "^6.23.1", diff --git a/client/src/app/quotes/edit.tsx b/client/src/app/quotes/edit.tsx index 3cd5854..f867c1b 100644 --- a/client/src/app/quotes/edit.tsx +++ b/client/src/app/quotes/edit.tsx @@ -2,7 +2,6 @@ import { BackHistoryButton, CancelButton, ErrorOverlay, - FormCurrencyField, LoadingOverlay, SubmitButton, } from "@/components"; @@ -93,7 +92,17 @@ export const QuoteEdit = () => { const { watch, getValues, setValue, formState } = form; - const { clear } = useFormPersist("quote-edit", { watch, setValue, storage: window.localStorage }); + const { clear } = useFormPersist( + "quote-edit", + { + watch, + setValue, + }, + { + storage: window.localStorage, // default window.sessionStorage + //exclude: ['foo'] + } + ); const { isSubmitting } = formState; @@ -196,15 +205,16 @@ export const QuoteEdit = () => { navigate("/quotes")}> {t("common.cancel")} - + {t("common.save")} - - - {t("quotes.create.tabs.general")} diff --git a/client/src/app/quotes/hooks/useQuotes.tsx b/client/src/app/quotes/hooks/useQuotes.tsx index 275d5bf..fdfc6cf 100644 --- a/client/src/app/quotes/hooks/useQuotes.tsx +++ b/client/src/app/quotes/hooks/useQuotes.tsx @@ -96,7 +96,7 @@ export const useQuotes = () => { }), useCreate: () => useSave({ - mutationKey: keys().data().resource("quotes").action("one").id("").params().get(), + //mutationKey: keys().data().resource("quotes").action("one").id("").params().get(), mutationFn: (data) => { const { date } = data; diff --git a/server/src/contexts/sales/infrastructure/Quote.repository.ts b/server/src/contexts/sales/infrastructure/Quote.repository.ts index b87cc8f..e006b6d 100644 --- a/server/src/contexts/sales/infrastructure/Quote.repository.ts +++ b/server/src/contexts/sales/infrastructure/Quote.repository.ts @@ -1,5 +1,5 @@ import { ISequelizeAdapter, SequelizeRepository } from "@/contexts/common/infrastructure/sequelize"; -import { ICollection, IQueryCriteria, UniqueID } from "@shared/contexts"; +import { UniqueID } from "@shared/contexts"; import { ModelDefined, Transaction } from "sequelize"; import { IQuoteRepository } from "../domain"; @@ -62,7 +62,22 @@ export class QuoteRepository extends SequelizeRepository implements IQuot const QuoteItem_Model: ModelDefined = this._adapter.getModel("QuoteItem_Model"); const rawQuote: any = await this._getById("Quote_Model", id, { - include: "items", + include: [ + { + model: QuoteItem_Model, + as: "items", + }, + ], + order: [ + [ + { + model: QuoteItem_Model, + as: "items", + }, + "position", + "asc", + ], + ], }); if (!rawQuote === true) {