diff --git a/src/components/master/CreateActivity.jsx b/src/components/master/CreateActivity.jsx index d26afd68..b7d2c862 100644 --- a/src/components/master/CreateActivity.jsx +++ b/src/components/master/CreateActivity.jsx @@ -14,7 +14,7 @@ const schema = z.object({ checkList: z .array( z.object({ - check: z.string().min(1, { message: "Checklist item cannot be empty" }), + description: z.string().min(1, { message: "descriptionlist item cannot be empty" }), isMandatory: z.boolean().default(false), id: z.any().default(0), }) @@ -82,18 +82,18 @@ const CreateActivity = ({ onClose }) => { const lastIndex = checkListItems.length - 1; if ( checkListItems.length > 0 && - (!values?.[lastIndex] || values[lastIndex].check.trim() === "") + (!values?.[lastIndex] || values[lastIndex].description.trim() === "") ) { - setError(`checkList.${lastIndex}.check`, { + setError(`checkList.${lastIndex}.description`, { type: "manual", message: "Please fill this checklist item before adding another.", }); return; } - clearErrors(`checkList.${lastIndex}.check`); + clearErrors(`checkList.${lastIndex}.description`); append({ id: 0, - check: "", + description: "", isMandatory: false, }); }; @@ -167,19 +167,19 @@ const CreateActivity = ({ onClose }) => { {...register(`checkList.${index}.id`)} > handleChecklistChange(index, e.target.value) } /> - {errors.checkList?.[index]?.check && ( + {errors.checkList?.[index]?.description && ( - {errors.checkList[index]?.check?.message} + {errors.checkList[index]?.description?.message} )} diff --git a/src/components/master/EditActivity.jsx b/src/components/master/EditActivity.jsx index 11d8c5f7..ea1cd364 100644 --- a/src/components/master/EditActivity.jsx +++ b/src/components/master/EditActivity.jsx @@ -14,7 +14,7 @@ const schema = z.object({ .array( z.object({ id: z.any().default(0), - check: z.string().min(1, { message: "Checklist item cannot be empty" }), + description: z.string().min(1, { message: "Checklist item cannot be empty" }), isMandatory: z.boolean().default(false), }) ) @@ -106,17 +106,17 @@ const UpdateActivity = ({ activityData, onClose }) => { if ( checkListItems.length > 0 && - (!values?.[lastIndex] || values[lastIndex].check.trim() === "") + (!values?.[lastIndex] || values[lastIndex].description.trim() === "") ) { - setError(`checkList.${lastIndex}.check`, { + setError(`checkList.${lastIndex}.description`, { type: "manual", message: "Please fill this checklist item before adding another.", }); return; } - clearErrors(`checkList.${lastIndex}.check`); - append({ id: 0, check: "", isMandatory: false }); + clearErrors(`checkList.${lastIndex}.description`); + append({ id: 0, description: "", isMandatory: false }); }; const removeChecklistItem = (index) => { @@ -178,19 +178,19 @@ const UpdateActivity = ({ activityData, onClose }) => { {...register(`checkList.${index}.id`)} > handleChecklistChange(index, e.target.value) } /> - {errors.checkList?.[index]?.check && ( + {errors.checkList?.[index]?.description && ( - {errors.checkList[index]?.check?.message} + {errors.checkList[index]?.description?.message} )} @@ -208,7 +208,7 @@ const UpdateActivity = ({ activityData, onClose }) => { onClick={() => removeChecklistItem(index)} className="btn btn-xs btn-icon btn-text-secondary" > - + @@ -223,7 +223,7 @@ const UpdateActivity = ({ activityData, onClose }) => { className="btn btn-xs btn-primary mt-2" onClick={addChecklistItem} > - +