Project_Branch_Management : New Feature Service Project - Branch Management #519

Merged
pramod.mahajan merged 76 commits from Project_Branch_Management into main 2025-11-25 09:42:48 +00:00
2 changed files with 76 additions and 45 deletions
Showing only changes of commit 17a9f4a9b1 - Show all commits

View File

@ -32,6 +32,8 @@ import Label from "../common/Label";
import EmployeeSearchInput from "../common/EmployeeSearchInput"; import EmployeeSearchInput from "../common/EmployeeSearchInput";
import Filelist from "./Filelist"; import Filelist from "./Filelist";
import { DEFAULT_CURRENCY } from "../../utils/constants"; import { DEFAULT_CURRENCY } from "../../utils/constants";
import SelectEmployeeServerSide, { SelectProjectField } from "../common/Forms/SelectFieldServerSide";
import { useAllocationServiceProjectTeam } from "../../hooks/useServiceProject";
const ManageExpense = ({ closeModal, expenseToEdit = null }) => { const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
const { const {
@ -40,6 +42,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
error: ExpenseErrorLoad, error: ExpenseErrorLoad,
} = useExpense(expenseToEdit); } = useExpense(expenseToEdit);
const [expenseCategory, setExpenseCategory] = useState(); const [expenseCategory, setExpenseCategory] = useState();
const [selectedEmployees, setSelectedEmployees] = useState([]);
const dispatch = useDispatch(); const dispatch = useDispatch();
const { const {
expenseCategories, expenseCategories,
@ -83,11 +86,11 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
loading: StatusLoadding, loading: StatusLoadding,
error: stausError, error: stausError,
} = useExpenseStatus(); } = useExpenseStatus();
const { // const {
data: employees, // data: employees,
isLoading: EmpLoading, // isLoading: EmpLoading,
isError: isEmployeeError, // isError: isEmployeeError,
} = useEmployeesNameByProject(selectedproject); // } = useEmployeesNameByProject(selectedproject);
const files = watch("billAttachments"); const files = watch("billAttachments");
const onFileChange = async (e) => { const onFileChange = async (e) => {
@ -150,6 +153,15 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
} }
}; };
const { mutate: AllocationTeam, isPending1 } = useAllocationServiceProjectTeam(
() => {
setSelectedEmployees([]);
setSeletingEmp({
employee: null,
isOpen: false,
});
}
);
useEffect(() => { useEffect(() => {
if (expenseToEdit && data) { if (expenseToEdit && data) {
reset({ reset({
@ -180,7 +192,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
: [], : [],
}); });
} }
}, [data, reset, employees]); }, [data, reset]);
const { mutate: ExpenseUpdate, isPending } = useUpdateExpense(() => const { mutate: ExpenseUpdate, isPending } = useUpdateExpense(() =>
handleClose() handleClose()
); );
@ -223,7 +235,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
</h5> </h5>
<form id="expenseForm" onSubmit={handleSubmit(onSubmit)}> <form id="expenseForm" onSubmit={handleSubmit(onSubmit)}>
<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>
@ -245,6 +257,24 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
{errors.projectId && ( {errors.projectId && (
<small className="danger-text">{errors.projectId.message}</small> <small className="danger-text">{errors.projectId.message}</small>
)} )}
</div> */}
<div className="col-12 col-md-6 mb-2">
<SelectProjectField
label="Project"
required
placeholder="Select Project"
value={watch("projectId")}
onChange={(val) =>
setValue("projectId", val, {
shouldDirty: true,
shouldValidate: true,
})
}
/>
{errors.projectId && (
<small className="danger-text">{errors.projectId.message}</small>
)}
</div> </div>
<div className="col-md-6"> <div className="col-md-6">
@ -314,7 +344,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
control={control} control={control}
name="paidById" name="paidById"
projectId={null} projectId={null}
forAll={expenseToEdit ? true : false} forAll={true}
/> />
</div> </div>
</div> </div>

View File

@ -7,6 +7,7 @@ import Avatar from "./Avatar";
const EmployeeSearchInput = ({ const EmployeeSearchInput = ({
control, control,
name, name,
size = "sm",
projectId, projectId,
placeholder, placeholder,
forAll, forAll,
@ -46,7 +47,7 @@ const EmployeeSearchInput = ({
<input <input
type="text" type="text"
ref={ref} ref={ref}
className={`form-control form-control-sm`} className={`form-control form-control-sm-${size}`}
placeholder={placeholder} placeholder={placeholder}
value={search} value={search}
onChange={(e) => { onChange={(e) => {