feat(admin/users): support multiple roles in user table and form

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>
This commit is contained in:
madresebanoo
2026-09-02 15:16:04 +04:30
parent 97adb2923e
commit 72d92c24d5
4 changed files with 54 additions and 42 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { number, object, string } from 'yup'
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'
@@ -9,7 +9,7 @@ export const rejectionReasonSchema = object().shape({
})
const baseUserShape = {
role: string().required(),
roles: array().of(string().required()).min(1, 'حداقل یک نقش را انتخاب کنید').required(),
name: string().required().min(3),
phone: phoneNumberRule,
nationalCode: nationalCodeRule,