handled default choosed activity and disabled
This commit is contained in:
parent
cd5e9291ae
commit
8e3a6bf1d1
@ -48,8 +48,8 @@ const SubTask = ({ activity, onClose }) => {
|
|||||||
if (Task?.workItem) {
|
if (Task?.workItem) {
|
||||||
reset({
|
reset({
|
||||||
workCategoryId: Task?.workItem?.workCategoryId || "",
|
workCategoryId: Task?.workItem?.workCategoryId || "",
|
||||||
activityId: Task?.workItem?.activityId || "",
|
activityId: Task?.workItem?.activityId || activity?.workItem?.activityId,
|
||||||
plannedWork: Number(Task.notApprovedTask || Task.workItem?.plannedWork),
|
plannedWork: Number(Task?.notApprovedTask || Task?.workItem?.plannedWork),
|
||||||
completedWork: 0,
|
completedWork: 0,
|
||||||
comment: "",
|
comment: "",
|
||||||
});
|
});
|
||||||
@ -90,7 +90,6 @@ const SubTask = ({ activity, onClose }) => {
|
|||||||
showToast(msg, "error");
|
showToast(msg, "error");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container-xxl my-1">
|
<div className="container-xxl my-1">
|
||||||
<p className="fw-semibold">Create Sub Task</p>
|
<p className="fw-semibold">Create Sub Task</p>
|
||||||
@ -132,7 +131,7 @@ const SubTask = ({ activity, onClose }) => {
|
|||||||
{...register("workCategoryId")}
|
{...register("workCategoryId")}
|
||||||
onChange={handleCategoryChange}
|
onChange={handleCategoryChange}
|
||||||
>
|
>
|
||||||
<option value="">-- Select Category --</option>
|
<option value="">{categoryLoading ? "Loading..." : "-- Select Category --" }</option>
|
||||||
{categoryData.map((category) => (
|
{categoryData.map((category) => (
|
||||||
<option key={category.id} value={category.id}>
|
<option key={category.id} value={category.id}>
|
||||||
{category.name}
|
{category.name}
|
||||||
@ -147,10 +146,11 @@ const SubTask = ({ activity, onClose }) => {
|
|||||||
<label className="form-label">Select Activity</label>
|
<label className="form-label">Select Activity</label>
|
||||||
<select
|
<select
|
||||||
className="form-select form-select-sm"
|
className="form-select form-select-sm"
|
||||||
{...register("activityId")}
|
{...register( "activityId" )}
|
||||||
|
disabled
|
||||||
>
|
>
|
||||||
<option value="">
|
<option value="">
|
||||||
{categoryLoading ? "Loading..." : "--Select Activity--"}
|
{categoryLoading && "Loading..." }
|
||||||
</option>
|
</option>
|
||||||
{activities?.map((activity) => (
|
{activities?.map((activity) => (
|
||||||
<option key={activity.id} value={activity.id}>
|
<option key={activity.id} value={activity.id}>
|
||||||
@ -180,7 +180,8 @@ const SubTask = ({ activity, onClose }) => {
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
className="form-control form-control-sm"
|
className="form-control form-control-sm"
|
||||||
{...register("completedWork")}
|
{...register( "completedWork" )}
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
{errors.completedWork && (
|
{errors.completedWork && (
|
||||||
<div className="danger-text">{errors.completedWork.message}</div>
|
<div className="danger-text">{errors.completedWork.message}</div>
|
||||||
@ -210,7 +211,7 @@ const SubTask = ({ activity, onClose }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12 text-center">
|
<div className="col-12 text-center">
|
||||||
<button type="submit" className="btn btn-sm btn-primary me-2">
|
<button type="submit" className="btn btn-sm btn-primary me-2" disabled={isSubmitting}>
|
||||||
{isSubmitting ? "Please wait..." : "Submit"}
|
{isSubmitting ? "Please wait..." : "Submit"}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
Loading…
x
Reference in New Issue
Block a user