#3: new passes type, user applications page, bug fixes
This commit is contained in:
		@@ -50,12 +50,16 @@
 | 
			
		||||
        <h1>Новая заявка на пропуск</h1>
 | 
			
		||||
        <div class="radio-inputs">
 | 
			
		||||
            <label class="radio">
 | 
			
		||||
                <input autocomplete="off" type="radio" id="temp-radio" name="form-type" value="temp" checked>
 | 
			
		||||
                <span class="name">Временный пропуск</span>
 | 
			
		||||
                <input autocomplete="off" type="radio" id="onetime-radio" name="form-type" value="onetime" checked>
 | 
			
		||||
                <span class="name">Разовый</span>
 | 
			
		||||
            </label>
 | 
			
		||||
            <label class="radio">
 | 
			
		||||
                <input autocomplete="off" type="radio" id="temp-radio" name="form-type" value="temp">
 | 
			
		||||
                <span class="name">Временный</span>
 | 
			
		||||
            </label>
 | 
			
		||||
            <label class="radio">
 | 
			
		||||
                <input autocomplete="off" type="radio" id="car-radio" name="form-type" value="car">
 | 
			
		||||
                <span class="name">Автомобильный пропуск</span>
 | 
			
		||||
                <span class="name">Автомобильный</span>
 | 
			
		||||
            </label>
 | 
			
		||||
            <label class="radio">
 | 
			
		||||
                <input autocomplete="off" type="radio" id="tmc-radio" name="form-type" value="tmc">
 | 
			
		||||
@@ -254,6 +258,28 @@
 | 
			
		||||
                        $('#send-button').removeClass('inactive');
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                if (document.getElementById('onetime-radio').checked) {
 | 
			
		||||
                    type = "Разовый";
 | 
			
		||||
                    // Отправляем запрос на сервер для авторизации
 | 
			
		||||
                    const response = await fetch("{{API_SERVER}}/passes/newform", {
 | 
			
		||||
                        method: "POST",
 | 
			
		||||
                        headers: {
 | 
			
		||||
                            "Content-Type": "application/json",
 | 
			
		||||
                            Authorization: getCookie("token"),
 | 
			
		||||
                        },
 | 
			
		||||
                        body: JSON.stringify({ formrole, passtext, type, fullnames, legalname, date })
 | 
			
		||||
                    });
 | 
			
		||||
                    if (response.status === 201) {
 | 
			
		||||
                        const data = await response.json();
 | 
			
		||||
                        alert("Ваша заявка принята к рассмотрению!")
 | 
			
		||||
 | 
			
		||||
                        window.location.href = "/";
 | 
			
		||||
                        $('#send-button').removeClass('inactive');
 | 
			
		||||
                    } else {
 | 
			
		||||
                        alert("Произошла ошибка при попытке отправить заявку");
 | 
			
		||||
                        $('#send-button').removeClass('inactive');
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                if (document.getElementById('car-radio').checked) {
 | 
			
		||||
                    type = "Автомобильный";
 | 
			
		||||
 | 
			
		||||
@@ -338,7 +364,7 @@
 | 
			
		||||
                    } else if (this.value === "tmc") {
 | 
			
		||||
                        carInputs.style.display = 'none';
 | 
			
		||||
                        tmcInputs.style.display = 'flex';
 | 
			
		||||
                    } else if (this.value === "temp") {
 | 
			
		||||
                    } else if (this.value === "temp" || this.value === "onetime") {
 | 
			
		||||
                        carInputs.style.display = 'none';
 | 
			
		||||
                        tmcInputs.style.display = 'none';
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user