<script>
$(document).ready(function(){
{% block button_new %}
{% if entities|length>0 %}
$('#{{ routeClassName }}').on('draw.dt',
function(){
{% if newInIndex %}
$("#{{ routeClassName }}_length").addClass("hide");
if (!$("#{{ routeClassName }}_wrapper").hasClass("boton_nuevo"))
{
$("#{{ routeClassName }}_wrapper").addClass("boton_nuevo")
$("#{{ routeClassName }}_wrapper").
children("div.row").
children("div:first")
{% block button_new_elements %}
{% set texto = routeClassName~'.singular' %}
.append("<span id='{{routeClassName}}_botonNuevoDiv' class='forChanges'><a id='{{routeClassName}}_botonNuevoBoton' href='{{ path('crud_plain_new', { 'rol': rol, 'routeClassName': routeClassName} ) }}'><button class='btn btn-white btn-inverse btn-bold btn-round' title='{% trans from 'crud' %}botones.nuevo{% endtrans %}'><i class='fas fa-plus green'></i><span class='hidden-xs'> {% trans from 'crud' %}botones.nuevo{% endtrans %}</span></button></a></span>")
{% endblock button_new_elements %}
;
}
{% endif %}
{% block more_index_buttons %}
{% endblock more_index_buttons %}
});
{% endif %}
{% endblock button_new %}
{% block table_script %}
{% block table_index_jquery %}
$('.ace-index').click(function(e){
e.preventDefault();
});
$('#{{ routeClassName }}').DataTable({
responsive: {details: {type: 'inline'}},
//searching:true,
{% if showPaginator %}
paging: true,
pageLength: 50,
{% else %}
paging: false,
{% endif %}
{% if search %}
searching: true,
{% else %}
searching: false,
{% endif %}
{% if tableInfo %}
info: true,
{% else %}
info: false,
{% endif %}
{% if scrollY %}
scrollY: {{ scrollY }},
{% endif %}
"aoColumns": [
{% if columnAction %}
{"bSortable": false}
{% endif %}
{% block sortableColumns %}
{% for field in indexFields %}
{% if not columnAction and loop.index==1 %}
null
{% else %}
, null
{% endif %}
{% endfor %}
{% endblock sortableColumns %}
],
{% if app.request.locale=='es' %}
language: {url: "{{ asset('ace/js/dataTables/languages/spanish.json') }}"}
{% else %}
{% if app.request.locale=='fr' %}
language: {url: "{{ asset('ace/js/dataTables/languages/french.json') }}"}
{% else %}
language: {url: "{{ asset('ace/js/dataTables/languages/english.json') }}"}
{% endif %}
{% endif %}
});
var $overflow = '';
var colorbox_params = {
rel: 'colorbox',
reposition:true,
scalePhotos:true,
scrolling:false,
previous:'<i class="fas fa-arrow-left"></i>',
next:'<i class="fas fa-arrow-right"></i>',
close:'×',
current:'{current} of {total}',
maxWidth:'100%',
maxHeight:'100%',
onOpen:function(){
$overflow = document.body.style.overflow;
document.body.style.overflow = 'hidden';
},
onClosed:function(){
document.body.style.overflow = $overflow;
},
onComplete:function(){
$.colorbox.resize();
}
};
$('.ace-thumbnails [data-rel="colorbox"]').colorbox(colorbox_params);
$("#cboxLoadingGraphic").html("<i class='fas fa-spinner blue fa-spin'></i>");//let's add a custom loading icon
$(document).one('ajaxloadstart.page', function(e) {
$('#colorbox, #cboxOverlay').remove();
});
{% endblock table_index_jquery %}
{% endblock table_script %}
});
{% block table_index_functions %}
{% endblock table_index_functions %}
</script>
{% block jquery %}
<script type="text/javascript">
$(function()
{
$(".del_item").click(function(e){
if (!confirm("{{ 'delete.confirm' | trans({}, 'crud') }}")){
e.preventDefault();
}
});
$('.chosen-select').chosen({allow_single_deselect:true});
});
</script>
{% endblock jquery %}
{% block principal_heading %}
{% endblock %}
{% block filter %}
{% if showFilter %}
{% include '@crud\\Common\\filter.html.twig' %}
{% endif %}
{% endblock filter %}
{% block results %}
<div class="widget-box transparent">
{% block secondary_heading %}
<div class="widget-header widget-header-flat">
<h4 id="header-index" class="widget-title lighter">
{% block icon_secondary_heading %}
<i class="fas fa-list-ol blue"></i>
{% endblock icon_secondary_heading %}
{% set texto = routeClassName~'.plural' %}
{{ texto | trans({}, 'crud') }}
{#% if filterActive %} (<i class="fas fa-filter blue"></i> {{ 'index.filtrado' | trans({}, 'crud') }}){% endif %#}
{% block more_secondary_heading %}
{% endblock more_secondary_heading %}
</h4>
</div>
{% endblock secondary_heading %}
<div class="widget-body" style="display: block;">
<div class="widget-main no-padding">
{% block table %}
{% block index_no_elements %}
{% if entities|length==0 %}
{% block show_no_results %}
<div class="alert alert-info">
<strong>
<i class="fas fa-info-circle bigger-150"></i>
{% if showFilter %}
{% trans from 'crud' %}index.info.no_elements.filtro{% endtrans %}
{% else %}
{% trans from 'crud' %}index.info.no_elements.nofiltro{% endtrans %}
{% endif %}
</strong>
<br>
</div>
{% endblock show_no_results %}
{% if newInIndex %}
<br>
<div id="{{ routeClassName }}_botonNuevoDiv" class="forChanges">
{% block button_new_no_elements %}
<a id="{{routeClassName}}_botonNuevoBoton"
{% block button_new_no_elements_href %}
href="{{ path('crud_plain_new', {'rol' : rol, 'routeClassName': routeClassName} ) }}"
{% endblock button_new_no_elements_href %}
{% block button_new_no_elements_onclick %}
{% endblock button_new_no_elements_onclick %}>
{% set texto = routeClassName~'.singular' %}
<button class='btn btn-white btn-inverse btn-bold btn-round' title="{% trans from 'crud' %}botones.nuevo{% endtrans %} {{ texto | trans({}, 'crud')|lower }}">
<i class="fas fa-plus green"></i>
<span class="hidden-xs">
{% trans from 'crud' %}botones.nuevo{% endtrans %}
</span>
</button>
</a>
{% endblock button_new_no_elements %}
</div>
{% endif %}
{% block more_noelements_buttons %}
{% endblock more_noelements_buttons %}
{% endif %}
{% endblock index_no_elements %}
{% block info %}
<div class='row'>
<div class='{% block colindex %}col-xs-12{% endblock colindex %}'>
{% block main_column_info %}
{% endblock main_column_info %}
{% block index %}
{% if entities|length>0 %}
<table id="{{ routeClassName }}" class="table table-striped table-bordered table-hover" width="100%">
<thead>
<tr>
{% block action_header_data %}
{% if columnAction %}
<th id="noExl" style="width: max-content" class="crud_th">{#% trans from 'crud' %}index.acciones.table_header{% endtrans %#}</th>
{% endif %}
{% endblock action_header_data %}
{% block index_th %}
{% for field in indexFields %}
<th class="crud_th">{{ field['label'] }}</th>
{% endfor %}
{% endblock index_th %}
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr id="tr_{{ entity.id }}" entityId='{{ entity.id }}' {% block tr_attr %}{% endblock tr_attr %}>
{% block action_column_data %}
{% if columnAction %}
<td id="noExl" class="crud_td" {% block styleCellAction %}{% endblock %}>
<div id="{{ routeClassName }}_{{entity.id}}" class="pull-left action-buttons forChanges">
<nobr>
{% block index_actions %}
{% if showInIndex %}
{% block show_action %}
<a class="action_show" href="{{ path('crud_plain_show', { 'rol': rol, 'id': entity.id, 'routeClassName': routeClassName }) }}" itemid="{{ entity.id }}">
<i class="{{ buttons['view'] }} bigger-150" title="{% trans from 'crud' %}index.acciones.show_alt{% endtrans %}"></i>
</a>
{% endblock show_action %}
{% endif %}
{% if editInIndex %}
{% if not entity.getSistema() %}
{% block edit_action %}
<a class="action_edit" href="{{ path('crud_plain_edit', { 'id': entity.id, 'rol': rol, 'routeClassName': routeClassName }) }}" itemid="{{ entity.id }}">
<i class="{{ buttons['edit'] }} bigger-150" title="{% trans from 'crud' %}index.acciones.edit_alt{% endtrans %}"></i>
</a>
{% endblock edit_action %}
{% endif %}
{% endif %}
{% if deleteInIndex %}
{% if not entity.getSistema() %}
{% block delete_action %}
<a class="del_item" href="{{ path('crud_plain_delete', { 'id': entity.id, 'rol': rol, 'routeClassName': routeClassName }) }}" itemid="{{ entity.id }}">
<i class="{{ buttons['delete'] }} bigger-150" title="{% trans from 'crud' %}index.acciones.delete_alt{% endtrans %}"></i>
<!--img src="{{ asset(buttons['delete']) }}" title="{% trans from 'crud' %}index.acciones.delete_alt{% endtrans %}"-->
</a>
{% endblock delete_action %}
{% endif %}
{% endif %}
{% endblock %}
</nobr>
</div>
</td>
{% endif %}
{% endblock action_column_data %}
{% block index_data %}
{% for field in indexFields %}
<td class="crud_td {{ field['nombre'] }}" {% block styleCellData %}{% endblock %}>
{% block cellData %}
{% if field['type'] is defined and isSubString(field['type'],'attach') and entity.getFieldValue(field['nombre']) %}
<a href="{{ absolute_url(entity.getFieldValue(field['nombre']).getUrl()) }}" target="_blank">{{ entity.getFieldValue(field['nombre']).getFileName() }}</a>
{% else %}
{% if field['type'] is defined and isSubString(field['type'],'image') and entity.getFieldValue(field['nombre']) %}
<img width="{{ imageWidth }}" src="{{ absolute_url(entity.getFieldValue(field['nombre']).getUrl()) }}">
{% else %}
{% if field['type'] is defined and field['type']=='datetime' and entity.getFieldValue(field['nombre']) %}
{{ entity.getFieldValue(field['nombre'])|date('Y/m/d H:i') }}
{% else %}
{%if field['type'] is defined and (field['type']=='fecha' or field['type']=='date') and entity.getFieldValue(field['nombre'])%}
{{ entity.getFieldValue(field['nombre'])|date('Y/m/d') }}
{% else%}
{%if field['type'] is defined and (field['type']=='hora' or field['type']=='time') and entity.getFieldValue(field['nombre'])%}
{{ entity.getFieldValue(field['nombre'])|date('H:i') }}
{% else%}
{% if field['type'] is defined and field['type']=='boolean' and booleans[entity.getFieldValue(field['nombre'])] is defined %}
{#<i class="{{ booleans[entity.getFieldValue(field['nombre'])] }}"></i>#}
<span class="hide">{{ entity.getFieldValue(field['nombre']) }}</span>
<div style="text-align: center">
<label class="block">
<input class="ace ace-switch ace-switch-5 ace-index" type="checkbox" style="width: 100%" {% if entity.getFieldValue(field['nombre']) %}checked="{{ entity.getFieldValue(field['nombre']) }}"{% endif %}>
<span class="lbl" data-lbl=" {{ 'choice_value.yes' | trans({}, 'crud') | upper}} {{ 'choice_value.no' | trans({}, 'crud') | upper}}"></span>
</label>
</div>
{% else %}
{% autoescape %}{{ entity.getFieldValue(field['nombre']) | raw }}{% endautoescape %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endblock %}
</td>
{% endfor %}
{% endblock %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock index %}
</div> {# end column #}
{% block other_columns %}
{% endblock other_columns %}
</div> {# end row #}
{% endblock info %}
{% endblock table %}
</div>
</div>
</div>
{% endblock results %}