Files
controles/templates/novo_militante.html

107 lines
5.0 KiB
HTML

{% extends 'base.html' %}
{% block title %}Novo Militante{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2">
<h1 class="mb-4">Criar Novo Militante</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="mb-4">
<div class="mb-3">
<label for="nome" class="form-label">Nome:</label>
<input type="text" class="form-control" id="nome" name="nome" required
value="{{ dados_anteriores.nome if dados_anteriores else '' }}">
</div>
<div class="mb-3">
<label for="cpf" class="form-label">CPF:</label>
<input type="text" class="form-control" id="cpf" name="cpf" required
value="{{ dados_anteriores.cpf if dados_anteriores else '' }}"
pattern="\d{3}\.?\d{3}\.?\d{3}-?\d{2}"
title="Digite um CPF no formato: xxx.xxx.xxx-xx">
</div>
<div class="mb-3">
<label for="email" class="form-label">Email:</label>
<input type="email" class="form-control" id="email" name="email" required
value="{{ dados_anteriores.email if dados_anteriores else '' }}">
</div>
<div class="mb-3">
<label for="telefone" class="form-label">Telefone:</label>
<input type="text" class="form-control" id="telefone" name="telefone"
value="{{ dados_anteriores.telefone if dados_anteriores else '' }}">
</div>
<div class="mb-3">
<label for="endereco" class="form-label">Endereço:</label>
<input type="text" class="form-control" id="endereco" name="endereco"
value="{{ dados_anteriores.endereco if dados_anteriores else '' }}">
</div>
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="filiado" name="filiado"
{% if dados_anteriores and dados_anteriores.filiado %}checked{% endif %}>
<label class="form-check-label" for="filiado">Filiado</label>
</div>
<div class="mb-3">
<label class="form-label">Responsabilidades:</label>
<div class="row">
{% for valor, nome in responsabilidades %}
<div class="col-md-4">
<div class="form-check">
<input type="checkbox" class="form-check-input"
id="resp_{{ valor }}" name="responsabilidades"
value="{{ valor }}">
<label class="form-check-label" for="resp_{{ valor }}">
{{ nome }}
</label>
</div>
</div>
{% endfor %}
</div>
</div>
{% if celulas %}
<div class="mb-3">
<label for="celula" class="form-label">Célula:</label>
<select class="form-select" id="celula" name="celula_id" required>
<option value="">Selecione uma célula</option>
{% for cr in celulas_por_cr %}
<optgroup label="CR {{ cr.nome }}">
{% for setor in cr.setores %}
<optgroup label="&nbsp;&nbsp;Setor {{ setor.nome }}">
{% for celula in setor.celulas %}
<option value="{{ celula.id }}">{{ celula.nome }}</option>
{% endfor %}
</optgroup>
{% endfor %}
</optgroup>
{% endfor %}
</select>
</div>
{% endif %}
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Criar</button>
<a href="{{ url_for('listar_militantes') }}" class="btn btn-secondary">Voltar</a>
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
</div>
</form>
</div>
</div>
</div>
{% endblock %}