2025-02-19 14:27:14 -03:00
<!DOCTYPE html>
2025-04-03 10:30:48 -03:00
< html lang = "pt-BR" >
2025-02-19 14:27:14 -03:00
< head >
< meta charset = "UTF-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2025-04-02 14:34:05 -03:00
< title > {% block title %}{% endblock %} - Controles OCI< / title >
2025-04-02 14:14:37 -03:00
{{ 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" >
2025-04-02 14:25:47 -03:00
< link rel = "stylesheet" href = "https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" >
2025-04-02 14:14:37 -03:00
< link rel = "stylesheet" href = "{{ url_for('static', filename='css/style.css') }}" >
2025-04-02 14:25:47 -03:00
< link rel = "icon" type = "image/png" href = "{{ url_for('static', filename='img/logo002-alpha.png') }}" >
2025-04-02 14:14:37 -03:00
{% block extra_css %}{% endblock %}
2025-02-19 14:27:14 -03:00
< / head >
< body >
2025-04-02 14:14:37 -03:00
{% if current_user is defined and current_user.is_authenticated %}
< nav class = "navbar navbar-expand-lg navbar-dark" >
2025-02-19 14:27:14 -03:00
< div class = "container" >
2025-04-02 14:55:01 -03:00
< a class = "navbar-brand" href = "{{ url_for('home') }}" >
2025-04-02 14:34:05 -03:00
< img src = "{{ url_for('static', filename='img/logo002-alpha.png') }}" alt = "Logo OCI" class = "navbar-logo" >
2025-04-02 14:55:01 -03:00
< span > Controles OCI< / span >
2025-04-02 14:14:37 -03:00
< / a >
2025-02-19 14:27:14 -03:00
< 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" >
2025-04-02 17:22:48 -03:00
< ul class = "navbar-nav mx-auto" >
2025-04-02 14:14:37 -03:00
{% 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
< / 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
< / 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
< / 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
< / 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 >
2025-04-03 15:58:07 -03:00
{% endif %}
2025-02-19 14:27:14 -03:00
< / ul >
2025-03-24 16:34:38 -03:00
< ul class = "navbar-nav" >
2025-04-02 14:14:37 -03:00
{% if current_user.is_admin %}
2025-03-24 16:34:38 -03:00
< li class = "nav-item" >
2025-04-02 14:14:37 -03:00
< a class = "nav-link" href = "{{ url_for('dashboard_admin') }}" >
< i class = "fas fa-user-shield me-1" > < / i > Dashboard Admin
< / a >
2025-03-24 16:34:38 -03:00
< / li >
2025-04-02 14:14:37 -03:00
{% endif %}
2025-04-03 15:58:07 -03:00
< li class = "nav-item" >
2025-04-02 14:14:37 -03:00
< a class = "nav-link" href = "{{ url_for('logout') }}" >
< i class = "fas fa-sign-out-alt me-1" > < / i > Sair
< / a >
2025-04-03 15:58:07 -03:00
< / li >
2025-03-24 16:34:38 -03:00
< / ul >
2025-02-19 14:27:14 -03:00
< / div >
< / div >
< / nav >
2025-04-02 14:14:37 -03:00
{% endif %}
2025-04-03 10:30:48 -03:00
2025-02-19 14:27:14 -03:00
< div class = "container mt-4" >
2025-04-02 14:14:37 -03:00
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
2025-04-02 15:25:00 -03:00
{% if not (category == 'success' and message == 'Login realizado com sucesso!') %}
2025-04-02 14:14:37 -03:00
< div class = "alert alert-{{ category }} alert-dismissible fade show" role = "alert" >
2025-04-02 15:02:20 -03:00
{% 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 %}
2025-04-02 14:14:37 -03:00
{{ message }}
< button type = "button" class = "btn-close" data-bs-dismiss = "alert" aria-label = "Close" > < / button >
< / div >
2025-04-02 15:25:00 -03:00
{% endif %}
2025-04-02 14:14:37 -03:00
{% endfor %}
{% endif %}
{% endwith %}
2025-02-19 14:27:14 -03:00
{% block content %}{% endblock %}
< / div >
2025-04-02 14:14:37 -03:00
{{ 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 %}
2025-04-03 15:58:07 -03:00
< script >
2025-04-02 15:25:00 -03:00
// Auto-dismiss para alertas após 5 segundos
document.addEventListener('DOMContentLoaded', function() {
const alerts = document.querySelectorAll('.alert');
alerts.forEach(function(alert) {
setTimeout(function() {
if (alert) {
bootstrap.Alert.getOrCreateInstance(alert).close();
}
}, 5000);
});
});
{% if current_user is defined and current_user.is_authenticated %}
// Verificar a sessão a cada 5 minutos
2025-04-03 15:58:07 -03:00
function checkSession() {
fetch('/check_session')
.then(response => response.json())
.then(data => {
if (data.expired) {
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();
}
});
2025-04-02 15:25:00 -03:00
{% endif %}
2025-04-03 15:58:07 -03:00
< / script >
2025-02-19 14:27:14 -03:00
< / body >
2025-02-20 10:39:31 -03:00
< / html >