<%@include file="/jsp/common/defaultTopLogin.jsp"%>
<%@include file="/jsp/dda/contrato/transaccion/comun/scripts.jsp"%>
<script src="${contextPath}/js/common/perfil/perfilController.js?v=${versionJS}"></script>
<script src="${contextPath}/js/common/perfil/perfilService.js?v=${versionJS}"></script>
<script type="text/javascript" language="javascript" src="${contextPath}/js/dda/contrato/promociones/promocionesService.js?v=${versionJS}"></script>
<script type="text/javascript" language="javascript" src="${contextPath}/js/dda/contrato/promociones/promocionesController.js?v=${versionJS}"></script>
<script src="${contextPath}/js/common/alerts/dist/sweetalert.min.js"></script>
<link rel="stylesheet" type="text/css" href="${contextPath}/js/common/alerts/dist/sweetalert.css">

<script src="https://unpkg.com/ng-table@2.0.2/bundles/ng-table.min.js"></script>

<style type="text/css">
thead {
	background: #cb2c25
}

th {
	color: white;
}

estilo {
	background-color: #cb2c25
}
</style>

<div ng-app="${contextPath}">
	<div  ng-controller="promocionesController">
	    <input type="hidden" id="idMDLAvalable" name="idMDLAvalable" value="<fmt:formatDate pattern='MM/dd/yyyy' value='${clista.fechaInicioPlusOneDay}' />" >
		
		 </br>
		 <div style="margin-bottom:20px;">
		     <button style="margin-left:300px;" id="btnIncluirTodas" type="button" class="btn btn-success btn-md" ng-click="mostrarPromociones()">Incluir Pasadas</button>
		     <button style="margin-left:300px;" id="btnVigentes" type="button" class="btn btn-success btn-md" ng-click="promosVigentes()">Solo Vigentes</button>
		     <input style="background-color:gray; color:#fff9f9; margin-left:150px;" class="btn" id="btnAgregarPromo" type="button" value="Agregar Promocion" ng-click="openAgregaPromocion()">
		 </div>
		 <div>
		      <table id="tabla_promociones"  class="table table-hover table-responsive table-striped" style="margin: 0 auto; width:900px;">
				      				 <thead>
				        			    <tr> 
				     					                  				            
				         			   </tr>
				       				   <tr  class="encabezado" role="row">
				          				        <!--  th class="sorting_disabled text-center" rowspan="1" colspan="1"> Estudio </th -->				          				        
				          				        <th ng-class="selectedCls('desc_estudio')" ng-click="changeSorting('desc_estudio')">
           											 Estudio <i class="glyphicon glyphicon-sort-by-alphabet-alt" ng-show="sort.descending"></i>
          											    <i class="glyphicon glyphicon-sort-by-alphabet" ng-show="!sort.descending"></i>
          										</th>
          														          				        
				                				<!-- th class="sorting_disabled text-center" rowspan="1" colspan="1">Nombre Promocion</th -->
				                				<th ng-class="selectedCls('nombre_promocion')" ng-click="changeSorting('nombre_promocion')">
           											 Nombre Promocion <i class="glyphicon glyphicon-sort-by-alphabet-alt" ng-show="sort.descending"></i>
          											    <i class="glyphicon glyphicon-sort-by-alphabet" ng-show="!sort.descending"></i>
          										</th>
          										
				                				<!-- th class="sorting_disabled text-center" rowspan="1" colspan="1">Fecha Inicio</th -->
				                				<th ng-class="selectedCls('fecha_inicio')" ng-click="changeSorting('fecha_inicio')">
           											 Fecha Inicio <i class="glyphicon glyphicon-sort-by-alphabet-alt" ng-show="sort.descending"></i>
          											    <i class="glyphicon glyphicon-sort-by-alphabet" ng-show="!sort.descending"></i>
          										</th>
				                				
				                				<!-- th class="sorting_disabled text-center" rowspan="1" colspan="1">Fecha Fin</th -->
				                				<th ng-class="selectedCls('fecha_fin')" ng-click="changeSorting('fecha_fin')">
           											 Fecha Fin <i class="glyphicon glyphicon-sort-by-alphabet-alt" ng-show="sort.descending"></i>
          											    <i class="glyphicon glyphicon-sort-by-alphabet" ng-show="!sort.descending"></i>
          										</th>
          										
				                				<th class="sorting_disabled text-center" rowspan="1" colspan="1">Descuento</th>
				                				<th class="sorting_disabled text-center" rowspan="1" colspan="1">Acciones</th>
				            		   </tr>
				      			 	</thead>
				    				<tbody>
				         				     <tr ng-repeat="promo in promociones | orderBy:sort.column:sort.descending"> <!-- | orderBy : 'desc_estudio' -->
				         				         <td class="text-center myborder">{{promo.desc_estudio}}</td>
				         				         <td id="{{promo.id_promocion}}" class="text-center myborder">
				         				                 <div style="display:none;" id="pDetalleTrue">
				         				                           <a id="{{promo.id_promocion}}" href='#' ng-click="openActualizaPromocion(promo.id_promocion)">{{promo.nombre_promocion}}</a>
				         				                 </div>
				         				                 <div style="display:block;" id="pDetalleFalse">
				         				                     <a id="id_promocion">{{promo.nombre_promocion}}</a>
				         				                 </div>
				         				         </td>
				         				         <td class="text-center myborder">{{promo.fecha_inicio}}</td>
				         				         <td class="text-center myborder">{{promo.fecha_fin}}</td>
				         				         <td class="text-center myborder">
				         				         <div ng-if="promo.tipo_descuento == 'PORCENTAJE'">{{promo.descuento}} %</div>
				         				         <div ng-if="promo.tipo_descuento == 'MONEDA'">$ {{promo.descuento}}</div>
				         				         </td>				         				         
				         				         <td id="{{promo.id_promocion}}" class="text-center myborder">
				         				               <div style="display:none;" id="pEliminarTrue">
				         				                   <a id="eliminaPromocion" href='#' ng-click="eliminaPromo(promo.id_promocion,promo.nombre_promocion)">Eliminar</a>
				         				               </div>
				         				               <div style="display:block;" id="pEliminarFalse" >
				         				                    <a id="acciones"> - </a>
				         				               </div>
				         				         </td>         				         
				         			             
				            			     </tr>				              
				      				</tbody>					     
				</table>
		 </div>
		
		<%@include file="/jsp/dda/contrato/promociones/modalAltaPromociones.jsp"%>
		<%@include file="/jsp/dda/contrato/promociones/modalModificaPromociones.jsp"%>
	</div>
</div>

<%@include file="/jsp/common/defaultBottomLogin.jsp"%>