From 427afc57342f444278ac89c416392253dd959684 Mon Sep 17 00:00:00 2001 From: "MSI\\derek" Date: Thu, 25 Apr 2024 16:43:52 +0800 Subject: [PATCH] update --- src/components/CustomInputForm/CustomInputForm.tsx | 11 +++++++++++ src/components/EditStaff/EditStaff.tsx | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/CustomInputForm/CustomInputForm.tsx b/src/components/CustomInputForm/CustomInputForm.tsx index dc7f269..9497208 100644 --- a/src/components/CustomInputForm/CustomInputForm.tsx +++ b/src/components/CustomInputForm/CustomInputForm.tsx @@ -307,6 +307,17 @@ const CustomInputForm: React.FC = ({ onChange={(newValue) => { handleDateChange(field.id, newValue); }} + slotProps={{ + textField: { + required: field.required, + }, + }} + // error={Boolean(errors[field.id])} + // slotProps={{ + // textField: { + // helperText: Boolean(errors[field.id]) && field.message, + // }, + // }} // required = {field.required ?? false}, /> diff --git a/src/components/EditStaff/EditStaff.tsx b/src/components/EditStaff/EditStaff.tsx index 1fbf96b..5a75dc3 100644 --- a/src/components/EditStaff/EditStaff.tsx +++ b/src/components/EditStaff/EditStaff.tsx @@ -165,7 +165,7 @@ const EditStaff: React.FC = async () => { label: t(`Team`), type: "combo-Obj", options: teamCombo, - value: data[key].id ?? "", + value: data[key]?.id ?? "", }; case "department": return { @@ -277,7 +277,7 @@ const EditStaff: React.FC = async () => { case "emergContactPhone": return { id: `${key}`, - label: t(`Emergency Contact Phonee`), + label: t(`Emergency Contact Phone`), type: "text", // pattern: "^\\d{8}$", message: t("input correct phone no."),