diff --git a/index.html b/index.html index cf1f8d7..5097521 100644 --- a/index.html +++ b/index.html @@ -291,7 +291,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s - + Айгуль К. Специалист АХО 8 @@ -299,7 +299,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s 92% - + Руслан М. Техник 6 @@ -307,7 +307,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s 88% - + Динара С. Документооборот 5 @@ -315,7 +315,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s 95% - + Алексей В. Кладовщик 5 @@ -611,8 +611,51 @@ document.querySelectorAll('.employee-select').forEach(select => { function saveEmployee(btn) { const row = btn.closest('tr'); - const name = row.cells[0].textContent; - showNotification('Данные сотрудника "' + name + '" сохранены'); + const oldName = row.dataset.employeeName; + const newName = row.cells[0].textContent.trim(); + const newRole = row.cells[1].textContent.trim(); + + // Обновляем данные во всех задачах + document.querySelectorAll('.task .meta').forEach(meta => { + if (meta.textContent.includes('Исполнитель: ' + oldName)) { + meta.textContent = meta.textContent.replace('Исполнитель: ' + oldName, 'Исполнитель: ' + newName); + } + }); + + // Обновляем данные во всех закупках + document.querySelectorAll('.table td').forEach(td => { + if (td.textContent.trim() === oldName && td.nextElementSibling && !td.nextElementSibling.querySelector('select')) { + td.textContent = newName; + } + }); + + // Обновляем данные в загрузке сотрудников + document.querySelectorAll('.employee .name').forEach(nameEl => { + if (nameEl.textContent.trim() === oldName) { + nameEl.textContent = newName; + } + }); + + document.querySelectorAll('.employee .role').forEach(roleEl => { + if (roleEl.textContent.trim() === oldName || roleEl.textContent.includes(oldName)) { + roleEl.textContent = newRole; + } + }); + + // Обновляем selectы с сотрудниками + document.querySelectorAll('.employee-select').forEach(select => { + select.querySelectorAll('option').forEach(option => { + if (option.value === oldName) { + option.value = newName; + option.textContent = newName; + } + }); + }); + + // Сохраняем новое имя для будущих изменений + row.dataset.employeeName = newName; + + showNotification('Данные сотрудника "' + oldName + '" обновлены на "' + newName + '" во всех разделах'); } function savePurchase(btn) {