add: unique_unit_identity
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
|||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../utils/useApiRequest";
|
||||||
@@ -30,6 +31,7 @@ const schema = z.object({
|
|||||||
city: zValidateNumber("شهر"),
|
city: zValidateNumber("شهر"),
|
||||||
organization: zValidateNumberOptional("سازمان"),
|
organization: zValidateNumberOptional("سازمان"),
|
||||||
organizationType: zValidateNumber("سازمان"),
|
organizationType: zValidateNumber("سازمان"),
|
||||||
|
unique_unit_identity: zValidateStringOptional("شناسه یکتا واحد"),
|
||||||
is_repeatable: z.boolean(),
|
is_repeatable: z.boolean(),
|
||||||
free_visibility_by_scope: z.boolean(),
|
free_visibility_by_scope: z.boolean(),
|
||||||
});
|
});
|
||||||
@@ -75,6 +77,7 @@ export const AddOrganization = ({ getData, item }: AddPageProps) => {
|
|||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: item?.name || "",
|
name: item?.name || "",
|
||||||
national_unique_id: item?.national_unique_id || "",
|
national_unique_id: item?.national_unique_id || "",
|
||||||
|
unique_unit_identity: item?.unique_unit_identity || "",
|
||||||
free_visibility_by_scope: item?.free_visibility_by_scope || false,
|
free_visibility_by_scope: item?.free_visibility_by_scope || false,
|
||||||
field_of_activity:
|
field_of_activity:
|
||||||
item && item?.field_of_activity !== "EM"
|
item && item?.field_of_activity !== "EM"
|
||||||
@@ -141,6 +144,9 @@ export const AddOrganization = ({ getData, item }: AddPageProps) => {
|
|||||||
type: data.organizationType,
|
type: data.organizationType,
|
||||||
}),
|
}),
|
||||||
national_unique_id: data?.national_unique_id,
|
national_unique_id: data?.national_unique_id,
|
||||||
|
...(data?.unique_unit_identity && {
|
||||||
|
unique_unit_identity: data.unique_unit_identity,
|
||||||
|
}),
|
||||||
province: data?.province,
|
province: data?.province,
|
||||||
city: data?.city,
|
city: data?.city,
|
||||||
...(data.organization && {
|
...(data.organization && {
|
||||||
@@ -252,6 +258,21 @@ export const AddOrganization = ({ getData, item }: AddPageProps) => {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="unique_unit_identity"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<Textfield
|
||||||
|
fullWidth
|
||||||
|
placeholder="شناسه یکتا واحد (اختیاری)"
|
||||||
|
value={field.value}
|
||||||
|
onChange={field.onChange}
|
||||||
|
error={!!errors.unique_unit_identity}
|
||||||
|
helperText={errors.unique_unit_identity?.message}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<Controller
|
<Controller
|
||||||
name="province"
|
name="province"
|
||||||
control={control}
|
control={control}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export const OrganizationsList = () => {
|
|||||||
`${item?.type?.name}`,
|
`${item?.type?.name}`,
|
||||||
item?.parent_organization?.name,
|
item?.parent_organization?.name,
|
||||||
item?.national_unique_id,
|
item?.national_unique_id,
|
||||||
|
item?.unique_unit_identity || "-",
|
||||||
item?.field_of_activity === "CO"
|
item?.field_of_activity === "CO"
|
||||||
? "کشور"
|
? "کشور"
|
||||||
: item?.field_of_activity === "PR"
|
: item?.field_of_activity === "PR"
|
||||||
@@ -184,6 +185,7 @@ export const OrganizationsList = () => {
|
|||||||
"نهاد",
|
"نهاد",
|
||||||
"سازمان والد",
|
"سازمان والد",
|
||||||
"شناسه کشوری",
|
"شناسه کشوری",
|
||||||
|
"شناسه یکتا واحد",
|
||||||
"حوزه فعالیت",
|
"حوزه فعالیت",
|
||||||
"استان",
|
"استان",
|
||||||
"شهر",
|
"شهر",
|
||||||
|
|||||||
Reference in New Issue
Block a user