<!DOCTYPE html>
<html>
<head>
	<title>Solicitudes de Vacaciones Pendientes</title>
	<!-- ##### -->
        <!-- Fonts -->
        <!-- ##### -->
        <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
        <!-- ################## -->
        <!-- Global stylesheets -->
        <!-- ################## -->
        <link href="<?= base_url(); ?>webroot/bower_components/Materialize/dist/css/materialize.css" rel="stylesheet" type="text/css" />
        <link href="<?= base_url(); ?>webroot/bower_components/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css" />
        <link href="<?= base_url(); ?>webroot/bower_components/code-prettify/src/prettify.css" rel="stylesheet" type="text/css" />
        <link href="<?= base_url(); ?>webroot/css/admin.css" rel="stylesheet" type="text/css" />                        
        <!-- ################# -->
        <!-- Theme stylesheets -->
        <!-- ################# -->
        <link href="<?= base_url(); ?>webroot/css/themes/light.css" id="ssThemeColor" rel="stylesheet" type="text/css" />
        <?php            
            $css = "red.css";
        ?>
        <link href="<?= base_url(); ?>webroot/css/themes/main/<?= $css ?>" id="ssMainColor" rel="stylesheet" type="text/css" />
        <link href="<?= base_url(); ?>webroot/css/themes/alternative/<?= $css ?>" id="ssAlternativeColor" rel="stylesheet" type="text/css" />
        <!-- ################ -->
        <!-- Util stylesheets -->
        <!-- ################ -->
        <!--<link href="<?= base_url(); ?>webroot/css/theme-switcher.css" rel="stylesheet" type="text/css" />-->
        <link href="<?= base_url(); ?>webroot/css/apps/crud.css" rel="stylesheet" type="text/css" />
        <!-- ##### -->
        <!-- Icons -->
        <!-- ##### -->
        <link rel="shortcut icon" href="<?= base_url(); ?>webroot/img/favicon.ico" type="image/x-icon">   
        <!-- ##### -->
        <!-- Others -->
        <!-- ##### -->        
        <link href="<?= base_url(); ?>webroot/css/style.css" rel="stylesheet" type="text/css" />         
        <link href="<?= base_url(); ?>webroot/orgchart/css/jquery.orgchart.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            .select-dropdown{
            overflow-y: auto !important;
            }
        </style>
        <script type="text/javascript">
        	function autorizarVacacionesRH($id_vacaciones){

        		var parametros = {                    
                            "id_vacaciones" : $id_vacaciones             
                    };

                    $.ajax({
                            data:  parametros,
                            url:   '<?php echo base_url(); ?>incidencias/autorizar_vacaciones_rh',
                            type:  'post',
                            beforeSend: function () {
                                    
                            },
                            success:  function (response) {                                               
                              alert(response);
                              javascript:location.reload();
                            }
                    });

        	}

        	function cancelarVacacionesRH($id_vacaciones,$id_empleado){

        		var parametros = {                    
                            "id_vacaciones" : $id_vacaciones,
                            "id_empleado" : $id_empleado             
                    };

                    $.ajax({
                            data:  parametros,
                            url:   '<?php echo base_url(); ?>incidencias/cancelar_vacaciones_rh',
                            type:  'post',
                            beforeSend: function () {
                                    
                            },
                            success:  function (response) {                                               
                              alert(response);
                              javascript:location.reload();
                            }
                    });

        	}
        </script>
