{% extends 'base.html.twig' %}
{% block title %}New Ordenes{% endblock %}
{% block body %}
<legend></legend>
<form name="consultar" method="post" id="planesselect" action="{{ path('ordenes_consultareventos') }}">
<input type="hidden" name="clienteid" id="clienteid" value="{{ clienteid }}" class="form-control">
<input type="hidden" name="certificado" id="certificado" value="" class="form-control">
<div class="row">
<div class="col-sm-2 col-md-2 col-lg-2">
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
<strong>N° de Identificación del Afiliado</strong>
</div>
<div class="col-sm-1 col-md-1 col-lg-1" style="margin-bottom:1%">
<select class="form-control" name="tipoid">
<option value="-">-</option>
<option value="V" {% if tipoid=='V'%} selected="selected" {% endif%} >V</option>
<option value="E" {% if tipoid=='E'%} selected="selected" {% endif%} >E</option>
<option value="M" {% if tipoid=='M'%} selected="selected" {% endif%} >M</option>
</select>
</div>
<div class="col-sm-2 col-md-2 col-lg-2" style="margin-bottom:1%" >
<input type="text" name="numid" value="{{ numid }}" class="form-control">
</div>
<div class="col-sm-1 col-md-1 col-lg-1">
<button class="btn btn-primary">Consultar</button>
</div>
</div>
<br>
{% if contratos %}
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<p class="alert-info text-right"><strong> Cantidad de Clientes que retornó la consulta: ({{ contratos|length }})</strong></p>
<div class="table-responsive">
<table class="table table-bordered table-condensed table-hover ">
<thead>
<tr class="active">
<th style="width:15%">Cliente</th>
<th style="width:8%">N° contrato</th>
<th style="width:15%">Titular</th>
<th style="width:10%">N° Certificado</th>
<th style="width:15%">Afiliado</th>
<th style="width:12%">Plan</th>
<th style="width:14%">Vigencia</th>
<th style="width:10%">Fecha Ingreso</th>
<th style="width:8%"></th>
</tr>
</thead>
<tbody>
{% for entity in contratos %}
{% set class = '' %}
{% if entity.indservicioconrecibopendiente== '1'%}
{% set class = 'alert alert-danger' %}
{% endif %}
<tr class="{{ class }}">
<td>{{ entity.tomador }}</td>
<td>{{ entity.id }}
{% if entity.vip=='1' %}
<i class="glyphicon glyphicon-king"></i>
{% endif %} </td>
<td>{{ entity.titular }}</td>
<td>{{ entity.ncertificado }}</td>
<td>{{ entity.nombreasegurado }}</td>
<td>{{ entity.plan }}</td>
<td>{{ entity.fechadesde ? entity.fechadesde|date('d-m-Y') : '' }}/{{ entity.fechahasta ? entity.fechahasta|date('d-m-Y') : '' }}</td>
<td>{{ entity.fechaingreso ? entity.fechaingreso|date('d-m-Y') : '' }}
<br><strong>Días Trans: {{ entity.dias }}</strong>
</td>
<td style="width:10%;">
<input type="radio" data-certificado="{{ entity.ncertificado }}" name="radiocontrato" value="{{ entity.id }}">
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="row" id="refresh" style="display: none">
<div class="col-md-12 text-center" >
Consultando ... <i class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></i>
</div>
</div>
<div class="row" id="servicios">
</div>
{% endif %}
{% if contratos==null and app.request.method =='POST' %}
<div class="row">
<div class="col-md-12 text-center alert alert-warning" >
<strong> No se encontraron contratos activos para la cédula ingresada </strong> <i class="glyphicon glyphicon-warning-sign"></i>
</div>
</div>
{% endif %}
</form>
<script type="text/javascript">
$(function() {
$('#refresh')
.hide()
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
})
;
$('input[type=radio]').click(function() {
var rutadeleteactuacion = '{{ path('ordenes_eventosporcontrato')}}';
var checkbox = $(this), // Selected or current checkbox
value = checkbox.val(); // Value of checkbox
var cliente = $("#clienteid").val();
console.log(value);
console.log(cliente);
console.log($(this).data("certificado"));
$('#certificado').val($(this).data("certificado"));
$('#servicios').html("");
$("#refresh").show();
$.ajax({
type: 'POST',
url: rutadeleteactuacion,
data: {"clienteid": cliente, "contratoid": value},
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
})
.done(function(data)
{
$("#refresh").hide();
$('#servicios').html(data);
});
$("body, html").animate({scrollTop: $("#servicios").offset().top }, 1000,function () {
document.getSelection().removeAllRanges();
});
});
});
</script>
{% endblock %}