{% extends 'base.html.twig' %}
{% block title %}Ordenes index{% endblock %}
{% block body %}
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<h4>Ordenes de Servicio Registradas</h4>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 text-right">
{% if maxPages > 1 %}
<nav aria-label="Page navigation" class="text-right">
<ul class="pagination">
<li>
<span class="label label-primary">Pagina ({{thisPage}}) de {{maxPages}}
</span>
</li>
{%if thisPage > 1 %}
<li >
<a aria-label="Previous" href="{{ path('ordenes_index', {currentPage: thisPage-1 < 1 ? 1 : thisPage-1}) }}">
<i class="glyphicon glyphicon-chevron-left"></i>
</a>
</li>
{% endif %}
{# `»` arrow #}
{%if thisPage < maxPages %}
<li>
<a aria-hidden="true" href="{{ path('ordenes_index', {currentPage: thisPage+1 <= maxPages ? thisPage+1 : thisPage}) }}">
<i class="glyphicon glyphicon-chevron-right"></i>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
</div>
</div>
<form name="formfiltros" method="POST" action="{{ path('ordenes_index', {currentPage:1}) }}">
<div class="row" style="margin-top: 5px">
<div class="col-md-12 text-left">
<label class="col-md-1 control-label"> N° Orden:</label>
<div class="col-md-2">
<input type="text" name="norden" value="{{ norden }}" class="form-control">
</div>
<label class="col-md-2 control-label"> N° Contrato:</label>
<div class="col-md-2">
<input type="text" name="ncontrato" value="{{ ncontrato }}" class="form-control">
</div>
<label class="col-md-1 control-label"> Cliente:</label>
<div class="col-sm-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-md-2">
<input type="text" name="numid" value="{{ numid }}" class="form-control">
</div>
<div class="col-md-1">
</div>
</div>
</div>
<div class="row" style="margin-top: 5px">
<div class="col-md-12 text-left">
<div class="col-md-10 text-right">
<input type="submit" class="btn btn-xs btn-primary" value="Consultar"/>
</div>
<div class="col-md-1">
<a href="{{ path('ordenes_index', {currentPage:1}) }}" class="btn btn-xs btn-default" >Limpiar Filtros</a>
</div>
<div class="col-md-1">
<a target="_black" href="{{ path('ordenes_generarexcel') }}" type="button" class="btn btn-xs btn-primary" >Generar Excel</a>
</div>
</div>
</div>
</form>
<br>
<p class="alert-info text-right"><strong> Cantidad de registros que retornó la consulta: ({{ ordenes|length }})</strong></p>
<div class="table-responsive">
<table class="table table-bordered table-condensed table-hover">
<thead>
<tr class="active">
<th>N° Orden</th>
<th>Afiliado</th>
<th>Contrato</th>
<th>Certificado</th>
<th>Servicio</th>
<th>Fecha Emisión</th>
<th>Estatus</th>
<th>Monto Autorizado</th>
<th>Monto $ </th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for ordene in ordenes %}
{% set class='' %}
{% if ordene.estatusordenes == 'Anulada' or ordene.estatusordenes == 'Rechazada' %}
{% set class='danger' %}
{% endif %}
<tr class="{{class}}">
<td>{{ ordene.id }}
{% if ordene.contratos.vip=='1' %}
<i class="glyphicon glyphicon-king"></i>
{% endif %}
</td>
<td>{{ ordene.Clientes }}</td>
<td>{{ ordene.contratos }}</td>
<td>{{ ordene.certificados }}</td>
<td>{{ ordene.tiposervicios }}</td>
<td>{{ ordene.fechaservicio ? ordene.fechaservicio|date('d-m-Y') : '' }}</td>
<td>{{ ordene.estatusordenes }} </td>
<td class="text-right">{{ ordene.montoautorizado|number_format(2, ',', '.') }}</td>
<td class="text-right">{{ ordene.tasacambio==0 ? 0 : (ordene.montoautorizado/ordene.tasacambio)|number_format(2, ',', '.') }}</td>
<td>
<a href="{{ path('ordenes_show', { 'id': ordene.id }) }}"><i class="glyphicon glyphicon-eye-open"></i></a> |
<a href="{{ path('ordenes_edit', { 'id': ordene.id }) }}"><i class="glyphicon glyphicon-edit"></i></a>
</td>
</tr>
{% else %}
<tr>
<td colspan="6">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="text-right">
<a href="{{ path('ordenes_new') }}" class="btn btn-large btn-primary">
Registrar nueva Orden
</a>
</p>
{% endblock %}