Pārlūkot izejas kodu

update

tags/Baseline_30082024_FRONTEND_UAT
MSI\derek pirms 1 gada
vecāks
revīzija
551ee6558a
2 mainītis faili ar 15 papildinājumiem un 19 dzēšanām
  1. +2
    -10
      src/components/CreateStaff/CreateStaff.tsx
  2. +13
    -9
      src/components/CreateStaff/StaffInfo.tsx

+ 2
- 10
src/components/CreateStaff/CreateStaff.tsx Parādīt failu

@@ -80,7 +80,7 @@ const CreateStaff: React.FC<formProps> = ({ combos }) => {
haveError = true
formProps.setError("phone1", { message: t("Please Enter Correct Phone No.."), type: "required" })
}
if(!regex_phone.test(data.emergContactPhone)) {
if(data.emergContactPhone && !regex_phone.test(data.emergContactPhone)) {
haveError = true
formProps.setError("emergContactPhone", { message: t("Please Enter Correct Phone No.."), type: "required" })
}
@@ -110,19 +110,11 @@ const CreateStaff: React.FC<formProps> = ({ combos }) => {
haveError = true
formProps.setError("employType", { message: t("Please Enter Employ Type."), type: "required" })
}
if (!data.departmentId) {
haveError = true
formProps.setError("departmentId", { message: t("Please Enter Department."), type: "required" })
}
if (!data.salaryId) {
haveError = true
formProps.setError("salaryId", { message: t("Please Enter Salary."), type: "required" })
}
if (!data.joinDate) {
haveError = true
formProps.setError("joinDate", { message: t("Please Enter Join Date."), type: "required" })
}
if (data.departDate && new Date(data.departDate) <= new Date(data.joinDate)) {
if (data.joinDate &&data.departDate && new Date(data.departDate) <= new Date(data.joinDate)) {
haveError = true
formProps.setError("departDate", { message: t("Depart Date cannot be earlier than Join Date."), type: "required" })
}


+ 13
- 9
src/components/CreateStaff/StaffInfo.tsx Parādīt failu

@@ -165,7 +165,7 @@ const StaffInfo: React.FC<Props> = ({ combos }) => {
</Grid>
<Grid item xs={6}>
<FormControl fullWidth>
<InputLabel required>{t("Department")}</InputLabel>
<InputLabel>{t("Department")}</InputLabel>
<Controller
control={control}
name="departmentId"
@@ -377,9 +377,11 @@ const StaffInfo: React.FC<Props> = ({ combos }) => {
label={t("Emergency Contact Name")}
fullWidth
required
{...register("emergContactName", {
required: "Emergency Contact Name required!",
})}
{...register("emergContactName"
// , {
// required: "Emergency Contact Name required!",
// }
)}
error={Boolean(errors.emergContactName)}
helperText={
Boolean(errors.emergContactName) &&
@@ -394,9 +396,11 @@ const StaffInfo: React.FC<Props> = ({ combos }) => {
label={t("Emergency Contact Phone")}
fullWidth
required
{...register("emergContactPhone", {
required: "Emergency Contact Phone required!",
})}
{...register("emergContactPhone"
// , {
// required: "Emergency Contact Phone required!",
// }
)}
error={Boolean(errors.emergContactPhone)}
helperText={
Boolean(errors.emergContactPhone) &&
@@ -421,7 +425,7 @@ const StaffInfo: React.FC<Props> = ({ combos }) => {
}}
slotProps={{
textField: {
required: true,
// required: true,
error:
joinDate === "Invalid Date" || Boolean(errors.joinDate),
// value: errors.joinDate?.message,
@@ -432,7 +436,7 @@ const StaffInfo: React.FC<Props> = ({ combos }) => {
</Grid>
<Grid item xs={6}>
<FormControl fullWidth>
<InputLabel required>{t("Join Position")}</InputLabel>
<InputLabel>{t("Join Position")}</InputLabel>
<Controller
control={control}
name="joinPositionId"


Notiek ielāde…
Atcelt
Saglabāt