2025-04-02 14:14:37 -03:00
|
|
|
{% extends "base.html" %}
|
2025-02-19 14:27:14 -03:00
|
|
|
|
2025-04-03 10:30:48 -03:00
|
|
|
{% block title %}Home{% endblock %}
|
2025-02-19 14:27:14 -03:00
|
|
|
|
|
|
|
|
{% block content %}
|
2025-04-02 17:22:48 -03:00
|
|
|
<div class="row g-4">
|
2025-04-02 14:14:37 -03:00
|
|
|
<div class="col-12">
|
2025-04-02 21:20:48 -03:00
|
|
|
<div class="welcome-header">
|
|
|
|
|
<h2 class="mb-2">Olá, {{ nome_usuario }}!</h2>
|
|
|
|
|
<h4 class="text-muted">
|
|
|
|
|
{{ data_atual }}
|
|
|
|
|
</h4>
|
|
|
|
|
</div>
|
2025-04-02 14:14:37 -03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{% if current_user.has_permission('view_cell_data') %}
|
|
|
|
|
<!-- Card de Militantes -->
|
|
|
|
|
<div class="col-md-6 col-lg-3">
|
|
|
|
|
<div class="card bg-primary text-white">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
|
|
|
<div>
|
|
|
|
|
<h6 class="card-title mb-0">Total de Militantes</h6>
|
|
|
|
|
<h2 class="my-2">{{ total_militantes }}</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="fs-1">
|
|
|
|
|
<i class="fas fa-users"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="{{ url_for('listar_militantes') }}" class="text-white text-decoration-none">
|
|
|
|
|
Ver detalhes <i class="fas fa-arrow-right ms-1"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
{% if current_user.has_permission('view_cell_reports') %}
|
|
|
|
|
<!-- Card de Cotas -->
|
|
|
|
|
<div class="col-md-6 col-lg-3">
|
|
|
|
|
<div class="card bg-success text-white">
|
|
|
|
|
<div class="card-body">
|
2025-04-02 21:20:48 -03:00
|
|
|
<h6 class="card-title mb-2">Total de Cotas</h6>
|
|
|
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
|
|
|
<div class="valor-container">
|
|
|
|
|
<h2 class="valor-cota mb-0">R$ {{ total_cotas }}</h2>
|
2025-04-02 14:14:37 -03:00
|
|
|
</div>
|
2025-04-02 21:20:48 -03:00
|
|
|
<div class="icon-container">
|
2025-04-02 14:14:37 -03:00
|
|
|
<i class="fas fa-dollar-sign"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-04-02 21:20:48 -03:00
|
|
|
<a href="{{ url_for('listar_cotas') }}" class="text-white text-decoration-none mt-2 d-block">
|
2025-04-02 14:14:37 -03:00
|
|
|
Ver detalhes <i class="fas fa-arrow-right ms-1"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Card de Materiais -->
|
|
|
|
|
<div class="col-md-6 col-lg-3">
|
|
|
|
|
<div class="card bg-info text-white">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
|
|
|
<div>
|
|
|
|
|
<h6 class="card-title mb-0">Materiais Vendidos</h6>
|
|
|
|
|
<h2 class="my-2">{{ total_materiais }}</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="fs-1">
|
|
|
|
|
<i class="fas fa-book"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="{{ url_for('listar_materiais') }}" class="text-white text-decoration-none">
|
|
|
|
|
Ver detalhes <i class="fas fa-arrow-right ms-1"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Card de Assinaturas -->
|
|
|
|
|
<div class="col-md-6 col-lg-3">
|
|
|
|
|
<div class="card bg-warning text-white">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
|
|
|
<div>
|
|
|
|
|
<h6 class="card-title mb-0">Assinaturas Ativas</h6>
|
|
|
|
|
<h2 class="my-2">{{ total_assinaturas }}</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="fs-1">
|
|
|
|
|
<i class="fas fa-newspaper"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="{{ url_for('listar_assinaturas') }}" class="text-white text-decoration-none">
|
|
|
|
|
Ver detalhes <i class="fas fa-arrow-right ms-1"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="row mt-4">
|
|
|
|
|
{% if current_user.has_permission('view_cell_data') %}
|
|
|
|
|
<!-- Últimos Militantes -->
|
|
|
|
|
<div class="col-md-6 mb-4">
|
|
|
|
|
<div class="card h-100">
|
2025-04-02 21:20:48 -03:00
|
|
|
<div class="card-header">
|
2025-04-02 14:14:37 -03:00
|
|
|
<h5 class="card-title mb-0">
|
|
|
|
|
<i class="fas fa-user-plus me-2"></i>Últimos Militantes Cadastrados
|
|
|
|
|
</h5>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
{% if ultimos_militantes %}
|
|
|
|
|
<div class="list-group list-group-flush">
|
|
|
|
|
{% for militante in ultimos_militantes %}
|
2025-04-02 21:33:56 -03:00
|
|
|
<a href="#" class="list-group-item list-group-item-action" data-militante-id="{{ militante.id }}">
|
2025-04-02 14:14:37 -03:00
|
|
|
<div class="d-flex w-100 justify-content-between">
|
|
|
|
|
<h6 class="mb-1">{{ militante.nome }}</h6>
|
2025-04-02 21:20:48 -03:00
|
|
|
<small class="text-muted">#{{ militante.id }}</small>
|
2025-04-02 14:14:37 -03:00
|
|
|
</div>
|
|
|
|
|
<small class="text-muted">{{ militante.email }}</small>
|
|
|
|
|
</a>
|
2025-03-24 14:50:42 -03:00
|
|
|
{% endfor %}
|
2025-04-02 14:14:37 -03:00
|
|
|
</div>
|
|
|
|
|
{% else %}
|
|
|
|
|
<p class="text-muted mb-0">Nenhum militante cadastrado recentemente.</p>
|
2025-03-24 14:50:42 -03:00
|
|
|
{% endif %}
|
2025-04-02 14:14:37 -03:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
{% if current_user.has_permission('view_cell_reports') %}
|
|
|
|
|
<!-- Últimos Pagamentos -->
|
|
|
|
|
<div class="col-md-6 mb-4">
|
|
|
|
|
<div class="card h-100">
|
|
|
|
|
<div class="card-header bg-light">
|
|
|
|
|
<h5 class="card-title mb-0">
|
|
|
|
|
<i class="fas fa-money-bill-wave me-2"></i>Últimos Pagamentos
|
|
|
|
|
</h5>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
{% if ultimos_pagamentos %}
|
|
|
|
|
<div class="list-group list-group-flush">
|
|
|
|
|
{% for pagamento in ultimos_pagamentos %}
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<div class="d-flex w-100 justify-content-between">
|
|
|
|
|
<h6 class="mb-1">{{ pagamento.militante.nome }}</h6>
|
|
|
|
|
<span class="badge bg-success">R$ {{ "%.2f"|format(pagamento.valor) }}</span>
|
2025-04-03 10:30:48 -03:00
|
|
|
</div>
|
2025-04-02 14:14:37 -03:00
|
|
|
<small class="text-muted">{{ pagamento.data_pagamento.strftime('%d/%m/%Y') }}</small>
|
2025-04-03 10:30:48 -03:00
|
|
|
</div>
|
2025-04-02 14:14:37 -03:00
|
|
|
{% endfor %}
|
2025-04-03 10:30:48 -03:00
|
|
|
</div>
|
2025-04-02 14:14:37 -03:00
|
|
|
{% else %}
|
|
|
|
|
<p class="text-muted mb-0">Nenhum pagamento registrado recentemente.</p>
|
|
|
|
|
{% endif %}
|
2025-03-24 14:50:42 -03:00
|
|
|
</div>
|
2025-02-19 14:27:14 -03:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-04-02 14:14:37 -03:00
|
|
|
{% endif %}
|
2025-02-19 14:27:14 -03:00
|
|
|
</div>
|
2025-04-02 21:20:48 -03:00
|
|
|
|
2025-04-02 21:33:56 -03:00
|
|
|
<!-- Modal de Detalhes do Militante -->
|
|
|
|
|
<div class="modal fade" id="militanteModal" tabindex="-1" aria-labelledby="militanteModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h5 class="modal-title" id="militanteModalLabel">Detalhes do Militante</h5>
|
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Fechar"></button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="fw-bold">Nome:</label>
|
|
|
|
|
<p id="militanteNome" class="mb-2"></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="fw-bold">CPF:</label>
|
|
|
|
|
<p id="militanteCPF" class="mb-2"></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="fw-bold">Email:</label>
|
|
|
|
|
<p id="militanteEmail" class="mb-2"></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="fw-bold">Telefone:</label>
|
|
|
|
|
<p id="militanteTelefone" class="mb-2"></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="fw-bold">Endereço:</label>
|
|
|
|
|
<p id="militanteEndereco" class="mb-2"></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="fw-bold">Status:</label>
|
|
|
|
|
<p id="militanteFiliado" class="mb-2"></p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<a href="#" id="btnEditarMilitante" class="btn btn-primary" style="background-color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; color: white !important;">
|
|
|
|
|
<i class="fas fa-edit me-1"></i>Editar
|
|
|
|
|
</a>
|
|
|
|
|
<button type="button" id="btnExcluirMilitante" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#confirmDeleteModal">
|
|
|
|
|
<i class="fas fa-trash me-1"></i>Excluir
|
|
|
|
|
</button>
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fechar</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Modal de Confirmação de Exclusão -->
|
|
|
|
|
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h5 class="modal-title">Confirmar Exclusão</h5>
|
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Fechar"></button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<p>Tem certeza que deseja excluir o militante <strong id="militanteExcluirNome"></strong>?</p>
|
|
|
|
|
<p class="text-danger mb-0">Esta ação não pode ser desfeita.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<form id="formExcluirMilitante" method="POST">
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
|
|
|
|
<button type="submit" class="btn btn-danger">
|
|
|
|
|
<i class="fas fa-trash me-1"></i>Excluir
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-04-02 21:20:48 -03:00
|
|
|
<style>
|
|
|
|
|
.welcome-header {
|
|
|
|
|
background: linear-gradient(to right, var(--background-color), rgba(232, 0, 12, 0.05));
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
padding: 1.5rem;
|
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.welcome-header h2 {
|
|
|
|
|
font-size: 2rem;
|
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
color: var(--primary-color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.welcome-header h4 {
|
|
|
|
|
font-size: 1.2rem;
|
|
|
|
|
color: var(--secondary-color);
|
|
|
|
|
opacity: 0.8;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.valor-container {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0; /* Permite que o texto quebre corretamente */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.valor-cota {
|
|
|
|
|
font-size: calc(1.2rem + 0.8vw);
|
|
|
|
|
line-height: 1.2;
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
margin-right: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-container {
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
opacity: 0.8;
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
}
|
2025-04-02 21:33:56 -03:00
|
|
|
|
|
|
|
|
/* Estilo para o backdrop do modal com blur */
|
|
|
|
|
.modal-backdrop.show {
|
|
|
|
|
backdrop-filter: blur(5px);
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Estilo para o modal */
|
|
|
|
|
.modal-content {
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-header {
|
|
|
|
|
background: linear-gradient(to right, var(--secondary-dark), var(--secondary-color));
|
|
|
|
|
color: white;
|
|
|
|
|
border-radius: 12px 12px 0 0;
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
padding: 1rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-body {
|
|
|
|
|
padding: 1.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-footer {
|
|
|
|
|
border-top: 1px solid #eee;
|
|
|
|
|
padding: 1rem;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Ajustes para mobile */
|
|
|
|
|
@media (max-width: 576px) {
|
|
|
|
|
.modal-footer {
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-footer .btn {
|
|
|
|
|
min-width: 120px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-body label {
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-body label {
|
|
|
|
|
color: var(--secondary-color);
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-body p {
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
color: var(--text-color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Garantir que o modal de confirmação mantenha o backdrop quando aberto */
|
|
|
|
|
#confirmDeleteModal {
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#confirmDeleteModal.show {
|
|
|
|
|
backdrop-filter: blur(5px);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Ajuste para garantir que o botão de editar fique azul */
|
|
|
|
|
.btn-primary,
|
|
|
|
|
.btn-primary:hover,
|
|
|
|
|
.btn-primary:focus,
|
|
|
|
|
.btn-primary:active {
|
|
|
|
|
background-color: var(--bs-primary) !important;
|
|
|
|
|
border-color: var(--bs-primary) !important;
|
|
|
|
|
color: white !important;
|
|
|
|
|
}
|
2025-04-02 21:20:48 -03:00
|
|
|
</style>
|
2025-04-02 21:33:56 -03:00
|
|
|
|
|
|
|
|
{% block extra_js %}
|
|
|
|
|
<script>
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
// Dados dos militantes para o modal
|
|
|
|
|
const militantes = {{ ultimos_militantes|tojson|safe }};
|
|
|
|
|
|
|
|
|
|
// Referência ao modal principal
|
|
|
|
|
const militanteModal = document.getElementById('militanteModal');
|
|
|
|
|
|
|
|
|
|
// Garantir que o backdrop seja removido ao fechar o modal
|
|
|
|
|
militanteModal.addEventListener('hidden.bs.modal', function () {
|
|
|
|
|
const backdrop = document.querySelector('.modal-backdrop');
|
|
|
|
|
if (backdrop) {
|
|
|
|
|
backdrop.remove();
|
|
|
|
|
}
|
|
|
|
|
document.body.classList.remove('modal-open');
|
|
|
|
|
document.body.style.overflow = '';
|
|
|
|
|
document.body.style.paddingRight = '';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Função para abrir o modal com os dados do militante
|
|
|
|
|
function showMilitanteModal(militanteId) {
|
|
|
|
|
const militante = militantes.find(m => m.id === militanteId);
|
|
|
|
|
if (!militante) return;
|
|
|
|
|
|
|
|
|
|
// Preencher os dados no modal
|
|
|
|
|
document.getElementById('militanteNome').textContent = militante.nome;
|
|
|
|
|
document.getElementById('militanteCPF').textContent = militante.cpf;
|
|
|
|
|
document.getElementById('militanteEmail').textContent = militante.email;
|
|
|
|
|
document.getElementById('militanteTelefone').textContent = militante.telefone;
|
|
|
|
|
document.getElementById('militanteEndereco').textContent = militante.endereco;
|
|
|
|
|
document.getElementById('militanteFiliado').textContent = militante.filiado ? 'Filiado' : 'Não Filiado';
|
|
|
|
|
|
|
|
|
|
// Configurar botões
|
|
|
|
|
document.getElementById('btnEditarMilitante').href = `/militantes/editar/${militante.id}`;
|
|
|
|
|
document.getElementById('formExcluirMilitante').action = `/militantes/excluir/${militante.id}`;
|
|
|
|
|
document.getElementById('militanteExcluirNome').textContent = militante.nome;
|
|
|
|
|
|
|
|
|
|
// Abrir o modal
|
|
|
|
|
const modal = new bootstrap.Modal(document.getElementById('militanteModal'));
|
|
|
|
|
modal.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Adicionar evento de clique nos itens da lista
|
|
|
|
|
document.querySelectorAll('[data-militante-id]').forEach(item => {
|
|
|
|
|
item.addEventListener('click', function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
const militanteId = parseInt(this.getAttribute('data-militante-id'));
|
|
|
|
|
showMilitanteModal(militanteId);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|
2025-02-19 14:27:14 -03:00
|
|
|
{% endblock %}
|