Compare commits

..

No commits in common. "bd1a97716c8c4632900d6726a13ef0da9feaa7fb" and "73f5b46a40b236d3d854e71cfc5d92da64cd7aa6" have entirely different histories.

2 changed files with 28 additions and 25 deletions

View File

@ -54,13 +54,7 @@ const ManagePurchase = ({ onClose, purchaseId }) => {
useEffect(() => {
if (purchaseId && data) {
reset({
...data,
title: data.title,
projectId: data.project.id,
organizationId: data.organization.id,
supplierId: data.supplier.id,
});
reset(data);
setCompletedTabs([0, 1, 2]);
}
}, [purchaseId, data, reset]);
@ -84,10 +78,11 @@ 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(() => {
@ -154,7 +149,9 @@ const ManagePurchase = ({ onClose, purchaseId }) => {
<span className="bs-stepper-label">
<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>
</button>
</div>
@ -228,3 +225,4 @@ const ManagePurchase = ({ onClose, purchaseId }) => {
};
export default ManagePurchase;

View File

@ -1,19 +1,12 @@
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 = () => {
@ -25,6 +18,7 @@ const PurchasePartyDetails = () => {
formState: { errors },
} = useAppFormContext();
return (
<div className="row g-2 text-start">
{/* Title */}
@ -67,27 +61,35 @@ const PurchasePartyDetails = () => {
/>
</div>
{/* Organization */}
<div className="col-12 col-md-6">
<AppFormController
name="organizationId"
control={control}
render={({ field }) => (
<SelectFieldSearch
{...field}
label="Organization"
placeholder="Select Organization"
required
value={field.value}
onChange={field.onChange}
valueKey="id"
labelKey="name"
useFetchHook={useGlobaleOrganizations}
hookParams={[ITEMS_PER_PAGE, 1]}
error={errors?.organizationId?.message}
hookParams={[ITEMS_PER_PAGE,1]}
errors={errors?.organizationId}
/>
)}
/>
</div>
{/* Supplier */}
<div className="col-12 col-md-6">
<AppFormController
name="supplierId"
control={control}
@ -101,13 +103,16 @@ const PurchasePartyDetails = () => {
valueKey="id"
labelKey="name"
useFetchHook={useGlobaleOrganizations}
hookParams={[ITEMS_PER_PAGE, 1]}
hookParams={[ITEMS_PER_PAGE,1]}
errors={errors.supplierId}
/>
)}
/>
</div>
{/* Billing Address */}
<div className="col-12 col-md-6">
<Label htmlFor="billingAddress">Billing Address</Label>