diff --git a/client/src/pages/Team.jsx b/client/src/pages/Team.jsx index c6d6317..6c2d97d 100644 --- a/client/src/pages/Team.jsx +++ b/client/src/pages/Team.jsx @@ -23,7 +23,7 @@ const MODULE_COLORS = { const EMPTY_MEMBER = { name: '', email: '', password: '', permission_level: 'contributor', - role_id: '', brands: [], phone: '', modules: [...ALL_MODULES], team_ids: [], + role_id: '', brands: [], phone: '', modules: [...ALL_MODULES], team_ids: [], preferred_language: 'en', } export default function Team() { @@ -91,6 +91,7 @@ export default function Team() { brands: addForm.brands, phone: addForm.phone, modules: addForm.modules, + preferred_language: addForm.preferred_language || 'en', } if (addForm.password) payload.password = addForm.password const created = await api.post('/users/team', payload) @@ -779,6 +780,28 @@ export default function Team() { )} + {/* Preferred Language */} +
+ +
+ {[{ value: 'en', label: 'English', flag: '🇬🇧' }, { value: 'ar', label: 'العربية', flag: '🇸🇦' }].map(l => ( + + ))} +
+
+ - - - {/* Users List */} -
- - - - - - - - - - - - {users.length === 0 ? ( - - - - ) : ( - users.map(user => { - const isCurrentUser = currentUser?.id === user.id - const roleInfo = ROLES.find(r => r.value === user.role) || ROLES[2] - return ( - - - - - - - - ) - }) - )} - -
{t('users.userSingular')}{t('users.email')}{t('users.role')}{t('users.created')}{t('users.actions')}
- {t('users.noUsers')} -
-
-
- {user.name?.split(' ').map(w => w[0]).join('').slice(0, 2).toUpperCase()} -
-
-
-

{user.name}

- {isCurrentUser && ( - - {t('users.you')} - - )} -
-
-
-
{user.email} - - - {user.createdAt ? new Date(user.createdAt).toLocaleDateString() : '—'} - -
- - {!isCurrentUser && ( - - )} -
-
-
- - {/* Add/Edit User Modal */} - { setShowModal(false); setEditingUser(null) }} - title={editingUser ? t('users.editUser') : t('users.addNewUser')} - size="md" - > -
-
- - setForm(f => ({ ...f, name: e.target.value }))} - className="w-full px-3 py-2 text-sm border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary" - placeholder={t('users.fullNamePlaceholder')} - required - /> -
- -
- - setForm(f => ({ ...f, email: e.target.value }))} - className="w-full px-3 py-2 text-sm border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary" - placeholder="user@company.com" - required - /> -
- -
- - { setForm(f => ({ ...f, password: e.target.value })); setPasswordError('') }} - className="w-full px-3 py-2 text-sm border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary" - placeholder="••••••••" - required={!editingUser} - /> -
- - {form.password && ( -
- - { setConfirmPassword(e.target.value); setPasswordError('') }} - className="w-full px-3 py-2 text-sm border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary" - placeholder="••••••••" - /> - {passwordError && ( -

{passwordError}

- )} -
- )} - -
- -
- {ROLES.map(r => ( - - ))} -
-
- -
- -
- {[{ value: 'en', label: 'English', flag: '🇬🇧' }, { value: 'ar', label: 'العربية', flag: '🇸🇦' }].map(l => ( - - ))} -
-
- -
- - -
-
-
- - {/* Delete Confirmation */} - { setShowDeleteConfirm(false); setUserToDelete(null) }} - title={t('users.deleteUserConfirmTitle')} - isConfirm - danger - confirmText={t('users.deleteUser')} - onConfirm={confirmDelete} - > - {t('users.deleteConfirm')} {userToDelete?.name} - - - ) -}