forked from UKSOURCE/cms.hailearning.edu.vn
103 lines
4.3 KiB
Plaintext
103 lines
4.3 KiB
Plaintext
<div class="page-title-area">
|
|
<div>
|
|
<h1>Certificates</h1>
|
|
<p class="subtitle">Certificate records</p>
|
|
</div>
|
|
<a href="/admin/certificate/create" class="btn btn-primary">
|
|
<i class="fas fa-plus"></i> New Certificate
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Filter -->
|
|
<div class="card border-0 mb-3">
|
|
<div class="card-body" style="padding:1rem 1.25rem;">
|
|
<form method="GET" action="/admin/certificate">
|
|
<div class="row g-2 align-items-end">
|
|
<div class="col-md-4">
|
|
<div class="position-relative search-bar">
|
|
<i class="fas fa-search search-icon"></i>
|
|
<input type="text" class="form-control" name="search" placeholder="Search name, number..." value="<%= query.search || '' %>">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<select class="form-select" name="status">
|
|
<option value="">All Status</option>
|
|
<option value="active" <%= query.status === 'active' ? 'selected' : '' %>>Active</option>
|
|
<option value="revoked" <%= query.status === 'revoked' ? 'selected' : '' %>>Revoked</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-1 d-flex gap-1">
|
|
<button type="submit" class="btn btn-primary flex-fill"><i class="fas fa-search"></i></button>
|
|
<% if (query.search || query.status) { %>
|
|
<a href="/admin/certificate" class="btn btn-outline-secondary"><i class="fas fa-times"></i></a>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Table -->
|
|
<div class="card border-0">
|
|
<div class="card-body p-0">
|
|
<% if (certificates && certificates.length > 0) { %>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th style="width:40px">#</th>
|
|
<th>Certificate No.</th>
|
|
<th>Full Name</th>
|
|
<th>Program</th>
|
|
<th>Department</th>
|
|
<th>Level</th>
|
|
<th>Issue Date</th>
|
|
<th>Status</th>
|
|
<th style="width:90px">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% certificates.forEach((c, i) => { %>
|
|
<tr>
|
|
<td style="color:var(--text-muted)"><%= i + 1 %></td>
|
|
<td><code style="font-size:0.8rem;color:var(--info-color)"><%= c.certification_number %></code></td>
|
|
<td style="font-weight:500"><%= c.student_name %></td>
|
|
<td style="font-size:0.8125rem;color:var(--text-muted)"><%= c.program_name %></td>
|
|
<td style="font-size:0.8125rem"><%= c.department ? c.department.name : '—' %></td>
|
|
<td style="font-size:0.8125rem"><%= c.level ? c.level.type : '—' %></td>
|
|
<td style="font-size:0.8125rem;color:var(--text-muted)"><%= c.issued_date ? new Date(c.issued_date).toLocaleDateString('en-GB') : '—' %></td>
|
|
<td>
|
|
<% if (c.status === 'active') { %>
|
|
<span class="badge bg-soft-success">Active</span>
|
|
<% } else { %>
|
|
<span class="badge bg-soft-danger">Revoked</span>
|
|
<% } %>
|
|
</td>
|
|
<td>
|
|
<div class="table-actions">
|
|
<a href="/admin/certificate/<%= c._id %>/edit" class="btn btn-sm btn-outline-primary btn-icon" title="Edit">
|
|
<i class="fas fa-pen"></i>
|
|
</a>
|
|
<form method="POST" action="/admin/certificate/<%= c._id %>/delete" style="display:inline;" onsubmit="return confirm('Delete this certificate?')">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger btn-icon" title="Delete">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<% }); %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% } else { %>
|
|
<div class="empty-state">
|
|
<div class="empty-state-icon"><i class="fas fa-certificate"></i></div>
|
|
<h5>No certificates found</h5>
|
|
<p>Create the first certificate record.</p>
|
|
<a href="/admin/certificate/create" class="btn btn-primary"><i class="fas fa-plus"></i> Create</a>
|
|
</div>
|
|
<% } %>
|
|
</div>
|
|
</div>
|