src/Crud/templates/Common/filter.html.twig line 1

Open in your IDE?
  1. <script>
  2.     $(document).ready(function(){
  3.         {% for key,widget in formFilter %}
  4.             {% if key != '_token' %} 
  5.                 {% if widget.vars.attr.class is defined and isSubString(widget.vars.attr.class,'spinbox-input') %} 
  6.                     {% set min = "" %}
  7.                     {% if widget.vars.attr.min is defined %}
  8.                         {% set min = "min: "~widget.vars.attr.min~", " %}
  9.                     {% endif %} 
  10.                     {% set max = "" %}
  11.                     {% if widget.vars.attr.max is defined %}
  12.                         {% set max = "max: "~widget.vars.attr.max~", " %}
  13.                     {% endif %} 
  14.                     $('#{{widget.vars.id}}').ace_spinner({ {{ min }}{{ max }} step: 1, on_sides: true, icon_up: 'fas fa-plus', icon_down: 'fas fa-minus ', btn_up_class: 'btn-grey', btn_down_class: 'btn-grey', full_width: true});
  15.                 {% else %} 
  16.                     {% if widget.vars.attr.class is defined and isSubString(widget.vars.attr.class,'campo_fecha') %}
  17.                         $('#{{widget.vars.id}}').wrap('<div class="input-group" id="campo_fecha_{{widget.vars.id}}" />');  
  18.                         $('#campo_fecha_{{widget.vars.id}}').append('<span class="input-group-addon"><i class="fas fa-calendar bigger-110"></i></span>');  
  19.                         $('#{{widget.vars.id}}').datepicker({
  20.                                     autoclose: true,
  21.                                     todayHighlight: true
  22.                         })
  23.                         .next().on(ace.click_event, function(){
  24.                                     $(this).prev().focus();
  25.                         });;
  26.                         //$('#{{widget.vars.id}}').wrap('<div class="input-group date" id="campo_fecha_{{widget.vars.id}}" />');  
  27.                         //$('#campo_fecha_{{widget.vars.id}}').append('<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>');  
  28.                         //$('#campo_fecha_{{widget.vars.id}}').datetimepicker({ format: 'DD/MM/YYYY H:mm' });
  29.                     {% endif %} 
  30.                 {% endif %} 
  31.             {% endif %} 
  32.         {% endfor %}   
  33.                     
  34.     });
  35. </script>
  36. {% block jquery %}    
  37. {% endblock jquery %}    
  38. {% set currentRoute = app.request.attributes.get('_route') %}
  39. {% set requestUri = app.request.baseUrl~app.request.pathInfo %}
  40. {% if collapsed is not defined or collapsed %}
  41.     {% set collapsed = 'collapsed' %}
  42.     {% set display = 'display: none;'%}
  43.     {% set chevron = 'fa-chevron-down' %}
  44. {% else %}
  45.     {% set collapsed = '' %}
  46.     {% set display = 'display: block;'%}
  47.     {% set chevron = 'fa-chevron-up' %}
  48. {% endif %}
  49. <div class="widget-box transparent {{collapsed}}">
  50.     <div class="widget-header widget-header-flat">
  51.         <h4 class="widget-title lighter">
  52.             <i class="fas fa-filter orange"></i>
  53.             {% block filter_title %}
  54.                 {% set texto = routeClassName~'.plural' %}     
  55.                 {% trans from 'crud' %}filtro.titulo{% endtrans %}&nbsp;{#{ texto | trans({}, 'crud')|lower }#}
  56.             {% endblock filter_title %}
  57.         </h4>
  58.         <div class="widget-toolbar">
  59.             <a href="#" data-action="collapse">
  60.                 <i class="ace-icon fas {{ chevron }}"></i>
  61.             </a>
  62.         </div>
  63.     </div>
  64.     <div class="widget-body" style="{{ display }}">
  65.         <div class="widget-main no-padding">
  66.             <div class="container-fluid">
  67.                 {#% trans from 'crud' %}filtro.case{% endtrans %<br>#}<br>
  68.                 {% block filter_form %}
  69.                     <form id="filterform_{{ routeClassName }}" method="post" action="{{ requestUri }}" class="filterForm filterClose form">
  70.                 {% endblock filter_form %}
  71.                 {% block filter_controls %}
  72.                     {% set rowopen=false %}
  73.                     {% set maxcol=filterColumns %}
  74.                     {% set col=0 %}
  75.                     {% for key,widget in formFilter %}  
  76.                             
  77.             {#% for k,el in widget.vars if k != 'is_selected'%} 
  78.                         
  79.                 {% if k=='attr' or k=='form' or k=='block_prefixes' or k=='errors' or k=='label_attr' or k=='preferred_choices' or k=='choices' or k=='value'%}
  80.                     {% for k1,el1 in widget.vars.attr %}        
  81.                         {{ k }}=>{{ k1 }}=>{{ el1 }}<br>        
  82.                     {% endfor %}        
  83.                 {% else %}        
  84.                     {{ k }}=>{{ el }}<br>        
  85.                 {% endif %}        
  86.             {% endfor %#}        
  87.                             
  88.                         {% if key != '_token' and not widget.vars.disabled %}
  89.                             {% if widget.vars.attr['containerclass'] is defined %} 
  90.                                 {% if  isSubString(widget.vars.attr['containerclass'],'full-row') %} 
  91.                                     {% if rowopen %}
  92.                                         </div>
  93.                                         <div class="row">  
  94.                                     {% endif %}
  95.                                     {% set col=maxcol-1 %}
  96.                                 {% endif %}
  97.                             {% endif %}
  98.                             {% if not rowopen %}
  99.                                 <div class="row">  
  100.                                 {% set rowopen=true %}
  101.                             {% endif %} 
  102.                             <div class="col-xs-12 {% if widget.vars.attr['containerclass'] is not defined or not isSubString(widget.vars.attr['containerclass'],'full-row') %}col-sm-6 col-md-{{ 12 / maxcol }}{% endif %} {% if widget.vars.attr['containerclass'] is defined %}{{widget.vars.attr['containerclass']}}{% endif %}">
  103.                                 <table class="table table-striped table-bordered table-hover">
  104.                                     <tr>
  105.                                         <th style="width: {{ widthLabel }};">
  106.                                             {% set required = '' %}
  107.                                             {% if widget.vars.required %}
  108.                                             {%   set required = 'class=required' %}
  109.                                             {% endif %}    
  110.                                             <div style="height: 25px; overflow-x: hidden">
  111.                                             <span class="name" id="span_label_{{widget.vars.id}}">
  112.                                                 <label id="label_{{widget.vars.id}}" {{required}}>
  113.                                                     {{widget.vars.label}}
  114.                                                 </label>
  115.                                             </span> 
  116.                                             </div>    
  117.                                         </th>
  118.                                         <td>
  119.                                             <span class="value" id="span_value_{{widget.vars.id}}">
  120.                                                 {{ form_widget(widget) }}
  121.                                             </span>
  122.                                         </td>    
  123.                                     </tr>    
  124.                                 </table> 
  125.                             </div>    
  126.                             {% set col = col + 1 %}
  127.                             {% if col == maxcol %}
  128.                                 </div>
  129.                                 {% set rowopen=false %}
  130.                                 {% set col=0 %}
  131.                             {% endif %} 
  132.                         {%endif%}
  133.                     {% endfor %}
  134.                     {% if rowopen %}
  135.                         </div>        
  136.                     {% endif %}        
  137.                     <!--table id="filter_table">
  138.                         <tbody>
  139.                             {% set currentCol = 0 %}
  140.                         </tbody>
  141.                     </table-->
  142.                 {% endblock filter_controls %}
  143.                 {% block filter_extra %}
  144.                 {% endblock filter_extra %}
  145.                 <input type="hidden" value="1" id="filter__page" name="filter[_page]">
  146.                 <input type="hidden" value="id" name="filter[_sort_by]" id="filter__sort_by">
  147.                 <input type="hidden" value="ASC" name="filter[_sort_order]" id="filter__sort_order">
  148.                 {% block filter_acciones %}
  149.                     <div class="row">
  150.                         <div class="col-xs-12">
  151.                             <div class="hr hr-8 hr-dotted"></div>
  152.                         </div>
  153.                     </div>
  154.                     <div class="row">
  155.                         <div class="col-xs-6">
  156.                             <center>
  157.                                 <input class="btn btn-white btn-inverse btn-bold btn-round" type="submit" value="{% trans from 'crud' %}filtro.boton.send{% endtrans %}" name="Enviar Consulta">
  158.                             </center>
  159.                         </div>    
  160.                         <div class="col-xs-6">
  161.                             <center>
  162.                                 <a id="cleanfiltro_{{ routeClassName }}" class="btn btn-white btn-inverse btn-bold btn-round" href="{{ path('crud_clean_filter', {'rol': rol, 'routeClassName': routeClassName}) }}">
  163.                                     {% trans from 'crud' %}filtro.boton.clean{% endtrans %}
  164.                                 </a>
  165.                             </center>
  166.                         </div>    
  167.                     </div>
  168.                     <div class="row">
  169.                         <div class="col-xs-12">
  170.                             <div class="hr hr-8 hr-dotted"></div>
  171.                         </div>
  172.                     </div>
  173.                 {% endblock filter_acciones %}
  174.                 </form>
  175.                 <br>
  176.             </div>
  177.         </div>
  178.     </div>
  179. </div>