Compare commits
No commits in common. "bd1a97716c8c4632900d6726a13ef0da9feaa7fb" and "73f5b46a40b236d3d854e71cfc5d92da64cd7aa6" have entirely different histories.
bd1a97716c
...
73f5b46a40
@ -54,13 +54,7 @@ const ManagePurchase = ({ onClose, purchaseId }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (purchaseId && data) {
|
if (purchaseId && data) {
|
||||||
reset({
|
reset(data);
|
||||||
...data,
|
|
||||||
title: data.title,
|
|
||||||
projectId: data.project.id,
|
|
||||||
organizationId: data.organization.id,
|
|
||||||
supplierId: data.supplier.id,
|
|
||||||
});
|
|
||||||
setCompletedTabs([0, 1, 2]);
|
setCompletedTabs([0, 1, 2]);
|
||||||
}
|
}
|
||||||
}, [purchaseId, data, reset]);
|
}, [purchaseId, data, reset]);
|
||||||
@ -84,7 +78,8 @@ const ManagePurchase = ({ onClose, purchaseId }) => {
|
|||||||
setActiveTab((prev) => Math.max(prev - 1, 0));
|
setActiveTab((prev) => Math.max(prev - 1, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
const { mutate: CreateInvoice, isPending } = useCreatePurchaseInvoice(() => {
|
const { mutate: CreateInvoice, isPending } =
|
||||||
|
useCreatePurchaseInvoice(() => {
|
||||||
reset();
|
reset();
|
||||||
onClose();
|
onClose();
|
||||||
});
|
});
|
||||||
@ -154,7 +149,9 @@ const ManagePurchase = ({ onClose, purchaseId }) => {
|
|||||||
|
|
||||||
<span className="bs-stepper-label">
|
<span className="bs-stepper-label">
|
||||||
<span className="bs-stepper-title">{step.name}</span>
|
<span className="bs-stepper-title">{step.name}</span>
|
||||||
<span className="bs-stepper-subtitle">{step.subtitle}</span>
|
<span className="bs-stepper-subtitle">
|
||||||
|
{step.subtitle}
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -228,3 +225,4 @@ const ManagePurchase = ({ onClose, purchaseId }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default ManagePurchase;
|
export default ManagePurchase;
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,12 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import {
|
import { AppFormController, useAppFormContext } from "../../hooks/appHooks/useAppForm";
|
||||||
AppFormController,
|
|
||||||
useAppFormContext,
|
|
||||||
} from "../../hooks/appHooks/useAppForm";
|
|
||||||
import Label from "../common/Label";
|
import Label from "../common/Label";
|
||||||
import DatePicker from "../common/DatePicker";
|
import DatePicker from "../common/DatePicker";
|
||||||
import {
|
import {
|
||||||
SelectFieldSearch,
|
SelectFieldSearch,
|
||||||
SelectProjectField,
|
SelectProjectField,
|
||||||
} from "../common/Forms/SelectFieldServerSide";
|
} from "../common/Forms/SelectFieldServerSide";
|
||||||
import {
|
import { useGlobaleOrganizations, useOrganization, useOrganizationsList } from "../../hooks/useOrganization";
|
||||||
useGlobaleOrganizations,
|
|
||||||
useOrganization,
|
|
||||||
useOrganizationsList,
|
|
||||||
} from "../../hooks/useOrganization";
|
|
||||||
import { ITEMS_PER_PAGE } from "../../utils/constants";
|
import { ITEMS_PER_PAGE } from "../../utils/constants";
|
||||||
|
|
||||||
const PurchasePartyDetails = () => {
|
const PurchasePartyDetails = () => {
|
||||||
@ -25,6 +18,7 @@ const PurchasePartyDetails = () => {
|
|||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useAppFormContext();
|
} = useAppFormContext();
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="row g-2 text-start">
|
<div className="row g-2 text-start">
|
||||||
{/* Title */}
|
{/* Title */}
|
||||||
@ -67,27 +61,35 @@ const PurchasePartyDetails = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Organization */}
|
||||||
<div className="col-12 col-md-6">
|
<div className="col-12 col-md-6">
|
||||||
|
|
||||||
|
|
||||||
<AppFormController
|
<AppFormController
|
||||||
name="organizationId"
|
name="organizationId"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<SelectFieldSearch
|
<SelectFieldSearch
|
||||||
{...field}
|
|
||||||
label="Organization"
|
label="Organization"
|
||||||
placeholder="Select Organization"
|
placeholder="Select Organization"
|
||||||
required
|
required
|
||||||
|
value={field.value}
|
||||||
|
onChange={field.onChange}
|
||||||
valueKey="id"
|
valueKey="id"
|
||||||
labelKey="name"
|
labelKey="name"
|
||||||
useFetchHook={useGlobaleOrganizations}
|
useFetchHook={useGlobaleOrganizations}
|
||||||
hookParams={[ITEMS_PER_PAGE, 1]}
|
hookParams={[ITEMS_PER_PAGE,1]}
|
||||||
error={errors?.organizationId?.message}
|
errors={errors?.organizationId}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Supplier */}
|
||||||
<div className="col-12 col-md-6">
|
<div className="col-12 col-md-6">
|
||||||
|
|
||||||
|
|
||||||
<AppFormController
|
<AppFormController
|
||||||
name="supplierId"
|
name="supplierId"
|
||||||
control={control}
|
control={control}
|
||||||
@ -101,13 +103,16 @@ const PurchasePartyDetails = () => {
|
|||||||
valueKey="id"
|
valueKey="id"
|
||||||
labelKey="name"
|
labelKey="name"
|
||||||
useFetchHook={useGlobaleOrganizations}
|
useFetchHook={useGlobaleOrganizations}
|
||||||
hookParams={[ITEMS_PER_PAGE, 1]}
|
hookParams={[ITEMS_PER_PAGE,1]}
|
||||||
errors={errors.supplierId}
|
errors={errors.supplierId}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Billing Address */}
|
||||||
<div className="col-12 col-md-6">
|
<div className="col-12 col-md-6">
|
||||||
<Label htmlFor="billingAddress">Billing Address</Label>
|
<Label htmlFor="billingAddress">Billing Address</Label>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user