</head>
<body>
	<br>
	<div class="row">
		<div class="col s4">
		</div>
		<div class="col s4 center-align">
			<div class="card-panel red">
				<span class="white-text">
					SOLICITUDES PENDIENTES
				</span>
			</div>
		</div>
		<div class="col s4">
		</div>
	</div>
	<div class="row">
		<div class="col s12">
			<a class="waves-effect waves-light btn grey lighten-1 black-text" href="<?=base_url()?>incidencias/exportarExcelVacacionesPorAutorizar"><i class="material-icons left">system_update_alt</i>Descargar en excel</a>
            <a class="waves-effect waves-light btn grey lighten-1 black-text" href="<?=base_url()?>incidencias/exportarTxtVacacionesPorAutorizar"><i class="material-icons left">system_update_alt</i>Descargar en txt</a>
			
		</div>	
	</div>
	<div class="row">
		<div class="col s12">
			<table style = "font-size:10px;" class="datatable bordered z-depth-1">
		<thead>
			<tr>
				<td class="center-align">ID</td>
				<td class="center-align"># SUCURSAL</td>
				<td class="center-align">SUCURSAL</td>
				<td class="center-align"># EMPLEADO</td>
				<td class="center-align">NOMBRE</td>
				<td class="center-align">DIAS VACACIONES</td>
				<td class="center-align">FECHA INICIO</td>
				<td class="center-align">FECHA TERMINO</td>
				<td class="center-align">DIA DESCANSO</td>
				<td class="center-align">FECHA AUTORIZACION REGIONAL</td>
				<td class="center-align">AUTORIZAR</td>
				<td class="center-align">RECHAZAR</td>
			</tr>
		</thead>
		<tbody>
			<?php
				foreach ($registro as $key) {
			?>
				<tr>
					<td class="center-align"><?= $key["id_vacaciones"] ?></td>
					<td class="center-align"><?= $key["id_sucursal"] ?></td>
					<td class="center-align"><?= $key["nombre_sucursal"] ?></td>
					<td class="center-align"><?= $key["id_empleado"] ?></td>
					<td class="center-align"><?= $key["nombre_empleado"] ?></td>
					<td class="center-align"><?= $key["dias_vacaciones"] ?></td>
					<td class="center-align"><?= $key["fecha_inicio_vacaciones"] ?></td>
					<td class="center-align"><?= $key["fecha_fin_vacaciones"] ?></td>
					<td class="center-align"><?= $key["dia_descanso"] ?></td>
					<td class="center-align">
						<?= $key["fecha_autorizacion_regional"] ?>
					</td>
					<td>
						<button class="btn waves-effect waves-light" onclick="autorizarVacacionesRH('<?= $key['id_vacaciones'] ?>')"> <i class="material-icons">check</i>
                        </button>	
					</td>
					<td>
						<button class="btn waves-effect waves-light" onclick="cancelarVacacionesRH('<?= $key['id_vacaciones'] ?>','<?= $key['id_empleado'] ?>')"> <i class="material-icons">close</i>
                        </button>
					</td>
				</tr>
			<?php
				}
			?>
		</tbody>
	</table>	
		</div>
	</div>
</body>
<!-- ################## -->
        <!-- Global javascripts -->
        <!-- ################## -->
        <script src="<?= base_url(); ?>webroot/bower_components/jquery/dist/jquery.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/bower_components/Materialize/dist/js/materialize.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/bower_components/code-prettify/src/prettify.js" type="text/javascript"></script>   
        <script src="<?= base_url(); ?>webroot/js/admin.js" type="text/javascript"></script>
        <!-- ################ -->
        <!-- Util javascripts -->
        <!-- ################ -->
        <script src="<?= base_url(); ?>webroot/js/utils.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/js/colors.js" type="text/javascript"></script>
        <!--<script src="<?= base_url(); ?>webroot/js/theme-switcher.js" type="text/javascript"></script>-->
        <!-- ################ -->
        <!-- Page javascripts -->
        <!-- ################ -->
        <script src="<?= base_url(); ?>webroot/bower_components/amcharts3/amcharts/amcharts.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/bower_components/amcharts3/amcharts/serial.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/bower_components/amcharts3/amcharts/gauge.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/bower_components/amcharts3/amcharts/themes/light.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/bower_components/slimscroll/jquery.slimscroll.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/orgchart/js/jquery.orgchart.js" type="text/javascript"></script>
        <script src="<?= base_url(); ?>webroot/js/multiselect.min.js" type="text/javascript"></script>
</html>