- {/* Agent Type - Editable */}
+ {/* Agent Type - Read Only */}
-
Agent Type
-
-
- {selectedAgentTypeId && selectedAgentTypeId !== user.agentProfile?.agentTypeId && (
-
- )}
-
+
Agent Type
+
+ {user.agentProfile.agentType?.name || 'Not assigned'}
+
Slug
@@ -566,6 +546,43 @@ export default function UserDetailPage() {
)}
+ {/* Dynamic Profile Data (only for AGENT role) */}
+ {user.role === 'AGENT' && agentFieldValues.length > 0 && (
+
+
+
Profile Details
+
+
+ {Object.entries(
+ agentFieldValues
+ .filter((fv) => fv.sectionSlug !== 'upload-documents')
+ .reduce((acc, fv) => {
+ if (!acc[fv.sectionName]) acc[fv.sectionName] = [];
+ acc[fv.sectionName].push(fv);
+ return acc;
+ }, {} as Record
)
+ ).map(([sectionName, fields]) => (
+
+
{sectionName}
+
+ {fields.map((fv) => (
+
+
{fv.fieldName}
+
+ {fv.value === null || fv.value === undefined ? - :
+ Array.isArray(fv.value) ? fv.value.map((v: any) => typeof v === 'object' ? (v.label || v.name || JSON.stringify(v)) : String(v)).join(', ') :
+ typeof fv.value === 'object' ? JSON.stringify(fv.value) :
+ String(fv.value)}
+
+
+ ))}
+
+
+ ))}
+
+
+ )}
+
{/* Verification Section (only for AGENT role) */}
{user.role === 'AGENT' && user.agentProfile && (
@@ -592,41 +609,6 @@ export default function UserDetailPage() {
)}
- {/* Agent Profile Data */}
- {agentFieldValues.length > 0 && (
-
-
Profile Data
-
- {Object.entries(
- agentFieldValues
- .filter((fv) => fv.sectionSlug !== 'upload-documents')
- .reduce((acc, fv) => {
- if (!acc[fv.sectionName]) acc[fv.sectionName] = [];
- acc[fv.sectionName].push(fv);
- return acc;
- }, {} as Record
)
- ).map(([sectionName, fields]) => (
-
-
{sectionName}
-
- {fields.map((fv) => (
-
- {fv.fieldName}:
-
- {fv.value === null || fv.value === undefined ? '-' :
- Array.isArray(fv.value) ? fv.value.map((v: any) => typeof v === 'object' ? (v.label || v.name || JSON.stringify(v)) : String(v)).join(', ') :
- typeof fv.value === 'object' ? JSON.stringify(fv.value) :
- String(fv.value)}
-
-
- ))}
-
-
- ))}
-
-
- )}
-
{/* Uploaded Documents */}
Uploaded Documents