<%@include file="/jsp/common/taglibs.jsp"%>
<script type="text/javascript" language="javascript" src="${contextPath}/js/dda/contrato/promociones/formManager.js?v=${versionJS}"></script>
<script type="text/javascript" language="javascript" src="${contextPath}/js/dda/contrato/promociones/promocionesValidate.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">

<style type="text/css">
.mymodal-xl {
    width: 90%;
   max-width:1200px;
  }

.myborder {
	border: 1px solid #dddddd;
}

</style>


<!-- _____________________________MODAL AGREGAR PROMOCIONES___________________________________________________________________________ -->

<div class="modal  bs-example-modal-lg" id="modalPromociones">
	<div class="modal-dialog  modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<h3 class="modal-title">Agregar Promoci&oacute;n</h3>
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-hidden="true"></button>
			</div>
			<div class="modal-body">
			
				<s:form id="formNuevaPromocion" class="form-horizontal col-md-50" action="#">	
				   <fieldset>		
					   <div class="form-group">							
							 <div  class="col-md-12" >
								
								<label for="selectEstudios" class="col-md-2 control-label">Estudio: </label>
								<div class="col-md-4">								    																																			
									<select id="selectEstudios" name="selectEstudios" class="form-control required" 
									        ng-model="estudioSeleccionado"
									        ng-options="estudio as estudio.desc_estudio for estudio in estudios track by estudio.id_estudio" required>
									        <option value="">Selecciona un Estudio</option>
									</select>									
								</div>
								
								<label for="paisSeleccionado" class="col-md-2 control-label">Pais: </label>
								<div class="col-md-4">	
								  <span  class="nullable">																					
									<select id="paisSeleccionado" name="paisSeleccionado" class="form-control required" 
									        ng-model="paisSeleccionado"
									        ng-options="pais as pais.descripcion for pais in paises">
									        <option value="">- Todos -</option>
									</select>
								  </span>																				
								</div>
							</div>
						</div>																		
												
						<div class="form-group">							
							 <div  class="col-md-12" >
								
								<label for="inputEmail3" class="col-md-2 control-label">Nombre Promocion: </label>
								<div class="col-md-4">								    																																			
									<input id="nombre_promocion" maxlength="50" type="text" class="form-control required" name="nombre_promocion" required>	
								</div>
								
								<label for="inputEmail3" class="col-md-2 control-label">Descuento: </label>
								<div class="col-md-4">																					
									<input id="descuento" class="form-control required" name="descuento"  type="number" maxlength="7" required >
								</div>
							</div>
						</div>																	
																						
						<div class="form-group">							
							 <div  class="col-md-12" >
								
								<label for="inputEmail3" class="col-md-2 control-label">Fecha Inicio</label>
								<div class="col-md-4">								    																																			
									<v:datePicker id="fecha_inicio"  name="fechaInicio" clazz="form-control required datepicker">
									</v:datePicker>									
								</div>
								
								<label for="inputEmail3" class="col-md-2 control-label">Fecha Fin</label>
								<div class="col-md-4">								    																																			
									<v:datePicker id="fecha_fin" name="fecha_fin" clazz="form-control required datepicker">
									</v:datePicker>									
								</div>
							</div>
						</div>																						
								
						<div class="form-group">							
							 <div  class="col-md-12" >
								
								<label for="inputEmail3" class="col-md-2 control-label">Tipo de Descuento</label>
								<div class="col-md-4">
								    
									    <label for="inputEmail3" class="checkbox-inline control-label"> 
											<input type="radio" value="MONEDA" name="tipo_descuento" class="formatos"> por Cantidad ($)
										</label>							    								    																																				
										<label for="inputEmail3" class=" checkbox-inline control-label"> 
											<input type="radio" value="PORCENTAJE" name="tipo_descuento" class="formatos" ng-checked='true'> por Porcentaje (%)
										</label>
																		
								</div>
								
							</div>
						</div>
						
						<div class="form-group">							
							 <div  class="col-md-12" >
								<div class="col-md-7">								    																																			
									 <input style="background-color:#181818; color:#fff9f9; width:100px; margin-left:150px;" class="btn" id="btnRegresar" type="button" value="Regresar" data-bs-dismiss="modal">									
								</div>
								<div class="col-md-4">																					
									 <input style="width:150px; margin-left:150px;" class="btn btn-primary" id="btnConsultarTitulos" type="button" value="Consulta Titulos" ng-click="listaTitulos()">																				
								</div>
							</div>
						</div>	
																																																															
						<br>
						<label id="errorFormatos" name="errorFormatos" class="lbErrores" style="display:none; color:red; font-size: large;">Se debe seleccionar un tipo descuento</label>
						<label id="errorEditForm"                      class="lbErrores" style="display:none; color:red; font-size: large;">Complete todos los campos</label>
					</fieldset>
				</s:form>
                <!-- tabla para mostrar Titulos -->
                <div>
                     <table id="tablaTitulosPromos" class="table" ng-repeat="contratoAtitulo in titulosToFilter() | filter:filterTitulos">
                            <thead>
                                 <tr class="encabezado" role="row" >
                                       <td style="width: 166px;">Contrato: {{ contratoAtitulo.numero_contrato }}</td>
                                       <td> </td>
                                       <td> </td>
                                 </tr>
                                 
                            </thead>
                            <body>
                                  <tr ng-repeat="titulo in titulos | filter:{numero_contrato: contratoAtitulo.numero_contrato}">
                                       <td><input style="margin-left: 70px;" type="checkbox" id="{{titulo.id_bv}}" value="{{titulo.id_bv}}" name="checksBoxPromo" class="formatos"></td>
                                       <td style="width: 166px;">{{titulo.id_bv}}</td>
                                       <td>{{titulo.nombre_estandar}}</td>
                                  </tr>
                            </body>
                     </table>
                </div>
			</div>
			<div class="modal-footer">
				<input id="btnGuardarPromocion" type="submit" class="btn btn-primary" ng-disabled="btnGuardarPromo" ng-click="guardarPromocion()" value="Guardar">
			</div>
		</div>
	</div>
</div>

	