72d92c24d5
UsersTable now shows all role labels joined (not just the first role), and its CSS badge class is based on the primary role. UserFormPage uses a multi-select for roles instead of a single-select, and the form validation requires at least one role. TermItem layout fix for inactive badge alignment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
import { array, number, object, string } from 'yup'
|
|
import { passwordRule } from '@/constants/rules/passwordRule'
|
|
import { phoneNumberRule } from '@/constants/rules/phoneNumberRule'
|
|
import { nationalCodeRule } from '@/constants/rules/nationalCodeRule'
|
|
import { passwordConfirmationRule } from '@/constants/rules/passwordConfirmationRule'
|
|
|
|
export const rejectionReasonSchema = object().shape({
|
|
reason: string().required(),
|
|
})
|
|
|
|
const baseUserShape = {
|
|
roles: array().of(string().required()).min(1, 'حداقل یک نقش را انتخاب کنید').required(),
|
|
name: string().required().min(3),
|
|
phone: phoneNumberRule,
|
|
nationalCode: nationalCodeRule,
|
|
birthday: string().nullable().notRequired(),
|
|
maritalStatus: string().nullable().notRequired(),
|
|
gender: string().nullable().notRequired(),
|
|
bio: string().nullable().notRequired(),
|
|
provinceId: string().nullable().notRequired(),
|
|
cityId: string().nullable().notRequired(),
|
|
address: string().nullable().notRequired(),
|
|
avatarMediaId: number().typeError('شناسه تصویر پروفایل باید عدد باشد').nullable().notRequired(),
|
|
}
|
|
|
|
export const userAddSchema = object().shape({
|
|
...baseUserShape,
|
|
password: passwordRule,
|
|
passwordConfirmation: passwordConfirmationRule,
|
|
})
|
|
|
|
export const userEditSchema = object().shape(baseUserShape)
|