BOC v1.0: RS256 auth, Ledger integration, Prometheus metrics, CI/CD, backup
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// CRM module
|
||||
export async function render(container) {
|
||||
container.innerHTML = `
|
||||
<header class="module-header">
|
||||
<h1>CRM</h1>
|
||||
<p class="subtitle">Kunder och leads</p>
|
||||
</header>
|
||||
<div class="toolbar">
|
||||
<button class="btn-primary" id="btn-new-customer">+ Ny kund</button>
|
||||
</div>
|
||||
<div class="table-container">
|
||||
<table class="data-table" id="customers-table">
|
||||
<thead>
|
||||
<tr><th>Namn</th><th>Företag</th><th>Status</th><th>Email</th></tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
`;
|
||||
|
||||
try {
|
||||
const res = await apiRequest('/crm/customers');
|
||||
const data = await res.json();
|
||||
const tbody = container.querySelector('#customers-table tbody');
|
||||
|
||||
if (data.customers?.length) {
|
||||
tbody.innerHTML = data.customers.map(c => `
|
||||
<tr>
|
||||
<td>${c.name}</td>
|
||||
<td>${c.company || '-'}</td>
|
||||
<td><span class="badge badge-${c.status}">${c.status}</span></td>
|
||||
<td>${c.email || '-'}</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
} else {
|
||||
tbody.innerHTML = '<tr><td colspan="4">Inga kunder hittades</td></tr>';
|
||||
}
|
||||
} catch (err) {
|
||||
container.innerHTML += `<div class="alert alert-error">Kunde inte ladda kunder: ${err.message}</div>`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user