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) {
|
||||
reset({
|
||||
workCategoryId: Task?.workItem?.workCategoryId || "",
|
||||
activityId: Task?.workItem?.activityId || "",
|
||||
plannedWork: Number(Task.notApprovedTask || Task.workItem?.plannedWork),
|
||||
activityId: Task?.workItem?.activityId || activity?.workItem?.activityId,
|
||||
plannedWork: Number(Task?.notApprovedTask || Task?.workItem?.plannedWork),
|
||||
completedWork: 0,
|
||||
comment: "",
|
||||
});
|
||||
@ -90,7 +90,6 @@ const SubTask = ({ activity, onClose }) => {
|
||||
showToast(msg, "error");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="container-xxl my-1">
|
||||
<p className="fw-semibold">Create Sub Task</p>
|
||||
@ -132,7 +131,7 @@ const SubTask = ({ activity, onClose }) => {
|
||||
{...register("workCategoryId")}
|
||||
onChange={handleCategoryChange}
|
||||
>
|
||||
<option value="">-- Select Category --</option>
|
||||
<option value="">{categoryLoading ? "Loading..." : "-- Select Category --" }</option>
|
||||
{categoryData.map((category) => (
|
||||
<option key={category.id} value={category.id}>
|
||||
{category.name}
|
||||
@ -147,10 +146,11 @@ const SubTask = ({ activity, onClose }) => {
|
||||
<label className="form-label">Select Activity</label>
|
||||
<select
|
||||
className="form-select form-select-sm"
|
||||
{...register("activityId")}
|
||||
{...register( "activityId" )}
|
||||
disabled
|
||||
>
|
||||
<option value="">
|
||||
{categoryLoading ? "Loading..." : "--Select Activity--"}
|
||||
{categoryLoading && "Loading..." }
|
||||
</option>
|
||||
{activities?.map((activity) => (
|
||||
<option key={activity.id} value={activity.id}>
|
||||
@ -180,7 +180,8 @@ const SubTask = ({ activity, onClose }) => {
|
||||
<input
|
||||
type="number"
|
||||
className="form-control form-control-sm"
|
||||
{...register("completedWork")}
|
||||
{...register( "completedWork" )}
|
||||
disabled
|
||||
/>
|
||||
{errors.completedWork && (
|
||||
<div className="danger-text">{errors.completedWork.message}</div>
|
||||
@ -210,7 +211,7 @@ const SubTask = ({ activity, onClose }) => {
|
||||
</div>
|
||||
|
||||
<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"}
|
||||
</button>
|
||||
<button
|
||||
|
Loading…
x
Reference in New Issue
Block a user