From 4fdb7fca942e0617c2628a1a4b27b46aa96c9740 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Sun, 11 Jan 2026 17:06:37 -0800 Subject: [PATCH] Implement team loading in portal Co-Authored-By: Claude Opus 4.5 --- portal/portal.js | 50 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/portal/portal.js b/portal/portal.js index 5ee5d5e..8f191ab 100644 --- a/portal/portal.js +++ b/portal/portal.js @@ -494,7 +494,55 @@ const Portal = { // Load team async loadTeam() { console.log('[Portal] Loading team...'); - // TODO: Implement team loading + const tbody = document.getElementById('teamTableBody'); + tbody.innerHTML = 'Loading team...'; + + try { + const response = await fetch(`${this.config.apiBaseUrl}/portal/team.cfm`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ BusinessID: this.config.businessId }) + }); + const data = await response.json(); + + if (data.OK && data.TEAM) { + if (data.TEAM.length === 0) { + tbody.innerHTML = 'No team members yet'; + return; + } + + tbody.innerHTML = data.TEAM.map(member => ` + + +
+ ${(member.FirstName || '?').charAt(0)}${(member.LastName || '').charAt(0)} + ${member.Name || 'Unknown'} +
+ + ${member.Email || '-'} + ${member.StatusName || 'Unknown'} + + + ${member.IsActive ? 'Active' : 'Inactive'} + + + + + + + `).join(''); + } else { + tbody.innerHTML = 'Failed to load team'; + } + } catch (err) { + console.error('[Portal] Error loading team:', err); + tbody.innerHTML = 'Error loading team'; + } + }, + + // Edit team member (placeholder) + editTeamMember(employeeId) { + this.showToast('Team member editing coming soon', 'info'); }, // Load settings