Merge pull request 'Renamed variable "check" to "description" in "CreateActivity" and "UpdateActivity" components' (#36) from Ashutosh_Bug#94_Rename_CheckList_Variable into Issues_April_4W

Reviewed-on: #36
This commit is contained in:
Vikas Nale 2025-04-20 06:44:08 +00:00
commit c3faca41e2
2 changed files with 18 additions and 18 deletions

View File

@ -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`)}
></input>
<input
{...register(`checkList.${index}.check`)}
{...register(`checkList.${index}.description`)}
className="form-control form-control-sm"
placeholder={`Checklist item ${index + 1}`}
onChange={(e) =>
handleChecklistChange(index, e.target.value)
}
/>
{errors.checkList?.[index]?.check && (
{errors.checkList?.[index]?.description && (
<small
style={{ fontSize: "10px" }}
className="danger-text"
>
{errors.checkList[index]?.check?.message}
{errors.checkList[index]?.description?.message}
</small>
)}
</td>

View File

@ -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`)}
></input>
<input
{...register(`checkList.${index}.check`)}
{...register(`checkList.${index}.description`)}
className="form-control form-control-sm"
placeholder={`Checklist item ${index + 1}`}
onChange={(e) =>
handleChecklistChange(index, e.target.value)
}
/>
{errors.checkList?.[index]?.check && (
{errors.checkList?.[index]?.description && (
<small
style={{ fontSize: "10px" }}
className="danger-text"
>
{errors.checkList[index]?.check?.message}
{errors.checkList[index]?.description?.message}
</small>
)}
</td>
@ -208,7 +208,7 @@ const UpdateActivity = ({ activityData, onClose }) => {
onClick={() => removeChecklistItem(index)}
className="btn btn-xs btn-icon btn-text-secondary"
>
<i class="bx bxs-minus-circle text-danger"></i>
<i className="bx bxs-minus-circle text-danger"></i>
</button>
</td>
</tr>
@ -223,7 +223,7 @@ const UpdateActivity = ({ activityData, onClose }) => {
className="btn btn-xs btn-primary mt-2"
onClick={addChecklistItem}
>
<i class="bx bx-plus-circle"></i>
<i className="bx bx-plus-circle"></i>
</button>
</div>