220 lines
12 KiB
HTML
220 lines
12 KiB
HTML
|
|
{% extends "base.html" %}
|
||
|
|
|
||
|
|
{% block title %}Comprovantes{% endblock %}
|
||
|
|
|
||
|
|
{% block content %}
|
||
|
|
<div class="container-fluid mt-3">
|
||
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||
|
|
<h2><i class="fas fa-money-bill-wave"></i> Comprovantes</h2>
|
||
|
|
<div>
|
||
|
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalNovoComprovante">
|
||
|
|
<i class="fas fa-plus"></i> Novo Comprovante
|
||
|
|
</button>
|
||
|
|
<button type="button" class="btn btn-outline-primary" id="btnExportar">
|
||
|
|
<i class="fas fa-file-export"></i> Exportar
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="card">
|
||
|
|
<div class="card-body">
|
||
|
|
<div class="table-responsive">
|
||
|
|
<table class="table table-striped table-hover" id="tabelaComprovantes">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>Militante</th>
|
||
|
|
<th>Tipo de Comprovante</th>
|
||
|
|
<th>Valor</th>
|
||
|
|
<th>Data do Comprovante</th>
|
||
|
|
<th>Ações</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
{% for comprovante in comprovantes %}
|
||
|
|
<tr>
|
||
|
|
<td data-militante="{{ comprovante.militante_id }}">{{ comprovante.militante.nome if comprovante.militante else 'N/A' }}</td>
|
||
|
|
<td data-tipo="{{ comprovante.tipo_comprovante }}">
|
||
|
|
{% if comprovante.tipo_comprovante == 1 %}
|
||
|
|
Cota
|
||
|
|
{% elif comprovante.tipo_comprovante == 2 %}
|
||
|
|
Contribuição Extra
|
||
|
|
{% elif comprovante.tipo_comprovante == 3 %}
|
||
|
|
Doação
|
||
|
|
{% elif comprovante.tipo_comprovante == 4 %}
|
||
|
|
Taxa de Evento
|
||
|
|
{% elif comprovante.tipo_comprovante == 5 %}
|
||
|
|
Jornal Avulso
|
||
|
|
{% elif comprovante.tipo_comprovante == 6 %}
|
||
|
|
Assinatura de Jornal
|
||
|
|
{% elif comprovante.tipo_comprovante == 7 %}
|
||
|
|
Campanha Financeira
|
||
|
|
{% elif comprovante.tipo_comprovante == 8 %}
|
||
|
|
Outros
|
||
|
|
{% else %}
|
||
|
|
Não Definido
|
||
|
|
{% endif %}
|
||
|
|
</td>
|
||
|
|
<td data-valor="{{ comprovante.valor }}">R$ {{ "%.2f"|format(comprovante.valor) }}</td>
|
||
|
|
<td data-data="{{ comprovante.data_comprovante }}">{{ comprovante.data_comprovante.strftime('%d/%m/%Y') }}</td>
|
||
|
|
<td>
|
||
|
|
<button type="button"
|
||
|
|
class="btn btn-sm btn-outline-primary"
|
||
|
|
data-bs-toggle="modal"
|
||
|
|
data-bs-target="#modalEditarComprovante"
|
||
|
|
data-comprovante-id="{{ comprovante.id }}"
|
||
|
|
data-militante-id="{{ comprovante.militante_id }}"
|
||
|
|
data-tipo-comprovante="{{ comprovante.tipo_comprovante }}"
|
||
|
|
data-valor="{{ comprovante.valor }}"
|
||
|
|
data-data-comprovante="{{ comprovante.data_comprovante.strftime('%Y-%m-%d') }}"
|
||
|
|
title="Editar">
|
||
|
|
<i class="fas fa-edit"></i>
|
||
|
|
</button>
|
||
|
|
<button type="button"
|
||
|
|
class="btn btn-sm btn-outline-danger"
|
||
|
|
data-bs-toggle="modal"
|
||
|
|
data-bs-target="#modalExcluirComprovante"
|
||
|
|
data-comprovante-id="{{ comprovante.id }}"
|
||
|
|
data-comprovante-info="Comprovante de {{ comprovante.militante.nome if comprovante.militante else 'N/A' }} - R$ {{ "%.2f"|format(comprovante.valor) }}"
|
||
|
|
title="Excluir">
|
||
|
|
<i class="fas fa-trash"></i>
|
||
|
|
</button>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% endfor %}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Modal Novo Comprovante -->
|
||
|
|
<div class="modal fade" id="modalNovoComprovante" tabindex="-1">
|
||
|
|
<div class="modal-dialog">
|
||
|
|
<div class="modal-content">
|
||
|
|
<div class="modal-header">
|
||
|
|
<h5 class="modal-title"><i class="fas fa-plus"></i> Novo Comprovante</h5>
|
||
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||
|
|
</div>
|
||
|
|
<div class="modal-body">
|
||
|
|
<form id="formNovoComprovante" method="post" action="{{ url_for('adicionar_comprovante') }}">
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="militante" class="form-label">Militante:</label>
|
||
|
|
<select class="form-select" id="militante" name="militante_id" required>
|
||
|
|
<option value="">Selecione um militante</option>
|
||
|
|
{% for militante in militantes %}
|
||
|
|
<option value="{{ militante.id }}">{{ militante.nome }}</option>
|
||
|
|
{% endfor %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="tipoComprovante" class="form-label">Tipo de Comprovante:</label>
|
||
|
|
<select class="form-select" id="tipoComprovante" name="tipo_comprovante" required>
|
||
|
|
<option value="">Selecione o tipo</option>
|
||
|
|
<option value="1">Cota</option>
|
||
|
|
{% if current_user.has_permission('gerenciar_tipos_comprovante') %}
|
||
|
|
<option value="2">Contribuição Extra</option>
|
||
|
|
<option value="3">Doação</option>
|
||
|
|
<option value="4">Taxa de Evento</option>
|
||
|
|
<option value="5">Jornal Avulso</option>
|
||
|
|
<option value="6">Assinatura de Jornal</option>
|
||
|
|
<option value="7">Campanha Financeira</option>
|
||
|
|
<option value="8">Outros</option>
|
||
|
|
{% endif %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="valor" class="form-label">Valor:</label>
|
||
|
|
<input type="number" step="0.01" class="form-control" id="valor" name="valor" required>
|
||
|
|
</div>
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="dataComprovante" class="form-label">Data do Comprovante:</label>
|
||
|
|
<input type="date" class="form-control" id="dataComprovante" name="data_comprovante" required>
|
||
|
|
</div>
|
||
|
|
<div class="modal-footer">
|
||
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
||
|
|
<button type="submit" class="btn btn-primary">Salvar</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Modal Editar Comprovante -->
|
||
|
|
<div class="modal fade" id="modalEditarComprovante" tabindex="-1">
|
||
|
|
<div class="modal-dialog">
|
||
|
|
<div class="modal-content">
|
||
|
|
<div class="modal-header">
|
||
|
|
<h5 class="modal-title"><i class="fas fa-edit"></i> Editar Comprovante</h5>
|
||
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||
|
|
</div>
|
||
|
|
<div class="modal-body">
|
||
|
|
<form id="formEditarComprovante" method="post">
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="editMilitante" class="form-label">Militante:</label>
|
||
|
|
<input type="text" class="form-control bg-light" id="editMilitanteNome" readonly>
|
||
|
|
<input type="hidden" id="editMilitante" name="militante_id">
|
||
|
|
</div>
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="editTipoComprovante" class="form-label">Tipo de Comprovante:</label>
|
||
|
|
<select class="form-select" id="editTipoComprovante" name="tipo_comprovante" required>
|
||
|
|
<option value="">Selecione o tipo</option>
|
||
|
|
<option value="1">Cota</option>
|
||
|
|
{% if current_user.has_permission('gerenciar_tipos_comprovante') %}
|
||
|
|
<option value="2">Contribuição Extra</option>
|
||
|
|
<option value="3">Doação</option>
|
||
|
|
<option value="4">Taxa de Evento</option>
|
||
|
|
<option value="5">Jornal Avulso</option>
|
||
|
|
<option value="6">Assinatura de Jornal</option>
|
||
|
|
<option value="7">Campanha Financeira</option>
|
||
|
|
<option value="8">Outros</option>
|
||
|
|
{% endif %}
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="editValor" class="form-label">Valor:</label>
|
||
|
|
<input type="number" step="0.01" class="form-control" id="editValor" name="valor" required>
|
||
|
|
</div>
|
||
|
|
<div class="mb-3">
|
||
|
|
<label for="editDataComprovante" class="form-label">Data do Comprovante:</label>
|
||
|
|
<input type="date" class="form-control" id="editDataComprovante" name="data_comprovante" required>
|
||
|
|
</div>
|
||
|
|
<div class="modal-footer">
|
||
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
||
|
|
<button type="submit" class="btn btn-primary">Salvar</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Modal Excluir Comprovante -->
|
||
|
|
<div class="modal fade" id="modalExcluirComprovante" tabindex="-1">
|
||
|
|
<div class="modal-dialog">
|
||
|
|
<div class="modal-content">
|
||
|
|
<div class="modal-header">
|
||
|
|
<h5 class="modal-title"><i class="fas fa-trash"></i> Excluir Comprovante</h5>
|
||
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||
|
|
</div>
|
||
|
|
<div class="modal-body">
|
||
|
|
<p>Tem certeza que deseja excluir este comprovante?</p>
|
||
|
|
<p id="comprovanteInfo" class="text-muted"></p>
|
||
|
|
</div>
|
||
|
|
<div class="modal-footer">
|
||
|
|
<form id="formExcluirComprovante" method="post">
|
||
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
||
|
|
<button type="submit" class="btn btn-danger">Excluir</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endblock %}
|
||
|
|
|
||
|
|
{% block scripts %}
|
||
|
|
<script src="{{ url_for('static', filename='js/comprovantes.js') }}"></script>
|
||
|
|
{% endblock %}
|
||
|
|
|