v8: Клик по ФИО — история выданных СИЗ (что, дата, годен до, статус)
This commit is contained in:
parent
97c42ed1f0
commit
d968995dd9
67
index.html
67
index.html
@ -425,6 +425,19 @@ tr:hover td { background: var(--cyan-50); }
|
||||
.norm-issue-emp-name { font-weight: 600; }
|
||||
.norm-issue-emp-meta { font-size: 12px; color: var(--gray-500); }
|
||||
|
||||
/* Employee name link */
|
||||
.emp-name-link {
|
||||
color: var(--ink);
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px dashed var(--gray-300);
|
||||
}
|
||||
.emp-name-link:hover {
|
||||
color: var(--cyan);
|
||||
border-bottom-color: var(--cyan);
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.header { padding: 12px 16px; }
|
||||
@ -947,6 +960,34 @@ tr:hover td { background: var(--cyan-50); }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- EMPLOYEE HISTORY MODAL -->
|
||||
<div class="modal-overlay" id="empHistoryModal">
|
||||
<div class="modal" style="max-width:700px;">
|
||||
<h2 id="empHistoryTitle">Выданные СИЗ</h2>
|
||||
<div id="empHistoryMeta" style="font-size:13px;color:var(--gray-500);margin-bottom:16px;"></div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>СИЗ</th>
|
||||
<th>Кол-во</th>
|
||||
<th>Дата выдачи</th>
|
||||
<th>Годен до</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="empHistoryTable"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="empty" id="empHistoryEmpty" style="display:none;">
|
||||
<p>Нет выданных СИЗ.</p>
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<button class="btn btn-outline" onclick="closeModal('empHistoryModal')">Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// ===================== DATA LAYER =====================
|
||||
const DB = {
|
||||
@ -1112,6 +1153,30 @@ function deleteEmployee(id) {
|
||||
renderIssuances();
|
||||
}
|
||||
|
||||
function showEmpHistory(empId) {
|
||||
const emp = DB.employees.find(e => e.id === empId);
|
||||
if (!emp) return;
|
||||
document.getElementById('empHistoryTitle').textContent = 'Выданные СИЗ';
|
||||
document.getElementById('empHistoryMeta').innerHTML = `<strong>${emp.fullName}</strong> — ${emp.position} • ${emp.department} • ${emp.branch || ''}`;
|
||||
|
||||
const issued = DB.issuances.filter(i => i.employeeId === empId);
|
||||
document.getElementById('empHistoryTable').innerHTML = issued.length
|
||||
? issued.map(i => {
|
||||
const siz = DB.siz.find(s => s.id === i.sizId);
|
||||
const st = getIssStatus(i);
|
||||
return `<tr>
|
||||
<td><strong>${getSizName(i.sizId)}</strong></td>
|
||||
<td>${i.quantity} ${siz ? siz.unit : ''}</td>
|
||||
<td>${fmtDate(i.dateIssued)}</td>
|
||||
<td>${fmtDate(i.dateExpire)}</td>
|
||||
<td>${statusBadge(st)}</td>
|
||||
</tr>`;
|
||||
}).join('')
|
||||
: '';
|
||||
document.getElementById('empHistoryEmpty').style.display = issued.length ? 'none' : 'block';
|
||||
openModal('empHistoryModal');
|
||||
}
|
||||
|
||||
function renderEmployees() {
|
||||
const q = (document.getElementById('empSearch').value || '').toLowerCase();
|
||||
let list = DB.employees;
|
||||
@ -1687,7 +1752,7 @@ function renderReports() {
|
||||
const issuedCount = empIss.filter(i => i.status !== 'returned').length;
|
||||
const expiredCount = empIss.filter(i => getIssStatus(i) === 'expired').length;
|
||||
return `<tr>
|
||||
<td><strong>${e.fullName}</strong></td>
|
||||
<td><a href="#" class="emp-name-link" onclick="event.preventDefault();showEmpHistory('${e.id}')">${e.fullName}</a></td>
|
||||
<td>${e.position}</td>
|
||||
<td>${issuedCount}</td>
|
||||
<td>${expiredCount ? '<span class="badge badge-red">' + expiredCount + '</span>' : '<span class="badge badge-green">0</span>'}</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user