registerPage('dedupe', async (content, params = {}) => { document.getElementById('topbar-title').textContent = 'Duplicate Employees'; let groups = []; content.innerHTML = `
β No duplicate employees found.
| Record ID | Name | Surname | Client | Company No | Occupation | Assessments | Tests | Bookings | Status |
|---|---|---|---|---|---|---|---|---|---|
| ${row.record_id} | ${row.client_employees_name} | ${row.surname} | ${row.clients_name || 'β'} | ${row.company_number || 'β'} | ${row.occupation || 'β'} | ${row.assessments_count} | ${row.tests_count} | ${row.bookings_count} | ${row.is_primary ? 'KEEP (Primary)' : 'DUPLICATE β will be removed'} |
Primary record (kept): ID ${primary.record_id} β ${primary.client_employees_name} ${primary.surname} @ ${primary.clients_name || '?'}
Duplicate records (deleted): IDs ${dups.map(d => d.record_id).join(', ')}
Assessments that will be re-linked to ID ${g.primary_id}:
| ID | Name | Date | Result |
|---|
Tests that will be re-linked to ID ${g.primary_id}:
| ID | Name | Date | Result |
|---|
Bookings that will be updated:
| Booking # | Date | Status | Dup IDs affected |
|---|
A full backup will be saved automatically before any changes are made. You can rollback from the Backups panel.
Merging 0 / ${total} groupsβ¦
| # | Date | Description | By | |
|---|---|---|---|---|
| ${b.record_id} | ${b.created_at} | ${b.description} | ${b.safesure_users_name || 'β'} |