Implement team loading in portal
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8092384702
commit
4fdb7fca94
1 changed files with 49 additions and 1 deletions
|
|
@ -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 = '<tr><td colspan="5" class="empty-state">Loading team...</td></tr>';
|
||||
|
||||
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 = '<tr><td colspan="5" class="empty-state">No team members yet</td></tr>';
|
||||
return;
|
||||
}
|
||||
|
||||
tbody.innerHTML = data.TEAM.map(member => `
|
||||
<tr>
|
||||
<td>
|
||||
<div class="member-info">
|
||||
<span class="member-avatar">${(member.FirstName || '?').charAt(0)}${(member.LastName || '').charAt(0)}</span>
|
||||
<span>${member.Name || 'Unknown'}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>${member.Email || '-'}</td>
|
||||
<td>${member.StatusName || 'Unknown'}</td>
|
||||
<td>
|
||||
<span class="status-badge ${member.IsActive ? 'active' : 'inactive'}">
|
||||
${member.IsActive ? 'Active' : 'Inactive'}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-secondary" onclick="Portal.editTeamMember(${member.EmployeeID})">Edit</button>
|
||||
</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
} else {
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-state">Failed to load team</td></tr>';
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[Portal] Error loading team:', err);
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="empty-state">Error loading team</td></tr>';
|
||||
}
|
||||
},
|
||||
|
||||
// Edit team member (placeholder)
|
||||
editTeamMember(employeeId) {
|
||||
this.showToast('Team member editing coming soon', 'info');
|
||||
},
|
||||
|
||||
// Load settings
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue