Melhorada interface dos formulários. Adicionado a opção de editar os Militantes direto da Lista

This commit is contained in:
LS
2025-02-20 10:39:31 -03:00
parent 765688df1f
commit 37d45e250f
14 changed files with 341 additions and 84 deletions

View File

@@ -38,4 +38,4 @@
{{ bootstrap.load_js() }}
</body>
</html>
</html>

View File

@@ -0,0 +1,34 @@
{% extends 'base.html' %}
{% block title %}Editar Militante{% endblock %}
{% block content %}
<h1>Editar 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">
Nome: <input type="text" name="nome" required
value="{{ militante.nome }}"><br>
CPF: <input type="text" name="cpf" required
value="{{ militante.cpf }}"
pattern="\d{3}\.?\d{3}\.?\d{3}-?\d{2}"
title="Digite um CPF no formato: xxx.xxx.xxx-xx"><br>
Email: <input type="email" name="email" required
value="{{ militante.email }}"><br>
Telefone: <input type="text" name="telefone"
value="{{ militante.telefone }}"><br>
Endereço: <input type="text" name="endereco"
value="{{ militante.endereco }}"><br>
Filiado: <input type="checkbox" name="filiado"
{% if militante.filiado %}checked{% endif %}><br>
<input type="submit" value="Salvar" class="btn btn-primary">
<a href="{{ url_for('listar_militantes') }}" class="btn btn-secondary">Cancelar</a>
</form>
{% endblock %}

View File

@@ -8,7 +8,7 @@
<h2>Lista de Militantes</h2>
<a href="{{ url_for('novo_militante') }}" class="btn btn-primary mb-3">Novo Militante</a>
<table class="table table-striped">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Nome</th>
@@ -21,7 +21,7 @@
</thead>
<tbody>
{% for militante in militantes %}
<tr>
<tr class="clickable-row" data-href="{{ url_for('editar_militante', id=militante.id) }}">
<td>{{ militante.nome }}</td>
<td>{{ militante.cpf }}</td>
<td>{{ militante.email }}</td>
@@ -34,4 +34,24 @@
</table>
</div>
</div>
<style>
.clickable-row {
cursor: pointer;
}
.clickable-row:hover {
background-color: #f5f5f5;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
const rows = document.querySelectorAll('.clickable-row');
rows.forEach(row => {
row.addEventListener('click', function() {
window.location.href = this.dataset.href;
});
});
});
</script>
{% endblock %}

View File

@@ -29,9 +29,11 @@
<label for="data_fim">Data de Fim:</label>
<input type="date" id="data_fim" name="data_fim" required>
</div>
<button type="submit">Registrar Assinatura</button>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Registrar</button>
<a href="{{ url_for('listar_assinaturas') }}" class="btn btn-secondary">Voltar</a>
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
</div>
</form>
<a href="{{ url_for('listar_assinaturas') }}">Voltar para Lista</a>
<a href="{{ url_for('home') }}">Home</a>
{% endblock %}

View File

@@ -21,9 +21,11 @@
<label for="data_alteracao">Data de Alteração:</label>
<input type="date" id="data_alteracao" name="data_alteracao" required>
</div>
<button type="submit">Registrar Cota</button>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Registrar</button>
<a href="{{ url_for('listar_cotas') }}" class="btn btn-secondary">Voltar</a>
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
</div>
</form>
<a href="{{ url_for('listar_cotas') }}">Voltar para Lista</a>
<a href="{{ url_for('home') }}">Home</a>
{% endblock %}

View File

@@ -21,9 +21,11 @@
<label for="data_venda">Data da Venda:</label>
<input type="date" id="data_venda" name="data_venda" required>
</div>
<button type="submit">Registrar Venda</button>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Registrar</button>
<a href="{{ url_for('listar_vendas_jornal') }}" class="btn btn-secondary">Voltar</a>
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
</div>
</form>
<a href="{{ url_for('listar_vendas_jornal') }}">Voltar para Lista</a>
<a href="{{ url_for('home') }}">Home</a>
{% endblock %}

View File

@@ -25,9 +25,11 @@
<label for="data_venda">Data da Venda:</label>
<input type="date" id="data_venda" name="data_venda" required>
</div>
<button type="submit">Registrar Material</button>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Registrar</button>
<a href="{{ url_for('listar_materiais') }}" class="btn btn-secondary">Voltar</a>
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
</div>
</form>
<a href="{{ url_for('listar_materiais') }}">Voltar para Lista</a>
<a href="{{ url_for('home') }}">Home</a>
{% endblock %}

View File

@@ -1,19 +1,68 @@
{% extends 'base.html' %}
{% block title %}Listar Militantes{% endblock %}
{% block title %}Novo Militante{% endblock %}
{% block content %}
<h1>Criar Novo Militante</h1>
<form method="post">
Nome: <input type="text" name="nome" required><br>
CPF: <input type="text" name="cpf" required><br>
Email: <input type="email" name="email" required><br>
Telefone: <input type="text" name="telefone"><br>
Endereço: <input type="text" name="endereco"><br>
Filiado: <input type="checkbox" name="filiado"><br>
<input type="submit" value="Criar">
</form>
<a href="{{ url_for('home') }}">Home</a>
<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="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 %}

View File

@@ -1,29 +1,41 @@
{% extends 'base.html' %}
{% block title %}Listar Militantes{% endblock %}
{% block title %}Novo Pagamento{% endblock %}
{% block content %}
<h1>Registrar Novo Pagamento</h1>
<form method="post">
<div>
<label for="militante_id">ID do Militante:</label>
<input type="number" id="militante_id" name="militante_id" required>
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2">
<h1 class="mb-4">Registrar Novo Pagamento</h1>
<form method="post" class="mb-4">
<div class="mb-3">
<label for="militante_id" class="form-label">ID do Militante:</label>
<input type="number" class="form-control" id="militante_id" name="militante_id" required>
</div>
<div class="mb-3">
<label for="tipo_pagamento_id" class="form-label">Tipo de Pagamento:</label>
<input type="number" class="form-control" id="tipo_pagamento_id" name="tipo_pagamento_id" required>
</div>
<div class="mb-3">
<label for="valor" class="form-label">Valor:</label>
<input type="number" class="form-control" id="valor" name="valor" step="0.01" required>
</div>
<div class="mb-3">
<label for="data_pagamento" class="form-label">Data do Pagamento:</label>
<input type="date" class="form-control" id="data_pagamento" name="data_pagamento" required>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Registrar</button>
<a href="{{ url_for('listar_pagamentos') }}" class="btn btn-secondary">Voltar</a>
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
</div>
</form>
</div>
<div>
<label for="tipo_pagamento_id">Tipo de Pagamento:</label>
<input type="number" id="tipo_pagamento_id" name="tipo_pagamento_id" required>
</div>
<div>
<label for="valor">Valor:</label>
<input type="number" id="valor" name="valor" step="0.01" required>
</div>
<div>
<label for="data_pagamento">Data do Pagamento:</label>
<input type="date" id="data_pagamento" name="data_pagamento" required>
</div>
<button type="submit">Registrar Pagamento</button>
</form>
<a href="{{ url_for('listar_pagamentos') }}">Voltar para Lista</a>
<a href="{{ url_for('home') }}">Home</a>
</div>
</div>
{% endblock %}