added new project filed inside ManagePaymentRequest

This commit is contained in:
pramod.mahajan 2025-11-21 14:08:52 +05:30
parent 4506f740eb
commit 8b4a9d2d1c
2 changed files with 23 additions and 4 deletions

View File

@ -29,6 +29,7 @@ import Filelist from "../Expenses/Filelist";
import InputSuggestions from "../common/InputSuggestion"; import InputSuggestions from "../common/InputSuggestion";
import { useProfile } from "../../hooks/useProfile"; import { useProfile } from "../../hooks/useProfile";
import { blockUI } from "../../utils/blockUI"; import { blockUI } from "../../utils/blockUI";
import { SelectProjectField } from "../common/Forms/SelectFieldServerSide";
function ManagePaymentRequest({ closeModal, requestToEdit = null }) { function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
const { const {
@ -234,10 +235,10 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
{/* Project and Category */} {/* Project and Category */}
<div className="row my-2 text-start"> <div className="row my-2 text-start">
<div className="col-md-6"> <div className="col-md-6">
<Label className="form-label" required> {/* <Label className="form-label" required>
Select Project Select Project
</Label> </Label> */}
<select {/* <select
className="form-select form-select-sm" className="form-select form-select-sm"
{...register("projectId")} {...register("projectId")}
disabled={ disabled={
@ -254,7 +255,23 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
</option> </option>
)) ))
)} )}
</select> </select> */}
<SelectProjectField
label="Project"
required
placeholder="Select Project"
value={watch("projectId")}
onChange={(val) =>
setValue("projectId", val, {
shouldDirty: true,
shouldValidate: true,
})
}
disabled={
data?.recurringPayment?.isVariable && !isDraft && !isProcessed
}
/>
{errors.projectId && ( {errors.projectId && (
<small className="danger-text">{errors.projectId.message}</small> <small className="danger-text">{errors.projectId.message}</small>
)} )}

View File

@ -200,6 +200,7 @@ export const SelectProjectField = ({
isFullObject = false, isFullObject = false,
isMultiple = false, isMultiple = false,
isAllProject = false, isAllProject = false,
disabled
}) => { }) => {
const [searchText, setSearchText] = useState(""); const [searchText, setSearchText] = useState("");
const debounce = useDebounce(searchText, 300); const debounce = useDebounce(searchText, 300);
@ -295,6 +296,7 @@ export const SelectProjectField = ({
open ? "show" : "" open ? "show" : ""
}`} }`}
onClick={() => setOpen((prev) => !prev)} onClick={() => setOpen((prev) => !prev)}
disabled={disabled}
> >
<span className={`text-truncate ${!displayText ? "text-muted" : ""}`}> <span className={`text-truncate ${!displayText ? "text-muted" : ""}`}>
{displayText} {displayText}