.
This commit is contained in:
parent
adbe76fd09
commit
cdda482253
@ -58,7 +58,7 @@
|
|||||||
"react-day-picker": "^8.10.1",
|
"react-day-picker": "^8.10.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-hook-form": "^7.51.5",
|
"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-i18next": "^14.1.2",
|
||||||
"react-resizable-panels": "^2.0.19",
|
"react-resizable-panels": "^2.0.19",
|
||||||
"react-router-dom": "^6.23.1",
|
"react-router-dom": "^6.23.1",
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import {
|
|||||||
BackHistoryButton,
|
BackHistoryButton,
|
||||||
CancelButton,
|
CancelButton,
|
||||||
ErrorOverlay,
|
ErrorOverlay,
|
||||||
FormCurrencyField,
|
|
||||||
LoadingOverlay,
|
LoadingOverlay,
|
||||||
SubmitButton,
|
SubmitButton,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
@ -93,7 +92,17 @@ export const QuoteEdit = () => {
|
|||||||
|
|
||||||
const { watch, getValues, setValue, formState } = form;
|
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;
|
const { isSubmitting } = formState;
|
||||||
|
|
||||||
@ -196,15 +205,16 @@ export const QuoteEdit = () => {
|
|||||||
<CancelButton variant='outline' size='sm' onClick={() => navigate("/quotes")}>
|
<CancelButton variant='outline' size='sm' onClick={() => navigate("/quotes")}>
|
||||||
{t("common.cancel")}
|
{t("common.cancel")}
|
||||||
</CancelButton>
|
</CancelButton>
|
||||||
<SubmitButton variant={form.formState.isDirty ? "default" : "outline"} size='sm'>
|
<SubmitButton
|
||||||
|
variant={form.formState.isDirty ? "default" : "outline"}
|
||||||
|
size='sm'
|
||||||
|
disabled={formState.isSubmitting || formState.isLoading || formState.isValidating}
|
||||||
|
>
|
||||||
{t("common.save")}
|
{t("common.save")}
|
||||||
</SubmitButton>
|
</SubmitButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<QuoteGeneralCardEditor />
|
|
||||||
<QuoteDetailsCardEditor currency={quoteCurrency} />
|
|
||||||
|
|
||||||
<Tabs defaultValue='items' className='space-y-4'>
|
<Tabs defaultValue='items' className='space-y-4'>
|
||||||
<TabsList>
|
<TabsList>
|
||||||
<TabsTrigger value='general'>{t("quotes.create.tabs.general")}</TabsTrigger>
|
<TabsTrigger value='general'>{t("quotes.create.tabs.general")}</TabsTrigger>
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export const useQuotes = () => {
|
|||||||
}),
|
}),
|
||||||
useCreate: () =>
|
useCreate: () =>
|
||||||
useSave<ICreateQuote_Response_DTO, TDataSourceError, ICreateQuote_Request_DTO>({
|
useSave<ICreateQuote_Response_DTO, TDataSourceError, ICreateQuote_Request_DTO>({
|
||||||
mutationKey: keys().data().resource("quotes").action("one").id("").params().get(),
|
//mutationKey: keys().data().resource("quotes").action("one").id("").params().get(),
|
||||||
mutationFn: (data) => {
|
mutationFn: (data) => {
|
||||||
const { date } = data;
|
const { date } = data;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ISequelizeAdapter, SequelizeRepository } from "@/contexts/common/infrastructure/sequelize";
|
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 { ModelDefined, Transaction } from "sequelize";
|
||||||
|
|
||||||
import { IQuoteRepository } from "../domain";
|
import { IQuoteRepository } from "../domain";
|
||||||
@ -62,7 +62,22 @@ export class QuoteRepository extends SequelizeRepository<Quote> implements IQuot
|
|||||||
const QuoteItem_Model: ModelDefined<any, any> = this._adapter.getModel("QuoteItem_Model");
|
const QuoteItem_Model: ModelDefined<any, any> = this._adapter.getModel("QuoteItem_Model");
|
||||||
|
|
||||||
const rawQuote: any = await this._getById("Quote_Model", id, {
|
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) {
|
if (!rawQuote === true) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user