This commit is contained in:
Dauren777 2026-06-19 07:08:15 +00:00
parent 68dfad3565
commit e565872b3a

View File

@ -89,23 +89,6 @@ th{background:var(--gray-100);font-weight:600}
<button class="btn-add" onclick="addWorker()">Добавить работника</button> <button class="btn-add" onclick="addWorker()">Добавить работника</button>
</div> </div>
<div class="table-container">
<table id="workersTable">
<thead>
<tr>
<th>ФИО</th>
<th>Дата приема</th>
<th>Оклад (₽)</th>
<th>Отработано дней</th>
<th>Отчетный месяц</th>
<th>Действие</th>
</tr>
</thead>
<tbody id="workersBody">
</tbody>
</table>
</div>
<button class="btn" onclick="calculateBonus()" style="margin-top:24px">Рассчитать премию</button> <button class="btn" onclick="calculateBonus()" style="margin-top:24px">Рассчитать премию</button>
<div id="results" class="result-section" style="display:none"> <div id="results" class="result-section" style="display:none">
@ -143,7 +126,6 @@ function addWorker() {
reportMonth reportMonth
}); });
updateTable();
clearForm(); clearForm();
} }
@ -251,7 +233,6 @@ function loadFromFile() {
loadedCount++; loadedCount++;
} }
updateTable();
alert(`Загружено ${loadedCount} работников`); alert(`Загружено ${loadedCount} работников`);
fileInput.value = ''; fileInput.value = '';
@ -264,25 +245,6 @@ function loadFromFile() {
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file);
} }
function removeWorker(id) {
workers = workers.filter(w => w.id !== id);
updateTable();
}
function updateTable() {
const tbody = document.getElementById('workersBody');
tbody.innerHTML = workers.map(w => `
<tr>
<td>${w.fullName}</td>
<td>${formatDate(w.hireDate)}</td>
<td>${w.salary.toLocaleString('ru-RU')}</td>
<td>${w.workedDays}</td>
<td>${formatMonth(w.reportMonth)}</td>
<td><button class="btn-remove" onclick="removeWorker(${w.id})">Удалить</button></td>
</tr>
`).join('');
}
function clearForm() { function clearForm() {
document.getElementById('fullName').value = ''; document.getElementById('fullName').value = '';
document.getElementById('hireDate').value = ''; document.getElementById('hireDate').value = '';