82
app.py
82
app.py
@@ -1,5 +1,4 @@
|
||||
from flask import Flask, request, render_template, redirect, url_for
|
||||
from functions.database import execute_query
|
||||
from flask import Flask, request, render_template, redirect, url_for, flash
|
||||
from functions.database import (
|
||||
Base,
|
||||
Militante,
|
||||
@@ -18,11 +17,16 @@ from functions.database import (
|
||||
from sqlalchemy import create_engine, and_
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from datetime import datetime
|
||||
from flask_bootstrap import Bootstrap5
|
||||
from routes.cota import cota_bp
|
||||
from functions.validations import validar_cpf
|
||||
|
||||
Session = sessionmaker(bind=engine)
|
||||
session = Session()
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = 'sua_chave_secreta_aqui'
|
||||
bootstrap = Bootstrap5(app)
|
||||
|
||||
|
||||
def session_run(model):
|
||||
@@ -38,17 +42,24 @@ def session_run(model):
|
||||
@app.route("/militantes/novo", methods=["GET", "POST"])
|
||||
def novo_militante():
|
||||
if request.method == "POST":
|
||||
cpf = request.form["cpf"]
|
||||
|
||||
if not validar_cpf(cpf):
|
||||
flash('CPF inválido. Por favor, verifique o número informado.', 'error')
|
||||
return render_template("novo_militante.html",
|
||||
dados_anteriores=request.form)
|
||||
|
||||
novo_militante = Militante(
|
||||
nome=request.form["nome"],
|
||||
cpf=request.form["cpf"],
|
||||
cpf=cpf,
|
||||
email=request.form["email"],
|
||||
telefone=request.form["telefone"],
|
||||
endereco=request.form["endereco"],
|
||||
filiado=request.form.get("filiado", False),
|
||||
filiado=bool(request.form.get("filiado", False))
|
||||
)
|
||||
|
||||
session_run(novo_militante)
|
||||
# execute_query(query, (nome, cpf, email, telefone, endereco, filiado))
|
||||
flash('Militante cadastrado com sucesso!', 'success')
|
||||
return redirect(url_for("listar_militantes"))
|
||||
|
||||
return render_template("novo_militante.html")
|
||||
@@ -145,7 +156,7 @@ def nova_venda_jornal():
|
||||
data_venda=datetime.strptime(request.form["data_venda"], "%Y-%m-%d"),
|
||||
)
|
||||
|
||||
session_run(VendaJornalAvulso)
|
||||
session_run(vendas_jornais_avulsos)
|
||||
return redirect(url_for("listar_vendas_jornal"))
|
||||
|
||||
return render_template("nova_venda_jornal.html")
|
||||
@@ -234,21 +245,16 @@ def listar_relatorios_vendas():
|
||||
|
||||
@app.route("/")
|
||||
def home():
|
||||
"""Página inicial do sistema"""
|
||||
links = []
|
||||
for rule in app.url_map.iter_rules():
|
||||
# Filter out rules we can't navigate to in a browser
|
||||
# and rules that require parameters
|
||||
if "GET" in rule.methods and has_no_empty_params(rule):
|
||||
url = url_for(rule.endpoint, **(rule.defaults or {}))
|
||||
links.append((url, rule.endpoint))
|
||||
l_html = ""
|
||||
for l in links:
|
||||
l_html += f'<a href="{l[0]}">{l[1].replace("_"," ")}</a><br>'
|
||||
home_html = f"""
|
||||
<p>Links</p>
|
||||
{l_html}
|
||||
"""
|
||||
return home_html
|
||||
# Substituindo 'home' por 'início' no menu
|
||||
endpoint_name = 'Início' if rule.endpoint == 'home' else rule.endpoint
|
||||
links.append((url, endpoint_name))
|
||||
|
||||
return render_template('home.html', links=links)
|
||||
|
||||
|
||||
def has_no_empty_params(rule):
|
||||
@@ -257,6 +263,48 @@ def has_no_empty_params(rule):
|
||||
return len(defaults) >= len(arguments)
|
||||
|
||||
|
||||
@app.route("/militantes/editar/<int:id>", methods=["GET", "POST"])
|
||||
def editar_militante(id):
|
||||
militante = session.query(Militante).get(id)
|
||||
if not militante:
|
||||
flash('Militante não encontrado.', 'error')
|
||||
return redirect(url_for('listar_militantes'))
|
||||
|
||||
if request.method == "POST":
|
||||
cpf = request.form["cpf"]
|
||||
if cpf != militante.cpf and not validar_cpf(cpf): # Só valida se o CPF foi alterado
|
||||
flash('CPF inválido. Por favor, verifique o número informado.', 'error')
|
||||
return render_template("editar_militante.html", militante=militante)
|
||||
|
||||
try:
|
||||
militante.nome = request.form["nome"]
|
||||
militante.cpf = cpf
|
||||
militante.email = request.form["email"]
|
||||
militante.telefone = request.form["telefone"]
|
||||
militante.endereco = request.form["endereco"]
|
||||
militante.filiado = bool(request.form.get("filiado", False))
|
||||
|
||||
session.commit()
|
||||
flash('Militante atualizado com sucesso!', 'success')
|
||||
return redirect(url_for('listar_militantes'))
|
||||
except Exception as e:
|
||||
session.rollback()
|
||||
flash('Erro ao atualizar militante. Verifique se o CPF ou email já não estão cadastrados.', 'error')
|
||||
return render_template("editar_militante.html", militante=militante)
|
||||
|
||||
return render_template("editar_militante.html", militante=militante)
|
||||
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
# ... existing code ...
|
||||
|
||||
app.register_blueprint(cota_bp)
|
||||
|
||||
# ... existing code ...
|
||||
return app
|
||||
|
||||
|
||||
# Iniciar o servidor Flask
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
|
||||
33
functions/cota_calculator.py
Normal file
33
functions/cota_calculator.py
Normal file
@@ -0,0 +1,33 @@
|
||||
def calculate_cota(salary, num_children=0, pays_school=False, pays_rent=False, num_parents=0):
|
||||
# Calculate discounts
|
||||
discount = 0
|
||||
discount += 0.5 * num_children
|
||||
discount += 1 if pays_school else 0
|
||||
discount += 1 if pays_rent else 0
|
||||
discount += 0.5 * num_parents
|
||||
|
||||
# Determine base percentage based on salary
|
||||
if salary < 1320.00:
|
||||
base_percentage = 3
|
||||
elif salary < 1980.00:
|
||||
base_percentage = 4
|
||||
elif salary < 2640.00:
|
||||
base_percentage = 5
|
||||
elif salary < 3300.00:
|
||||
base_percentage = 6
|
||||
elif salary < 3960.00:
|
||||
base_percentage = 7
|
||||
elif salary < 5280.00:
|
||||
base_percentage = 8
|
||||
elif salary < 6600.00:
|
||||
base_percentage = 9
|
||||
else:
|
||||
base_percentage = 10
|
||||
|
||||
# Calculate final percentage after applying discounts
|
||||
final_percentage = base_percentage - discount
|
||||
final_percentage = max(final_percentage, 0) # Ensure percentage is not negative
|
||||
|
||||
# Calculate cota
|
||||
cota = (final_percentage / 100) * salary
|
||||
return cota
|
||||
@@ -1,39 +1,31 @@
|
||||
import mysql.connector
|
||||
from mysql.connector import Error
|
||||
# from config.db_config import db_config
|
||||
from sqlalchemy import create_engine, Column, Integer, String, Boolean, Numeric, Date, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.orm import relationship, sessionmaker
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
engine = create_engine('sqlite:///database.db', echo=True)
|
||||
Base = declarative_base()
|
||||
SessionLocal = sessionmaker(bind=engine)
|
||||
|
||||
def get_db_connection(db_config):
|
||||
try:
|
||||
connection = mysql.connector.connect(**db_config)
|
||||
return connection
|
||||
except Error as e:
|
||||
print(f"Error connecting to database: {e}")
|
||||
return None
|
||||
def get_db_connection():
|
||||
"""
|
||||
Retorna uma nova sessão do banco de dados
|
||||
"""
|
||||
return SessionLocal()
|
||||
|
||||
def execute_query(query, params=None):
|
||||
connection = get_db_connection('')
|
||||
if connection is None:
|
||||
return None
|
||||
"""
|
||||
Executa uma query usando SQLAlchemy
|
||||
"""
|
||||
session = get_db_connection()
|
||||
try:
|
||||
cursor = connection.cursor(dictionary=True)
|
||||
cursor.execute(query, params)
|
||||
connection.commit()
|
||||
return cursor
|
||||
except Error as e:
|
||||
print(f"Error executing query: {e}")
|
||||
return None
|
||||
result = session.execute(query, params)
|
||||
session.commit()
|
||||
return result
|
||||
except Exception as e:
|
||||
session.rollback()
|
||||
raise e
|
||||
finally:
|
||||
if connection.is_connected():
|
||||
cursor.close()
|
||||
connection.close()
|
||||
session.close()
|
||||
|
||||
class Militante(Base):
|
||||
__tablename__ = 'militantes'
|
||||
|
||||
34
functions/validations.py
Normal file
34
functions/validations.py
Normal file
@@ -0,0 +1,34 @@
|
||||
def validar_cpf(cpf):
|
||||
"""
|
||||
Valida um CPF seguindo as regras do governo brasileiro.
|
||||
Retorna True se o CPF é válido, False caso contrário.
|
||||
"""
|
||||
# Remove caracteres não numéricos
|
||||
cpf = ''.join(filter(str.isdigit, cpf))
|
||||
|
||||
# Verifica se tem 11 dígitos
|
||||
if len(cpf) != 11:
|
||||
return False
|
||||
|
||||
# Verifica se todos os dígitos são iguais
|
||||
if len(set(cpf)) == 1:
|
||||
return False
|
||||
|
||||
# Calcula primeiro dígito verificador
|
||||
soma = 0
|
||||
for i in range(9):
|
||||
soma += int(cpf[i]) * (10 - i)
|
||||
resto = soma % 11
|
||||
digito1 = 0 if resto < 2 else 11 - resto
|
||||
|
||||
if int(cpf[9]) != digito1:
|
||||
return False
|
||||
|
||||
# Calcula segundo dígito verificador
|
||||
soma = 0
|
||||
for i in range(10):
|
||||
soma += int(cpf[i]) * (11 - i)
|
||||
resto = soma % 11
|
||||
digito2 = 0 if resto < 2 else 11 - resto
|
||||
|
||||
return int(cpf[10]) == digito2
|
||||
24
models/integracao.py
Normal file
24
models/integracao.py
Normal file
@@ -0,0 +1,24 @@
|
||||
def calcular_cota(salary, num_children, pays_school, pays_rent, num_parents):
|
||||
"""
|
||||
Calcula o valor da cota baseado nos parâmetros fornecidos
|
||||
"""
|
||||
# Base da cota é 1% do salário
|
||||
cota_base = salary * 0.01
|
||||
|
||||
# Adiciona 0.5% por filho
|
||||
cota_filhos = (salary * 0.005) * num_children
|
||||
|
||||
# Adiciona 0.3% por pai/mãe dependente
|
||||
cota_pais = (salary * 0.003) * num_parents
|
||||
|
||||
# Reduz 0.2% se paga escola
|
||||
reducao_escola = (salary * 0.002) if pays_school else 0
|
||||
|
||||
# Reduz 0.2% se paga aluguel
|
||||
reducao_aluguel = (salary * 0.002) if pays_rent else 0
|
||||
|
||||
# Calcula cota final
|
||||
cota_final = cota_base + cota_filhos + cota_pais - reducao_escola - reducao_aluguel
|
||||
|
||||
# Garante que a cota não seja menor que 0.5% do salário
|
||||
return max(cota_final, salary * 0.005)
|
||||
30
routes/cota.py
Normal file
30
routes/cota.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from flask import Blueprint, request, jsonify
|
||||
from models.integracao import calcular_cota
|
||||
|
||||
cota_bp = Blueprint('cota', __name__)
|
||||
|
||||
@cota_bp.route('/calculate_cota', methods=['POST'])
|
||||
def calculate_cota():
|
||||
try:
|
||||
data = request.get_json()
|
||||
|
||||
# Extrair dados do request
|
||||
salary = float(data.get('salary', 0))
|
||||
num_children = int(data.get('num_children', 0))
|
||||
pays_school = bool(data.get('pays_school', False))
|
||||
pays_rent = bool(data.get('pays_rent', False))
|
||||
num_parents = int(data.get('num_parents', 0))
|
||||
|
||||
# Calcular a cota (implemente sua lógica de cálculo aqui)
|
||||
cota = calcular_cota(
|
||||
salary=salary,
|
||||
num_children=num_children,
|
||||
pays_school=pays_school,
|
||||
pays_rent=pays_rent,
|
||||
num_parents=num_parents
|
||||
)
|
||||
|
||||
return jsonify({'cota': cota})
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({'error': str(e)}), 400
|
||||
41
templates/base.html
Normal file
41
templates/base.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-br">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}{% endblock %} - Sistema de Gestão</title>
|
||||
{{ bootstrap.load_css() }}
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{{ url_for('home') }}">Sistema de Gestão</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">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('listar_militantes') }}">Militantes</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('listar_cotas') }}">Cotas</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('listar_pagamentos') }}">Pagamentos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('listar_materiais') }}">Materiais</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-4">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
{{ bootstrap.load_js() }}
|
||||
</body>
|
||||
</html>
|
||||
34
templates/editar_militante.html
Normal file
34
templates/editar_militante.html
Normal 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 %}
|
||||
18
templates/home.html
Normal file
18
templates/home.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Início{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>Menu do Sistema</h2>
|
||||
<div class="list-group">
|
||||
{% for url, endpoint in links %}
|
||||
<a href="{{ url }}" class="list-group-item list-group-item-action">
|
||||
{{ endpoint|replace('_', ' ')|title }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Listar Assinaturas Anuais</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Início{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Assinaturas Anuais</h1>
|
||||
<a href="{{ url_for('nova_assinatura') }}">Adicionar Nova Assinatura</a>
|
||||
<table border="1">
|
||||
@@ -34,5 +32,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Listar Cotas Mensais</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Cotas Mensais</h1>
|
||||
<a href="{{ url_for('nova_cota') }}">Adicionar Nova Cota</a>
|
||||
<table border="1">
|
||||
@@ -30,5 +28,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Listar Materiais</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Materiais Vendidos</h1>
|
||||
<a href="{{ url_for('novo_material') }}">Adicionar Novo Material</a>
|
||||
<table border="1">
|
||||
@@ -32,5 +30,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,17 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Lista de Militantes</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Militantes</h1>
|
||||
<ul>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<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-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>CPF</th>
|
||||
<th>Email</th>
|
||||
<th>Telefone</th>
|
||||
<th>Endereço</th>
|
||||
<th>Filiado</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for militante in militantes %}
|
||||
<li>{{ militante.nome }} - {{ militante.email }}</li>
|
||||
<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>
|
||||
<td>{{ militante.telefone }}</td>
|
||||
<td>{{ militante.endereco }}</td>
|
||||
<td>{{ 'Sim' if militante.filiado else 'Não' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a href="{{ url_for('novo_militante') }}">Adicionar Novo Militante</a>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
</tbody>
|
||||
</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 %}
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Listar Pagamentos</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Pagamentos</h1>
|
||||
<a href="{{ url_for('novo_pagamento') }}">Adicionar Novo Pagamento</a>
|
||||
<table border="1">
|
||||
@@ -30,5 +28,5 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Listar Relatórios de Cotas</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Relatórios de Cotas Mensais</h1>
|
||||
<a href="{{ url_for('novo_relatorio_cotas') }}">Adicionar Novo Relatório</a>
|
||||
<table border="1">
|
||||
@@ -30,5 +28,5 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Listar Relatórios de Vendas</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Relatórios de Vendas de Materiais</h1>
|
||||
<a href="{{ url_for('novo_relatorio_vendas') }}">Adicionar Novo Relatório</a>
|
||||
<table border="1">
|
||||
@@ -30,5 +28,5 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Listar Vendas de Jornais</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Vendas de Jornais Avulsos</h1>
|
||||
<a href="{{ url_for('nova_venda_jornal') }}">Adicionar Nova Venda</a>
|
||||
<table border="1">
|
||||
@@ -30,5 +28,5 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Nova Assinatura Anual</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Registrar Nova Assinatura Anual</h1>
|
||||
<form method="post">
|
||||
<div>
|
||||
@@ -31,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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Nova Cota Mensal</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Registrar Nova Cota Mensal</h1>
|
||||
<form method="post">
|
||||
<div>
|
||||
@@ -23,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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Nova Venda de Jornal</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Registrar Nova Venda de Jornal</h1>
|
||||
<form method="post">
|
||||
<div>
|
||||
@@ -23,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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Novo Material</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Registrar Novo Material</h1>
|
||||
<form method="post">
|
||||
<div>
|
||||
@@ -27,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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,20 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Novo Militante</title>
|
||||
</head>
|
||||
<body>
|
||||
<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">
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Novo Militante{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<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>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1,31 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Novo Pagamento</title>
|
||||
</head>
|
||||
<body>
|
||||
<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>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Novo Pagamento{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<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>
|
||||
<label for="tipo_pagamento_id">Tipo de Pagamento:</label>
|
||||
<input type="number" id="tipo_pagamento_id" name="tipo_pagamento_id" required>
|
||||
|
||||
<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>
|
||||
<label for="valor">Valor:</label>
|
||||
<input type="number" id="valor" name="valor" step="0.01" required>
|
||||
|
||||
<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>
|
||||
<label for="data_pagamento">Data do Pagamento:</label>
|
||||
<input type="date" id="data_pagamento" name="data_pagamento" required>
|
||||
|
||||
<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>
|
||||
<button type="submit">Registrar Pagamento</button>
|
||||
</form>
|
||||
<a href="{{ url_for('listar_pagamentos') }}">Voltar para Lista</a>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Novo Relatório de Cotas</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Registrar Novo Relatório de Cotas</h1>
|
||||
<form method="post">
|
||||
<div>
|
||||
@@ -27,5 +25,6 @@
|
||||
</form>
|
||||
<a href="{{ url_for('listar_relatorios_cotas') }}">Voltar para Lista</a>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Novo Relatório de Vendas</title>
|
||||
</head>
|
||||
<body>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Registrar Novo Relatório de Vendas</h1>
|
||||
<form method="post">
|
||||
<div>
|
||||
@@ -27,5 +25,6 @@
|
||||
</form>
|
||||
<a href="{{ url_for('listar_relatorios_vendas') }}">Voltar para Lista</a>
|
||||
<a href="{{ url_for('home') }}">Home</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user