Enhance candidate lists by adding badge containers for improved visual feedback on submission status.

This commit is contained in:
Ross
2026-01-05 11:52:58 +00:00
parent 378d784435
commit 459b7f9b93
3 changed files with 23 additions and 10 deletions
+21 -9
View File
@@ -175,13 +175,15 @@
}); });
// Helper to ensure a single badge exists inside an li and update its tooltip // Helper to ensure a single badge exists inside an li and update its tooltip
function ensureSubmittedBadge(li, title){ function ensureBadge(li, selector, className, text, title){
let b = li.querySelector('.submitted-badge'); // Prefer the explicit badge container if present
const container = li.querySelector('.badge-container') || li;
let b = container.querySelector(selector);
if(!b){ if(!b){
b = document.createElement('span'); b = document.createElement('span');
b.className = 'submitted-badge badge bg-success ms-2'; b.className = className;
b.textContent = 'Submitted'; b.textContent = text;
li.appendChild(b); container.appendChild(b);
} }
if(title){ if(title){
b.setAttribute('title', title); b.setAttribute('title', title);
@@ -198,8 +200,14 @@
const text = (link && link.textContent) ? link.textContent.trim() : (li.textContent||'').trim(); const text = (link && link.textContent) ? link.textContent.trim() : (li.textContent||'').trim();
if(submittedCids.has(text)){ if(submittedCids.has(text)){
const info = submittedCids.get(text) || {first:'', last:''}; const info = submittedCids.get(text) || {first:'', last:''};
const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : ''; // add Started badge if start time exists
ensureSubmittedBadge(li, title); if(info.first){
const t = `Started\nFirst: ${info.first}`;
ensureBadge(li, '.started-badge', 'started-badge badge bg-info ms-2', 'Started', t);
}
// add Submitted badge if end time exists (or always keep submitted)
const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : 'Submitted';
ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Submitted', title);
} }
}catch(e){ console.error('highlightSubmitted CID item error', e); } }catch(e){ console.error('highlightSubmitted CID item error', e); }
}); });
@@ -213,8 +221,12 @@
for(const user of submittedUsers.keys()){ for(const user of submittedUsers.keys()){
if(txt.indexOf(user) !== -1){ if(txt.indexOf(user) !== -1){
const info = submittedUsers.get(user) || {first:'', last:''}; const info = submittedUsers.get(user) || {first:'', last:''};
const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : ''; if(info.first){
ensureSubmittedBadge(li, title); const t = `Started\nFirst: ${info.first}`;
ensureBadge(li, '.started-badge', 'started-badge badge bg-info ms-2', 'Started', t);
}
const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : 'Submitted';
ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Submitted', title);
break; break;
} }
} }
@@ -22,6 +22,7 @@
<div class="small text-muted mt-1 cid-notes" title="{{ cid.notes|escape }}" data-bs-toggle="tooltip" data-bs-placement="top">Notes: {{ cid.notes|truncatechars:120 }}</div> <div class="small text-muted mt-1 cid-notes" title="{{ cid.notes|escape }}" data-bs-toggle="tooltip" data-bs-placement="top">Notes: {{ cid.notes|truncatechars:120 }}</div>
{% endif %} {% endif %}
</div> </div>
<div class="badge-container d-flex align-items-center ms-3"></div>
</div> </div>
</li> </li>
{% endfor %} {% endfor %}
@@ -18,7 +18,7 @@
</div> </div>
<div class="small">Email: {{ user.email }}</div> <div class="small">Email: {{ user.email }}</div>
</div> </div>
<div class="small text-muted">&nbsp;</div> <div class="badge-container d-flex align-items-center ms-3"></div>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>