diff --git a/src/app/routers/staff.py b/src/app/routers/staff.py index 5e6e918..fb7e456 100644 --- a/src/app/routers/staff.py +++ b/src/app/routers/staff.py @@ -86,8 +86,10 @@ async def update(reqData: dict = Depends(requestDict)): ).replace(hour=12, minute=0, second=0) if "attorney" in updatePractitioner and updatePractitioner["attorney"] != "": logger.info("🔐 МЧД получена") + updatePractitioner["esiaAuth"] = False if "signature" in updatePractitioner: logger.info("🔐 УКЭП получен") + updatePractitioner["esiaAuth"] = True fileData = updatePractitioner.pop("signature") fileInfo = p7s_save(fileData, updatePractitioner["userIdLpu"]) if fileInfo.success: diff --git a/src/app/static/js/staff.js b/src/app/static/js/staff.js index 75f07d4..ef3f16d 100644 --- a/src/app/static/js/staff.js +++ b/src/app/static/js/staff.js @@ -353,6 +353,7 @@ function updateStaffTable() { } let rows = ''; + const showDisabled = document.getElementById('showDisabled').checked; filteredPractitioners.forEach(practitioner => { // Проверяем, что practitioner - объект @@ -361,6 +362,10 @@ function updateStaffTable() { return; } + const isDisabled = practitioner.expired_at === null; + + if (!showDisabled && isDisabled) return; + // Определяем тип подписи let signatureTypeHtml; if (practitioner.esiaAuth) { @@ -382,8 +387,9 @@ function updateStaffTable() { onclick="showAttorneyPopup('${snils}', this)"> `; - signatureTypeHtml = `МЧД${eyeIcon} - СНИЛС${snilsIcon}`; + mchdBadge = `МЧД${eyeIcon}`; + slilsBadge = `СНИЛС${snilsIcon}`; + signatureTypeHtml = isDisabled ? slilsBadge : `${mchdBadge} ${slilsBadge}`; } // Форматируем дату и проверяем срок @@ -417,25 +423,40 @@ function updateStaffTable() { } else { expiryHtml = `
- Не установлен - - + Без права подписи
`; } // Кнопки действий - const actionsHtml = ` + let actionsHtml = ''; + if (isDisabled) { + actionsHtml = ` +
+ + +
+ `; + } else { + actionsHtml = `
`; + } rows += ` @@ -642,6 +663,7 @@ function editPractitioner(userIdLpu, isEsiaAuth) { document.getElementById('ukepPractitionerId').value = userIdLpu; document.getElementById('ukepFile').required = false; document.getElementById('ukepSnilsNumber').value = practitioner.snils; + document.getElementById('ukepExpiryDate').value = practitioner.expired_at || ''; // Очищаем data-атрибуты модального окна const modal = document.getElementById('editUKEPModal'); @@ -663,6 +685,7 @@ function editPractitioner(userIdLpu, isEsiaAuth) { document.getElementById('mchdPractitionerId').value = userIdLpu; document.getElementById('mchdNumber').value = practitioner.attorney || ''; document.getElementById('mchdSnilsNumber').value = practitioner.snils; + document.getElementById('mchdExpiryDate').value = practitioner.expired_at || ''; // Очищаем data-атрибуты модального окна const modal = document.getElementById('editMCHDModal'); @@ -1093,6 +1116,7 @@ document.addEventListener('DOMContentLoaded', function () { // Обработчики попапа с номером МЧД document.getElementById('closeAttorneyPopupBtn').addEventListener('click', hideAttorneyPopup); document.getElementById('closeAttorneyBtn').addEventListener('click', hideAttorneyPopup); + document.getElementById('showDisabled').addEventListener('click', updateStaffTable); document.getElementById('copyAttorneyBtn').addEventListener('click', function () { const attorneyNumber = document.getElementById('attorneyNumber').textContent; diff --git a/src/app/templates/staff/index.html b/src/app/templates/staff/index.html index bf34e15..6ef0f34 100644 --- a/src/app/templates/staff/index.html +++ b/src/app/templates/staff/index.html @@ -88,9 +88,15 @@
- +
+
+ + +
+ +
@@ -211,22 +217,22 @@ - +