Adicionados os campos mínimos do Banco de Dados, precisa melhorar interface e controle de acesso que será posterior nessa branch mesmo

This commit is contained in:
LS
2025-04-03 10:30:48 -03:00
parent 449a203926
commit bf93e84cec
43 changed files with 3357 additions and 388 deletions

View File

@@ -1,33 +1,58 @@
{% extends 'base.html' %}
{% block title %}Listar Militantes{% endblock %}
{% block title %}Listar Materiais{% endblock %}
{% block content %}
<h1>Materiais Vendidos</h1>
<a href="{{ url_for('novo_material') }}">Adicionar Novo Material</a>
<table border="1">
<thead>
<tr>
<th>ID</th>
<th>Militante ID</th>
<th>Tipo Material</th>
<th>Descrição</th>
<th>Valor</th>
<th>Data da Venda</th>
</tr>
</thead>
<tbody>
{% for material in materiais %}
<tr>
<td>{{ material.id }}</td>
<td>{{ material.militante_id }}</td>
<td>{{ material.tipo_material_id }}</td>
<td>{{ material.descricao }}</td>
<td>R$ {{ material.valor }}</td>
<td>{{ material.data_venda }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ url_for('home') }}">Home</a>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="mb-4">Lista de Materiais</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 %}
<div class="d-flex justify-content-between mb-4">
<a href="{{ url_for('novo_material') }}" class="btn btn-success">Novo Material</a>
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
</div>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Nome</th>
<th>Descrição</th>
<th>Preço</th>
<th>Quantidade</th>
<th>Tipo</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
{% for material in materiais %}
<tr>
<td>{{ material.id }}</td>
<td>{{ material.nome }}</td>
<td>{{ material.descricao }}</td>
<td>R$ {{ "%.2f"|format(material.preco) }}</td>
<td>{{ material.quantidade }}</td>
<td>{{ material.tipo.nome }}</td>
<td>
<a href="{{ url_for('editar_material', id=material.id) }}" class="btn btn-primary btn-sm">Editar</a>
<a href="{{ url_for('deletar_material', id=material.id) }}" class="btn btn-danger btn-sm" onclick="return confirm('Tem certeza que deseja excluir este material?')">Excluir</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endblock %}