Fixed update modal linked user assignment

This commit is contained in:
2026-10-25 13:23:25 +02:00
parent 31d775c917
commit c8e54815ef
3 changed files with 17 additions and 16 deletions
@@ -270,8 +270,6 @@ export const GovernancePage: React.FC = () => {
const linkedUserId = const linkedUserId =
editingOrg?.userId || editingOrg?.userId ||
editingOrg?.UserId || editingOrg?.UserId ||
editingOrg?.organisationUser ||
editingOrg?.OrganisationUser ||
''; '';
if (linkedUserId) { if (linkedUserId) {
@@ -296,7 +294,7 @@ export const GovernancePage: React.FC = () => {
} }
return list; return list;
}, [executiveAndManagerUsers, usersDirectory, editingOrg?.id, editingOrg?.userId, editingOrg?.organisationUser]); }, [executiveAndManagerUsers, usersDirectory, editingOrg?.id, editingOrg?.userId]);
// Quick Add Executive User Subform state // Quick Add Executive User Subform state
const [isQuickAddUserOpen, setIsQuickAddUserOpen] = useState(false); const [isQuickAddUserOpen, setIsQuickAddUserOpen] = useState(false);
@@ -630,7 +628,6 @@ export const GovernancePage: React.FC = () => {
registrationNo: data.registrationNo, registrationNo: data.registrationNo,
email: data.email, email: data.email,
organisationUser: data.organisationUser, organisationUser: data.organisationUser,
userId: data.organisationUser,
type: Number(data.type), type: Number(data.type),
status: data.status !== undefined ? Number(data.status) : ActivityStatus.Active, status: data.status !== undefined ? Number(data.status) : ActivityStatus.Active,
}); });
@@ -770,9 +767,6 @@ export const GovernancePage: React.FC = () => {
const targetUserId = const targetUserId =
org.userId || org.userId ||
org.UserId || org.UserId ||
org.organisationUser ||
org.OrganisationUser ||
org.createdBy ||
''; '';
let selectedUserId = ''; let selectedUserId = '';
@@ -1238,6 +1232,11 @@ export const GovernancePage: React.FC = () => {
<Mail className="w-3.5 h-3.5 text-slate-500" /> <Mail className="w-3.5 h-3.5 text-slate-500" />
{org.email} {org.email}
</span> </span>
{org.userId && (
<span className="text-[10px] text-blue-400/90 font-mono block mt-0.5" title={`Executive User: ${org.userId}`}>
Exec: {getUserEmail(org.userId)}
</span>
)}
</td> </td>
<td className="py-3.5 px-4"> <td className="py-3.5 px-4">
<span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-semibold border ${statusBadge.className}`}> <span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-[10px] font-semibold border ${statusBadge.className}`}>
@@ -1736,11 +1735,11 @@ export const GovernancePage: React.FC = () => {
<div className="flex items-center justify-between mb-1"> <div className="flex items-center justify-between mb-1">
<div className="flex items-center gap-1"> <div className="flex items-center gap-1">
<label className="block text-xs font-semibold text-slate-300"> <label className="block text-xs font-semibold text-slate-300">
Linked Executive / Manager User * Responsible Executive User *
</label> </label>
<HelpTooltip <HelpTooltip
title="Designated Organisation User" title="Executive / Organisation User"
content="Only users with an Executive or Manager role can be assigned to an organisation." content="The Executive user responsible for this organisation. Stored as userId in the organisation record and submitted as organisationUser to the API."
size="sm" size="sm"
placement="top" placement="top"
/> />
@@ -2585,11 +2584,17 @@ export const GovernancePage: React.FC = () => {
<span className="text-slate-300">{getOrganisationTypeLabel(orgFreshDetail?.type ?? selectedOrgForDetail?.type ?? OrganisationType.Enterprise)}</span> <span className="text-slate-300">{getOrganisationTypeLabel(orgFreshDetail?.type ?? selectedOrgForDetail?.type ?? OrganisationType.Enterprise)}</span>
</div> </div>
<div className="flex items-center gap-2 min-w-0"> <div className="flex items-center gap-2 min-w-0">
<span className="text-slate-400 font-semibold text-[11px] uppercase tracking-wider shrink-0">Linked User:</span> <span className="text-slate-400 font-semibold text-[11px] uppercase tracking-wider shrink-0">Executive User:</span>
<span className="text-blue-400 font-mono text-[11px] truncate"> <span className="text-blue-400 font-mono text-[11px] truncate">
{getUserEmail(orgFreshDetail?.userId || selectedOrgForDetail?.userId) || orgFreshDetail?.userId || selectedOrgForDetail?.userId || '—'} {getUserEmail(orgFreshDetail?.userId || selectedOrgForDetail?.userId) || orgFreshDetail?.userId || selectedOrgForDetail?.userId || '—'}
</span> </span>
</div> </div>
<div className="flex items-center gap-2 min-w-0">
<span className="text-slate-400 font-semibold text-[11px] uppercase tracking-wider shrink-0">Created By:</span>
<span className="text-slate-300 font-mono text-[11px] truncate">
{getUserEmail(orgFreshDetail?.createdBy || selectedOrgForDetail?.createdBy) || orgFreshDetail?.createdBy || selectedOrgForDetail?.createdBy || '—'}
</span>
</div>
</div> </div>
</div> </div>
@@ -247,7 +247,6 @@ export const createOrganisation = async (payload: CreateOrganisationRequest): Pr
email: payload.email, email: payload.email,
idNumber: payload.idNumber || null, idNumber: payload.idNumber || null,
organisationUser: payload.organisationUser, organisationUser: payload.organisationUser,
userId: payload.userId || payload.organisationUser,
type: payload.type !== undefined ? Number(payload.type) : 5, type: payload.type !== undefined ? Number(payload.type) : 5,
}); });
return res.data; return res.data;
@@ -260,9 +259,8 @@ export const updateOrganisation = async (payload: UpdateOrganisationRequest): Pr
name: payload.name, name: payload.name,
registrationNo: payload.registrationNo, registrationNo: payload.registrationNo,
email: payload.email, email: payload.email,
idNumber: payload.idNumber, idNumber: payload.idNumber || null,
organisationUser: payload.organisationUser, organisationUser: payload.organisationUser,
userId: payload.userId || payload.organisationUser,
type: Number(payload.type), type: Number(payload.type),
status: orgStatus, status: orgStatus,
}); });
@@ -388,7 +388,6 @@ export interface CreateOrganisationRequest {
email: string; email: string;
idNumber?: string | null; idNumber?: string | null;
organisationUser: string; organisationUser: string;
userId?: string | null;
type: OrganisationType; type: OrganisationType;
} }
@@ -399,7 +398,6 @@ export interface UpdateOrganisationRequest {
email: string; email: string;
idNumber?: string | null; idNumber?: string | null;
organisationUser: string; organisationUser: string;
userId?: string | null;
type: OrganisationType; type: OrganisationType;
status?: ActivityStatus; status?: ActivityStatus;
} }