111 lines
5.1 KiB
HTML
111 lines
5.1 KiB
HTML
|
|
{% extends 'base.html' %}
|
||
|
|
|
||
|
|
{% block title %}Criar {{ tipo_instancia }}{% endblock %}
|
||
|
|
|
||
|
|
{% block content %}
|
||
|
|
<div class="container">
|
||
|
|
<div class="row">
|
||
|
|
<div class="col-md-12">
|
||
|
|
<h1 class="mb-4">Criar {{ tipo_instancia }}</h1>
|
||
|
|
|
||
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
||
|
|
{% if messages %}
|
||
|
|
{% for category, message in messages %}
|
||
|
|
<div class="alert alert-{{ category }}">{{ message }}</div>
|
||
|
|
{% endfor %}
|
||
|
|
{% endif %}
|
||
|
|
{% endwith %}
|
||
|
|
|
||
|
|
<form method="POST" class="needs-validation" novalidate>
|
||
|
|
<div class="row">
|
||
|
|
<div class="col-md-6 mb-3">
|
||
|
|
<label for="nome" class="form-label">Nome</label>
|
||
|
|
<input type="text" class="form-control" id="nome" name="nome" required>
|
||
|
|
<div class="invalid-feedback">
|
||
|
|
Por favor, insira o nome da {{ tipo_instancia }}.
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
{% if tipo_instancia != 'Célula' %}
|
||
|
|
<div class="col-md-6 mb-3">
|
||
|
|
<label for="instancia_superior_id" class="form-label">{{ instancia_superior }}</label>
|
||
|
|
<select class="form-select" id="instancia_superior_id" name="instancia_superior_id" required>
|
||
|
|
<option value="">Selecione uma {{ instancia_superior }}</option>
|
||
|
|
{% for superior in instancias_superiores %}
|
||
|
|
<option value="{{ superior.id }}">{{ superior.nome }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
<div class="invalid-feedback">
|
||
|
|
Por favor, selecione uma {{ instancia_superior }}.
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endif %}
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="row">
|
||
|
|
<div class="col-md-6 mb-3">
|
||
|
|
<label for="responsavel_geral_id" class="form-label">Responsável Geral</label>
|
||
|
|
<select class="form-select" id="responsavel_geral_id" name="responsavel_geral_id" required>
|
||
|
|
<option value="">Selecione o responsável geral</option>
|
||
|
|
{% for militante in militantes %}
|
||
|
|
<option value="{{ militante.id }}">{{ militante.nome }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
<div class="invalid-feedback">
|
||
|
|
Por favor, selecione o responsável geral.
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="col-md-6 mb-3">
|
||
|
|
<label for="responsavel_financas_id" class="form-label">Responsável de Finanças</label>
|
||
|
|
<select class="form-select" id="responsavel_financas_id" name="responsavel_financas_id">
|
||
|
|
<option value="">Selecione o responsável de finanças</option>
|
||
|
|
{% for militante in militantes %}
|
||
|
|
<option value="{{ militante.id }}">{{ militante.nome }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="row">
|
||
|
|
<div class="col-md-6 mb-3">
|
||
|
|
<label for="responsavel_imprensa_id" class="form-label">Responsável de Imprensa</label>
|
||
|
|
<select class="form-select" id="responsavel_imprensa_id" name="responsavel_imprensa_id">
|
||
|
|
<option value="">Selecione o responsável de imprensa</option>
|
||
|
|
{% for militante in militantes %}
|
||
|
|
<option value="{{ militante.id }}">{{ militante.nome }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="d-flex justify-content-between mt-4">
|
||
|
|
<button type="submit" class="btn btn-primary">Criar</button>
|
||
|
|
<a href="{{ url_for('listar_' + tipo_instancia.lower() + 's') }}" class="btn btn-secondary">Cancelar</a>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
// Validação do formulário
|
||
|
|
(function () {
|
||
|
|
'use strict'
|
||
|
|
|
||
|
|
var forms = document.querySelectorAll('.needs-validation')
|
||
|
|
|
||
|
|
Array.prototype.slice.call(forms)
|
||
|
|
.forEach(function (form) {
|
||
|
|
form.addEventListener('submit', function (event) {
|
||
|
|
if (!form.checkValidity()) {
|
||
|
|
event.preventDefault()
|
||
|
|
event.stopPropagation()
|
||
|
|
}
|
||
|
|
|
||
|
|
form.classList.add('was-validated')
|
||
|
|
}, false)
|
||
|
|
})
|
||
|
|
})()
|
||
|
|
</script>
|
||
|
|
{% endblock %}
|