templates/kmapi/index.html.twig line 1

Open in your IDE?
  1. {% extends '_lista2.html.twig' %}
  2. {% block custom_table %}true{% endblock %}
  3. {% block css %}
  4.     <style>
  5.         .table.dataTable td {
  6.             font-size: 0.7em;
  7.         }
  8.         .table.dataTable th {
  9.             font-size: 0.7em;
  10.         }
  11.             
  12.     </style>
  13. {% endblock %}
  14. {% block body %}<br>
  15. <div class="container m-5">
  16.  <div class="page-title b-0 bg-white d-flex align-items-center">
  17.     <img src="{{ asset('imagens/appkm.png')}}" alt="Logo KM" class="img-fluid" style="max-width: 100px;">
  18.     <h1 class="h4 mt-4 mb-0 px-3 font-weight-normal">
  19.         PESQUISA
  20.     </h1>
  21. </div>
  22. <form method="POST" action="{{ path('app_kmapi') }}" class="bs-validate" novalidate="true" id="_form_0">
  23.     <div class="row _form_normal_0 align-items-center">
  24.         
  25.           <div class="col-3">
  26.                     <div class="form-label-group mb-2">                    
  27.                             <select name="tipoOperacao" id="tipoOperacao" 
  28.                                    class="form-control form-control-clean  border-primary">                            
  29.                                 <option value="pagamento" {% if 'pagamento' in tipoOperacao %} selected {% endif %}>Pagamento</option>
  30.                                 <option value="recebimentos" {% if 'recebimentos' in tipoOperacao %} selected {% endif %}>Recebimento</option>
  31.                                 <option value="baixas" {% if 'baixas' in tipoOperacao %} selected {% endif %}>Baixas</option>
  32.                             </select>
  33.                             <label for="">Operação</label>
  34.                     
  35.                     </div>                    
  36.         </div>
  37.         <div class="col-2">
  38.             <div class="form-label-group mb-2">
  39.                 <input autocomplete="off" type="text" name="dataIni"
  40.                        class="form-control form-control-clean datepicker border-primary"
  41.                        value="{% if dini is defined %}{{ dini }}{% else %}{{ "now"|date("d/m/Y") }}{% endif %}"
  42.                        required data-format="DD/MM/YYYY"
  43.                        data-quick-locale='{
  44.                     "days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
  45.                     "daysShort": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"],
  46.                     "daysMin": ["Do", "Se", "Te", "Qu", "Qi", "Se", "Sa"],
  47.                     "months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
  48.                     "monthsShort": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
  49.                     "today": "Hoje",
  50.                     "clear": "limpar",
  51.                     "titleFormat": "MM yyyy"
  52.                 }'>
  53.                 <label for="">Data Inicial</label>
  54.             </div>
  55.         </div>
  56.         <div class="col-2">
  57.             <div class="form-label-group mb-2">
  58.                 <input autocomplete="off" type="text" name="dataFim"
  59.                        class="form-control form-control-clean datepicker border-primary"
  60.                        value="{% if dfim is defined %}{{ dfim }}{% else %}{{ "now"|date("d/m/Y") }}{% endif %}"
  61.                        required data-format="DD/MM/YYYY"
  62.                        data-quick-locale='{
  63.                     "days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
  64.                     "daysShort": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"],
  65.                     "daysMin": ["Do", "Se", "Te", "Qu", "Qi", "Se", "Sa"],
  66.                     "months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
  67.                     "monthsShort": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
  68.                     "today": "Hoje",
  69.                     "clear": "limpar",
  70.                     "titleFormat": "MM yyyy"
  71.                 }'>
  72.                 <label for="">Data Final</label>
  73.             </div>
  74.         </div>
  75.          <div class="col-4">
  76.               <div class="form-label-group mb-2">                    
  77.                 <input autocomplete="off" type="text" name="nomForne"
  78.                        class="form-control form-control-clean border-primary"
  79.                        value="{% if nomForne is defined %}{{ nomForne }}{% else %}{{ "" }}{% endif %}">
  80.                 <label for="">Nome Fornecedor/Cliente</label>
  81.             </div>
  82.         </div>
  83.                   <div class="col-4">
  84.                     <div class="form-label-group mb-2">                    
  85.                             <select name="realtime" id="realtime" 
  86.                                    class="form-control form-control-clean  border-primary">                            
  87.                                 <option value="1" {% if '1' in realtime %} selected {% endif %}>Em Tempo Real</option>
  88.                                 <option value="2" {% if '2' in realtime %} selected {% endif %}>24h Atrás</option>                                
  89.                             </select>
  90.                             <label for="">OnLine? (+ performace)</label>
  91.                     
  92.                     </div>                    
  93.         </div>
  94.         <div class="col-3">
  95.             <button type="submit" class="btn btn-success btn-sm save fs--12">
  96.                 <i class="fi fi-check"></i>
  97.                 Processar
  98.             </button>
  99.         </div>
  100.     </div>
  101. </form>
  102. <section class="p--20 bg-white ">
  103.     {% set theadDefault = '' %}
  104.     {% if table|length > 0 %}
  105.         {% for columnName in table[0]|keys %}            
  106.             {% set theadDefault = theadDefault ~ '<th>' ~ columnName ~ '</th>\n' %}
  107.         {% endfor %}
  108.        
  109.             <div class="">
  110.                 <div class="row " id="_list_">
  111.                     <div class="col-md-12">
  112.                         <div class="">
  113.                             <div class="">
  114.                                 <table id="lista_tabela" class="table-datatable table table-bordered table-hover table-striped" 
  115.                                 data-lng-empty="Sem dados disponíveis na tabela" 
  116.     data-lng-page-info="Exibindo _START_ até _END_ de _TOTAL_ Pagamentos" 
  117.     data-lng-filtered="(Filtrado de _MAX_ total entries)" 
  118.     data-lng-loading="Carregando..." 
  119.     data-lng-processing="Processando..." 
  120.     data-lng-search="Procurando..." 
  121.     data-lng-norecords="Nenhum registro correspondente encontrado" 
  122.     data-lng-sort-ascending=": Clique para classificar a coluna em ordem crescente" 
  123.     data-lng-sort-descending=": Clique para classificar a coluna em ordem decrescente" 
  124.     data-lng-column-visibility="Visibilidade da coluna" 
  125.     data-lng-csv="CSV" 
  126.     data-lng-pdf="PDF"
  127.     data-lng-xls="XLS" 
  128.     data-lng-copy="Copiar" 
  129.     data-lng-print="Imprimir" 
  130.     data-lng-all="Tudo" 
  131.     data-main-search="true" 
  132.     data-column-search="false" 
  133.     data-row-reorder="false" 
  134.     data-col-reorder="true" 
  135.     data-responsive="true" 
  136.     data-header-fixed="true" 
  137.     data-select-onclick="true" 
  138.     data-enable-paging="true" 
  139.     data-enable-col-sorting="true" 
  140.     data-autofill="true" 
  141.     data-group="false" 
  142.     data-items-per-page="30" 
  143.     data-lng-export="<i class='fi fi-squared-dots fs--8 line-height-1'></i>" 
  144.     data-export-pdf-disable-mobile="true" 
  145.     data-export='["csv", "pdf", "xls"]' 
  146.     data-options='["copy", "print"]'
  147.     style="width: 100%;">
  148.                                     <thead>
  149.                                         <tr>
  150.                                             {{theadDefault | raw}}                                        
  151.                                         </tr>
  152.                                     </thead>
  153.                                     <tbody>
  154. {% for row in table %}
  155.     <tr>
  156.            {% for key, value in row %}
  157.                                     {# Adicione classes de alinhamento com base no nome da coluna #}
  158.                                     {% set alignmentClass = 'text-left' %}
  159.                                     {% if 'VLR' in key %}
  160.                                         {% set alignmentClass = 'text-right' %}
  161.                                         {% set formattedValue = value|number_format(2, ',', '.') %}
  162.                                     {% else %}
  163.                                         {% set formattedValue = value %}
  164.                                     {% endif %}
  165.                                     {# Aplica formatação correspondente para datas #}
  166.                                     {% if 'VCT' in key or 'DAT' in key or 'ULTPGT' in key %}
  167.                                         {% if value is defined and value is not empty %}
  168.                                             {% set formattedValue = value|date('d/m/Y') %}
  169.                                         {% endif %}
  170.                                     {% endif %}
  171.                                     {# Renderiza a célula com a classe de alinhamento #}
  172.                                     <td class="{{ alignmentClass }}">{{ formattedValue }}</td>
  173.                                 {% endfor %}
  174.     </tr>
  175. {% endfor %}
  176.                                     </tbody>
  177.                                     {# <tfoot>
  178.                                         <tr>
  179.                                             {{theadDefault | raw}} 
  180.                                         </tr>
  181.                                     </tfoot> #}
  182.                                     
  183.                                 </table>
  184.                             </div>
  185.                         </div>
  186.                         <!--  CARDSHOW -->
  187.                     </div>
  188.                 </div>
  189.             </div>
  190.         
  191.     {% else %}
  192.         <p>A tabela está vazia.</p>
  193.         </div>
  194.     {% endif %}
  195.         </section>
  196. {% block javascript %}
  197.    
  198.   <script src="{{ asset('smarty/js/vendor.datatables.js') }}"></script> 
  199.   <script type="text/javascript">
  200.     //  $('#tblSetores').removeClass('table-datatable');
  201.     //  $('#tblSetores').addClass('table-datatable');
  202.           new DataTable('#lista_tabela', {
  203.               // var table = $('#lista_tabela').DataTable({
  204.                   sort: true,
  205.     searching: true,
  206.     stateSave: true,
  207.     fixedColumns: true,
  208.     paging: false,
  209.     scrollCollapse: true,
  210.     scrollX: true,
  211.     scrollY: 300,
  212.     //   fixedColumns: {
  213.         //     left: 2
  214.     // }
  215.      //dom:        'lfrtip<"bottom"B>', 
  216.      dom: 'ftipB', // https://datatables.net/reference/option/dom,
  217.      order: [
  218.          [2, 'asc']
  219.      ],
  220.      buttons: [{
  221.          extend: 'print',
  222.          text: 'Imprimir',
  223.          exportOptions: {
  224.              columns: [0, 1, 2, 3, 4] //Your Colume value those you want
  225.          }
  226.        },
  227.        {
  228.            extend: 'excel',
  229.          text: 'Exportar Excel',
  230.          exportOptions: {
  231.              columns: [0, 1, 2, 3, 4] //Your Colume value those you want
  232.          },
  233.        }
  234.      ],
  235.      language: {
  236.          "decimal": "",
  237.        "emptyTable": "Sem dados disponíveis na tabela",
  238.        "info": "Mostrando _START_ até _END_ de _TOTAL_ registros",
  239.        "infoEmpty": "Mostrando 0 até 0 de 0 registro",
  240.        "infoFiltered": "(Filtrado de _MAX_ registros)",
  241.        "infoPostFix": "",
  242.        "thousands": ",",
  243.        "lengthMenu": "Exibir _MENU_ registros",
  244.        "loadingRecords": "Carregando...",
  245.        "processing": "Processando...",
  246.        "search": "Localizar:",
  247.        "zeroRecords": "Nenhum registro correspondente encontrado",
  248.        "paginate": {
  249.            "first": "Primeiro",
  250.          "last": "Último",
  251.          "next": "Próximo",
  252.          "previous": "Anterior"
  253.        },
  254.        "aria": {
  255.            "sortAscending": ": classificar a coluna em ordem crescente",
  256.          "sortDescending": ": classificar a coluna em ordem decrescente"
  257.        }
  258.      }
  259.      /*
  260.      rowGroup: {
  261.          dataSrc: 2 
  262.      }, 
  263.      */
  264.     });
  265.         </script>
  266.     {% endblock %}
  267. {% endblock %}