Planned Work now accepts values with up to 2 decimal places.
This commit is contained in:
parent
88dc11793c
commit
95813c5869
@ -17,7 +17,7 @@ const taskSchema = z
|
|||||||
.object({
|
.object({
|
||||||
activityID: z.string().min(1, "Activity is required"),
|
activityID: z.string().min(1, "Activity is required"),
|
||||||
workCategoryId: z.string().min(1, "Work Category is required"),
|
workCategoryId: z.string().min(1, "Work Category is required"),
|
||||||
plannedWork: z.number().min(1, "Planned Work must be greater than 0"),
|
plannedWork: z.number().min(0.01, "Planned Work must be greater than 0"),
|
||||||
completedWork: z.number().min(0, "Completed Work must be ≥ 0"),
|
completedWork: z.number().min(0, "Completed Work must be ≥ 0"),
|
||||||
comment: z.string(),
|
comment: z.string(),
|
||||||
})
|
})
|
||||||
@ -107,6 +107,7 @@ const EditActivityModal = ({
|
|||||||
const onSubmitForm = (data) => {
|
const onSubmitForm = (data) => {
|
||||||
const payload = {
|
const payload = {
|
||||||
...data,
|
...data,
|
||||||
|
plannedWork: Number(data.plannedWork.toFixed(2)),
|
||||||
id: workItem?.workItem?.id ?? workItem?.id,
|
id: workItem?.workItem?.id ?? workItem?.id,
|
||||||
buildingID: building?.id,
|
buildingID: building?.id,
|
||||||
floorId: floor?.id,
|
floorId: floor?.id,
|
||||||
@ -220,8 +221,10 @@ const EditActivityModal = ({
|
|||||||
<input
|
<input
|
||||||
{...register("plannedWork", { valueAsNumber: true })}
|
{...register("plannedWork", { valueAsNumber: true })}
|
||||||
type="number"
|
type="number"
|
||||||
|
step="0.01" // <-- allows 2 decimal places
|
||||||
className="form-control form-control-sm"
|
className="form-control form-control-sm"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{errors.plannedWork && (
|
{errors.plannedWork && (
|
||||||
<p className="danger-text">{errors.plannedWork.message}</p>
|
<p className="danger-text">{errors.plannedWork.message}</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user