From e0789cda3a8b30236262f26ab1bf09cf2abb60ab Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Fri, 28 Nov 2025 11:02:17 +0530 Subject: [PATCH] fixed project, supplier and Organization filed fullfied whenevr open for update --- src/components/purchase/ManagePurchase.jsx | 22 +++++++------ .../purchase/PurchasePartyDetails.jsx | 31 ++++++++----------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/components/purchase/ManagePurchase.jsx b/src/components/purchase/ManagePurchase.jsx index 1c76017e..085401e4 100644 --- a/src/components/purchase/ManagePurchase.jsx +++ b/src/components/purchase/ManagePurchase.jsx @@ -54,7 +54,13 @@ const ManagePurchase = ({ onClose, purchaseId }) => { useEffect(() => { if (purchaseId && data) { - reset(data); + reset({ + ...data, + title: data.title, + projectId: data.project.id, + organizationId: data.organization.id, + supplierId: data.supplier.id, + }); setCompletedTabs([0, 1, 2]); } }, [purchaseId, data, reset]); @@ -78,11 +84,10 @@ const ManagePurchase = ({ onClose, purchaseId }) => { setActiveTab((prev) => Math.max(prev - 1, 0)); }; - const { mutate: CreateInvoice, isPending } = - useCreatePurchaseInvoice(() => { - reset(); - onClose(); - }); + const { mutate: CreateInvoice, isPending } = useCreatePurchaseInvoice(() => { + reset(); + onClose(); + }); const { mutate: updatePurchase, isPending: isUpdating } = useUpdatePurchaseInvoice(() => { @@ -149,9 +154,7 @@ const ManagePurchase = ({ onClose, purchaseId }) => { {step.name} - - {step.subtitle} - + {step.subtitle} @@ -225,4 +228,3 @@ const ManagePurchase = ({ onClose, purchaseId }) => { }; export default ManagePurchase; - diff --git a/src/components/purchase/PurchasePartyDetails.jsx b/src/components/purchase/PurchasePartyDetails.jsx index 3ef4beeb..0684becb 100644 --- a/src/components/purchase/PurchasePartyDetails.jsx +++ b/src/components/purchase/PurchasePartyDetails.jsx @@ -1,12 +1,19 @@ import React from "react"; -import { AppFormController, useAppFormContext } from "../../hooks/appHooks/useAppForm"; +import { + AppFormController, + useAppFormContext, +} from "../../hooks/appHooks/useAppForm"; import Label from "../common/Label"; import DatePicker from "../common/DatePicker"; import { SelectFieldSearch, SelectProjectField, } from "../common/Forms/SelectFieldServerSide"; -import { useGlobaleOrganizations, useOrganization, useOrganizationsList } from "../../hooks/useOrganization"; +import { + useGlobaleOrganizations, + useOrganization, + useOrganizationsList, +} from "../../hooks/useOrganization"; import { ITEMS_PER_PAGE } from "../../utils/constants"; const PurchasePartyDetails = () => { @@ -18,7 +25,6 @@ const PurchasePartyDetails = () => { formState: { errors }, } = useAppFormContext(); - return (
{/* Title */} @@ -61,35 +67,27 @@ const PurchasePartyDetails = () => { />
- {/* Organization */}
- - ( )} /> -
- {/* Supplier */}
- - { valueKey="id" labelKey="name" useFetchHook={useGlobaleOrganizations} - hookParams={[ITEMS_PER_PAGE,1]} + hookParams={[ITEMS_PER_PAGE, 1]} errors={errors.supplierId} /> )} /> - -
- {/* Billing Address */}