passesFrontend/static/templates/account/newtso.html
2024-05-15 16:27:22 +03:00

126 lines
5.7 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../styles/main.css">
<script src="../scripts/jquery.min.js"></script>
<script src="../scripts/helpPopup.js"></script>
<title>Заявка на пропуск</title>
<style>
body {
background-color: #EEEFF5;
}
</style>
</head>
<body>
<header>
<a href="/account"><h1>Бюро пропусков / Личный кабинет</h1></a>
<nav>
<div class="dropdown">
<a class="help-button" onclick="toggleDropdown('dropdownHelp-1')">Техническая поддержка</a>
<div id="dropdownHelp-1" class="dropdown-help">
<a href="tel:83477527706">8 (34775) 2-77-06</a>
<a href="tel:89174023516">8 (917) 402-35-16</a>
</div>
</div>
<div class="dropdown">
<a class="help-button" onclick="toggleDropdown('dropdownHelp-2')">Инструкции</a>
<div id="dropdownHelp-2" class="dropdown-help dropdown-manual">
<a href="/docs/manual.pdf" target="_blank">Текст</a>
<a href="https://drive.google.com/file/d/1CxrAgr2brQclZqtbbreSUU9tN-jsNTwf/view?usp=sharing" target="_blank">Видео</a>
</div>
</div>
{{#if (eq Role 'legal')}}
<span>{{User.Наименование}}</span>
{{else}}
<span>{{User.Фамилия}} {{User.Имя}} {{User.Отчество}}</span>
{{/if}}
<a class="exit-button" href="/logout"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" fill="none" viewBox="0 0 20 16">
<path fill="#6B7A99" d="m4.016 7.13 2.608-2.606-1.226-1.226L.696 8l4.702 4.702 1.226-1.226L4.016 8.87h4.858V7.131H4.016ZM8.874.179v6.953h5.215V8.87H8.874v6.953h10.43V.178H8.873Z"/>
</svg>
</a>
</nav>
</header>
<form class="main-form" id="pass-form">
<h1>Новая заявка ТСО</h1>
<div class="input-area">
<label for="fullname-input">ФИО*</label>
<input type="text" id="fullname-input" value="{{User.Фамилия}} {{User.Имя}} {{User.Отчество}}" required>
</div>
<div class="input-area">
<label for="type-input">Вид неисправности*</label>
<textarea id="type-input" cols="30" rows="10"></textarea>
</div>
<div class="input-area">
<label for="object-input">Объект*</label>
<input type="text" id="object-input" required>
</div>
<div class="input-area">
<label for="fabula-input">Фабула</label>
<input type="text" id="fabula-input">
</div>
<div class="form-info">
<p>В тексте формы указывайе всю информацию, которая может быть полезна при решении проблемы.</p>
</div>
<button style="margin-top: 15px;" type="submit" id="send-button">Оставить заявку</button>
</form>
<script>
function getCookie(name) {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].trim();
if (cookie.startsWith(name + "=")) {
return cookie.substring(name.length + 1);
}
}
return null;
}
document.addEventListener("DOMContentLoaded", function() {
const passForm = document.getElementById("pass-form");
passForm.addEventListener("submit", async function(event) {
event.preventDefault();
$('#send-button').addClass('inactive');
const type = $('#type-input').val();
const object = $('#object-input').val();
const fabula = $('#fabula-input').val();
const fullname = $('#fullname-input').val();
// Отправляем запрос на сервер для авторизации
const response = await fetch("{{API_SERVER}}/passes/newtso", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: getCookie("token"),
},
body: JSON.stringify({ type, object, fabula, fullname })
});
if (response.status === 201) {
const data = await response.json();
alert("Ваша заявка принята к рассмотрению!")
window.location.href = "/";
$('#send-button').removeClass('inactive');
} else {
alert("Произошла ошибка при попытке отправить заявку");
$('#send-button').removeClass('inactive');
}
});
});
</script>
</body>
</html>