{% extends '_lista2.html.twig' %}
{% block custom_table %}true{% endblock %}
{% block css %}
<style>
.table.dataTable td {
font-size: 0.7em;
}
.table.dataTable th {
font-size: 0.7em;
}
</style>
{% endblock %}
{% block body %}<br>
<div class="container m-5">
<div class="page-title b-0 bg-white d-flex align-items-center">
<img src="{{ asset('imagens/appkm.png')}}" alt="Logo KM" class="img-fluid" style="max-width: 100px;">
<h1 class="h4 mt-4 mb-0 px-3 font-weight-normal">
PESQUISA
</h1>
</div>
<form method="POST" action="{{ path('app_kmapi') }}" class="bs-validate" novalidate="true" id="_form_0">
<div class="row _form_normal_0 align-items-center">
<div class="col-3">
<div class="form-label-group mb-2">
<select name="tipoOperacao" id="tipoOperacao"
class="form-control form-control-clean border-primary">
<option value="pagamento" {% if 'pagamento' in tipoOperacao %} selected {% endif %}>Pagamento</option>
<option value="recebimentos" {% if 'recebimentos' in tipoOperacao %} selected {% endif %}>Recebimento</option>
<option value="baixas" {% if 'baixas' in tipoOperacao %} selected {% endif %}>Baixas</option>
</select>
<label for="">Operação</label>
</div>
</div>
<div class="col-2">
<div class="form-label-group mb-2">
<input autocomplete="off" type="text" name="dataIni"
class="form-control form-control-clean datepicker border-primary"
value="{% if dini is defined %}{{ dini }}{% else %}{{ "now"|date("d/m/Y") }}{% endif %}"
required data-format="DD/MM/YYYY"
data-quick-locale='{
"days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
"daysShort": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"],
"daysMin": ["Do", "Se", "Te", "Qu", "Qi", "Se", "Sa"],
"months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
"monthsShort": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
"today": "Hoje",
"clear": "limpar",
"titleFormat": "MM yyyy"
}'>
<label for="">Data Inicial</label>
</div>
</div>
<div class="col-2">
<div class="form-label-group mb-2">
<input autocomplete="off" type="text" name="dataFim"
class="form-control form-control-clean datepicker border-primary"
value="{% if dfim is defined %}{{ dfim }}{% else %}{{ "now"|date("d/m/Y") }}{% endif %}"
required data-format="DD/MM/YYYY"
data-quick-locale='{
"days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
"daysShort": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"],
"daysMin": ["Do", "Se", "Te", "Qu", "Qi", "Se", "Sa"],
"months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
"monthsShort": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
"today": "Hoje",
"clear": "limpar",
"titleFormat": "MM yyyy"
}'>
<label for="">Data Final</label>
</div>
</div>
<div class="col-4">
<div class="form-label-group mb-2">
<input autocomplete="off" type="text" name="nomForne"
class="form-control form-control-clean border-primary"
value="{% if nomForne is defined %}{{ nomForne }}{% else %}{{ "" }}{% endif %}">
<label for="">Nome Fornecedor/Cliente</label>
</div>
</div>
<div class="col-4">
<div class="form-label-group mb-2">
<select name="realtime" id="realtime"
class="form-control form-control-clean border-primary">
<option value="1" {% if '1' in realtime %} selected {% endif %}>Em Tempo Real</option>
<option value="2" {% if '2' in realtime %} selected {% endif %}>24h Atrás</option>
</select>
<label for="">OnLine? (+ performace)</label>
</div>
</div>
<div class="col-3">
<button type="submit" class="btn btn-success btn-sm save fs--12">
<i class="fi fi-check"></i>
Processar
</button>
</div>
</div>
</form>
<section class="p--20 bg-white ">
{% set theadDefault = '' %}
{% if table|length > 0 %}
{% for columnName in table[0]|keys %}
{% set theadDefault = theadDefault ~ '<th>' ~ columnName ~ '</th>\n' %}
{% endfor %}
<div class="">
<div class="row " id="_list_">
<div class="col-md-12">
<div class="">
<div class="">
<table id="lista_tabela" class="table-datatable table table-bordered table-hover table-striped"
data-lng-empty="Sem dados disponíveis na tabela"
data-lng-page-info="Exibindo _START_ até _END_ de _TOTAL_ Pagamentos"
data-lng-filtered="(Filtrado de _MAX_ total entries)"
data-lng-loading="Carregando..."
data-lng-processing="Processando..."
data-lng-search="Procurando..."
data-lng-norecords="Nenhum registro correspondente encontrado"
data-lng-sort-ascending=": Clique para classificar a coluna em ordem crescente"
data-lng-sort-descending=": Clique para classificar a coluna em ordem decrescente"
data-lng-column-visibility="Visibilidade da coluna"
data-lng-csv="CSV"
data-lng-pdf="PDF"
data-lng-xls="XLS"
data-lng-copy="Copiar"
data-lng-print="Imprimir"
data-lng-all="Tudo"
data-main-search="true"
data-column-search="false"
data-row-reorder="false"
data-col-reorder="true"
data-responsive="true"
data-header-fixed="true"
data-select-onclick="true"
data-enable-paging="true"
data-enable-col-sorting="true"
data-autofill="true"
data-group="false"
data-items-per-page="30"
data-lng-export="<i class='fi fi-squared-dots fs--8 line-height-1'></i>"
data-export-pdf-disable-mobile="true"
data-export='["csv", "pdf", "xls"]'
data-options='["copy", "print"]'
style="width: 100%;">
<thead>
<tr>
{{theadDefault | raw}}
</tr>
</thead>
<tbody>
{% for row in table %}
<tr>
{% for key, value in row %}
{# Adicione classes de alinhamento com base no nome da coluna #}
{% set alignmentClass = 'text-left' %}
{% if 'VLR' in key %}
{% set alignmentClass = 'text-right' %}
{% set formattedValue = value|number_format(2, ',', '.') %}
{% else %}
{% set formattedValue = value %}
{% endif %}
{# Aplica formatação correspondente para datas #}
{% if 'VCT' in key or 'DAT' in key or 'ULTPGT' in key %}
{% if value is defined and value is not empty %}
{% set formattedValue = value|date('d/m/Y') %}
{% endif %}
{% endif %}
{# Renderiza a célula com a classe de alinhamento #}
<td class="{{ alignmentClass }}">{{ formattedValue }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
{# <tfoot>
<tr>
{{theadDefault | raw}}
</tr>
</tfoot> #}
</table>
</div>
</div>
<!-- CARDSHOW -->
</div>
</div>
</div>
{% else %}
<p>A tabela está vazia.</p>
</div>
{% endif %}
</section>
{% block javascript %}
<script src="{{ asset('smarty/js/vendor.datatables.js') }}"></script>
<script type="text/javascript">
// $('#tblSetores').removeClass('table-datatable');
// $('#tblSetores').addClass('table-datatable');
new DataTable('#lista_tabela', {
// var table = $('#lista_tabela').DataTable({
sort: true,
searching: true,
stateSave: true,
fixedColumns: true,
paging: false,
scrollCollapse: true,
scrollX: true,
scrollY: 300,
// fixedColumns: {
// left: 2
// }
//dom: 'lfrtip<"bottom"B>',
dom: 'ftipB', // https://datatables.net/reference/option/dom,
order: [
[2, 'asc']
],
buttons: [{
extend: 'print',
text: 'Imprimir',
exportOptions: {
columns: [0, 1, 2, 3, 4] //Your Colume value those you want
}
},
{
extend: 'excel',
text: 'Exportar Excel',
exportOptions: {
columns: [0, 1, 2, 3, 4] //Your Colume value those you want
},
}
],
language: {
"decimal": "",
"emptyTable": "Sem dados disponíveis na tabela",
"info": "Mostrando _START_ até _END_ de _TOTAL_ registros",
"infoEmpty": "Mostrando 0 até 0 de 0 registro",
"infoFiltered": "(Filtrado de _MAX_ registros)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Exibir _MENU_ registros",
"loadingRecords": "Carregando...",
"processing": "Processando...",
"search": "Localizar:",
"zeroRecords": "Nenhum registro correspondente encontrado",
"paginate": {
"first": "Primeiro",
"last": "Último",
"next": "Próximo",
"previous": "Anterior"
},
"aria": {
"sortAscending": ": classificar a coluna em ordem crescente",
"sortDescending": ": classificar a coluna em ordem decrescente"
}
}
/*
rowGroup: {
dataSrc: 2
},
*/
});
</script>
{% endblock %}
{% endblock %}