Merge branch 'Issue_May_2W' of https://git.marcoaiot.com/admin/marco.pms.web into pramod_Bug#141

This commit is contained in:
Pramod Mahajan 2025-05-08 15:56:30 +05:30
commit 13fb930a77
7 changed files with 24 additions and 19 deletions

View File

@ -194,7 +194,8 @@ const ManageEmployee = () => {
navigation("/employees"); navigation("/employees");
}) })
.catch((error) => { .catch((error) => {
showToast(error.message, "error"); const message = error?.response?.data?.message || error?.message || "Error occured during api calling"
showToast(message, "error");
setLoading(false); setLoading(false);
}); });
}; };

View File

@ -157,9 +157,9 @@ const ManageRole = ( {employeeId, onClosed} ) =>
reset(); reset();
onClosed(); onClosed();
}) })
.catch((err) => { .catch((error) => {
console.error(err); const message = error?.response?.data?.message || error?.message || "Error occured during api calling"
showToast(err.message, "error"); showToast(message, "error");
setIsLoading(false); setIsLoading(false);
}); });
}; };

View File

@ -110,6 +110,7 @@ const TaskModel = ({
await onSubmit(data); await onSubmit(data);
setValue("plannedWork", 0); setValue("plannedWork", 0);
setValue( "completedWork", 0 ); setValue( "completedWork", 0 );
setValue("activityID",0)
setIsSubmitting(false); setIsSubmitting(false);
}; };
@ -246,7 +247,7 @@ const TaskModel = ({
{selectedWorkArea && ( {selectedWorkArea && (
<div className="col-12 col-md-12"> <div className="col-12 col-md-12">
<label className="form-label" htmlFor="activityID"> <label className="form-label" >
Select Activity Select Activity
</label> </label>
<select <select

View File

@ -28,7 +28,10 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
name: z.string().min(1, { message: "Project Name is required" }), name: z.string().min(1, { message: "Project Name is required" }),
contactPerson: z contactPerson: z
.string() .string()
.min(1, { message: "Contact Person Name is required" }), .min( 1, {message: "Contact Person Name is required"} )
.regex(/^[A-Za-z\s]+$/, {
message: "Contact Person must contain only letters",
}),
projectAddress: z projectAddress: z
.string() .string()
.min(1, { message: "Address is required" }) .min(1, { message: "Address is required" })
@ -156,6 +159,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
name="contactPerson" name="contactPerson"
className="form-control" className="form-control"
placeholder="Contact Person" placeholder="Contact Person"
maxLength={50}
{...register("contactPerson")} {...register("contactPerson")}
/> />
{errors.contactPerson && ( {errors.contactPerson && (

View File

@ -46,17 +46,16 @@ const EmployeeList = () => {
const handleSearch = (e) => { const handleSearch = (e) => {
const value = e.target.value.toLowerCase(); const value = e.target.value.toLowerCase();
setSearchText(value); setSearchText(value);
if (!employeeList.length) return; if (!employeeList.length) return;
const results = employeeList.filter((item) => const results = employeeList.filter((item) => {
Object.values(item).some( const fullName = `${item.firstName} ${item.lastName}`.toLowerCase();
(field) => field && field.toString().toLowerCase().includes(value) return fullName.includes(value);
) });
);
setFilteredData(results); setFilteredData(results);
}; };
useEffect(() => { useEffect(() => {
setCurrentPage(1); setCurrentPage(1);
@ -557,7 +556,7 @@ const EmployeeList = () => {
> >
<i className="bx bx-edit bx-sm"></i> Edit <i className="bx bx-edit bx-sm"></i> Edit
</Link> </Link>
<button {!item.isSystem && (<><button
className="dropdown-item py-1" className="dropdown-item py-1"
onClick={() => suspendEmployee(item.id)} onClick={() => suspendEmployee(item.id)}
> >
@ -573,7 +572,7 @@ const EmployeeList = () => {
> >
<i className="bx bx-cog bx-sm"></i> Manage <i className="bx bx-cog bx-sm"></i> Manage
Role Role
</button> </button></>)}
</div> </div>
</div> </div>
</td> </td>

View File

@ -25,7 +25,7 @@ const ProjectList = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [itemsPerPage] = useState(6); const [itemsPerPage] = useState(10);
const [searchTerm, setSearchTerm] = useState(""); const [searchTerm, setSearchTerm] = useState("");
const [selectedStatuses, setSelectedStatuses] = useState([ const [selectedStatuses, setSelectedStatuses] = useState([
"b74da4c2-d07e-46f2-9919-e75e49b12731", "b74da4c2-d07e-46f2-9919-e75e49b12731",

View File

@ -15,7 +15,7 @@ export const RolesRepository = {
getEmployeeRoles:(id)=>api.get(`/api/employee/roles/${id}`), getEmployeeRoles:(id)=>api.get(`/api/employee/roles/${id}`),
createEmployeeRoles:(data)=>api.post("/api/employee/roles",data) createEmployeeRoles:(data)=>api.post("/api/roles/assign-roles",data)
}; };