fix: restaura layout da dashboard e corrige exibição das listas
This commit is contained in:
@@ -4,161 +4,504 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}{% endblock %} - Controles OCI</title>
|
||||
{{ bootstrap.load_css() }}
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
<link rel="icon" type="image/png" href="{{ url_for('static', filename='img/logo001-alpha.png') }}">
|
||||
|
||||
<!-- Bootstrap 5 CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css?v=1" rel="stylesheet">
|
||||
<!-- Font Awesome 6 -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css?v=1">
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--primary-color: #dc3545;
|
||||
--primary-light: #e35d6a;
|
||||
--secondary-color: #6c757d;
|
||||
--secondary-light: #868e96;
|
||||
--success-color: #198754;
|
||||
--danger-color: #dc3545;
|
||||
--warning-color: #ffc107;
|
||||
--info-color: #0dcaf0;
|
||||
--background-gradient: linear-gradient(135deg, var(--primary-color) 40%, white 100%);
|
||||
--navbar-stripe: 4px solid var(--primary-color);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background-color: #f8f9fa;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background: #343a40 !important;
|
||||
padding: 0.5rem;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
border-bottom: var(--navbar-stripe);
|
||||
}
|
||||
|
||||
.navbar > .container-fluid {
|
||||
width: 100%;
|
||||
max-width: 1140px;
|
||||
margin: 0 auto;
|
||||
padding: 0.5rem 1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.navbar > .container-fluid {
|
||||
max-width: 960px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.navbar > .container-fluid {
|
||||
max-width: 720px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.navbar > .container-fluid {
|
||||
max-width: 540px;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.navbar > .container-fluid {
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-weight: bold;
|
||||
color: var(--primary-color) !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 3rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.navbar-brand img {
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#navbarNav {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.navbar-nav.mx-auto {
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
|
||||
.navbar-nav:last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
color: var(--secondary-color) !important;
|
||||
transition: color 0.3s ease;
|
||||
padding: 0.5rem 1rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nav-link:hover {
|
||||
color: var(--primary-color) !important;
|
||||
}
|
||||
|
||||
.nav-link.active {
|
||||
color: var(--primary-color) !important;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
border: none;
|
||||
box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.dropdown-item {
|
||||
padding: 0.5rem 1.5rem;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.dropdown-item:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.dropdown-item i {
|
||||
margin-right: 0.5rem;
|
||||
width: 1.25rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1320px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.container {
|
||||
max-width: 960px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.container {
|
||||
max-width: 720px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
max-width: 540px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.container {
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cards da Dashboard */
|
||||
.card {
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
background-color: #f8f9fa;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.card-header .card-title {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.card-header h5 {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.card-header h5 i {
|
||||
margin-right: 0.75rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
background: none;
|
||||
border-top: 1px solid rgba(0,0,0,0.05);
|
||||
padding: 1rem 1.5rem;
|
||||
}
|
||||
|
||||
/* Estatísticas da Dashboard */
|
||||
.stats-card {
|
||||
position: relative;
|
||||
padding: 1.5rem;
|
||||
border-radius: 0.5rem;
|
||||
color: white;
|
||||
box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
overflow: hidden;
|
||||
min-height: 140px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.stats-card:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.stats-card.blue {
|
||||
background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
|
||||
}
|
||||
|
||||
.stats-card.green {
|
||||
background: linear-gradient(45deg, #1cc88a, #13855c);
|
||||
}
|
||||
|
||||
.stats-card.cyan {
|
||||
background: linear-gradient(45deg, #36b9cc, #258391);
|
||||
}
|
||||
|
||||
.stats-card.yellow {
|
||||
background: linear-gradient(45deg, #f6c23e, #dda20a);
|
||||
}
|
||||
|
||||
.stats-card .title {
|
||||
font-size: 0.9rem;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.stats-card .value {
|
||||
font-size: 2rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.stats-card .icon {
|
||||
position: absolute;
|
||||
right: 1rem;
|
||||
top: 1rem;
|
||||
font-size: 2rem;
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/* Tabelas */
|
||||
.table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.table th {
|
||||
border-top: none;
|
||||
background-color: #f8f9fa;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.8rem;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Botões */
|
||||
.btn {
|
||||
font-weight: 500;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 0.25rem;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: var(--primary-light);
|
||||
border-color: var(--primary-light);
|
||||
}
|
||||
|
||||
.btn-outline-primary {
|
||||
color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.btn-outline-primary:hover {
|
||||
background-color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
/* Alertas */
|
||||
.alert {
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.alert-success {
|
||||
background-color: #d4edda;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
.alert-danger {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.alert-warning {
|
||||
background-color: #fff3cd;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
background-color: #d1ecf1;
|
||||
color: #0c5460;
|
||||
}
|
||||
|
||||
/* Formulários */
|
||||
.form-control {
|
||||
border-radius: 0.25rem;
|
||||
border: 1px solid #ced4da;
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
.form-control:focus {
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-weight: 500;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
/* Modais */
|
||||
.modal-content {
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
padding: 1rem 1.5rem;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
border-top: 1px solid #e9ecef;
|
||||
padding: 1rem 1.5rem;
|
||||
}
|
||||
|
||||
/* Responsividade */
|
||||
@media (max-width: 768px) {
|
||||
.navbar-brand {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.navbar-brand img {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.stats-card {
|
||||
min-height: 120px;
|
||||
}
|
||||
|
||||
.stats-card .value {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.stats-card .icon {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{% block extra_css %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% if current_user is defined and current_user.is_authenticated %}
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||
<div class="container">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ url_for('home') }}">
|
||||
<img src="{{ url_for('static', filename='img/logo002-alpha.png') }}" alt="Logo OCI" class="navbar-logo">
|
||||
<span>Controles OCI</span>
|
||||
<img src="{{ url_for('static', filename='img/logo.png') }}" alt="Logo">
|
||||
Controles OCI
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav mx-auto">
|
||||
{% if current_user.has_permission('view_cell_data') %}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="militantesDropdown" role="button" data-bs-toggle="dropdown">
|
||||
<i class="fas fa-users me-1"></i>Militantes
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'home' %}active{% endif %}" href="{{ url_for('home') }}">
|
||||
<i class="fas fa-home"></i> Início
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_militantes') }}">Listar Militantes</a></li>
|
||||
<li><a class="dropdown-item" href="{{ url_for('novo_militante') }}">Novo Militante</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if current_user.has_permission('view_cell_reports') %}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="financeiroDropdown" role="button" data-bs-toggle="dropdown">
|
||||
<i class="fas fa-dollar-sign me-1"></i>Financeiro
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'listar_militantes' %}active{% endif %}" href="{{ url_for('listar_militantes') }}">
|
||||
<i class="fas fa-users"></i> Militantes
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_cotas') }}">Cotas</a></li>
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_pagamentos') }}">Pagamentos</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="materiaisDropdown" role="button" data-bs-toggle="dropdown">
|
||||
<i class="fas fa-book me-1"></i>Materiais
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'listar_materiais' %}active{% endif %}" href="{{ url_for('listar_materiais') }}">
|
||||
<i class="fas fa-box"></i> Materiais
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_materiais') }}">Listar Materiais</a></li>
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_vendas_jornal') }}">Vendas de Jornal</a></li>
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_assinaturas') }}">Assinaturas</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if current_user.has_permission('view_cell_reports') or current_user.has_permission('view_sector_reports') or current_user.has_permission('view_cr_reports') %}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="relatoriosDropdown" role="button" data-bs-toggle="dropdown">
|
||||
<i class="fas fa-chart-bar me-1"></i>Relatórios
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'listar_pagamentos' %}active{% endif %}" href="{{ url_for('listar_pagamentos') }}">
|
||||
<i class="fas fa-money-bill"></i> Pagamentos
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{% if current_user.has_permission('view_cell_reports') %}
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_relatorios_cotas') }}">Relatórios de Cotas</a></li>
|
||||
<li><a class="dropdown-item" href="{{ url_for('listar_relatorios_vendas') }}">Relatórios de Vendas</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
{% if current_user.is_admin %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('dashboard_admin') }}">
|
||||
<i class="fas fa-user-shield me-1"></i>Dashboard Admin
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('logout') }}">
|
||||
<i class="fas fa-sign-out-alt me-1"></i>Sair
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown">
|
||||
<i class="fas fa-user"></i> {{ current_user.username }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li>
|
||||
<a class="dropdown-item" href="{{ url_for('logout') }}">
|
||||
<i class="fas fa-sign-out-alt"></i> Sair
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<!-- Conteúdo -->
|
||||
<div class="container mt-4">
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
{% if not (category == 'success' and message == 'Login realizado com sucesso!') %}
|
||||
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
||||
{% if category == 'success' %}
|
||||
<i class="fas fa-check-circle"></i>
|
||||
{% elif category == 'danger' %}
|
||||
<i class="fas fa-exclamation-circle"></i>
|
||||
{% elif category == 'warning' %}
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
{% elif category == 'info' %}
|
||||
<i class="fas fa-info-circle"></i>
|
||||
{% endif %}
|
||||
<div class="alert alert-{{ category }} alert-dismissible fade show">
|
||||
{{ message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
{{ bootstrap.load_js() }}
|
||||
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/forms.js') }}"></script>
|
||||
{% block extra_js %}{% endblock %}
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
// Auto-dismiss para alertas após 5 segundos
|
||||
// Auto-dismiss alerts after 5 seconds
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const alerts = document.querySelectorAll('.alert');
|
||||
alerts.forEach(function(alert) {
|
||||
setTimeout(function() {
|
||||
if (alert) {
|
||||
bootstrap.Alert.getOrCreateInstance(alert).close();
|
||||
}
|
||||
}, 5000);
|
||||
});
|
||||
setTimeout(function() {
|
||||
var alerts = document.querySelectorAll('.alert');
|
||||
alerts.forEach(function(alert) {
|
||||
var bsAlert = new bootstrap.Alert(alert);
|
||||
bsAlert.close();
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
{% if current_user is defined and current_user.is_authenticated %}
|
||||
// Verificar a sessão a cada 5 minutos
|
||||
// Check session timeout
|
||||
function checkSession() {
|
||||
fetch('/check_session')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.expired) {
|
||||
if (data.status !== 'active') {
|
||||
window.location.href = '/login';
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Erro ao verificar sessão:', error));
|
||||
});
|
||||
}
|
||||
|
||||
// Verificar a cada 5 minutos
|
||||
setInterval(checkSession, 5 * 60 * 1000);
|
||||
|
||||
// Verificar também quando a página ganha foco
|
||||
document.addEventListener('visibilitychange', function() {
|
||||
if (document.visibilityState === 'visible') {
|
||||
checkSession();
|
||||
}
|
||||
});
|
||||
{% endif %}
|
||||
// Check session every minute
|
||||
setInterval(checkSession, 60000);
|
||||
</script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user