HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux Bradford-Sitios 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/gestor-horarios.bradford/app/views/reportes/reporte_incidencias_view.php
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<style>
	.table-result {
		font-size: 13px;
	}

	.select2-container--default .select2-selection--single .select2-selection__rendered {
		color: #444;
		line-height: 31px;
	}

	.select2-container--default .select2-selection--single {
		background-color: #fff;
		border: 1px solid #aaa;
		border-radius: 4px;
		height: 35px;
	}
</style>
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">Criterios de selección </h3>
	</div>
	<div class="box-body p-2">
		<div class="row">
			<div class="box-body" style="padding: 30px;">
				<div class="col-md-12">
					<?php if ($this->session->flashdata("mensaje_error")) : ?>
						<div class="alert alert-danger">
							<a data-dismiss="alert" class="close">×</a>
							<strong>ERROR DE VALIDACIÓN</strong><br />
							<?php echo $this->session->flashdata("mensaje_error"); ?>
						</div>
					<?php endif ?>
					<div class="row">
						<div class="col-md-4">
							<div class="form-group" style="padding: 2px;">
								<label for="worker_id" class="control-label">TRABAJADOR</label>
								<select class="select2 form-control" name="worker_id" id="worker_id">
									<option value="">Seleccione....</option>
									<?php foreach ($employees as $key => $value) : ?>
										<option value="<?php echo $value->id ?>"><?= !empty($value->rut) ? $value->rut . ' | ' : '' ?><?= (!empty($value->nombres) ? ($value->nombres . ' ' . $value->apellido_p . ' ' . $value->apellido_m) : '') ?></option>
									<?php endforeach ?>
								</select>
							</div>
						</div>
						<div class="col-md-4">
							<div class="form-group" style="padding: 2px;">
								<label for="month" class="control-label">MES</label>
								<select class="select2 form-control" name="month" id="month">
									<option value="">Seleccione....</option>
									<?php foreach (traerMeses() as $key => $month) : ?>
										<option value="<?= $key ?>" <?= date('m') == $key ? 'selected' : '' ?>><?= strtoupper($month) ?></option>
									<?php endforeach ?>
								</select>
							</div>
						</div>
						<div class="col-md-4">
							<div class="form-group" style="padding: 2px;">
								<label for="year" class="control-label">AÑO</label>
								<select class="select2 form-control" name="year" id="year">
									<option value="">Seleccione....</option>
									<?php for ($i = 2020; $i <= (date('Y') + 1); $i++) : ?>
										<option value="<?= $i ?>" <?= date('Y') == $i ? 'selected' : '' ?>><?= $i ?></option>
									<?php endfor ?>
								</select>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="">
							<button type="button" class="buscar bg-navy btn pull-right">Realizar busquedaxs</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script>
	$(document).ready(function() {
		$('.select2').select2();
	});

	$('.buscar').click(function(e) {

		let worker_id = $('#worker_id').val();
		console.log(worker_id)
		if (worker_id < 1) {
			alert('Debe seleccionar un trabajador');
			$('#worker_id').focus();
			return;
		}
		let month = $('#month').val();
		if (month < 1) {
			alert('Debe seleccionar un mes');
			$('#month').focus();
			return;
		}
		let year = $('#year').val();
		if (year < 1) {
			alert('Debe seleccionar un año');
			$('#year').focus();
			return;
		}

		let url = "<?= base_url("dashboard/reportes/incidencias/pdf") ?>";
		url = `${url}?worker_id=${worker_id}&month=${month}&year=${year}`;
		// window.location.href = url;
		window.open(url, '_blank');;
	});
</script>