Enhance team member role management and localization updates
- Added a new SQL field to indicate pending invitations for team members, improving role management logic. - Updated the settings drawer component to display tooltips for roles that cannot be changed, enhancing user experience. - Introduced new localization entries for pending invitations and role change restrictions in English, Spanish, and Portuguese, ensuring consistency across languages.
This commit is contained in:
@@ -232,7 +232,11 @@ export default class AdminCenterController extends WorklenzControllerBase {
|
||||
FROM team_member_info_view
|
||||
WHERE team_member_info_view.team_member_id = tm.id),
|
||||
role_id,
|
||||
r.name AS role_name
|
||||
r.name AS role_name,
|
||||
EXISTS(SELECT email
|
||||
FROM email_invitations
|
||||
WHERE team_member_id = tm.id
|
||||
AND email_invitations.team_id = tm.team_id) AS pending_invitation
|
||||
FROM team_members tm
|
||||
LEFT JOIN users u on tm.user_id = u.id
|
||||
LEFT JOIN roles r on tm.role_id = r.id
|
||||
|
||||
@@ -29,5 +29,7 @@
|
||||
"role": "Role",
|
||||
"owner": "Owner",
|
||||
"admin": "Admin",
|
||||
"member": "Member"
|
||||
"member": "Member",
|
||||
"cannotChangeOwnerRole": "Owner role cannot be changed",
|
||||
"pendingInvitation": "Pending invitation"
|
||||
}
|
||||
|
||||
@@ -29,5 +29,7 @@
|
||||
"role": "Rol",
|
||||
"owner": "Propietario",
|
||||
"admin": "Administrador",
|
||||
"member": "Miembro"
|
||||
"member": "Miembro",
|
||||
"cannotChangeOwnerRole": "El rol de Propietario no puede ser cambiado",
|
||||
"pendingInvitation": "Invitación pendiente"
|
||||
}
|
||||
|
||||
@@ -29,5 +29,7 @@
|
||||
"role": "Rol",
|
||||
"owner": "Propietario",
|
||||
"admin": "Administrador",
|
||||
"member": "Miembro"
|
||||
"member": "Miembro",
|
||||
"cannotChangeOwnerRole": "A função de Proprietário não pode ser alterada",
|
||||
"pendingInvitation": "Convite pendente"
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
Table,
|
||||
TableProps,
|
||||
Typography,
|
||||
Tooltip,
|
||||
} from 'antd';
|
||||
import React, { useState } from 'react';
|
||||
import { useAppDispatch } from '@/hooks/useAppDispatch';
|
||||
@@ -22,8 +23,6 @@ import {
|
||||
} from '@/types/admin-center/admin-center.types';
|
||||
import SingleAvatar from '@/components/common/single-avatar/single-avatar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API_BASE_URL } from '@/shared/constants';
|
||||
import apiClient from '@/api/api-client';
|
||||
|
||||
interface SettingTeamDrawerProps {
|
||||
teamId: string;
|
||||
@@ -126,15 +125,32 @@ const SettingTeamDrawer: React.FC<SettingTeamDrawerProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const isDisabled = record.role_name === 'Owner' || record.pending_invitation;
|
||||
const tooltipTitle = record.role_name === 'Owner'
|
||||
? t('cannotChangeOwnerRole')
|
||||
: record.pending_invitation
|
||||
? t('pendingInvitation')
|
||||
: '';
|
||||
|
||||
const selectComponent = (
|
||||
<Select
|
||||
style={{ width: '150px', height: '32px' }}
|
||||
options={roleOptions}
|
||||
defaultValue={record.role_name || ''}
|
||||
disabled={isDisabled}
|
||||
onChange={handleRoleChange}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
style={{ width: '150px', height: '32px' }}
|
||||
options={roleOptions}
|
||||
defaultValue={record.role_name || ''}
|
||||
disabled={record.role_name === 'Owner'}
|
||||
onChange={handleRoleChange}
|
||||
/>
|
||||
{isDisabled ? (
|
||||
<Tooltip title={tooltipTitle}>
|
||||
{selectComponent}
|
||||
</Tooltip>
|
||||
) : (
|
||||
selectComponent
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -35,6 +35,7 @@ export interface IOrganizationTeamMember {
|
||||
role_id?: string;
|
||||
role_name?: string;
|
||||
created_at?: string;
|
||||
pending_invitation?: boolean;
|
||||
}
|
||||
|
||||
export interface IOrganizationTeam {
|
||||
|
||||
Reference in New Issue
Block a user