{% block jquery_show %}
<script type="text/javascript">
function mostrarTextoGeometria(geometria)
{
cadenaRetorno = '';
if (geometria.length)
{
cadena = geometria.replace('POINT(','');
cadena = cadena.replace(')','');
punto = cadena.split(' ');
cadenaRetorno = 'Lat:'+ parseFloat(punto[1]).toFixed(2) + ' Lon:'+ parseFloat(punto[0]).toFixed(2);
}
return cadenaRetorno;
}
$(function(){
var cargainicial = true;
$( "#{{ routeClassName }}_dialog-mapa" ).dialog({
autoOpen: false,
height: 610,
width: 750,
modal: true,
resizable: false,
title_html: true,
title: "<div id='texto' class='widget-header widget-header-small'><h4 class='smaller red'><i class='fas fa-shopping-cart'></i> Definir Ubicación en Mapa</h4></div>",
buttons: {
Cancelar: function() {
$( "#{{ routeClassName }}_dialog-mapa" ).dialog( "close" );
$( "#{{ routeClassName }}_dialog-mapa" ).empty();
}
}
});
$(".{{ routeClassName }}_botonmapa").click(function(e){
var idcampo = $(this).attr('itemid');
var tipoDibujo = $(this).attr('geom');
var url = '{{ path('mostrarGeometria', {'tipoDibujo': '__TIPO__', 'idCampo': '__CAMPO__', 'idContenedorMapa': routeClassName~'_dialog-mapa'}) }}';
url =url.replace('__TIPO__', tipoDibujo);
url =url.replace('__CAMPO__', idcampo);
e.preventDefault();
$("#{{ routeClassName }}_dialog-mapa").dialog("open");
if (cargainicial){
$('#{{ routeClassName }}_dialog-mapa').load(url);
cargainicial = false;
}
});
variable = $('#{{ routeClassName }}_valorgeometria').val();
if(typeof variable === 'string')
{
valor = mostrarTextoGeometria($('#{{ routeClassName }}_valorgeometria').val());
$('#textoGeometriaPunto').html(valor);
}
});
</script>
<div id="{{ routeClassName }}_dialog-mapa" title="Definir Ubicación en Mapa"></div>
{% endblock jquery_show %}
{% block principal_heading %}
{% endblock %}
{% block show_data %}
{% set rowopen=false %}
{% set maxcol=showColumns %}
{% set col=0 %}
{% for field in showFields %}
{% if field.atributos.attr.containerclass is defined %}
{% if isSubString(field.atributos.attr.containerclass,'full-row') %}
{% if rowopen %}
</div>
<div class="row">
{% endif %}
{% set col=maxcol-1 %}
{% endif %}
{% endif %}
{% if not rowopen %}
<div class="row">
{% set rowopen=true %}
{% endif %}
<div class="col-xs-12 {% if field.atributos.attr.containerclass is not defined or not isSubString(field.atributos.attr.containerclass,'full-row') %}col-sm-6 col-md-{{ 12 / maxcol }}{% endif %}">
<table class="table table-striped table-bordered table-hover">
<tr>
<th style="width: {{ widthLabel }}">
<label class="crud_label">
{{ field['label']|trans({},'crud') }}:
</label>
</th>
<td id="show_{{ field['nombre'] }}" class="crud_td">
{% if field['type'] is defined and field['type']=='datetime' and entity.getFieldValue(field['nombre']) %}
{{ entity.getFieldValue(field['nombre'])|date('d/m/Y H:i') }}
{% elseif field['type'] is defined and (field['type']=='time' or field['type']=='hora') and entity.getFieldValue(field['nombre']) %}
{{ entity.getFieldValue(field['nombre'])|date('H:i') }}
{% elseif field['type'] is defined and field['type']=='fecha' and entity.getFieldValue(field['nombre']) %}
{{ entity.getFieldValue(field['nombre'])|date('d-m-Y') }}
{% elseif field['type'] is defined and field['type']=='boolean' and booleans[entity.getFieldValue(field['nombre'])] is defined %}
<div style="text-align: center">
<label class="block">
<input class="ace ace-switch ace-switch-5" 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>
{% elseif field['type'] is defined and field['type']=="geometria_punto" %}
<input id="{{ routeClassName }}_valorgeometria" type="hidden" value="{{ entity.getFieldValue(field['nombre']) }}">
<a class="{{ routeClassName }}_botonmapa noti btn-minier" title="Definir Ubicación en Mapa" itemid="{{ routeClassName }}_valorgeometria" geom="punto" href="#">
<i class="fas fa-globe bigger-180 blue"></i>
</a>
<span id="textoGeometriaPunto"></span>
{% if entity.getFieldValue(field['nombre'])=="" %}
{% trans from 'crud' %}index.info.no_elements.nofiltro{% endtrans %}
{% endif %}
{% elseif field['type'] is defined and field['type']=="geometria_poligonoo" %}
<input id="{{ routeClassName }}_valorgeometria" type="hidden" value="{{ entity.getFieldValue(field['nombre']) }}">
<a class="{{ routeClassName }}_botonmapa noti btn-minier" title="Definir Ubicación en Mapa" itemid="{{ routeClassName }}_valorgeometria" geom="poligono" href="#">
<i class="fas fa-globe bigger-180 blue"></i>
</a>
<span id="textoGeometriaPoligono"> {% if entity.getFieldValue(field['nombre'])!="" %}Polígono definido {% endif %}</span>
{% if entity.getFieldValue(field['nombre'])=="" %}
{% trans from 'crud' %}index.info.no_elements.nofiltro{% endtrans %}
{% endif %}
{% else %}
{% if field['type'] is defined and field['type']=="image/*" %}
{% if entity.getFieldValue(field['nombre']) %}
<img width="80px" src="{{ absolute_url(entity.getFieldValue(field['nombre']).getUrl()) }}">
{% endif %}
{% else %}
{{ entity.getFieldValue(field['nombre'])|raw }}
{% endif %}
{% endif %}
</td>
</tr>
</table>
</div>
{% set col = col + 1 %}
{% if col == maxcol %}
</div>
{% set rowopen=false %}
{% set col=0 %}
{% endif %}
{% endfor %}
{% if rowopen %}
</div>
{% endif %}
{% endblock show_data %}
{% block post_data %}
{% endblock %}