Compare commits
No commits in common. "f84d04efd57dbfa762f32c46d05fb755c1b050bb" and "6e570ee411c7fd3b3ff3b54a06851b761dec7ca5" have entirely different histories.
f84d04efd5
...
6e570ee411
@ -168,7 +168,7 @@ const SubTask = ({ activity, onClose }) => {
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
className="form-control form-control-sm"
|
className="form-control form-control-sm"
|
||||||
{...register("plannedWork", { valueAsNumber: true })}
|
{...register("plannedWork")}
|
||||||
/>
|
/>
|
||||||
{errors.plannedWork && (
|
{errors.plannedWork && (
|
||||||
<div className="danger-text">{errors.plannedWork.message}</div>
|
<div className="danger-text">{errors.plannedWork.message}</div>
|
||||||
|
|||||||
@ -33,6 +33,7 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
.int()
|
.int()
|
||||||
.positive({ message: "Planned task must be a positive number" })
|
.positive({ message: "Planned task must be a positive number" })
|
||||||
.max(maxPlanned, {
|
.max(maxPlanned, {
|
||||||
|
|
||||||
message: `Planned task cannot exceed ${maxPlanned}`,
|
message: `Planned task cannot exceed ${maxPlanned}`,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
@ -41,7 +42,6 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
const [isHelpVisibleTarget, setIsHelpVisibleTarget] = useState(false);
|
const [isHelpVisibleTarget, setIsHelpVisibleTarget] = useState(false);
|
||||||
const helpPopupRefTarget = useRef(null);
|
const helpPopupRefTarget = useRef(null);
|
||||||
const [isHelpVisible, setIsHelpVisible] = useState(false);
|
const [isHelpVisible, setIsHelpVisible] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
||||||
|
|
||||||
// Refs for Bootstrap Popovers
|
// Refs for Bootstrap Popovers
|
||||||
const infoRef = useRef(null);
|
const infoRef = useRef(null);
|
||||||
@ -151,7 +151,7 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
// Form submission handler
|
// Form submission handler
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
const selectedEmployeeIds = data.selectedEmployees;
|
const selectedEmployeeIds = data.selectedEmployees;
|
||||||
setIsSubmitting(true);
|
|
||||||
// Prepare taskTeam data (only IDs are needed for the backend based on previous context)
|
// Prepare taskTeam data (only IDs are needed for the backend based on previous context)
|
||||||
const taskTeamWithDetails = selectedEmployeeIds
|
const taskTeamWithDetails = selectedEmployeeIds
|
||||||
.map((empId) => {
|
.map((empId) => {
|
||||||
@ -169,11 +169,10 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await TasksRepository.assignTask(formattedData);
|
// Call API to assign task
|
||||||
setIsSubmitting(false);
|
// Close the modal
|
||||||
closedModel();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsSubmitting(false);
|
console.error("Error assigning task:", error);
|
||||||
showToast("Something went wrong. Please try again.", "error");
|
showToast("Something went wrong. Please try again.", "error");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -184,6 +183,7 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<div className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">
|
<div className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">
|
||||||
<p className="align-items-center flex-wrap m-0 ">Assign Task</p>
|
<p className="align-items-center flex-wrap m-0 ">Assign Task</p>
|
||||||
<div className="container my-3">
|
<div className="container my-3">
|
||||||
@ -195,7 +195,8 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
assignData?.building?.name,
|
assignData?.building?.name,
|
||||||
assignData?.floor?.floorName,
|
assignData?.floor?.floorName,
|
||||||
assignData?.workArea?.areaName,
|
assignData?.workArea?.areaName,
|
||||||
assignData?.workItem?.workItem?.activityMaster?.activityName,
|
assignData?.workItem?.workItem?.activityMaster
|
||||||
|
?.activityName,
|
||||||
]
|
]
|
||||||
.filter(Boolean) // Filter out any undefined/null values
|
.filter(Boolean) // Filter out any undefined/null values
|
||||||
.map((item, index, array) => (
|
.map((item, index, array) => (
|
||||||
@ -287,7 +288,9 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
id={`employee-${emp?.id}`}
|
id={`employee-${emp?.id}`}
|
||||||
value={emp.id}
|
value={emp.id}
|
||||||
checked={field.value?.includes(emp.id)}
|
checked={field.value?.includes(
|
||||||
|
emp.id
|
||||||
|
)}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
handleCheckboxChange(e, emp);
|
handleCheckboxChange(e, emp);
|
||||||
}}
|
}}
|
||||||
@ -338,7 +341,9 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
<div className="mt-1">
|
<div className="mt-1">
|
||||||
<div className="text-start px-2">
|
<div className="text-start px-2">
|
||||||
{watch("selectedEmployees")?.map((empId) => {
|
{watch("selectedEmployees")?.map((empId) => {
|
||||||
const emp = employees.find((emp) => emp.id === empId);
|
const emp = employees.find(
|
||||||
|
(emp) => emp.id === empId
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
emp && (
|
emp && (
|
||||||
<span
|
<span
|
||||||
@ -402,7 +407,9 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
}
|
}
|
||||||
</u>
|
</u>
|
||||||
</label>
|
</label>
|
||||||
<div style={{ display: "flex", alignItems: "center" }}>
|
<div
|
||||||
|
style={{ display: "flex", alignItems: "center" }}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
ref={infoRef}
|
ref={infoRef}
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
@ -537,18 +544,16 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{errors.description && (
|
{errors.description && (
|
||||||
<div className="danger-text">{errors.description.message}</div>
|
<div className="danger-text">
|
||||||
|
{errors.description.message}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Submit and Cancel buttons */}
|
{/* Submit and Cancel buttons */}
|
||||||
<div className="col-12 d-flex justify-content-center align-items-center gap-sm-6 gap-8 text-center mt-1">
|
<div className="col-12 d-flex justify-content-center align-items-center gap-sm-6 gap-8 text-center mt-1">
|
||||||
<button
|
<button type="submit" className="btn btn-sm btn-primary ">
|
||||||
type="submit"
|
Submit
|
||||||
className="btn btn-sm btn-primary "
|
|
||||||
disabled={(isSubmitting, loading)}
|
|
||||||
>
|
|
||||||
{isSubmitting ? "Please Wait" : "Submit"}
|
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="reset"
|
type="reset"
|
||||||
@ -556,7 +561,6 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
data-bs-dismiss="modal"
|
data-bs-dismiss="modal"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
onClick={closedModel}
|
onClick={closedModel}
|
||||||
disabled={isSubmitting || loading}
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
@ -565,6 +569,7 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@ const CreateActivity = ({ onClose }) => {
|
|||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* <h6>Create Activity</h6> */}
|
<h6>Create Activity</h6>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-6">
|
<div className="col-6">
|
||||||
<label className="form-label">Activity</label>
|
<label className="form-label">Activity</label>
|
||||||
|
|||||||
@ -70,9 +70,9 @@ const CreateJobRole = ({onClose}) => {
|
|||||||
const maxDescriptionLength = 255;
|
const maxDescriptionLength = 255;
|
||||||
return (<>
|
return (<>
|
||||||
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* <div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Create Job Role</label>
|
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Create Job Role</label>
|
||||||
</div> */}
|
</div>
|
||||||
<div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="form-label">Role</label>
|
<label className="form-label">Role</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
@ -96,10 +96,10 @@ const CreateRole = ({ modalType, onClose }) => {
|
|||||||
return (
|
return (
|
||||||
|
|
||||||
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* <div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Create Application Role</label>
|
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Create Application Role</label>
|
||||||
|
|
||||||
</div> */}
|
</div>
|
||||||
<div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="form-label">Role</label>
|
<label className="form-label">Role</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
@ -131,7 +131,7 @@ const UpdateActivity = ({ activityData, onClose }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* <h6>Update Activity</h6> */}
|
<h6>Update Activity</h6>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
{/* Activity Name */}
|
{/* Activity Name */}
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
|
|||||||
@ -77,9 +77,9 @@ const EditJobRole = ({data,onClose}) => {
|
|||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* <div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Edit Job Role</label>
|
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Edit Job Role</label>
|
||||||
</div> */}
|
</div>
|
||||||
<div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="form-label">Role</label>
|
<label className="form-label">Role</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
@ -146,9 +146,9 @@ const EditMaster = ({ master, onClose }) => {
|
|||||||
return (
|
return (
|
||||||
|
|
||||||
<form className="row g-2 " onSubmit={handleSubmit(onSubmit)}>
|
<form className="row g-2 " onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* <div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Edit Application Role</label>
|
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Edit Application Role</label>
|
||||||
</div> */}
|
</div>
|
||||||
<div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="form-label">Role</label>
|
<label className="form-label">Role</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
@ -77,10 +77,10 @@ const EditWorkCategory = ({data,onClose}) => {
|
|||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
|
||||||
{/* <div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Edit Work Category</label>
|
<label className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">Edit Work Category</label>
|
||||||
</div>
|
</div>
|
||||||
*/}
|
|
||||||
<div className="col-12 col-md-12">
|
<div className="col-12 col-md-12">
|
||||||
<label className="form-label">Category Name</label>
|
<label className="form-label">Category Name</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user