diff --git a/public/index.html b/public/index.html index 008df05..4608c2d 100644 --- a/public/index.html +++ b/public/index.html @@ -184,6 +184,35 @@
+
diff --git a/public/main.js b/public/main.js index c0e0bcd..c616266 100644 --- a/public/main.js +++ b/public/main.js @@ -157,9 +157,22 @@ async function createTask(event) { } const title = document.getElementById('title').value; - const description = document.getElementById('description').value; + let description = document.getElementById('description').value; const taskType = document.getElementById('task-type').value; - + + // Для типа it добавляем кабинет и тип проблемы в описание + if (taskType === 'it') { + const cabinet = document.getElementById('it-cabinet').value.trim(); + const corpusType = document.getElementById('it-corpus-type').value; + const problemType = document.getElementById('it-problem-type').value; + if (!cabinet || !problemType) { + alert('Для заявки в ИТ необходимо указать номер кабинета и тип проблемы'); + return; + } + // Добавляем в конец описания с переносом строки + description = description + '
Кабинет: ' + cabinet + '
Корпус: ' + corpusType + '
Тип проблемы: ' + problemType; + } + // Получаем полную дату и время из отдельных полей const fullDateTime = getFullDateTime('due-date', 'due-time'); diff --git a/public/ui.js b/public/ui.js index 7d25245..a6ec226 100644 --- a/public/ui.js +++ b/public/ui.js @@ -1162,6 +1162,22 @@ async function loadTaskFiles(taskId) { } async function selectTaskType(type) { + // Управление видимостью дополнительных полей для ИТ + const itFields = document.getElementById('it-additional-fields'); + const cabinetInput = document.getElementById('it-cabinet'); + const corpusInput = document.getElementById('it-corpus'); + const problemSelect = document.getElementById('it-problem-type'); + if (type === 'it') { + if (itFields) itFields.style.display = 'block'; + if (cabinetInput) cabinetInput.setAttribute('required', 'required'); + if (corpusInput) corpusInput.setAttribute('required', 'required'); + if (problemSelect) problemSelect.setAttribute('required', 'required'); + } else { + if (itFields) itFields.style.display = 'none'; + if (cabinetInput) cabinetInput.removeAttribute('required'); + if (corpusInput) corpusInput.removeAttribute('required'); + if (problemSelect) problemSelect.removeAttribute('required'); + } document.querySelectorAll('.task-type-btn').forEach(btn => { btn.classList.remove('active'); });