fix: Se borro todos los archivos, para poder hacer el merge
This commit is contained in:
parent
788fa4d4cc
commit
b8adbfff3e
|
@ -1,65 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href='https://unpkg.com/boxicons@2.0.9/css/boxicons.min.css' rel='stylesheet'>
|
|
||||||
<link rel="stylesheet" href="../css/inicio.css">
|
|
||||||
<title>Gestión de usuarios</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
|
|
||||||
<ul class="side-menu">
|
|
||||||
|
|
||||||
<li><a href="inicio.html"><i class='bx bxs-dashboard icon' ></i>Dashboard</a></li>
|
|
||||||
<li><a href="formulario-candidato.html" target="_blank"><i class='bx bxs-dashboard icon' ></i>Formulario de registro</a></li>
|
|
||||||
<li><a href="control-candidatos.php"><i class='bx bxs-dashboard icon' ></i>Control candidatos</a></li>
|
|
||||||
<li><a href="control-candidatos.php" class="active"><i class='bx bxs-dashboard icon' ></i>Gestión usuarios</a></li>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<li class="divider" data-text="main">Main</li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-inbox icon' ></i> Elements <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="#">Alert</a></li>
|
|
||||||
<li><a href="#">Badges</a></li>
|
|
||||||
<li><a href="#">Breadcrumbs</a></li>
|
|
||||||
<li><a href="#">Button</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a href="#"><i class='bx bxs-chart icon' ></i> Charts</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-widget icon' ></i> Widgets</a></li>
|
|
||||||
<li class="divider" data-text="tablas y formularios">Tablas y formularios</li>
|
|
||||||
<li><a href="#"><i class='bx bx-table icon' ></i> Tablas</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-notepad icon' ></i> Formularios <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="formulario-candidato.html">Registro de candidato</a></li>
|
|
||||||
<li><a href="formulario-datos-candidato.php">Datos de candidato</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
-->
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<!-- .SIDEBAR -->
|
|
||||||
|
|
||||||
<section id="content">
|
|
||||||
<!-- ========== MAIN ========== -->
|
|
||||||
<main>
|
|
||||||
<h1 class="title" style="margin: 2% 1%">Control</h1>
|
|
||||||
|
|
||||||
</main>
|
|
||||||
<!-- .......... MAIN .......... -->
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
<script src="../js/sidebar-navbar.js"></script>
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 54 KiB |
File diff suppressed because one or more lines are too long
|
@ -1,68 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . "/../../config/Database.php";
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['n'])){
|
|
||||||
$numero_inserts = intval($_GET['n']);
|
|
||||||
|
|
||||||
if ($numero_inserts <= 0) {
|
|
||||||
echo "El número de inserts debe ser un entero positivo.";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configuración de rangos para campos aleatorios
|
|
||||||
$id_examen_min = 1;
|
|
||||||
$id_examen_max = 15;
|
|
||||||
$id_tipo_id_min = 1;
|
|
||||||
$id_tipo_id_max = 5;
|
|
||||||
$id_rango_edad_min = 1;
|
|
||||||
$id_rango_edad_max = 7;
|
|
||||||
$id_genero_min = 1;
|
|
||||||
$id_genero_max = 3;
|
|
||||||
|
|
||||||
$conn = Database::getInstance();
|
|
||||||
|
|
||||||
$conn->begin_transaction();
|
|
||||||
|
|
||||||
try {
|
|
||||||
for ($i = 1; $i <= $numero_inserts; $i++) {
|
|
||||||
$nombres = "Nombre" . $i;
|
|
||||||
$primer_apellido = "ApellidoP" . $i;
|
|
||||||
$segundo_apellido = "ApellidoM" . $i;
|
|
||||||
$correo = "correo" . $i . "@gmail.com";
|
|
||||||
|
|
||||||
$fecha_entrada = date('Y-m-d H:i:s');
|
|
||||||
// fecha_salida es NULL por defecto en la tabla, o se puede especificar como NULL
|
|
||||||
|
|
||||||
$telefono = '';
|
|
||||||
for ($j = 0; $j < 10; $j++) {
|
|
||||||
$telefono .= rand(0, 9);
|
|
||||||
}
|
|
||||||
|
|
||||||
$id_examen = rand($id_examen_min, $id_examen_max);
|
|
||||||
$id_tipo_id = rand($id_tipo_id_min, $id_tipo_id_max);
|
|
||||||
$id_rango_edad = rand($id_rango_edad_min, $id_rango_edad_max);
|
|
||||||
$id_genero = rand($id_genero_min, $id_genero_max);
|
|
||||||
|
|
||||||
$sql = "INSERT INTO candidato (fecha_entrada, nombres, primer_apellido, segundo_apellido, correo, telefono, id_examen, id_tipo_id, id_rango_edad, id_genero)
|
|
||||||
VALUES ('{$fecha_entrada}', '{$nombres}', '{$primer_apellido}', '{$segundo_apellido}', '{$correo}', '{$telefono}', {$id_examen}, {$id_tipo_id}, {$id_rango_edad}, {$id_genero})";
|
|
||||||
|
|
||||||
if (!$conn->query($sql)) {
|
|
||||||
throw new Exception("Error al insertar el registro {$i}: " . $conn->error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$conn->commit();
|
|
||||||
echo "Se han insertado {$numero_inserts} registros exitosamente.";
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$conn->rollback();
|
|
||||||
echo "Error en la transacción: " . $e->getMessage();
|
|
||||||
} finally {
|
|
||||||
$conn->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
echo "Parámetros incorrectos. Asegúrate de pasar 'n' como parámetro GET con un número entero. Por ejemplo: .../ruta/inserts-prueba.php?n=5";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,233 +0,0 @@
|
||||||
DROP DATABASE IF EXISTS lania_cc;
|
|
||||||
CREATE DATABASE lania_cc DEFAULT CHARACTER SET utf8mb4;
|
|
||||||
USE lania_cc;
|
|
||||||
|
|
||||||
-- DDL -------------------------------------------------------------------------------------
|
|
||||||
CREATE TABLE genero (
|
|
||||||
id_genero TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
descripcion VARCHAR(20) NOT NULL UNIQUE
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
CREATE TABLE rango_edad (
|
|
||||||
id_rango_edad TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
descripcion VARCHAR(15) NOT NULL UNIQUE
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE tipo_identificacion (
|
|
||||||
id_tipo_id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
descripcion VARCHAR(50) NOT NULL UNIQUE
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
CREATE TABLE nivel_estudio (
|
|
||||||
id_nivel TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
descripcion VARCHAR(50) NOT NULL UNIQUE
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
CREATE TABLE giro (
|
|
||||||
id_giro TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
descripcion VARCHAR(100) NOT NULL UNIQUE
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
CREATE TABLE examen (
|
|
||||||
id_examen SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
nombre_examen VARCHAR(150) NOT NULL UNIQUE
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
|
|
||||||
-- IMPORTAR BASE DE DATOS DE INEGI
|
|
||||||
|
|
||||||
-- Catalogo de motivos
|
|
||||||
CREATE TABLE motivo_examen (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
descripcion VARCHAR(255) NOT NULL UNIQUE
|
|
||||||
);
|
|
||||||
|
|
||||||
-- 1. TABLA CANDIDATO (datos básicos)
|
|
||||||
CREATE TABLE candidato (
|
|
||||||
id_candidato INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
fecha_entrada DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
fecha_salida DATETIME DEFAULT NULL,
|
|
||||||
|
|
||||||
nombres VARCHAR(100) NOT NULL,
|
|
||||||
primer_apellido VARCHAR(100) NOT NULL,
|
|
||||||
segundo_apellido VARCHAR(100) DEFAULT NULL,
|
|
||||||
|
|
||||||
correo VARCHAR(150) NOT NULL,
|
|
||||||
telefono VARCHAR(30) NOT NULL,
|
|
||||||
|
|
||||||
id_examen SMALLINT UNSIGNED NOT NULL,
|
|
||||||
id_tipo_id TINYINT UNSIGNED NOT NULL,
|
|
||||||
id_rango_edad TINYINT UNSIGNED NOT NULL,
|
|
||||||
id_genero TINYINT UNSIGNED NOT NULL,
|
|
||||||
|
|
||||||
FOREIGN KEY (id_examen) REFERENCES examen(id_examen),
|
|
||||||
FOREIGN KEY (id_tipo_id) REFERENCES tipo_identificacion(id_tipo_id),
|
|
||||||
FOREIGN KEY (id_rango_edad) REFERENCES rango_edad(id_rango_edad),
|
|
||||||
FOREIGN KEY (id_genero) REFERENCES genero(id_genero)
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
-- 2. TABLA INFO_CANDIDATOS (datos extendidos)
|
|
||||||
CREATE TABLE info_candidatos (
|
|
||||||
id_candidato INT UNSIGNED PRIMARY KEY,
|
|
||||||
|
|
||||||
id_pais INT NOT NULL,
|
|
||||||
id_estado INT DEFAULT NULL,
|
|
||||||
id_municipio INT DEFAULT NULL,
|
|
||||||
id_colonia INT DEFAULT NULL,
|
|
||||||
|
|
||||||
id_nivel TINYINT UNSIGNED NOT NULL,
|
|
||||||
id_giro TINYINT UNSIGNED NOT NULL,
|
|
||||||
|
|
||||||
nombre_empresa_institucion VARCHAR(150) NOT NULL,
|
|
||||||
id_motivo_examen INT NOT NULL,
|
|
||||||
|
|
||||||
calificacion_servicio TINYINT NOT NULL,
|
|
||||||
consentimiento_pub TINYINT NOT NULL,
|
|
||||||
|
|
||||||
FOREIGN KEY (id_candidato) REFERENCES candidato(id_candidato)
|
|
||||||
ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY (id_pais) REFERENCES paises(id),
|
|
||||||
FOREIGN KEY (id_estado) REFERENCES estados(id),
|
|
||||||
FOREIGN KEY (id_municipio) REFERENCES municipios(id),
|
|
||||||
FOREIGN KEY (id_colonia) REFERENCES colonias(id),
|
|
||||||
FOREIGN KEY (id_nivel) REFERENCES nivel_estudio(id_nivel),
|
|
||||||
FOREIGN KEY (id_giro) REFERENCES giro(id_giro),
|
|
||||||
FOREIGN KEY (id_motivo_examen) REFERENCES motivo_examen(id)
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
CREATE TABLE usuario (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
usuario VARCHAR(150) UNIQUE NOT NULL,
|
|
||||||
contrasena VARCHAR(255) NOT NULL
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
|
|
||||||
-- OAuth 2.0
|
|
||||||
CREATE TABLE oauth_clients (
|
|
||||||
client_id VARCHAR(80) NOT NULL,
|
|
||||||
client_secret VARCHAR(80) NOT NULL,
|
|
||||||
redirect_uri VARCHAR(2000) DEFAULT NULL,
|
|
||||||
grant_types VARCHAR(80) DEFAULT NULL,
|
|
||||||
scope VARCHAR(4000) DEFAULT NULL,
|
|
||||||
user_id VARCHAR(80) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (client_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE oauth_access_tokens (
|
|
||||||
access_token VARCHAR(255) NOT NULL,
|
|
||||||
client_id VARCHAR(80) NOT NULL,
|
|
||||||
user_id VARCHAR(80) DEFAULT NULL,
|
|
||||||
expires TIMESTAMP NOT NULL,
|
|
||||||
scope VARCHAR(4000) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (access_token)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE oauth_refresh_tokens (
|
|
||||||
refresh_token VARCHAR(40) NOT NULL,
|
|
||||||
client_id VARCHAR(80) NOT NULL,
|
|
||||||
user_id VARCHAR(80) DEFAULT NULL,
|
|
||||||
expires TIMESTAMP NOT NULL,
|
|
||||||
scope VARCHAR(4000) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (refresh_token)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE oauth_scopes (
|
|
||||||
scope VARCHAR(80) NOT NULL,
|
|
||||||
is_default BOOLEAN,
|
|
||||||
PRIMARY KEY (scope)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
-- DML -------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- Inserción catalogo "genero":
|
|
||||||
INSERT INTO genero (id_genero, descripcion) VALUES
|
|
||||||
(1, 'Masculino'),
|
|
||||||
(2, 'Femenino'),
|
|
||||||
(3, 'Prefiero no decir');
|
|
||||||
|
|
||||||
-- Inserción catalogo "rango_edad":
|
|
||||||
INSERT INTO rango_edad (id_rango_edad, descripcion) VALUES
|
|
||||||
(1, 'Menos de 18'),
|
|
||||||
(2, '18-24'),
|
|
||||||
(3, '24-34'),
|
|
||||||
(4, '35-44'),
|
|
||||||
(5, '44-54'),
|
|
||||||
(6, '55-64'),
|
|
||||||
(7, '65 o más');
|
|
||||||
|
|
||||||
-- Inserción catalogo "tipo_identificacion":
|
|
||||||
INSERT INTO tipo_identificacion (id_tipo_id, descripcion) VALUES
|
|
||||||
(1, 'Credencial de estudiante'),
|
|
||||||
(2, 'INE'),
|
|
||||||
(3, 'Pasaporte'),
|
|
||||||
(4, 'Licencia de conducir'),
|
|
||||||
(5, 'Cartilla militar');
|
|
||||||
|
|
||||||
-- Inserción catalogo "nivel_estudio":
|
|
||||||
INSERT INTO nivel_estudio (id_nivel, descripcion) VALUES
|
|
||||||
(1, 'Primaria'),
|
|
||||||
(2, 'Secundaria'),
|
|
||||||
(3, 'Bachillerato'),
|
|
||||||
(4, 'Técnico Superior Universitario'),
|
|
||||||
(5, 'Licenciatura'),
|
|
||||||
(6, 'Maestría'),
|
|
||||||
(7, 'Doctorado'),
|
|
||||||
(8, 'Otro');
|
|
||||||
|
|
||||||
-- Inserción catalogo "giro_empresa" considerando los giros de las empresas más comunes:
|
|
||||||
INSERT INTO giro (id_giro, descripcion) VALUES
|
|
||||||
(1, 'Tecnologías de la información'),
|
|
||||||
(2, 'Gobierno'),
|
|
||||||
(3, 'Finanzas'),
|
|
||||||
(4, 'Salud'),
|
|
||||||
(5, 'Educación'),
|
|
||||||
(6, 'Telecomunicaciones'),
|
|
||||||
(7, 'Retail'),
|
|
||||||
(8, 'Manufactura'),
|
|
||||||
(9, 'Logística y transporte'),
|
|
||||||
(10, 'Construcción'),
|
|
||||||
(11, 'Turismo y hospitalidad'),
|
|
||||||
(12, 'Energía y recursos Naturales'),
|
|
||||||
(13, 'Agricultura y alimentación'),
|
|
||||||
(14, 'Medios de comunicación y entretenimiento'),
|
|
||||||
(15, 'Otros');
|
|
||||||
|
|
||||||
-- Inserción catalogo "examen" se refiere al nombre de la organización a la que pertence el examen:
|
|
||||||
INSERT INTO examen (id_examen, nombre_examen) VALUES
|
|
||||||
(1, 'Cisco'),
|
|
||||||
(2, 'IBM'),
|
|
||||||
(3, 'Microsoft'),
|
|
||||||
(4, 'Oracle'),
|
|
||||||
(5, 'SAP'),
|
|
||||||
(6, 'CompTIA'),
|
|
||||||
(7, 'Amazon Web Services'),
|
|
||||||
(8, 'Google Cloud Platform'),
|
|
||||||
(9, 'Salesforce'),
|
|
||||||
(10, 'Red Hat'),
|
|
||||||
(11, 'VMware'),
|
|
||||||
(12, 'Palo Alto Networks'),
|
|
||||||
(13, 'Fortinet'),
|
|
||||||
(14, 'Juniper Networks'),
|
|
||||||
(15, 'Otros');
|
|
||||||
|
|
||||||
-- Depues de importar la bd de inegi
|
|
||||||
insert into paises(nombre) values('Otro');
|
|
||||||
|
|
||||||
-- Inserts para poblar la tabla motivos_examen_certificacion
|
|
||||||
INSERT INTO motivo_examen (descripcion) VALUES
|
|
||||||
('Mejora u oportunidad laboral'),
|
|
||||||
('Requisito de la empresa o puesto'),
|
|
||||||
('Incremento salarial'),
|
|
||||||
('Crecimiento personal'),
|
|
||||||
('Cambio de carrera o sector laboral'),
|
|
||||||
('Requisito académico'),
|
|
||||||
('Mantenerse actualizado'),
|
|
||||||
('Requisito para obtener otra certificación de nivel superior');
|
|
||||||
|
|
||||||
INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id)
|
|
||||||
VALUES ('testclient', 'testpass', NULL, 'client_credentials', 'basic', NULL);
|
|
||||||
|
|
||||||
INSERT INTO oauth_scopes (scope, is_default) VALUES ('basic', true);
|
|
|
@ -1,166 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css'>
|
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="../css/inicio.css">
|
|
||||||
<link rel="stylesheet" href="../font/bootstrap-icons.css">
|
|
||||||
<link rel="stylesheet" href="../css/consultar-api.css">
|
|
||||||
<title>API Candidatos</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="inicio.html"><i class='bx bxs-dashboard icon' ></i>Dashboard</a></li>
|
|
||||||
<li><a href="formulario-candidato.html" target="_blank"><i class='bx bxs-dashboard icon' ></i>Formulario de registro</a></li>
|
|
||||||
<li><a href="control-candidatos.php"><i class='bx bxs-dashboard icon' ></i>Control candidatos</a></li>
|
|
||||||
<li><a href="control-usuarios.php"><i class='bx bxs-dashboard icon' ></i>Control usuario</a></li>
|
|
||||||
<li><a href="consultar-api.html" class="active"><i class='bx bxs-data icon' ></i>API</a></li>
|
|
||||||
<li><a href="../controllers/cerrarSesion.php"><i class="bi bi-box-arrow-left icon"></i>Cerrar sesión</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<!-- .SIDEBAR -->
|
|
||||||
|
|
||||||
|
|
||||||
<section id="content">
|
|
||||||
<!-- ========== MAIN ========== -->
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<h1 class="title" style="margin: 2% 1%">API Candidatos</h1>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6 mb-4">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h5>Credenciales del Cliente</h5>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form id="oauth-form">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="clientId" class="form-label">Client ID</label>
|
|
||||||
<input type="text" class="form-control" id="clientId" required />
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="clientSecret" class="form-label">Client Secret</label>
|
|
||||||
<input type="password" class="form-control" id="clientSecret" required />
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">Obtener Token</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6 mb-4">
|
|
||||||
<div class="card" id="token-card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h5>Estado de Autenticación</h5>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div id="token-section" class="hidden">
|
|
||||||
<div class="success-message">
|
|
||||||
<p><strong>✓ Autenticación exitosa</strong></p>
|
|
||||||
<p><strong>Token tipo:</strong> <span id="token-type">-</span></p>
|
|
||||||
<p><strong>Token válido por:</strong> <span id="expires-in">-</span> segundos</p>
|
|
||||||
<p><small class="text-muted">El token de acceso se ha guardado de forma segura</small></p>
|
|
||||||
</div>
|
|
||||||
<button id="get-candidates" class="btn btn-success">Obtener Candidatos</button>
|
|
||||||
</div>
|
|
||||||
<div id="no-token-message">
|
|
||||||
<p class="text-muted">Ingrese sus credenciales y haga clic en "Obtener Token" para comenzar.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card" id="result-card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h5>Resultados</h5>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div id="download-section" class="download-section hidden">
|
|
||||||
<h6 class="mb-3">📥 Descargar Datos</h6>
|
|
||||||
<div class="download-buttons">
|
|
||||||
<button id="download-json" class="btn btn-outline-primary download-btn">
|
|
||||||
📄 JSON
|
|
||||||
</button>
|
|
||||||
<button id="download-csv" class="btn btn-outline-success download-btn">
|
|
||||||
📊 CSV
|
|
||||||
</button>
|
|
||||||
<button id="download-excel" class="btn btn-outline-info download-btn">
|
|
||||||
📈 Excel
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<small class="text-muted d-block mt-2">
|
|
||||||
Total de registros: <span id="records-count">0</span>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="candidates-section" class="hidden">
|
|
||||||
<h4 class="mb-3">Lista de Candidatos</h4>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Nombre</th>
|
|
||||||
<th>Correo</th>
|
|
||||||
<th>Teléfono</th>
|
|
||||||
<th>Género</th>
|
|
||||||
<th>Rango Edad</th>
|
|
||||||
<th>Tipo Identificación</th>
|
|
||||||
<th>País</th>
|
|
||||||
<th>Estado</th>
|
|
||||||
<th>Municipio</th>
|
|
||||||
<th>Colonia</th>
|
|
||||||
<th>Nivel Estudio</th>
|
|
||||||
<th>Giro</th>
|
|
||||||
<th>Empresa/Institución</th>
|
|
||||||
<th>ID Examen</th>
|
|
||||||
<th>Nombre Examen</th>
|
|
||||||
<th>Motivo</th>
|
|
||||||
<th>Calificación</th>
|
|
||||||
<th>Consentimiento Publicidad</th>
|
|
||||||
<th>Fecha Entrada</th>
|
|
||||||
<th>Fecha Salida</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="candidates-table-body"></tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="api-response-section" class="hidden">
|
|
||||||
<h4 class="mb-3">Respuesta JSON</h4>
|
|
||||||
<pre id="api-response">Esperando respuesta...</pre>
|
|
||||||
</div>
|
|
||||||
<div id="error-section" class="hidden">
|
|
||||||
<div class="alert alert-danger" id="error-message"></div>
|
|
||||||
</div>
|
|
||||||
<div id="no-results-message">
|
|
||||||
<p class="text-muted">Obtenga un token y haga una solicitud para ver los resultados aquí.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<!-- .......... MAIN .......... -->
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <script src="assets/bootstrap/js/bootstrap.min.js"></script> -->
|
|
||||||
<script src="../js/consultar-api.js"></script>
|
|
||||||
<script src="../js/sidebar-navbar.js"></script>
|
|
||||||
<script src="../js/control-candidato.js"></script>
|
|
||||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script> -->
|
|
||||||
|
|
||||||
<!-- <script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script> -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,108 +0,0 @@
|
||||||
<?php
|
|
||||||
//session_start();
|
|
||||||
//
|
|
||||||
//if (!isset($_SESSION['usuario'])) {
|
|
||||||
// header('Location: ../index.html');
|
|
||||||
// session_destroy();
|
|
||||||
// exit();
|
|
||||||
//}
|
|
||||||
|
|
||||||
require_once __DIR__ . "/../controllers/ControlCandidatos.php";
|
|
||||||
|
|
||||||
$candidatoControl = new ControlCandidatos();
|
|
||||||
$resultado = $candidatoControl->obtenerCandidatosSinFechaSalida();
|
|
||||||
|
|
||||||
if(isset($resultado['estado'])){
|
|
||||||
$hayCandidatos = false;
|
|
||||||
if($resultado['estado'] == 'error'){
|
|
||||||
// Enviar un console.error con $resultado['mensaje']
|
|
||||||
echo "<script>console.error('Error: " . $resultado['mensaje'] . "');</script>";
|
|
||||||
} else {
|
|
||||||
echo "<script>console.log(" . $resultado['mensaje'] . ");</script>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$hayCandidatos = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css'>
|
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="../css/inicio.css">
|
|
||||||
<link rel="stylesheet" href="../font/bootstrap-icons.css">
|
|
||||||
<title>Control de candidatos</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="inicio.html"><i class='bx bxs-dashboard icon' ></i>Dashboard</a></li>
|
|
||||||
<li><a href="formulario-candidato.html" target="_blank"><i class='bx bxs-dashboard icon' ></i>Formulario de registro</a></li>
|
|
||||||
<li><a href="control-candidatos.php" class="active"><i class='bx bxs-dashboard icon' ></i>Control candidatos</a></li>
|
|
||||||
<li><a href="control-usuarios.php"><i class='bx bxs-dashboard icon' ></i>Control usuario</a></li>
|
|
||||||
<li><a href="consultar-api.html"><i class='bx bxs-dashboard icon' ></i>API</a></li>
|
|
||||||
<li><a href="../controllers/cerrarSesion.php"><i class="bi bi-box-arrow-left icon"></i>Cerrar sesión</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<!-- .SIDEBAR -->
|
|
||||||
|
|
||||||
|
|
||||||
<section id="content">
|
|
||||||
<!-- ========== MAIN ========== -->
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<h1 class="title" style="margin: 2% 1%">Control</h1>
|
|
||||||
|
|
||||||
<!-- ------------------------------ div qué contiene la tabla ------------------------------------------ -->
|
|
||||||
<div style="margin: 1%">
|
|
||||||
<div class="table-responsive rounded-4" style="height: 100%;width: 100%;">
|
|
||||||
<table class="table table-hover table-bordered border-dark-subtle shadow-sm">
|
|
||||||
<thead>
|
|
||||||
<tr class="table-dark">
|
|
||||||
<th>Nombre</th>
|
|
||||||
<th>Entrada</th>
|
|
||||||
<th>Acciones</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="table-group-divider">
|
|
||||||
<?php if ($hayCandidatos): ?>
|
|
||||||
<?php foreach ($resultado as $candidato): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $candidato['nombre_completo'] ?></td>
|
|
||||||
<td><?php echo $candidato['fecha_entrada'] ?></td>
|
|
||||||
<td>
|
|
||||||
<a class="btn border rounded-3 shadow" role="button" style="background-color: #35245b;color: white;" href="formulario-datos-candidato.php?id_candidato=<?php echo $candidato['id_candidato']?>" target="_blank"><i class="bi bi-file-earmark-text"></i> Abrir formulario</a>
|
|
||||||
<button class="boton-eliminar btn border rounded-3 shadow" role="button" style="background-color: #35245b;color: white;" data-id-candidato="<?php echo $candidato['id_candidato'] ?>"><i class="bi bi-trash"></i> Eliminar</button>
|
|
||||||
</td>
|
|
||||||
<tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- ------------------------------ /div qué contiene la tabla ----------------------------------------- -->
|
|
||||||
</main>
|
|
||||||
<!-- .......... MAIN .......... -->
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<script src="../js/sidebar-navbar.js"></script>
|
|
||||||
<script src="../js/control-candidato.js"></script>
|
|
||||||
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,103 +0,0 @@
|
||||||
<?php
|
|
||||||
//session_start();
|
|
||||||
//
|
|
||||||
//if (!isset($_SESSION['usuario'])) {
|
|
||||||
// header('Location: ../index.html');
|
|
||||||
// session_destroy();
|
|
||||||
// exit();
|
|
||||||
//}
|
|
||||||
|
|
||||||
require_once __DIR__ . "/../controllers/UsuarioController.php";
|
|
||||||
|
|
||||||
$resultado = UsuarioController::obtenerUsuarios();
|
|
||||||
$hayUsuarios = true;
|
|
||||||
|
|
||||||
// Si hubo algún error se retorno un array con el estado y mensaje, comprobar si existe
|
|
||||||
if (isset($resultado['estado'])){
|
|
||||||
$hayUsuarios = false;
|
|
||||||
echo "<script>console.log('".$resultado['mensaje']."');</script>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css'>
|
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="../css/inicio.css">
|
|
||||||
<link rel="stylesheet" href="../font/bootstrap-icons.css">
|
|
||||||
<title>Control de usuarios</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="inicio.html"><i class='bx bxs-dashboard icon' ></i>Dashboard</a></li>
|
|
||||||
<li><a href="formulario-candidato.html" target="_blank"><i class='bx bxs-dashboard icon' ></i>Formulario de registro</a></li>
|
|
||||||
<li><a href="control-candidatos.php"><i class='bx bxs-dashboard icon' ></i>Control candidatos</a></li>
|
|
||||||
<li><a href="control-usuarios.php" class="active"><i class='bx bxs-dashboard icon' ></i>Control usuario</a></li>
|
|
||||||
<li><a href="consultar-api.html"><i class='bx bxs-dashboard icon' ></i>API</a></li>
|
|
||||||
<li><a href="../controllers/cerrarSesion.php"><i class="bi bi-box-arrow-left icon"></i>Cerrar sesión</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<!-- .SIDEBAR -->
|
|
||||||
|
|
||||||
|
|
||||||
<section id="content">
|
|
||||||
<!-- ========== MAIN ========== -->
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<h1 class="title" style="margin: 2% 1%">Control de usuarios</h1>
|
|
||||||
|
|
||||||
<a class="btn border rounded-3 shadow" style="background-color: #35245b;color: white;margin: 1%" href="crearUsuario.php"><i class="bi bi-person-plus"></i> Crear usuario</a>
|
|
||||||
|
|
||||||
<!-- ------------------------------ div qué contiene la tabla ------------------------------------------ -->
|
|
||||||
<div style="margin: 1%">
|
|
||||||
<div class="table-responsive rounded-4" style="height: 100%;width: 100%;">
|
|
||||||
<table class="table table-hover table-bordered border-dark-subtle shadow-sm">
|
|
||||||
<thead>
|
|
||||||
<tr class="table-dark">
|
|
||||||
<th>Nombre</th>
|
|
||||||
<th>Acciones</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="table-group-divider">
|
|
||||||
<?php if ($hayUsuarios): ?>
|
|
||||||
<?php foreach ($resultado as $usuario): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $usuario['usuario'] ?></td>
|
|
||||||
<td>
|
|
||||||
<a class="btn border rounded-3 shadow" role="button" style="background-color: #35245b;color: white;" href="modificar-usuario.php?id=<?php echo $usuario['id'] ?>&usuario=<?php echo urlencode($usuario['usuario']) ?>"><i class="bi bi-pencil-square"></i> Modificar</a>
|
|
||||||
<button class="boton-eliminar btn border rounded-3 shadow" role="button" style="background-color: #35245b;color: white;" data-id-usuario="<?php echo $usuario['id'] ?>" data-nombre-usuario="<?php echo $usuario['usuario'] ?>"><i class="bi bi-trash"></i> Eliminar</button>
|
|
||||||
</td>
|
|
||||||
<tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- ------------------------------ /div qué contiene la tabla ----------------------------------------- -->
|
|
||||||
</main>
|
|
||||||
<!-- .......... MAIN .......... -->
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<script src="../js/sidebar-navbar.js"></script>
|
|
||||||
<script src="../js/control-usuario.js"></script>
|
|
||||||
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,105 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../models/CandidatoModel.php';
|
|
||||||
|
|
||||||
class CandidatoController {
|
|
||||||
private static $candidatoModel = null;
|
|
||||||
|
|
||||||
public static function inicializar() {
|
|
||||||
if (self::$candidatoModel === null) {
|
|
||||||
self::$candidatoModel = new CandidatoModel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function registrarCandidato() {
|
|
||||||
|
|
||||||
$nombres = $_POST['nombres'];
|
|
||||||
$primer_apellido = $_POST['primer_apellido'];
|
|
||||||
$segundo_apellido = $_POST['segundo_apellido'];
|
|
||||||
$correo = $_POST['correo'];
|
|
||||||
$telefono = $_POST['telefono'];
|
|
||||||
$id_examen = $_POST['id_examen'];
|
|
||||||
$id_tipo_id = $_POST['id_tipo_id'];
|
|
||||||
$id_rango_edad = $_POST['id_rango_edad'];
|
|
||||||
$id_genero = $_POST['id_genero'];
|
|
||||||
|
|
||||||
return self::$candidatoModel->registrarCandidato(
|
|
||||||
$nombres,
|
|
||||||
$primer_apellido,
|
|
||||||
$segundo_apellido,
|
|
||||||
$correo,
|
|
||||||
$telefono,
|
|
||||||
$id_examen,
|
|
||||||
$id_tipo_id,
|
|
||||||
$id_rango_edad,
|
|
||||||
$id_genero
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function registrarInfoCandidato() {
|
|
||||||
$id_candidato = $_POST['id_candidato'];
|
|
||||||
|
|
||||||
$exiteInfo = self::existeRegistroInfoCandidato($id_candidato);
|
|
||||||
if ($exiteInfo) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Ya existe un registro de información para este candidato."
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!self::existeIdCandidato($id_candidato)){
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "El ID del candidato no existe."
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$id_pais = $_POST['id_pais'];
|
|
||||||
$id_estado = $_POST['id_estado'];
|
|
||||||
$id_municipio = $_POST['id_municipio'];
|
|
||||||
$id_colonia = $_POST['id_colonia'];
|
|
||||||
$id_nivel = $_POST['id_nivel'];
|
|
||||||
$id_giro = $_POST['id_giro'];
|
|
||||||
$nombre_empresa_institucion = $_POST['nombre_empresa_institucion'];
|
|
||||||
$motivo_examen = $_POST['motivo_examen'];
|
|
||||||
$calificacion_servicio = $_POST['calificacion_servicio'];
|
|
||||||
$consentimiento_pub = $_POST['consentimiento_pub'];
|
|
||||||
|
|
||||||
$fecha_salida = $_POST['fecha_salida'];
|
|
||||||
|
|
||||||
return self::$candidatoModel->registrarInfoCandidatos(
|
|
||||||
$id_candidato,
|
|
||||||
$id_pais,
|
|
||||||
$id_estado,
|
|
||||||
$id_municipio,
|
|
||||||
$id_colonia,
|
|
||||||
$id_nivel,
|
|
||||||
$id_giro,
|
|
||||||
$nombre_empresa_institucion,
|
|
||||||
$motivo_examen,
|
|
||||||
$calificacion_servicio,
|
|
||||||
$consentimiento_pub,
|
|
||||||
$fecha_salida
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function existeRegistroInfoCandidato($id_candidato) {
|
|
||||||
return self::$candidatoModel->verificarRegistroInfoCandidato($id_candidato);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function existeIdCandidato($id_candidato){
|
|
||||||
$resultado = self::$candidatoModel->existeIdCandidato($id_candidato);
|
|
||||||
if($resultado['estado'] === 'exitoso'){
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Instanciar el modelo al cargar el controlador
|
|
||||||
CandidatoController::inicializar();
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,102 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../models/CatalogosModel.php';
|
|
||||||
|
|
||||||
class CatalogosController {
|
|
||||||
private static $catalogosModel = null;
|
|
||||||
|
|
||||||
public static function inicializar() {
|
|
||||||
if (self::$catalogosModel === null) {
|
|
||||||
self::$catalogosModel = new Catalogos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerInfiCodigoPostal($codigo_postal){
|
|
||||||
return self::$catalogosModel->obtenerInfiCodigoPostal($codigo_postal);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerGiros(){
|
|
||||||
return self::$catalogosModel->obtenerGiros();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerNombresExamenes(){
|
|
||||||
return self::$catalogosModel->obtenerNombresExamenes();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerTiposIdentificacion(){
|
|
||||||
return self::$catalogosModel->obtenerTiposIdentificacion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerRangosEdad(){
|
|
||||||
return self::$catalogosModel->obtenerRangosEdad();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerNivelesEstudio(){
|
|
||||||
return self::$catalogosModel->obtenerNivelesEstudio();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerNombresEmpresasInstituciones(){
|
|
||||||
return self::$catalogosModel->obtenerNombresEmpresasInstituciones();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerMotivosExamen(){
|
|
||||||
return self::$catalogosModel->obtenerMotivosExamen();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CatalogosController::inicializar();
|
|
||||||
|
|
||||||
// Petición GET para información del código postal
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['codigo_postal'])) {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$codigo_postal = $_GET['codigo_postal'];
|
|
||||||
$result = CatalogosController::obtenerInfiCodigoPostal($codigo_postal);
|
|
||||||
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['obtener']) && $_GET['obtener'] === 'giros') {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$result = CatalogosController::obtenerGiros();
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['obtener']) && $_GET['obtener'] === 'examenes') {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$result = CatalogosController::obtenerNombresExamenes();
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['obtener']) && $_GET['obtener'] === 'identificacion') {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$result = CatalogosController::obtenerTiposIdentificacion();
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['obtener']) && $_GET['obtener'] === 'rangosedad') {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$result = CatalogosController::obtenerRangosEdad();
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['obtener']) && $_GET['obtener'] === 'nivelesestudio') {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$result = CatalogosController::obtenerNivelesEstudio();
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['obtener']) && $_GET['obtener'] === 'empresasinstituciones') {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$result = CatalogosController::obtenerNombresEmpresasInstituciones();
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['obtener']) && $_GET['obtener'] === 'motivos') {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
$result = CatalogosController::obtenerMotivosExamen();
|
|
||||||
echo json_encode($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../models/CandidatoModel.php';
|
|
||||||
|
|
||||||
class ControlCandidatos {
|
|
||||||
|
|
||||||
private $candidatoModel;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->candidatoModel = new CandidatoModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerCandidatosSinFechaSalida(){
|
|
||||||
$resultado = $this->candidatoModel->obtenerCandidatosSinFechaSalida();
|
|
||||||
if( isset($resultado['estado'])){
|
|
||||||
return $resultado;
|
|
||||||
} else {
|
|
||||||
// iterar sobre $resultado y concatenar nombre completo, la fecha dejarla como esta
|
|
||||||
$candidatos = [];
|
|
||||||
foreach ($resultado as $candidato) {
|
|
||||||
$nombreCompleto = "{$candidato['nombres']} {$candidato['primer_apellido']} {$candidato['segundo_apellido']}";
|
|
||||||
$candidatos[] = [
|
|
||||||
'id_candidato' => $candidato['id_candidato'],
|
|
||||||
'nombre_completo' => $nombreCompleto,
|
|
||||||
'fecha_entrada' => $candidato['fecha_entrada']
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return $candidatos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function eliminarCandidato($id_candidato){
|
|
||||||
return $this->candidatoModel->eliminarCandidato($id_candidato);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
require_once __DIR__ . '/UsuarioController.php';
|
|
||||||
|
|
||||||
// Inicializar el modelo de usuario
|
|
||||||
UsuarioController::inicializar();
|
|
||||||
|
|
||||||
if ( $_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
|
|
||||||
$usuario = isset($_POST['numero-personal']) ? $_POST['numero-personal'] : '';
|
|
||||||
$contrasena = isset($_POST['contrasena']) ? $_POST['contrasena'] : '';
|
|
||||||
|
|
||||||
// Iniciar sesión y obtener respuesta
|
|
||||||
$respuesta = UsuarioController::iniciarSesion($usuario, $contrasena);
|
|
||||||
|
|
||||||
|
|
||||||
if ($respuesta['estado'] === 'exitoso') {
|
|
||||||
// Iniciar sesión
|
|
||||||
session_start();
|
|
||||||
$_SESSION['usuario'] = $usuario;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($respuesta);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Metodo no permitido
|
|
||||||
echo json_encode([
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Método no permitido'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,56 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../models/UsuarioModel.php';
|
|
||||||
|
|
||||||
|
|
||||||
class UsuarioController{
|
|
||||||
private static $usuarioModel = null;
|
|
||||||
|
|
||||||
public static function inicializar() {
|
|
||||||
if (self::$usuarioModel === null) {
|
|
||||||
self::$usuarioModel = new UsuarioModel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function obtenerUsuarios(){
|
|
||||||
return self::$usuarioModel->obtenerUsuarios();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function iniciarSesion($usuario, $contrasena){
|
|
||||||
return self::$usuarioModel->iniciarSesion($usuario, $contrasena);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function existeUsuario($usuario){
|
|
||||||
$usuario = self::$usuarioModel->buscarUsuario($usuario);
|
|
||||||
if ( isset($usuario['usuario']) ) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function crearUsuario($usuario, $contrasena){
|
|
||||||
if ( self::existeUsuario($usuario) ) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'El usuario ya existe.'
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
return self::$usuarioModel->crearUsuario($usuario, $contrasena);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function eliminarUsuario($id_usuario){
|
|
||||||
return self::$usuarioModel->eliminarUsuario($id_usuario);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function actualizarUsuario($id, $usuario, $contrasena){
|
|
||||||
return self::$usuarioModel->actualizarUsuario($id, $usuario, $contrasena);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# Instanciar el modelo al cargar el controlador
|
|
||||||
UsuarioController::inicializar();
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once __DIR__ . '/UsuarioController.php';
|
|
||||||
header('Content-type: application/json');
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|
||||||
$id = $_POST['id'];
|
|
||||||
$usuario = $_POST['usuario'];
|
|
||||||
$contrasena = $_POST['contrasena'];
|
|
||||||
|
|
||||||
$resultado = UsuarioController::actualizarUsuario($id, $usuario, $contrasena);
|
|
||||||
echo json_encode($resultado);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode([
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Método no permitido.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
session_destroy();
|
|
||||||
header('Location: ../index.html');
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once __DIR__ . '/UsuarioController.php';
|
|
||||||
header('Content-type: application/json');
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|
||||||
$usuario = $_POST['usuario'];
|
|
||||||
$contrasena = $_POST['contrasena'];
|
|
||||||
|
|
||||||
$resultado = UsuarioController::crearUsuario($usuario, $contrasena);
|
|
||||||
echo json_encode($resultado);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode([
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Método no permitido.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
header('Content-Type: application/json', 'charset=UTF-8');
|
|
||||||
require_once __DIR__ . '/ControlCandidatos.php';
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['id_candidato'])) {
|
|
||||||
$candidatoController = new ControlCandidatos();
|
|
||||||
$id_candidato = $_POST['id_candidato'];
|
|
||||||
$resultado = $candidatoController->eliminarCandidato($id_candidato);
|
|
||||||
echo json_encode($resultado);
|
|
||||||
} else {
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode([
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Método no permitido.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
header('Content-Type: application/json', 'charset=UTF-8');
|
|
||||||
require_once __DIR__ . '/UsuarioController.php';
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['id_usuario'])) {
|
|
||||||
$id_usuario = $_POST['id_usuario'];
|
|
||||||
$resultado = UsuarioController::eliminarUsuario($id_usuario);
|
|
||||||
echo json_encode($resultado);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode([
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Método no permitido.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,525 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once '../config/Database.php';
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
$input = json_decode(file_get_contents('php://input'), true);
|
|
||||||
$tipoConsulta = $input['tipoConsulta'] ?? '';
|
|
||||||
|
|
||||||
$filtros = [
|
|
||||||
'id_rango_edad' => $input['id_rango_edad'] ?? null,
|
|
||||||
'id_genero' => $input['id_genero'] ?? null,
|
|
||||||
'id_examen' => $input['id_examen'] ?? null,
|
|
||||||
'fechaInicio' => $input['fechaInicio'] ?? null,
|
|
||||||
'fechaFin' => $input['fechaFin'] ?? null,
|
|
||||||
];
|
|
||||||
|
|
||||||
$graficos = new Graficos();
|
|
||||||
|
|
||||||
switch ($tipoConsulta) {
|
|
||||||
case 'Femenino':
|
|
||||||
$cantidad = $graficos->obtenerGeneroFemenino($filtros);
|
|
||||||
break;
|
|
||||||
case 'Masculino':
|
|
||||||
$cantidad = $graficos->obtenerGeneroMasculino($filtros);
|
|
||||||
break;
|
|
||||||
case 'Prefiero no decirlo':
|
|
||||||
$cantidad = $graficos->obtenerGeneroNoDefinido($filtros);
|
|
||||||
break;
|
|
||||||
case 'Menor de 18 años':
|
|
||||||
$cantidad = $graficos->obtenerEdadMenor18($filtros);
|
|
||||||
break;
|
|
||||||
case '18 a 24 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad1824($filtros);
|
|
||||||
break;
|
|
||||||
case '25 a 34 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad2434($filtros);
|
|
||||||
break;
|
|
||||||
case '35 a 44 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad3544($filtros);
|
|
||||||
break;
|
|
||||||
case '45 a 54 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad4554($filtros);
|
|
||||||
break;
|
|
||||||
case '55 a 64 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad5564($filtros);
|
|
||||||
break;
|
|
||||||
case '65 años o más':
|
|
||||||
$cantidad = $graficos->obtenerEdad65oMas($filtros);
|
|
||||||
break;
|
|
||||||
case 'Estados':
|
|
||||||
$cantidad = $graficos->obtenerEstados($filtros);
|
|
||||||
echo json_encode($cantidad);
|
|
||||||
exit;
|
|
||||||
case 'Examenes':
|
|
||||||
$cantidad = $graficos->obtenerExamenes($filtros);
|
|
||||||
echo json_encode($cantidad);
|
|
||||||
exit;
|
|
||||||
case 'Fechas':
|
|
||||||
$fechaInicio = $input['fechaInicio'] ?? '';
|
|
||||||
$fechaFin = $input['fechaFin'] ?? '';
|
|
||||||
$cantidad = $graficos->obtenerFecha($fechaInicio, $fechaFin);
|
|
||||||
echo json_encode($cantidad);
|
|
||||||
exit;
|
|
||||||
default:
|
|
||||||
$cantidad = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(['cantidad' => $cantidad]);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Graficos{
|
|
||||||
private $Database;
|
|
||||||
protected $db;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->Database = new Database();
|
|
||||||
$this->db = $this->Database->getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroFemenino($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS Femenino FROM candidato WHERE id_genero = 2";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['Femenino'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroMasculino($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS Masculino FROM candidato WHERE id_genero = 1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['Masculino'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroNoDefinido($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS NoDefinido FROM candidato WHERE id_genero = 3";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['NoDefinido'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdadMenor18($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS menorEdad FROM candidato WHERE id_rango_edad = 1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['menorEdad'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad1824($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad1824 FROM candidato WHERE id_rango_edad = 2";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad1824'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad2434($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad2434 FROM candidato WHERE id_rango_edad = 3";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad2434'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad3544($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad3544 FROM candidato WHERE id_rango_edad = 4";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad3544'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad4554($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad4554 FROM candidato WHERE id_rango_edad = 5";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad4554'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad5564($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad5564 FROM candidato WHERE id_rango_edad = 6";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad5564'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad65oMas($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad65oMas FROM candidato WHERE id_rango_edad = 7";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad65oMas'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEstados($filtros = []) {
|
|
||||||
$sql = "SELECT estados.nombre AS estado, COUNT(*) AS cantidad
|
|
||||||
FROM candidato
|
|
||||||
INNER JOIN info_candidatos ON candidato.id_candidato = info_candidatos.id_candidato
|
|
||||||
INNER JOIN estados ON info_candidatos.id_estado = estados.id
|
|
||||||
WHERE 1=1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_genero']) && $filtros['id_genero'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_genero = ?";
|
|
||||||
$params[] = $filtros['id_genero'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(candidato.fecha_entrada) >= ? AND DATE(candidato.fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= " GROUP BY estados.nombre ORDER BY estados.nombre";
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$estados = [];
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$estados[] = $data;
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $estados;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerExamenes($filtros = []) {
|
|
||||||
$sql = "SELECT examen.nombre_examen AS examen, COUNT(*) AS cantidad
|
|
||||||
FROM candidato
|
|
||||||
LEFT JOIN examen ON candidato.id_examen = examen.id_examen
|
|
||||||
WHERE 1=1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_genero']) && $filtros['id_genero'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_genero = ?";
|
|
||||||
$params[] = $filtros['id_genero'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(candidato.fecha_entrada) >= ? AND DATE(candidato.fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= " GROUP BY examen.nombre_examen ORDER BY examen.nombre_examen";
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$examenes = [];
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$examenes[] = $data;
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $examenes;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerFecha($fechaInicio, $fechaFin) {
|
|
||||||
$sql = "SELECT COUNT(*) AS cantidad
|
|
||||||
FROM candidato
|
|
||||||
WHERE DATE(fecha_entrada) >= ? AND DATE(fecha_entrada) <= ?";
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
$query->bind_param("ss", $fechaInicio, $fechaFin);
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$query->close();
|
|
||||||
// Devuelve un array con un solo objeto para mantener compatibilidad con el frontend
|
|
||||||
return [ [ 'cantidad' => $data['cantidad'], 'fechaInicio' => $fechaInicio, 'fechaFin' => $fechaFin ] ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,59 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once '../config/Database.php';
|
|
||||||
require_once '../models/GraficoModel.php';
|
|
||||||
|
|
||||||
header('Content-Type: application/json'); // Aseguramos que siempre se devuelva JSON
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
$input = json_decode(file_get_contents('php://input'), true);
|
|
||||||
$tipoConsulta = $input['tipoConsulta'] ?? '';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch ($tipoConsulta) {
|
|
||||||
case 'Femenino':
|
|
||||||
$cantidad = GraficoModel::obtenerGeneroFemenino();
|
|
||||||
break;
|
|
||||||
case 'Masculino':
|
|
||||||
$cantidad = GraficoModel::obtenerGeneroMasculino();
|
|
||||||
break;
|
|
||||||
case 'Prefiero no decirlo':
|
|
||||||
$cantidad = GraficoModel::obtenerGeneroNoDefinido();
|
|
||||||
break;
|
|
||||||
case 'Menor de 18 años':
|
|
||||||
$cantidad = GraficoModel::obtenerEdadMenor18();
|
|
||||||
break;
|
|
||||||
case '18 a 24 años':
|
|
||||||
$cantidad = GraficoModel::obtenerEdad1824();
|
|
||||||
break;
|
|
||||||
case '25 a 34 años':
|
|
||||||
$cantidad = GraficoModel::obtenerEdad2434();
|
|
||||||
break;
|
|
||||||
case '35 a 44 años':
|
|
||||||
$cantidad = GraficoModel::obtenerEdad3544();
|
|
||||||
break;
|
|
||||||
case '45 a 54 años':
|
|
||||||
$cantidad = GraficoModel::obtenerEdad4554();
|
|
||||||
break;
|
|
||||||
case '55 a 64 años':
|
|
||||||
$cantidad = GraficoModel::obtenerEdad5564();
|
|
||||||
break;
|
|
||||||
case '65 años o más':
|
|
||||||
$cantidad = GraficoModel::obtenerEdad65oMas();
|
|
||||||
break;
|
|
||||||
case 'Estados':
|
|
||||||
$cantidad = GraficoModel::obtenerEstados();
|
|
||||||
echo json_encode($cantidad); // Devolver directamente el array de estados
|
|
||||||
exit; // Terminar la ejecucion aqui
|
|
||||||
case 'Examenes':
|
|
||||||
$cantidad = GraficoModel::obtenerExamenes();
|
|
||||||
echo json_encode($cantidad); // Devolver directamente el array de examenes
|
|
||||||
exit; // Terminar la ejecucion aqui
|
|
||||||
default:
|
|
||||||
$cantidad = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(['cantidad' => $cantidad]);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1 +0,0 @@
|
||||||
<?php
|
|
|
@ -1,81 +0,0 @@
|
||||||
<?php
|
|
||||||
//session_start();
|
|
||||||
//
|
|
||||||
//if (!isset($_SESSION['usuario'])) {
|
|
||||||
// header('Location: ../index.html');
|
|
||||||
// session_destroy();
|
|
||||||
// exit();
|
|
||||||
//}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="../font/bootstrap-icons.css">
|
|
||||||
<link rel="stylesheet" href="../css/inicio.css">
|
|
||||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css'>
|
|
||||||
<title>Crear usuario</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="inicio.html"><i class='bx bxs-dashboard icon' ></i>Dashboard</a></li>
|
|
||||||
<li><a href="formulario-candidato.html" target="_blank"><i class='bx bxs-dashboard icon' ></i>Formulario de registro</a></li>
|
|
||||||
<li><a href="control-candidatos.php"><i class='bx bxs-dashboard icon' ></i>Control candidatos</a></li>
|
|
||||||
<li><a href="control-usuarios.php" class="active"><i class='bx bxs-dashboard icon' ></i>Control usuario</a></li>
|
|
||||||
<li><a href="../controllers/cerrarSesion.php"><i class="bi bi-box-arrow-left icon"></i>Cerrar sesión</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<!-- .SIDEBAR -->
|
|
||||||
|
|
||||||
|
|
||||||
<section id="content">
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<h1 class="title" style="margin: 2% 1%">Crear usuario</h1>
|
|
||||||
|
|
||||||
<!-- div de formulario ------------------------------------------------------------------------------------- -->
|
|
||||||
<div class="bg-light-subtle border border-dark-subtle shadow-sm rounded-3" style="margin: 1%">
|
|
||||||
<div style="margin:5%;">
|
|
||||||
<form id="form">
|
|
||||||
<label class="form-label" for="usuario" style="margin: 8px 0px 8px 0px;"><i class="bi bi-person"></i> Nombre de usuario</label>
|
|
||||||
<input class="border rounded border-dark-subtle form-control" type="text" id="usuario" required="" minlength="1" maxlength="150" pattern="^[a-zA-Z0-9]+$" />
|
|
||||||
|
|
||||||
<label class="form-label" for="contrasena" style="margin: 8px 0px 8px 0px;"><i class="bi bi-key"></i> Contraseña</label>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="input-group">
|
|
||||||
<input class="form-control" type="password" id="contrasena" required="" minlength="1"/>
|
|
||||||
<button class="btn btn-light" id="togglePassword" type="button" style="border: var(--bs-border-width) solid var(--bs-border-color);"><i class="bi bi-eye"></i></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<label class="form-label" for="contrasena" style="margin: 8px 0px 8px 0px;"><i class="bi bi-key"></i> Vuelva a escribir la contraseña</label>
|
|
||||||
<input class="form-control" type="password" id="contrasena_verificacion" required="" minlength="1"/>
|
|
||||||
|
|
||||||
<input class="btn text-light w-100" type="submit" id="submit" style="margin: 8px 0px 8px 0px;background-color: #35245b"/ value="Crear usuario">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- /div de formulario ------------------------------------------------------------------------------------ -->
|
|
||||||
</main>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<script src="../js/sidebar-navbar.js"></script>
|
|
||||||
<script src="../js/crear-usuario.js"></script>
|
|
||||||
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,38 +0,0 @@
|
||||||
.token-info {
|
|
||||||
word-break: break-all;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
pre {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.success-message {
|
|
||||||
background-color: #d4edda;
|
|
||||||
border-color: #c3e6cb;
|
|
||||||
color: #155724;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
.download-section {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
border: 1px solid #dee2e6;
|
|
||||||
}
|
|
||||||
.download-buttons {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.download-btn {
|
|
||||||
min-width: 120px;
|
|
||||||
}
|
|
517
css/form.css
517
css/form.css
|
@ -1,517 +0,0 @@
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');
|
|
||||||
|
|
||||||
* {
|
|
||||||
font-family: 'Open Sans', sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root {
|
|
||||||
--grey: #F1F0F6;
|
|
||||||
--dark-grey: #8D8D8D;
|
|
||||||
--light: #fff;
|
|
||||||
--dark: #000;
|
|
||||||
--green: #81D43A;
|
|
||||||
--light-green: #E3FFCB;
|
|
||||||
--blue: #35245b;
|
|
||||||
--light-blue: #D0E4FF;
|
|
||||||
--dark-blue: #0c1b5e;
|
|
||||||
--red: #FC3B56;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background: var(--grey);
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* SIDEBAR */
|
|
||||||
#sidebar {
|
|
||||||
position: fixed;
|
|
||||||
max-width: 260px;
|
|
||||||
width: 100%;
|
|
||||||
background: var(--light);
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 100%;
|
|
||||||
overflow-y: auto;
|
|
||||||
scrollbar-width: none;
|
|
||||||
transition: all .3s ease;
|
|
||||||
z-index: 200;
|
|
||||||
}
|
|
||||||
#sidebar.hide {
|
|
||||||
max-width: 60px;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover {
|
|
||||||
max-width: 260px;
|
|
||||||
}
|
|
||||||
#sidebar::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#sidebar .brand {
|
|
||||||
font-size: 24px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: 64px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--blue);
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 100;
|
|
||||||
background: var(--light);
|
|
||||||
transition: all .3s ease;
|
|
||||||
padding: 0 6px;
|
|
||||||
}
|
|
||||||
#sidebar .icon {
|
|
||||||
min-width: 48px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-right: 6px;
|
|
||||||
}
|
|
||||||
#sidebar .icon-right {
|
|
||||||
margin-left: auto;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
#sidebar .side-menu {
|
|
||||||
margin: 36px 0;
|
|
||||||
padding: 0 20px;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
#sidebar.hide .side-menu {
|
|
||||||
padding: 0 6px;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover .side-menu {
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
|
||||||
#sidebar .side-menu a {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--dark);
|
|
||||||
padding: 12px 16px 12px 0;
|
|
||||||
transition: all .3s ease;
|
|
||||||
border-radius: 10px;
|
|
||||||
margin: 4px 0;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
#sidebar .side-menu > li > a:hover {
|
|
||||||
background: var(--grey);
|
|
||||||
}
|
|
||||||
#sidebar .side-menu > li > a.active .icon-right {
|
|
||||||
transform: rotateZ(90deg);
|
|
||||||
}
|
|
||||||
#sidebar .side-menu > li > a.active,
|
|
||||||
#sidebar .side-menu > li > a.active:hover {
|
|
||||||
background: var(--blue);
|
|
||||||
color: var(--light);
|
|
||||||
}
|
|
||||||
#sidebar .divider {
|
|
||||||
margin-top: 24px;
|
|
||||||
font-size: 12px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--dark-grey);
|
|
||||||
transition: all .3s ease;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover .divider {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
#sidebar.hide .divider {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#sidebar .side-dropdown {
|
|
||||||
padding-left: 54px;
|
|
||||||
max-height: 0;
|
|
||||||
overflow-y: hidden;
|
|
||||||
transition: all .15s ease;
|
|
||||||
}
|
|
||||||
#sidebar .side-dropdown.show {
|
|
||||||
max-height: 1000px;
|
|
||||||
}
|
|
||||||
#sidebar .side-dropdown a:hover {
|
|
||||||
color: var(--blue);
|
|
||||||
}
|
|
||||||
#sidebar .ads {
|
|
||||||
width: 100%;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
#sidebar.hide .ads {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover .ads {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
#sidebar .ads .wrapper {
|
|
||||||
background: var(--grey);
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
#sidebar .btn-upgrade {
|
|
||||||
font-size: 14px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 12px 0;
|
|
||||||
color: var(--light);
|
|
||||||
background: var(--blue);
|
|
||||||
transition: all .3s ease;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
#sidebar .btn-upgrade:hover {
|
|
||||||
background: var(--dark-blue);
|
|
||||||
}
|
|
||||||
#sidebar .ads .wrapper p {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--dark-grey);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#sidebar .ads .wrapper p span {
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
/* SIDEBAR */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* CONTENT */
|
|
||||||
#content {
|
|
||||||
position: relative;
|
|
||||||
width: calc(100% - 260px);
|
|
||||||
left: 260px;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
#sidebar.hide + #content {
|
|
||||||
width: calc(100% - 60px);
|
|
||||||
left: 60px;
|
|
||||||
}
|
|
||||||
/* NAVBAR */
|
|
||||||
nav {
|
|
||||||
background: var(--light);
|
|
||||||
height: 64px;
|
|
||||||
padding: 0 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
grid-gap: 28px;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
nav .toggle-sidebar {
|
|
||||||
font-size: 18px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
nav form {
|
|
||||||
max-width: 400px;
|
|
||||||
width: 100%;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
nav .form-group {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
nav .form-group input {
|
|
||||||
width: 100%;
|
|
||||||
background: var(--grey);
|
|
||||||
border-radius: 5px;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
padding: 10px 36px 10px 16px;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .form-group input:focus {
|
|
||||||
box-shadow: 0 0 0 1px var(--blue), 0 0 0 4px var(--light-blue);
|
|
||||||
}
|
|
||||||
nav .form-group .icon {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
right: 16px;
|
|
||||||
color: var(--dark-grey);
|
|
||||||
}
|
|
||||||
nav .nav-link {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
nav .nav-link .icon {
|
|
||||||
font-size: 18px;
|
|
||||||
color: var(--dark);
|
|
||||||
}
|
|
||||||
nav .nav-link .badge {
|
|
||||||
position: absolute;
|
|
||||||
top: -12px;
|
|
||||||
right: -12px;
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2px solid var(--light);
|
|
||||||
background: var(--red);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
color: var(--light);
|
|
||||||
font-size: 10px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
nav .divider {
|
|
||||||
width: 1px;
|
|
||||||
background: var(--grey);
|
|
||||||
height: 12px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
nav .profile {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
nav .profile img {
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 50%;
|
|
||||||
object-fit: cover;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link {
|
|
||||||
position: absolute;
|
|
||||||
top: calc(100% + 10px);
|
|
||||||
right: 0;
|
|
||||||
background: var(--light);
|
|
||||||
padding: 10px 0;
|
|
||||||
box-shadow: 4px 4px 16px rgba(0, 0, 0, .1);
|
|
||||||
border-radius: 10px;
|
|
||||||
width: 160px;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link.show {
|
|
||||||
opacity: 1;
|
|
||||||
pointer-events: visible;
|
|
||||||
top: 100%;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link a {
|
|
||||||
padding: 10px 16px;
|
|
||||||
display: flex;
|
|
||||||
grid-gap: 10px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--dark);
|
|
||||||
align-items: center;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link a:hover {
|
|
||||||
background: var(--grey);
|
|
||||||
}
|
|
||||||
/* NAVBAR */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* MAIN */
|
|
||||||
main {
|
|
||||||
width: 100%;
|
|
||||||
padding: 24px 20px 20px 20px;
|
|
||||||
}
|
|
||||||
main .title {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
main .breadcrumbs {
|
|
||||||
display: flex;
|
|
||||||
grid-gap: 6px;
|
|
||||||
}
|
|
||||||
main .breadcrumbs li,
|
|
||||||
main .breadcrumbs li a {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
main .breadcrumbs li a {
|
|
||||||
color: var(--blue);
|
|
||||||
}
|
|
||||||
main .breadcrumbs li a.active,
|
|
||||||
main .breadcrumbs li.divider {
|
|
||||||
color: var(--dark-grey);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MAIN */
|
|
||||||
/* CONTENT */
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
#content {
|
|
||||||
position: relative;
|
|
||||||
width: calc(100% - 60px);
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .nav-link,
|
|
||||||
nav .divider {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#surveyForm {
|
|
||||||
margin-top: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome p {
|
|
||||||
color: #7f8c8d;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #2c3e50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rating {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
.rating-option {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
width: 18%;
|
|
||||||
}
|
|
||||||
.rating-btn {
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2px solid #ddd;
|
|
||||||
background-color: white;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s;
|
|
||||||
}
|
|
||||||
.rating-btn:hover {
|
|
||||||
border-color: #35245b;
|
|
||||||
color: #35245b;
|
|
||||||
}
|
|
||||||
.rating-btn.selected {
|
|
||||||
background-color: #35245b;
|
|
||||||
color: white;
|
|
||||||
border-color: #35245b;
|
|
||||||
}
|
|
||||||
.rating-label {
|
|
||||||
margin-top: 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
text-align: center;
|
|
||||||
color: #7f8c8d;
|
|
||||||
}
|
|
||||||
.checkbox-group {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
.checkbox-group input {
|
|
||||||
margin-right: 10px;
|
|
||||||
margin-top: 3px;
|
|
||||||
}
|
|
||||||
.checkbox-group label {
|
|
||||||
margin-bottom: 0;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 1.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
padding: 12px 20px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 16px;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
|
||||||
.btn-primary {
|
|
||||||
background-color: #35245b;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: #35245b;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
.emoji {
|
|
||||||
font-size: 24px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title2 {
|
|
||||||
margin-top: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
display: block;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="text"], input[type="number"], textarea,
|
|
||||||
select {
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
font-size: 16px;
|
|
||||||
transition: border-color 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="text"]:focus,
|
|
||||||
select:focus {
|
|
||||||
border-color: #35245b;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
background-color: #35245b;
|
|
||||||
color: white;
|
|
||||||
padding: 12px 20px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 16px;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background-color: #432d74;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mensaje-error {
|
|
||||||
display: none;
|
|
||||||
background-color: #f8d7da;
|
|
||||||
color: #dc3545;
|
|
||||||
border: 1px solid #dc3545;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 0.75rem;
|
|
||||||
margin-top: 1rem;
|
|
||||||
text-align: center;
|
|
||||||
animation: fadeIn 0.3s ease-in-out;
|
|
||||||
}
|
|
581
css/inicio.css
581
css/inicio.css
|
@ -1,581 +0,0 @@
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');
|
|
||||||
|
|
||||||
* {
|
|
||||||
font-family: 'Open Sans', sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root {
|
|
||||||
--grey: #F1F0F6;
|
|
||||||
--dark-grey: #8D8D8D;
|
|
||||||
--light: #fff;
|
|
||||||
--dark: #000;
|
|
||||||
--green: #81D43A;
|
|
||||||
--light-green: #E3FFCB;
|
|
||||||
--blue: #35245b;
|
|
||||||
--light-blue: #D0E4FF;
|
|
||||||
--dark-blue: #0c1b5e;
|
|
||||||
--red: #FC3B56;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background: var(--grey);
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SIDEBAR */
|
|
||||||
#sidebar {
|
|
||||||
position: fixed;
|
|
||||||
max-width: 260px;
|
|
||||||
width: 100%;
|
|
||||||
background: var(--light);
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 100%;
|
|
||||||
overflow-y: auto;
|
|
||||||
scrollbar-width: none;
|
|
||||||
transition: all .3s ease;
|
|
||||||
z-index: 200;
|
|
||||||
}
|
|
||||||
#sidebar.hide {
|
|
||||||
max-width: 60px;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover {
|
|
||||||
max-width: 260px;
|
|
||||||
}
|
|
||||||
#sidebar::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#sidebar .brand {
|
|
||||||
font-size: 24px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: 64px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--blue);
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 100;
|
|
||||||
background: var(--light);
|
|
||||||
transition: all .3s ease;
|
|
||||||
padding: 0 6px;
|
|
||||||
}
|
|
||||||
#sidebar .icon {
|
|
||||||
min-width: 48px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-right: 6px;
|
|
||||||
}
|
|
||||||
#sidebar .icon-right {
|
|
||||||
margin-left: auto;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
#sidebar .side-menu {
|
|
||||||
margin: 36px 0;
|
|
||||||
padding: 0 20px;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
#sidebar.hide .side-menu {
|
|
||||||
padding: 0 6px;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover .side-menu {
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
|
||||||
#sidebar .side-menu a {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--dark);
|
|
||||||
padding: 12px 16px 12px 0;
|
|
||||||
transition: all .3s ease;
|
|
||||||
border-radius: 10px;
|
|
||||||
margin: 4px 0;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
#sidebar .side-menu > li > a:hover {
|
|
||||||
background: var(--grey);
|
|
||||||
}
|
|
||||||
#sidebar .side-menu > li > a.active .icon-right {
|
|
||||||
transform: rotateZ(90deg);
|
|
||||||
}
|
|
||||||
#sidebar .side-menu > li > a.active,
|
|
||||||
#sidebar .side-menu > li > a.active:hover {
|
|
||||||
background: var(--blue);
|
|
||||||
color: var(--light);
|
|
||||||
}
|
|
||||||
#sidebar .divider {
|
|
||||||
margin-top: 24px;
|
|
||||||
font-size: 12px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--dark-grey);
|
|
||||||
transition: all .3s ease;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover .divider {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
#sidebar.hide .divider {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#sidebar .side-dropdown {
|
|
||||||
padding-left: 54px;
|
|
||||||
max-height: 0;
|
|
||||||
overflow-y: hidden;
|
|
||||||
transition: all .15s ease;
|
|
||||||
}
|
|
||||||
#sidebar .side-dropdown.show {
|
|
||||||
max-height: 1000px;
|
|
||||||
}
|
|
||||||
#sidebar .side-dropdown a:hover {
|
|
||||||
color: var(--blue);
|
|
||||||
}
|
|
||||||
#sidebar .ads {
|
|
||||||
width: 100%;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
#sidebar.hide .ads {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#sidebar.hide:hover .ads {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
#sidebar .ads .wrapper {
|
|
||||||
background: var(--grey);
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
#sidebar .btn-upgrade {
|
|
||||||
font-size: 14px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 12px 0;
|
|
||||||
color: var(--light);
|
|
||||||
background: var(--blue);
|
|
||||||
transition: all .3s ease;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
#sidebar .btn-upgrade:hover {
|
|
||||||
background: var(--dark-blue);
|
|
||||||
}
|
|
||||||
#sidebar .ads .wrapper p {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--dark-grey);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#sidebar .ads .wrapper p span {
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
/* SIDEBAR */
|
|
||||||
|
|
||||||
/* CONTENT */
|
|
||||||
#content {
|
|
||||||
position: relative;
|
|
||||||
width: calc(100% - 260px);
|
|
||||||
left: 260px;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
#sidebar.hide + #content {
|
|
||||||
width: calc(100% - 60px);
|
|
||||||
left: 60px;
|
|
||||||
}
|
|
||||||
/* NAVBAR */
|
|
||||||
nav {
|
|
||||||
background: var(--light);
|
|
||||||
height: 64px;
|
|
||||||
padding: 0 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
grid-gap: 28px;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
nav .toggle-sidebar {
|
|
||||||
font-size: 18px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
nav form {
|
|
||||||
max-width: 400px;
|
|
||||||
width: 100%;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
nav .form-group {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
nav .form-group input {
|
|
||||||
width: 100%;
|
|
||||||
background: var(--grey);
|
|
||||||
border-radius: 5px;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
padding: 10px 36px 10px 16px;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .form-group input:focus {
|
|
||||||
box-shadow: 0 0 0 1px var(--blue), 0 0 0 4px var(--light-blue);
|
|
||||||
}
|
|
||||||
nav .form-group .icon {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
right: 16px;
|
|
||||||
color: var(--dark-grey);
|
|
||||||
}
|
|
||||||
nav .nav-link {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
nav .nav-link .icon {
|
|
||||||
font-size: 18px;
|
|
||||||
color: var(--dark);
|
|
||||||
}
|
|
||||||
nav .nav-link .badge {
|
|
||||||
position: absolute;
|
|
||||||
top: -12px;
|
|
||||||
right: -12px;
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2px solid var(--light);
|
|
||||||
background: var(--red);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
color: var(--light);
|
|
||||||
font-size: 10px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
nav .divider {
|
|
||||||
width: 1px;
|
|
||||||
background: var(--grey);
|
|
||||||
height: 12px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
nav .profile {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
nav .profile img {
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 50%;
|
|
||||||
object-fit: cover;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link {
|
|
||||||
position: absolute;
|
|
||||||
top: calc(100% + 10px);
|
|
||||||
right: 0;
|
|
||||||
background: var(--light);
|
|
||||||
padding: 10px 0;
|
|
||||||
box-shadow: 4px 4px 16px rgba(0, 0, 0, .1);
|
|
||||||
border-radius: 10px;
|
|
||||||
width: 160px;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link.show {
|
|
||||||
opacity: 1;
|
|
||||||
pointer-events: visible;
|
|
||||||
top: 100%;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link a {
|
|
||||||
padding: 10px 16px;
|
|
||||||
display: flex;
|
|
||||||
grid-gap: 10px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--dark);
|
|
||||||
align-items: center;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .profile .profile-link a:hover {
|
|
||||||
background: var(--grey);
|
|
||||||
}
|
|
||||||
/* NAVBAR */
|
|
||||||
|
|
||||||
|
|
||||||
/* MAIN */
|
|
||||||
main {
|
|
||||||
width: 100%;
|
|
||||||
padding: 24px 20px 20px 20px;
|
|
||||||
}
|
|
||||||
main .title {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
main .breadcrumbs {
|
|
||||||
display: flex;
|
|
||||||
grid-gap: 6px;
|
|
||||||
}
|
|
||||||
main .breadcrumbs li,
|
|
||||||
main .breadcrumbs li a {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
main .breadcrumbs li a {
|
|
||||||
color: var(--blue);
|
|
||||||
}
|
|
||||||
main .breadcrumbs li a.active,
|
|
||||||
main .breadcrumbs li.divider {
|
|
||||||
color: var(--dark-grey);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
main .info-data {
|
|
||||||
margin-top: 36px;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
||||||
grid-gap: 20px;
|
|
||||||
}
|
|
||||||
main .info-data .card {
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
background: var(--light);
|
|
||||||
box-shadow: 4px 4px 16px rgba(0, 0, 0, .05);
|
|
||||||
}
|
|
||||||
main .card .head {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
main .card .head h2 {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
main .card .head p {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
main .card .head .icon {
|
|
||||||
font-size: 20px;
|
|
||||||
color: var(--green);
|
|
||||||
}
|
|
||||||
main .card .head .icon.down {
|
|
||||||
color: var(--red);
|
|
||||||
}
|
|
||||||
main .card .progress {
|
|
||||||
display: block;
|
|
||||||
margin-top: 24px;
|
|
||||||
height: 10px;
|
|
||||||
width: 100%;
|
|
||||||
border-radius: 10px;
|
|
||||||
background: var(--grey);
|
|
||||||
overflow-y: hidden;
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
main .card .progress::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 100%;
|
|
||||||
background: var(--blue);
|
|
||||||
width: var(--value);
|
|
||||||
}
|
|
||||||
main .card .label {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
main .data {
|
|
||||||
display: flex;
|
|
||||||
grid-gap: 20px;
|
|
||||||
margin-top: 20px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
main .data .content-data {
|
|
||||||
flex-grow: 1;
|
|
||||||
flex-basis: 400px;
|
|
||||||
padding: 20px;
|
|
||||||
background: var(--light);
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 4px 4px 16px rgba(0, 0, 0, .1);
|
|
||||||
}
|
|
||||||
main .content-data .head {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
main .content-data .head h3 {
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
main .content-data .head .menu {
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
main .content-data .head .menu .icon {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
main .content-data .head .menu-link {
|
|
||||||
position: absolute;
|
|
||||||
top: calc(100% + 10px);
|
|
||||||
right: 0;
|
|
||||||
width: 140px;
|
|
||||||
background: var(--light);
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 4px 4px 16px rgba(0, 0, 0, .1);
|
|
||||||
padding: 10px 0;
|
|
||||||
z-index: 100;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
main .content-data .head .menu-link.show {
|
|
||||||
top: 100%;
|
|
||||||
opacity: 1;
|
|
||||||
pointer-events: visible;
|
|
||||||
}
|
|
||||||
main .content-data .head .menu-link a {
|
|
||||||
display: block;
|
|
||||||
padding: 6px 16px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--dark);
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
main .content-data .head .menu-link a:hover {
|
|
||||||
background: var(--grey);
|
|
||||||
}
|
|
||||||
main .content-data .chart {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
overflow-x: auto;
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
main .content-data .chart::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
main .chat-box {
|
|
||||||
width: 100%;
|
|
||||||
max-height: 360px;
|
|
||||||
overflow-y: auto;
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
main .chat-box::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
main .chat-box .day {
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
main .chat-box .day span {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 6px 12px;
|
|
||||||
border-radius: 20px;
|
|
||||||
background: var(--light-blue);
|
|
||||||
color: var(--blue);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
main .chat-box .msg img {
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
border-radius: 50%;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
main .chat-box .msg {
|
|
||||||
display: flex;
|
|
||||||
grid-gap: 6px;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
main .chat-box .profile .username {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 6px;
|
|
||||||
}
|
|
||||||
main .chat-box .profile .time {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--dark-grey);
|
|
||||||
}
|
|
||||||
main .chat-box .chat p {
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 6px 10px;
|
|
||||||
display: inline-block;
|
|
||||||
max-width: 400px;
|
|
||||||
line-height: 150%;
|
|
||||||
}
|
|
||||||
main .chat-box .msg:not(.me) .chat p {
|
|
||||||
border-radius: 0 5px 5px 5px;
|
|
||||||
background: var(--blue);
|
|
||||||
color: var(--light);
|
|
||||||
}
|
|
||||||
main .chat-box .msg.me {
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
main .chat-box .msg.me .profile {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
main .chat-box .msg.me p {
|
|
||||||
background: var(--grey);
|
|
||||||
border-radius: 5px 0 5px 5px;
|
|
||||||
}
|
|
||||||
main form {
|
|
||||||
margin-top: 6px;
|
|
||||||
}
|
|
||||||
main .form-group {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
grid-gap: 10px;
|
|
||||||
}
|
|
||||||
main .form-group input {
|
|
||||||
flex-grow: 1;
|
|
||||||
padding: 10px 16px;
|
|
||||||
border-radius: 5px;
|
|
||||||
outline: none;
|
|
||||||
background: var(--grey);
|
|
||||||
border: none;
|
|
||||||
transition: all .3s ease;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
main .form-group input:focus {
|
|
||||||
box-shadow: 0 0 0 1px var(--blue), 0 0 0 4px var(--light-blue);
|
|
||||||
}
|
|
||||||
main .btn-send {
|
|
||||||
padding: 0 16px;
|
|
||||||
background: var(--blue);
|
|
||||||
border-radius: 5px;
|
|
||||||
color: var(--light);
|
|
||||||
cursor: pointer;
|
|
||||||
border: none;
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
main .btn-send:hover {
|
|
||||||
background: var(--dark-blue);
|
|
||||||
}
|
|
||||||
/* MAIN */
|
|
||||||
/* CONTENT */
|
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
#content {
|
|
||||||
position: relative;
|
|
||||||
width: calc(100% - 60px);
|
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
|
||||||
nav .nav-link,
|
|
||||||
nav .divider {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
132
css/login.css
132
css/login.css
|
@ -1,132 +0,0 @@
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');
|
|
||||||
|
|
||||||
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-family: 'Open Sans', sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: #f1f0f6;
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-container {
|
|
||||||
background-color: #ffffff;
|
|
||||||
border: 2px solid #e8e8e8;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 2rem;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 500px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
.login-container {
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.login-encabezado {
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-logo {
|
|
||||||
max-width: 150px;
|
|
||||||
height: auto;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-titulo {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
color: #333;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-subtitulo {
|
|
||||||
color: #666;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-formulario {
|
|
||||||
color: #666;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-grupo {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-label {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-input {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.75rem;
|
|
||||||
border: 1px solid #e8e8e8;
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-input:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: #35245b;
|
|
||||||
box-shadow: 0 0 0 2px rgba(2, 27, 48, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-boton {
|
|
||||||
background-color: #35245b;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 0.75rem;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
margin-top: 1rem;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-boton:hover {
|
|
||||||
background-color: #432d74;
|
|
||||||
box-shadow: 0 4px 8px #53388f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-boton:active {
|
|
||||||
transform: scale(0.98);
|
|
||||||
}
|
|
||||||
|
|
||||||
.material-icons {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mensaje-error {
|
|
||||||
display: none;
|
|
||||||
background-color: #f8d7da;
|
|
||||||
color: #dc3545;
|
|
||||||
border: 1px solid #dc3545;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 0.75rem;
|
|
||||||
margin-top: 1rem;
|
|
||||||
text-align: center;
|
|
||||||
animation: fadeIn 0.3s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -1,198 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href='https://unpkg.com/boxicons@2.0.9/css/boxicons.min.css' rel='stylesheet'>
|
|
||||||
<link rel="stylesheet" href="css/form.css">
|
|
||||||
<title>AdminSite</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
<!-- <a href="#" class="brand">
|
|
||||||
<img src="img/lania_logo.png" alt="Logo" style="height: 40px;">
|
|
||||||
</a> -->
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="#" class="active"><i class='bx bxs-dashboard icon' ></i> Dashboard</a></li>
|
|
||||||
<li class="divider" data-text="main">Main</li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-inbox icon' ></i> Elements <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="#">Alert</a></li>
|
|
||||||
<li><a href="#">Badges</a></li>
|
|
||||||
<li><a href="#">Breadcrumbs</a></li>
|
|
||||||
<li><a href="#">Button</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a href="#"><i class='bx bxs-chart icon' ></i> Charts</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-widget icon' ></i> Widgets</a></li>
|
|
||||||
<li class="divider" data-text="table and forms">Table and forms</li>
|
|
||||||
<li><a href="#"><i class='bx bx-table icon' ></i> Tables</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-notepad icon' ></i> Formularios <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="form_datos_basicos.html">Datos Básicos</a></li>
|
|
||||||
<li><a href="form_datos_extendidos.html">Datos Extendidos</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<!-- <div class="ads">
|
|
||||||
<div class="wrapper">
|
|
||||||
<a href="#" class="btn-upgrade">Upgrade</a>
|
|
||||||
<p>Become a <span>PRO</span> member and enjoy <span>All Features</span></p>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</section>
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
<section id="content">
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
<nav>
|
|
||||||
<i class='bx bx-menu toggle-sidebar' ></i>
|
|
||||||
<form action="#">
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" placeholder="Buscar...">
|
|
||||||
<i class='bx bx-search icon' ></i>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<a href="#" class="nav-link">
|
|
||||||
<i class='bx bxs-bell icon' ></i>
|
|
||||||
<span class="badge">5</span>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="nav-link">
|
|
||||||
<i class='bx bxs-message-square-dots icon' ></i>
|
|
||||||
<span class="badge">8</span>
|
|
||||||
</a>
|
|
||||||
<span class="divider"></span>
|
|
||||||
<div class="profile">
|
|
||||||
<img src="https://images.unsplash.com/photo-1517841905240-472988babdf9?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8cGVvcGxlfGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt="">
|
|
||||||
<ul class="profile-link">
|
|
||||||
<li><a href="#"><i class='bx bxs-user-circle icon' ></i> Profile</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-cog' ></i> Settings</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-log-out-circle' ></i> Logout</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
|
|
||||||
<!-- MAIN -->
|
|
||||||
<main>
|
|
||||||
<h1 class="title">Datos básicos</h1>
|
|
||||||
<ul class="breadcrumbs">
|
|
||||||
<li><a href="#">Formularios</a></li>
|
|
||||||
<li class="divider">/</li>
|
|
||||||
<li><a href="#" class="active">Datos básicos</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h3 class="title2">¡Bienvenido (a)!</h3>
|
|
||||||
<p>Nos gustaría conocerte mejor</p>
|
|
||||||
<br>
|
|
||||||
<form id="formulario-datos-basicos" action="" method="POST">
|
|
||||||
<input type="hidden" id="id_candidato" name="id_candidato">
|
|
||||||
<input type="hidden" id="fecha_entrada" name="fecha_entrada" value="">
|
|
||||||
<input type="hidden" id="fecha_salida" name="fecha_salida" value="">
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for ="nombres">Nombres:</label>
|
|
||||||
<input type="text" id="nombres" name="nombres" required>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="primer_apellido">Primer apellido:</label>
|
|
||||||
<input type="text" id="primer_apellido" name="primer_apellido" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="segundo_apellido">Segundo apellido:</label>
|
|
||||||
<input type="text" id="segundo_apellido" name="segundo_apellido" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="correo">Correo electrónico:</label>
|
|
||||||
<input type="text" id="correo" name="correo" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="telefono">Teléfono:</label>
|
|
||||||
<input type="number" id="telefono" name="telefono" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="id_examen">Examen:</label>
|
|
||||||
<select name="id_examen" id="id_examen" required>
|
|
||||||
<option value="">Selecciona un examen</option>
|
|
||||||
<option value="1">Cisco</option>
|
|
||||||
<option value="2">IBM</option>
|
|
||||||
<option value="3">Microsoft</option>
|
|
||||||
<option value="4">Oracle</option>
|
|
||||||
<option value="5">SAP</option>
|
|
||||||
<option value="6">CompTIA</option>
|
|
||||||
<option value="7">Amazon Web Services</option>
|
|
||||||
<option value="8">Google Cloud Platform</option>
|
|
||||||
<option value="9">Salesforce</option>
|
|
||||||
<option value="10">Red Hat</option>
|
|
||||||
<option value="11">VMWare</option>
|
|
||||||
<option value="12">Palo Alto Networks</option>
|
|
||||||
<option value="13">Fornitet</option>
|
|
||||||
<option value="14">Juniper Networks</option>
|
|
||||||
<option value="15">Otros</option>
|
|
||||||
</select><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="id_tipo_id">Tipo de Identificación:</label>
|
|
||||||
<select name="id_tipo_id" id="id_tipo_id" required>
|
|
||||||
<option value="">Selecciona el tipo de identificación</option>
|
|
||||||
<option value="1">INE</option>
|
|
||||||
<option value="2">Pasaporte</option>
|
|
||||||
<option value="3">CURP</option>
|
|
||||||
<option value="4">RFC</option>
|
|
||||||
<option value="5">Cédila Profesional</option>
|
|
||||||
<option value="6">Licencia de conducir</option>
|
|
||||||
<option value="7">Otro</option>
|
|
||||||
</select><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="id_rango_edad">Rango de edad:</label>
|
|
||||||
<select name="id_rango_edad" id="id_rango_edad" required>
|
|
||||||
<option value="">Selecciona un rango de edad</option>
|
|
||||||
<option value="1">Menos de 18</option>
|
|
||||||
<option value="2">18-24</option>
|
|
||||||
<option value="3">24-34</option>
|
|
||||||
<option value="4">35-44</option>
|
|
||||||
<option value="5">45-54</option>
|
|
||||||
<option value="6">55-64</option>
|
|
||||||
<option value="7">65 o más</option>
|
|
||||||
</select><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="id_genero">Género:</label>
|
|
||||||
<select name="id_genero" id="id_genero" required>
|
|
||||||
<option value="">Selecciona un género</option>
|
|
||||||
<option value="1">Masculino</option>
|
|
||||||
<option value="2">Femenino</option>
|
|
||||||
<option value="3">Prefiero no decir</option>
|
|
||||||
</select><br>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<button type="submit">Enviar</button>
|
|
||||||
|
|
||||||
<div id="mensaje-error" class="mensaje-error"><p>hola</p></div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</main>
|
|
||||||
<!-- MAIN -->
|
|
||||||
</section>
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
|
|
||||||
<script src="js/form.js"></script>
|
|
||||||
<script src="js/form_datos_basicos.js"""
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,260 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href='https://unpkg.com/boxicons@2.0.9/css/boxicons.min.css' rel='stylesheet'>
|
|
||||||
<link rel="stylesheet" href="css/form.css">
|
|
||||||
<title>AdminSite</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
<!-- <a href="#" class="brand">
|
|
||||||
<img src="img/lania_logo.png" alt="Logo" style="height: 40px;">
|
|
||||||
</a> -->
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="#" class="active"><i class='bx bxs-dashboard icon' ></i> Dashboard</a></li>
|
|
||||||
<li class="divider" data-text="main">Main</li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-inbox icon' ></i> Elements <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="#">Alert</a></li>
|
|
||||||
<li><a href="#">Badges</a></li>
|
|
||||||
<li><a href="#">Breadcrumbs</a></li>
|
|
||||||
<li><a href="#">Button</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a href="#"><i class='bx bxs-chart icon' ></i> Charts</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-widget icon' ></i> Widgets</a></li>
|
|
||||||
<li class="divider" data-text="table and forms">Table and forms</li>
|
|
||||||
<li><a href="#"><i class='bx bx-table icon' ></i> Tables</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-notepad icon' ></i> Formularios <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="form_datos_basicos.html">Datos Básicos</a></li>
|
|
||||||
<li><a href="form_datos_extendidos.html">Datos Extendidos</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<!-- <div class="ads">
|
|
||||||
<div class="wrapper">
|
|
||||||
<a href="#" class="btn-upgrade">Upgrade</a>
|
|
||||||
<p>Become a <span>PRO</span> member and enjoy <span>All Features</span></p>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</section>
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
<section id="content">
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
<nav>
|
|
||||||
<i class='bx bx-menu toggle-sidebar' ></i>
|
|
||||||
<form action="#">
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" placeholder="Buscar...">
|
|
||||||
<i class='bx bx-search icon' ></i>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<a href="#" class="nav-link">
|
|
||||||
<i class='bx bxs-bell icon' ></i>
|
|
||||||
<span class="badge">5</span>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="nav-link">
|
|
||||||
<i class='bx bxs-message-square-dots icon' ></i>
|
|
||||||
<span class="badge">8</span>
|
|
||||||
</a>
|
|
||||||
<span class="divider"></span>
|
|
||||||
<div class="profile">
|
|
||||||
<img src="https://images.unsplash.com/photo-1517841905240-472988babdf9?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8cGVvcGxlfGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt="">
|
|
||||||
<ul class="profile-link">
|
|
||||||
<li><a href="#"><i class='bx bxs-user-circle icon' ></i> Profile</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-cog' ></i> Settings</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-log-out-circle' ></i> Logout</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
|
|
||||||
<!-- MAIN -->
|
|
||||||
<main>
|
|
||||||
<h1 class="title">Datos Extendidos</h1>
|
|
||||||
<ul class="breadcrumbs">
|
|
||||||
<li><a href="#">Formularios</a></li>
|
|
||||||
<li class="divider">/</li>
|
|
||||||
<li><a href="#" class="active">Datos Extendidos</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<form id="formulario-datos-extendido" method="post" action="#">
|
|
||||||
<div class="form-section">
|
|
||||||
<br>
|
|
||||||
<h3>Ubicación</h3>
|
|
||||||
<br>
|
|
||||||
<div class="form-row">
|
|
||||||
<input type="hidden" id="id_candidato" name="id_candidato">
|
|
||||||
<div class="form-col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="id_pais" class="required">País</label>
|
|
||||||
<select id="id_pais" name="id_pais" required>
|
|
||||||
<option value="">Seleccione...</option>
|
|
||||||
<!-- Aquí irían los países desde la base de datos -->
|
|
||||||
<option value="1">México</option>
|
|
||||||
<option value="2">Otro</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="codigo_postal" class="required">Código Postal</label>
|
|
||||||
<input type="number" min="0" step="1" id="codigo_postal" name="codigo_postal" maxlength="10" required>
|
|
||||||
<button type="button" id="buscarBtn"><span class="material-icons">search</span>Buscar</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="id_estado">Estado</label>
|
|
||||||
<select id="id_estado" name="id_estado">
|
|
||||||
<option value="">Seleccione...</option>
|
|
||||||
<!-- Aquí irían los estados desde la base de datos -->
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="id_municipio">Municipio</label>
|
|
||||||
<select id="id_municipio" name="id_municipio">
|
|
||||||
<option value="">Seleccione...</option>
|
|
||||||
<!-- Aquí irían los municipios desde la base de datos -->
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="id_colonia">Colonia</label>
|
|
||||||
<select id="id_colonia" name="id_colonia">
|
|
||||||
<option value="">Seleccione...</option>
|
|
||||||
<!-- Aquí irían las colonias desde la base de datos -->
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Sección 3: Información Académica y Laboral -->
|
|
||||||
<div class="form-section">
|
|
||||||
<br>
|
|
||||||
<h3>Información Académica/Laboral</h3>
|
|
||||||
<br>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="id_nivel" class="required">Nivel de Estudios</label>
|
|
||||||
<select id="id_nivel" name="id_nivel" required>
|
|
||||||
<option value="">Seleccione...</option>
|
|
||||||
<option value="1">Primaria</option>
|
|
||||||
<option value="2">Secundaria</option>
|
|
||||||
<option value="3">Bachillerato</option>
|
|
||||||
<option value="4">Técnico Superior Universitario</option>
|
|
||||||
<option value="5">Licenciatura</option>
|
|
||||||
<option value="6">Maestría</option>
|
|
||||||
<option value="7">Doctorado</option>
|
|
||||||
<option value="8">Otro</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="id_giro" class="required">Giro</label>
|
|
||||||
<select id="id_giro" name="id_giro" required>
|
|
||||||
<option value="">Seleccione...</option>
|
|
||||||
<option value="1">Tecnologías de la Información</option>
|
|
||||||
<option value="2">Gobierno</option>
|
|
||||||
<option value="3">Finanzas</option>
|
|
||||||
<option value="4">Salud</option>
|
|
||||||
<option value="5">Educación</option>
|
|
||||||
<option value="6">Telecomunicaciones</option>
|
|
||||||
<option value="7">Retail</option>
|
|
||||||
<option value="8">Manufactura</option>
|
|
||||||
<option value="9">Logística y Transporte</option>
|
|
||||||
<option value="10">Construcción</option>
|
|
||||||
<option value="11">Turismo y Hospitalidad</option>
|
|
||||||
<option value="12">Energía y Recursos Naturales</option>
|
|
||||||
<option value="13">Agricultura y Alimentación</option>
|
|
||||||
<option value="14">Medios de Comunicación y Entretenimiento</option>
|
|
||||||
<option value="15">Otros</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="nombre_empresa">Nombre de la Empresa/Institución</label>
|
|
||||||
<input type="text" id="nombre_empresa" name="nombre_empresa"
|
|
||||||
maxlength="100">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="motivo_examen">Motivo del Examen</label>
|
|
||||||
<textarea id="motivo_examen" name="motivo_examen" rows="3"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Sección 4: Evaluación y Consentimiento -->
|
|
||||||
<div class="form-section">
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<h3>Evaluación y Consentimiento</h3>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<p>Calificación del Servicio</p>
|
|
||||||
<br>
|
|
||||||
<label for="calificacion_servicio">¿Qué tan satisfecho estás con nuestra institución en general, considerando la calidad de las instalaciones, la atención del personal y el proceso de certificación?</label>
|
|
||||||
<br>
|
|
||||||
<select id="calificacion_servicio" name="calificacion_servicio" class="select-emoji">
|
|
||||||
<option value="">Seleccione una calificación...</option>
|
|
||||||
<option value="1">😡 Muy insatisfecho</option>
|
|
||||||
<option value="2">😕 Insatisfecho</option>
|
|
||||||
<option value="3">😐 Neutral</option>
|
|
||||||
<option value="4">🙂 Satisfecho</option>
|
|
||||||
<option value="5">😄 Muy satisfecho</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="checkbox" id="consentimiento_pub" name="consentimiento_pub" value="1" checked>
|
|
||||||
<label for="consentimiento_pub" style="display: inline;">Doy mi consentimiento para la publicación de mis datos</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<button type="submit" class="btn-submit">Enviar</button>
|
|
||||||
|
|
||||||
<div id="mensaje-error" class="mensaje-error"></div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</main>
|
|
||||||
<!-- MAIN -->
|
|
||||||
</section>
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
|
|
||||||
|
|
||||||
<script src="js/form.js"></script>
|
|
||||||
<script src="js/form_datos_extendidos.js"></script>
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
<script src="js/buscarCodigo.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 81 KiB |
64
index.html
64
index.html
|
@ -1,64 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="css/login.css" />
|
|
||||||
<link
|
|
||||||
rel="stylesheet"
|
|
||||||
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
|
||||||
/>
|
|
||||||
<title>Iniciar Sesión</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="login-container">
|
|
||||||
<div class="login-encabezado">
|
|
||||||
<img
|
|
||||||
src="img/lania_logo.png"
|
|
||||||
alt="Logo de la empresa"
|
|
||||||
class="login-logo"
|
|
||||||
/>
|
|
||||||
<h1 class="login-titulo">Iniciar Sesión</h1>
|
|
||||||
<p class="login-subtitulo">Por favor ingrese sus credenciales</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form id="login-formulario" class="login-formulario">
|
|
||||||
<div class="form-grupo">
|
|
||||||
<label for="numero-personal" class="form-label"
|
|
||||||
><span class="material-icons">person</span>Número de Personal</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="numero-personal"
|
|
||||||
name="numero-personal"
|
|
||||||
class="form-input"
|
|
||||||
placeholder="Ingresa tu número de personal"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-grupo">
|
|
||||||
<label for="contrasena" class="form-label">
|
|
||||||
<span class="material-icons">lock</span>
|
|
||||||
Contraseña</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
id="contrasena"
|
|
||||||
name="contrasena"
|
|
||||||
class="form-input"
|
|
||||||
placeholder="Ingresa tu contraseña"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="login-boton">
|
|
||||||
<span class="material-icons">login</span>Iniciar Sesión
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div id="mensaje-error" class="mensaje-error"></div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<script src="js/login.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
270
inicio.html
270
inicio.html
|
@ -1,270 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href='https://unpkg.com/boxicons@2.0.9/css/boxicons.min.css' rel='stylesheet'>
|
|
||||||
<link rel="stylesheet" href="../css/inicio.css">
|
|
||||||
|
|
||||||
<title>AdminSite</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="#" class="active"><i class='bx bxs-dashboard icon' ></i> Dashboard</a></li>
|
|
||||||
<li class="divider" data-text="main">Main</li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-inbox icon' ></i> Elements <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="#">Alert</a></li>
|
|
||||||
<li><a href="#">Badges</a></li>
|
|
||||||
<li><a href="#">Breadcrumbs</a></li>
|
|
||||||
<li><a href="#">Button</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a href="#"><i class='bx bxs-chart icon' ></i> Charts</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-widget icon' ></i> Widgets</a></li>
|
|
||||||
<li class="divider" data-text="tablas y formularios">Tablas y formularios</li>
|
|
||||||
<li><a href="#"><i class='bx bx-table icon' ></i> Tablas</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="#"><i class='bx bxs-notepad icon' ></i> Formularios <i class='bx bx-chevron-right icon-right' ></i></a>
|
|
||||||
<ul class="side-dropdown">
|
|
||||||
<li><a href="formulario-candidato.html">Registro de candidato</a></li>
|
|
||||||
<li><a href="formulario-datos-candidato.php">Datos de candidato</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<!-- <div class="ads">
|
|
||||||
<div class="wrapper">
|
|
||||||
<a href="#" class="btn-upgrade">Upgrade</a>
|
|
||||||
<p>Become a <span>PRO</span> member and enjoy <span>All Features</span></p>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</section>
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
<section id="content">
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
<nav>
|
|
||||||
<i class='bx bx-menu toggle-sidebar' ></i>
|
|
||||||
<form action="#">
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" placeholder="Buscar...">
|
|
||||||
<i class='bx bx-search icon' ></i>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<a href="#" class="nav-link">
|
|
||||||
<i class='bx bxs-bell icon' ></i>
|
|
||||||
<span class="badge">5</span>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="nav-link">
|
|
||||||
<i class='bx bxs-message-square-dots icon' ></i>
|
|
||||||
<span class="badge">8</span>
|
|
||||||
</a>
|
|
||||||
<span class="divider"></span>
|
|
||||||
<div class="profile">
|
|
||||||
<img src="https://images.unsplash.com/photo-1517841905240-472988babdf9?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8cGVvcGxlfGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt="">
|
|
||||||
<ul class="profile-link">
|
|
||||||
<li><a href="#"><i class='bx bxs-user-circle icon' ></i> Profile</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-cog' ></i> Settings</a></li>
|
|
||||||
<li><a href="#"><i class='bx bxs-log-out-circle' ></i> Logout</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
|
|
||||||
<!-- MAIN -->
|
|
||||||
<main>
|
|
||||||
<h1 class="title">Dashboard</h1>
|
|
||||||
<ul class="breadcrumbs">
|
|
||||||
<li><a href="#">Home</a></li>
|
|
||||||
<li class="divider">/</li>
|
|
||||||
<li><a href="#" class="active">Dashboard</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!--Añadido nuevo -->
|
|
||||||
<div class="select-data">
|
|
||||||
<div class="card">
|
|
||||||
<div class="head">
|
|
||||||
<i class='bx bx-trending-up icon'></i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div style="display: flex; gap: 20px; margin: 10px 0;">
|
|
||||||
<!-- Campo: Edad -->
|
|
||||||
<div style="flex: 1;">
|
|
||||||
<label class="form-label" for="id_rango_edad">Edad</label>
|
|
||||||
<select class="border rounded-pill shadow-sm form-select" id="id_rango_edad" required>
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Campo: Género -->
|
|
||||||
<div style="flex: 1;">
|
|
||||||
<label class="form-label" for="id_genero" style="margin: 10px 0px 5px;">Género</label>
|
|
||||||
<select class="border rounded-pill shadow-sm form-select" id="id_genero" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
<option value="1">Masculino</option>
|
|
||||||
<option value="2">Femenino</option>
|
|
||||||
<option value="3">Prefiero no decir</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="flex: 1;">
|
|
||||||
<label class="form-label" for="id_examen" style="margin: 10px 0px 5px;">Examen</label>
|
|
||||||
<select class="border rounded-pill shadow-sm form-select" id="id_examen" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2>Fecha</h2>
|
|
||||||
<h3>Ingresa una fecha de inicio:</h3>
|
|
||||||
<br>
|
|
||||||
<input type="date" id="date1" name="date1">
|
|
||||||
<h3>Ingresa una fecha de final:</h3>
|
|
||||||
<input type="date" id="date2" name="date2">
|
|
||||||
<br>
|
|
||||||
<button type="button" id="buscar">Buscar</button>
|
|
||||||
<button type="button" id="limpiar">Limpiar</button>
|
|
||||||
<br>
|
|
||||||
<div class="content-data">
|
|
||||||
<div class="head">
|
|
||||||
<h3>Resultado de registros en el rango de fecha ingresado</h3>
|
|
||||||
<div class="menu">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="chart">
|
|
||||||
<div id="chart5"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<br>
|
|
||||||
<h3>Promedio de géneros:</h3>
|
|
||||||
<div class="info-data">
|
|
||||||
<div class="card" id="card-femenino">
|
|
||||||
<div class="head">
|
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
|
||||||
<i class='bx bx-female' style="font-size: 24px; color: #e91e63;"></i>
|
|
||||||
<div>
|
|
||||||
<h2>0</h2>
|
|
||||||
<p>Femenino</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card" id="card-masculino">
|
|
||||||
<div class="head">
|
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
|
||||||
<i class='bx bx-male' style="font-size: 24px; color: #2196f3;"></i>
|
|
||||||
<div>
|
|
||||||
<h2>0</h2>
|
|
||||||
<p>Masculino</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card" id="card-nodefinido">
|
|
||||||
<div class="head">
|
|
||||||
<div style="display: flex; align-items: center; gap: 8px;">
|
|
||||||
<i class='bx bx-male' style="font-size: 24px; color: black;"></i>
|
|
||||||
<div>
|
|
||||||
<h2>0</h2>
|
|
||||||
<p>Prefiero no decirlo</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="data">
|
|
||||||
<div class="content-data">
|
|
||||||
<div class="head">
|
|
||||||
<h3>Generos</h3>
|
|
||||||
<div class="menu">
|
|
||||||
<i class='bx bx-dots-horizontal-rounded icon'></i>
|
|
||||||
<ul class="menu-link">
|
|
||||||
<li><a href="#">Edit</a></li>
|
|
||||||
<li><a href="#">Save</a></li>
|
|
||||||
<li><a href="#">Remove</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="chart">
|
|
||||||
<div id="chart"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="content-data">
|
|
||||||
<div class="head">
|
|
||||||
<h3>Edades</h3>
|
|
||||||
<div class="menu">
|
|
||||||
<i class='bx bx-dots-horizontal-rounded icon'></i>
|
|
||||||
<ul class="menu-link">
|
|
||||||
<li><a href="#">Edit</a></li>
|
|
||||||
<li><a href="#">Save</a></li>
|
|
||||||
<li><a href="#">Remove</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="chart">
|
|
||||||
<div id="chart2"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="content-data">
|
|
||||||
<div class="head">
|
|
||||||
<h3>Estados</h3>
|
|
||||||
<div class="menu">
|
|
||||||
<i class='bx bx-dots-horizontal-rounded icon'></i>
|
|
||||||
<ul class="menu-link">
|
|
||||||
<li><a href="#">Edit</a></li>
|
|
||||||
<li><a href="#">Save</a></li>
|
|
||||||
<li><a href="#">Remove</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="chart">
|
|
||||||
<div id="chart3"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="content-data">
|
|
||||||
<div class="head">
|
|
||||||
<h3>Examenes</h3>
|
|
||||||
<div class="menu">
|
|
||||||
<i class='bx bx-dots-horizontal-rounded icon'></i>
|
|
||||||
<ul class="menu-link">
|
|
||||||
<li><a href="#">Edit</a></li>
|
|
||||||
<li><a href="#">Save</a></li>
|
|
||||||
<li><a href="#">Remove</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="chart">
|
|
||||||
<div id="chart4"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<!-- MAIN -->
|
|
||||||
</section>
|
|
||||||
<!-- NAVBAR -->
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
|
||||||
<script type="module" src="../js/inicio.js"></script>
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
<script src="../js/formulario-candidato.js"></script>
|
|
||||||
<script src="../js/tarjetasPromedio.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,69 +0,0 @@
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
|
||||||
form = document.getElementById('form');
|
|
||||||
const contrasena = document.getElementById('contrasena');
|
|
||||||
const contrasenaVerificacion = document.getElementById('contrasena_verificacion');
|
|
||||||
const btnSubmit = document.getElementById('submit');
|
|
||||||
|
|
||||||
const togglePassword = document.getElementById('togglePassword');
|
|
||||||
togglePassword.addEventListener('click', function(e) {
|
|
||||||
const type = contrasena.getAttribute('type') === 'password' ? 'text' : 'password';
|
|
||||||
contrasena.setAttribute('type', type);
|
|
||||||
const icon = togglePassword.querySelector('i');
|
|
||||||
if (type === 'text') {
|
|
||||||
icon.classList.remove('bi-eye');
|
|
||||||
icon.classList.add('bi-eye-slash');
|
|
||||||
} else {
|
|
||||||
icon.classList.remove('bi-eye-slash');
|
|
||||||
icon.classList.add('bi-eye');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
btnSubmit.addEventListener('click', function(event){
|
|
||||||
if (!form.checkValidity()) {
|
|
||||||
form.reportValidity();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const c1 = contrasena.value;
|
|
||||||
const c2 = contrasenaVerificacion.value;
|
|
||||||
if (c1 === c2) {
|
|
||||||
|
|
||||||
const usuario = document.getElementById('usuario').value;
|
|
||||||
|
|
||||||
const regex = /^[a-zA-Z0-9]+$/;
|
|
||||||
if (!regex.test(usuario)) {
|
|
||||||
alert("Nombre de usuario no valido.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const id = document.getElementById('id').value;
|
|
||||||
const data = new FormData();
|
|
||||||
data.append("id", id);
|
|
||||||
data.append("usuario", usuario);
|
|
||||||
data.append("contrasena", c1);
|
|
||||||
|
|
||||||
fetch('../controllers/actualizarUsuario.php', {
|
|
||||||
method: 'POST',
|
|
||||||
body: data
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.estado === "exitoso") {
|
|
||||||
alert(data.mensaje);
|
|
||||||
} else if (data.estado === "error") {
|
|
||||||
alert("Error, intentelo más tarde.");
|
|
||||||
console.log(data.mensaje);
|
|
||||||
} else {
|
|
||||||
alert("Error inesperado, intentelo más tarde.");
|
|
||||||
console.log(data);
|
|
||||||
}
|
|
||||||
window.location.href = "control-usuarios.php";
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
alert("Las contraseñas no coinciden");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -1,77 +0,0 @@
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
var buscarBtn = document.getElementById("buscarBtn");
|
|
||||||
|
|
||||||
//Añadir un evento al boton de buscar
|
|
||||||
buscarBtn.addEventListener("click", function() {
|
|
||||||
var codigoPostal = document.getElementById("codigo_postal").value;
|
|
||||||
console.log(codigoPostal);
|
|
||||||
|
|
||||||
//verificar si el codigo postal esta vacio
|
|
||||||
if (codigoPostal) {
|
|
||||||
//crear la url para la peticion
|
|
||||||
var url = "./php/buscarCodigo.php?codigo_postal=" + encodeURIComponent(codigoPostal);
|
|
||||||
|
|
||||||
//Realiza una solicitud HTTP GET a la URL especificada
|
|
||||||
fetch(url)
|
|
||||||
.then(response => {
|
|
||||||
//console.log("Estado de la respuesta:", response.status);
|
|
||||||
//console.log("Contenido de la respuesta:", response);
|
|
||||||
// Verifica si la respuesta del servidor es exitosa
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("Error en la respuesta del servidor");
|
|
||||||
}
|
|
||||||
//Convierte la respuesta a formato JSON
|
|
||||||
return response.json();
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
var estadoSelect = document.getElementById("id_estado");
|
|
||||||
var municipioSelect = document.getElementById("id_municipio");
|
|
||||||
var coloniaSelect = document.getElementById("id_colonia");
|
|
||||||
|
|
||||||
// Inicializa los elementos select con una opción por defecto
|
|
||||||
estadoSelect.innerHTML = "<option value=''>Seleccionar Estado</option>";
|
|
||||||
municipioSelect.innerHTML = "<option value=''>Seleccionar Municipios</option>";
|
|
||||||
coloniaSelect.innerHTML = "<option value=''>Seleccionar Colonia</option>";
|
|
||||||
|
|
||||||
// Verifica si se recibieron datos
|
|
||||||
if (data.length > 0) {
|
|
||||||
//Crea conjuntos para almacenar estados, ciudades y colonias únicos
|
|
||||||
let estados = new Set();
|
|
||||||
let municipios = new Set();
|
|
||||||
let colonias = [];
|
|
||||||
|
|
||||||
// Itera sobre cada fila de datos recibidos
|
|
||||||
data.forEach(row => {
|
|
||||||
estados.add(row.estado);
|
|
||||||
municipios.add(row.municipio);
|
|
||||||
colonias.push(row.colonia);
|
|
||||||
});
|
|
||||||
|
|
||||||
//Añade las opciones de estados al elemento select
|
|
||||||
estados.forEach(estado => {
|
|
||||||
estadoSelect.innerHTML += "<option value='" + estado + "'>" + estado + "</option>";
|
|
||||||
});
|
|
||||||
|
|
||||||
//Añade las opciones de ciudades al elemento select
|
|
||||||
municipios.forEach(municipio => {
|
|
||||||
municipioSelect.innerHTML += "<option value='" + municipio + "'>" + municipio + "</option>";
|
|
||||||
});
|
|
||||||
|
|
||||||
//Añade las opciones de colonias al elemento select
|
|
||||||
colonias.forEach(colonia => {
|
|
||||||
coloniaSelect.innerHTML += "<option value='" + colonia + "'>" + colonia + "</option>";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert("No se encontraron datos para el código postal ingresado.");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error("Error en la solicitud:", error);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert("Por favor, ingrese un código postal.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,362 +0,0 @@
|
||||||
// ==========================================
|
|
||||||
// CONFIGURACIÓN Y CONSTANTES
|
|
||||||
// ==========================================
|
|
||||||
const CONFIG = {
|
|
||||||
API_BASE_URL: 'http://localhost:5000/api',
|
|
||||||
FILE_PREFIX: 'candidatos'
|
|
||||||
};
|
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// ESTADO DE LA APLICACIÓN
|
|
||||||
// ==========================================
|
|
||||||
class AppState {
|
|
||||||
constructor() {
|
|
||||||
this.accessToken = '';
|
|
||||||
this.candidatesData = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
setAccessToken(token) {
|
|
||||||
this.accessToken = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAccessToken() {
|
|
||||||
return this.accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
setCandidatesData(data) {
|
|
||||||
this.candidatesData = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
getCandidatesData() {
|
|
||||||
return this.candidatesData;
|
|
||||||
}
|
|
||||||
|
|
||||||
hasToken() {
|
|
||||||
return !!this.accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
hasData() {
|
|
||||||
return this.candidatesData.length > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// SERVICIOS API
|
|
||||||
// ==========================================
|
|
||||||
class ApiService {
|
|
||||||
static async getAccessToken(clientId, clientSecret) {
|
|
||||||
const formData = new URLSearchParams();
|
|
||||||
formData.append('grant_type', 'client_credentials');
|
|
||||||
formData.append('client_id', clientId);
|
|
||||||
formData.append('client_secret', clientSecret);
|
|
||||||
|
|
||||||
const response = await fetch(`${CONFIG.API_BASE_URL}/oauth/token`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
body: formData
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
const errorData = await response.json();
|
|
||||||
throw new Error(errorData.message || 'Error en la autenticación');
|
|
||||||
}
|
|
||||||
|
|
||||||
return await response.json();
|
|
||||||
}
|
|
||||||
|
|
||||||
static async getCandidates(accessToken) {
|
|
||||||
if (!accessToken) {
|
|
||||||
throw new Error('No hay token de acceso disponible');
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await fetch(`${CONFIG.API_BASE_URL}/candidatos/obtenerCandidatos`, {
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'Authorization': `Bearer ${accessToken}`,
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
const errorData = await response.json();
|
|
||||||
throw new Error(errorData.message || 'Error al obtener candidatos');
|
|
||||||
}
|
|
||||||
|
|
||||||
return await response.json();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// UTILIDADES
|
|
||||||
// ==========================================
|
|
||||||
class Utils {
|
|
||||||
static getCurrentDateTime() {
|
|
||||||
const now = new Date();
|
|
||||||
const year = now.getFullYear();
|
|
||||||
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
||||||
const day = String(now.getDate()).padStart(2, '0');
|
|
||||||
const hours = String(now.getHours()).padStart(2, '0');
|
|
||||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
||||||
|
|
||||||
return `${year}${month}${day}_${hours}${minutes}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
static flattenObject(obj, prefix = '') {
|
|
||||||
const flattened = {};
|
|
||||||
|
|
||||||
for (const key in obj) {
|
|
||||||
if (obj.hasOwnProperty(key)) {
|
|
||||||
const newKey = prefix ? `${prefix}_${key}` : key;
|
|
||||||
|
|
||||||
if (obj[key] !== null && typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
|
||||||
Object.assign(flattened, Utils.flattenObject(obj[key], newKey));
|
|
||||||
} else {
|
|
||||||
flattened[newKey] = obj[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return flattened;
|
|
||||||
}
|
|
||||||
|
|
||||||
static convertToCSV(data) {
|
|
||||||
if (!data.length) return '';
|
|
||||||
|
|
||||||
const flatData = data.map(candidato => Utils.flattenObject(candidato));
|
|
||||||
const headers = Object.keys(flatData[0]);
|
|
||||||
|
|
||||||
const csvHeaders = headers.join(',');
|
|
||||||
const csvRows = flatData.map(row =>
|
|
||||||
headers.map(header => {
|
|
||||||
const value = row[header];
|
|
||||||
if (typeof value === 'string' && (value.includes(',') || value.includes('\n') || value.includes('"'))) {
|
|
||||||
return `"${value.replace(/"/g, '""')}"`;
|
|
||||||
}
|
|
||||||
return value || '';
|
|
||||||
}).join(',')
|
|
||||||
);
|
|
||||||
|
|
||||||
return [csvHeaders, ...csvRows].join('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
static downloadFile(content, filename, mimeType) {
|
|
||||||
const blob = new Blob([content], { type: mimeType });
|
|
||||||
const link = document.createElement('a');
|
|
||||||
link.href = URL.createObjectURL(blob);
|
|
||||||
link.download = filename;
|
|
||||||
link.click();
|
|
||||||
URL.revokeObjectURL(link.href);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// CONTROLADOR DE DESCARGA
|
|
||||||
// ==========================================
|
|
||||||
class DownloadController {
|
|
||||||
constructor(appState) {
|
|
||||||
this.appState = appState;
|
|
||||||
}
|
|
||||||
|
|
||||||
downloadJSON() {
|
|
||||||
if (!this.appState.hasData()) {
|
|
||||||
alert('No hay datos para descargar');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dataStr = JSON.stringify(this.appState.getCandidatesData(), null, 2);
|
|
||||||
const filename = `${CONFIG.FILE_PREFIX}_${Utils.getCurrentDateTime()}.json`;
|
|
||||||
Utils.downloadFile(dataStr, filename, 'application/json');
|
|
||||||
}
|
|
||||||
|
|
||||||
downloadCSV() {
|
|
||||||
if (!this.appState.hasData()) {
|
|
||||||
alert('No hay datos para descargar');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const csvData = Utils.convertToCSV(this.appState.getCandidatesData());
|
|
||||||
const filename = `${CONFIG.FILE_PREFIX}_${Utils.getCurrentDateTime()}.csv`;
|
|
||||||
Utils.downloadFile(csvData, filename, 'text/csv;charset=utf-8;');
|
|
||||||
}
|
|
||||||
|
|
||||||
downloadExcel() {
|
|
||||||
if (!this.appState.hasData()) {
|
|
||||||
alert('No hay datos para descargar');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const flatData = this.appState.getCandidatesData().map(candidato => Utils.flattenObject(candidato));
|
|
||||||
|
|
||||||
const wb = XLSX.utils.book_new();
|
|
||||||
const ws = XLSX.utils.json_to_sheet(flatData);
|
|
||||||
|
|
||||||
const cols = Object.keys(flatData[0]).map(() => ({ wch: 15 }));
|
|
||||||
ws['!cols'] = cols;
|
|
||||||
|
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Candidatos');
|
|
||||||
const filename = `${CONFIG.FILE_PREFIX}_${Utils.getCurrentDateTime()}.xlsx`;
|
|
||||||
XLSX.writeFile(wb, filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// CONTROLADOR DE UI
|
|
||||||
// ==========================================
|
|
||||||
class UIController {
|
|
||||||
constructor() {
|
|
||||||
this.elements = {
|
|
||||||
tokenType: document.getElementById('token-type'),
|
|
||||||
expiresIn: document.getElementById('expires-in'),
|
|
||||||
tokenSection: document.getElementById('token-section'),
|
|
||||||
noTokenMessage: document.getElementById('no-token-message'),
|
|
||||||
downloadSection: document.getElementById('download-section'),
|
|
||||||
recordsCount: document.getElementById('records-count'),
|
|
||||||
candidatesSection: document.getElementById('candidates-section'),
|
|
||||||
candidatesTableBody: document.getElementById('candidates-table-body'),
|
|
||||||
apiResponseSection: document.getElementById('api-response-section'),
|
|
||||||
apiResponse: document.getElementById('api-response'),
|
|
||||||
errorSection: document.getElementById('error-section'),
|
|
||||||
errorMessage: document.getElementById('error-message'),
|
|
||||||
noResultsMessage: document.getElementById('no-results-message')
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
displayTokenInfo(tokenData) {
|
|
||||||
this.elements.tokenType.textContent = tokenData.token_type;
|
|
||||||
this.elements.expiresIn.textContent = tokenData.expires_in;
|
|
||||||
|
|
||||||
this.elements.tokenSection.classList.remove('hidden');
|
|
||||||
this.elements.noTokenMessage.classList.add('hidden');
|
|
||||||
|
|
||||||
console.log('Token obtenido y almacenado de forma segura');
|
|
||||||
}
|
|
||||||
|
|
||||||
displayCandidates(candidates) {
|
|
||||||
this.elements.apiResponse.textContent = JSON.stringify(candidates, null, 2);
|
|
||||||
this.elements.apiResponseSection.classList.remove('hidden');
|
|
||||||
|
|
||||||
this.elements.downloadSection.classList.remove('hidden');
|
|
||||||
this.elements.recordsCount.textContent = candidates.length;
|
|
||||||
|
|
||||||
this._fillCandidatesTable(candidates);
|
|
||||||
|
|
||||||
this.elements.candidatesSection.classList.remove('hidden');
|
|
||||||
this.elements.noResultsMessage.classList.add('hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
_fillCandidatesTable(candidates) {
|
|
||||||
this.elements.candidatesTableBody.innerHTML = '';
|
|
||||||
|
|
||||||
candidates.forEach(candidato => {
|
|
||||||
const dem = candidato.demograficos || {};
|
|
||||||
const ubi = dem.ubicacion || {};
|
|
||||||
const form = candidato.formacion || {};
|
|
||||||
const exam = candidato.examen || {};
|
|
||||||
const exp = candidato.experiencia_servicio || {};
|
|
||||||
const fechas = candidato.fechas || {};
|
|
||||||
|
|
||||||
const row = document.createElement('tr');
|
|
||||||
row.innerHTML = `
|
|
||||||
<td>${candidato.id_candidato ?? ''}</td>
|
|
||||||
<td>${candidato.nombre_completo ?? ''}</td>
|
|
||||||
<td>${candidato.contacto?.correo ?? ''}</td>
|
|
||||||
<td>${candidato.contacto?.telefono ?? ''}</td>
|
|
||||||
<td>${dem.genero ?? ''}</td>
|
|
||||||
<td>${dem.rango_edad ?? ''}</td>
|
|
||||||
<td>${dem.tipo_identificacion ?? ''}</td>
|
|
||||||
<td>${ubi.pais ?? ''}</td>
|
|
||||||
<td>${ubi.estado ?? ''}</td>
|
|
||||||
<td>${ubi.municipio ?? ''}</td>
|
|
||||||
<td>${ubi.colonia ?? ''}</td>
|
|
||||||
<td>${form.nivel_estudio ?? ''}</td>
|
|
||||||
<td>${form.giro ?? ''}</td>
|
|
||||||
<td>${form.nombre_empresa_institucion ?? ''}</td>
|
|
||||||
<td>${exam.id_examen ?? ''}</td>
|
|
||||||
<td>${exam.nombre_examen ?? ''}</td>
|
|
||||||
<td>${exam.motivo ?? ''}</td>
|
|
||||||
<td>${exp.calificacion_servicio ?? ''}</td>
|
|
||||||
<td>${exp.consentimiento_publicidad !== undefined ? (exp.consentimiento_publicidad ? 'Sí' : 'No') : ''}</td>
|
|
||||||
<td>${fechas.entrada ?? ''}</td>
|
|
||||||
<td>${fechas.salida ?? ''}</td>
|
|
||||||
`;
|
|
||||||
|
|
||||||
this.elements.candidatesTableBody.appendChild(row);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
showError(message) {
|
|
||||||
this.elements.errorMessage.textContent = message;
|
|
||||||
this.elements.errorSection.classList.remove('hidden');
|
|
||||||
this.elements.noResultsMessage.classList.add('hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
hideAllMessages() {
|
|
||||||
this.elements.errorSection.classList.add('hidden');
|
|
||||||
this.elements.apiResponseSection.classList.add('hidden');
|
|
||||||
this.elements.downloadSection.classList.add('hidden');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// CONTROLADOR PRINCIPAL DE LA APLICACIÓN
|
|
||||||
// ==========================================
|
|
||||||
class AppController {
|
|
||||||
constructor() {
|
|
||||||
this.appState = new AppState();
|
|
||||||
this.uiController = new UIController();
|
|
||||||
this.downloadController = new DownloadController(this.appState);
|
|
||||||
|
|
||||||
this._initializeEventListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
_initializeEventListeners() {
|
|
||||||
// OAuth form
|
|
||||||
document.getElementById('oauth-form').addEventListener('submit', (e) => this._handleOAuthSubmit(e));
|
|
||||||
|
|
||||||
// Get candidates button
|
|
||||||
document.getElementById('get-candidates').addEventListener('click', () => this._handleGetCandidates());
|
|
||||||
|
|
||||||
// Download buttons
|
|
||||||
document.getElementById('download-json').addEventListener('click', () => this.downloadController.downloadJSON());
|
|
||||||
document.getElementById('download-csv').addEventListener('click', () => this.downloadController.downloadCSV());
|
|
||||||
document.getElementById('download-excel').addEventListener('click', () => this.downloadController.downloadExcel());
|
|
||||||
}
|
|
||||||
|
|
||||||
async _handleOAuthSubmit(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const clientId = document.getElementById('clientId').value;
|
|
||||||
const clientSecret = document.getElementById('clientSecret').value;
|
|
||||||
|
|
||||||
this.uiController.hideAllMessages();
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await ApiService.getAccessToken(clientId, clientSecret);
|
|
||||||
this.appState.setAccessToken(response.access_token);
|
|
||||||
this.uiController.displayTokenInfo(response);
|
|
||||||
} catch (error) {
|
|
||||||
this.uiController.showError(`Error al obtener token: ${error.message}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async _handleGetCandidates() {
|
|
||||||
this.uiController.hideAllMessages();
|
|
||||||
|
|
||||||
try {
|
|
||||||
const candidates = await ApiService.getCandidates(this.appState.getAccessToken());
|
|
||||||
this.appState.setCandidatesData(candidates);
|
|
||||||
this.uiController.displayCandidates(candidates);
|
|
||||||
} catch (error) {
|
|
||||||
this.uiController.showError(`Error al obtener candidatos: ${error.message}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// INICIALIZACIÓN DE LA APLICACIÓN
|
|
||||||
// ==========================================
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
new AppController();
|
|
||||||
});
|
|
|
@ -1,35 +0,0 @@
|
||||||
document.addEventListener("DOMContentLoaded" , function() {
|
|
||||||
const tabla = document.querySelector('table');
|
|
||||||
|
|
||||||
tabla.addEventListener("click", function(evento) {
|
|
||||||
const botonEliminar = evento.target.closest(".boton-eliminar");
|
|
||||||
|
|
||||||
if (botonEliminar) {
|
|
||||||
// Obtener id del candidato a eliminar usando dataset
|
|
||||||
const idCandidatoEliminar = botonEliminar.dataset.idCandidato;
|
|
||||||
|
|
||||||
// Mostrar un mensaje de confirmación antes de eliminar
|
|
||||||
if (!confirm("¿Desea eliminar al candidato " + idCandidatoEliminar + "?")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = new FormData();
|
|
||||||
data.append("id_candidato", idCandidatoEliminar);
|
|
||||||
|
|
||||||
|
|
||||||
fetch('../controllers/eliminarCandidato.php', {
|
|
||||||
method: 'POST',
|
|
||||||
body: data
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
alert(data.mensaje);
|
|
||||||
location.reload();
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Error:', error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
document.addEventListener("DOMContentLoaded" , function() {
|
|
||||||
const tabla = document.querySelector('table');
|
|
||||||
|
|
||||||
tabla.addEventListener("click", function(evento) {
|
|
||||||
const botonEliminar = evento.target.closest(".boton-eliminar");
|
|
||||||
|
|
||||||
if (botonEliminar) {
|
|
||||||
const idUsuarioEliminar = botonEliminar.dataset.idUsuario;
|
|
||||||
const nombreUsuarioEliminar = botonEliminar.dataset.nombreUsuario;
|
|
||||||
|
|
||||||
// Mostrar un mensaje de confirmación antes de eliminar
|
|
||||||
if (!confirm("¿Desea eliminar al usuario " + nombreUsuarioEliminar + "?")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = new FormData();
|
|
||||||
data.append("id_usuario", idUsuarioEliminar);
|
|
||||||
|
|
||||||
fetch('../controllers/eliminarUsuario.php', {
|
|
||||||
method: 'POST',
|
|
||||||
body: data
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
alert(data.mensaje);
|
|
||||||
location.reload();
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Error:', error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,69 +0,0 @@
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
|
||||||
const form = document.getElementById('form');
|
|
||||||
const contrasena = document.getElementById('contrasena');
|
|
||||||
const contrasenaVerificacion = document.getElementById('contrasena_verificacion');
|
|
||||||
const btnSubmit = document.getElementById('submit');
|
|
||||||
|
|
||||||
const togglePassword = document.getElementById('togglePassword');
|
|
||||||
const password = document.getElementById('contrasena');
|
|
||||||
togglePassword.addEventListener('click', function(e) {
|
|
||||||
const type = password.getAttribute('type') === 'password' ? 'text' : 'password';
|
|
||||||
password.setAttribute('type', type);
|
|
||||||
const icon = togglePassword.querySelector('i');
|
|
||||||
if (type === 'text') {
|
|
||||||
icon.classList.remove('bi-eye');
|
|
||||||
icon.classList.add('bi-eye-slash');
|
|
||||||
} else {
|
|
||||||
icon.classList.remove('bi-eye-slash');
|
|
||||||
icon.classList.add('bi-eye');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
btnSubmit.addEventListener('click', function(event){
|
|
||||||
// Forzar vaidación nativa de HTML5
|
|
||||||
if (!form.checkValidity()) {
|
|
||||||
form.reportValidity();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const c1 = contrasena.value;
|
|
||||||
const c2 = contrasenaVerificacion.value;
|
|
||||||
if (c1 === c2) {
|
|
||||||
|
|
||||||
const usuario = document.getElementById('usuario').value;
|
|
||||||
|
|
||||||
const regex = /^[a-zA-Z0-9]+$/;
|
|
||||||
if (!regex.test(usuario)) {
|
|
||||||
alert("Nombre de usuario no valido.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = new FormData();
|
|
||||||
data.append("usuario", usuario);
|
|
||||||
data.append("contrasena", c1);
|
|
||||||
|
|
||||||
fetch('../controllers/crearUsuario.php', {
|
|
||||||
method: 'POST',
|
|
||||||
body: data
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.estado === "exitoso") {
|
|
||||||
alert(data.mensaje);
|
|
||||||
window.location.href = "control-usuarios.php";
|
|
||||||
} else if (data.estado === "error") {
|
|
||||||
alert("Error, intentelo más tarde.");
|
|
||||||
console.log(data.mensaje);
|
|
||||||
} else {
|
|
||||||
alert("Error inesperado, intentelo más tarde.");
|
|
||||||
console.log(data);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
alert("Las contraseñas no coinciden");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
148
js/form.js
148
js/form.js
|
@ -1,148 +0,0 @@
|
||||||
// SIDEBAR DROPDOWN
|
|
||||||
const allDropdown = document.querySelectorAll('#sidebar .side-dropdown');
|
|
||||||
const sidebar = document.getElementById('sidebar');
|
|
||||||
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.addEventListener('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if(!this.classList.contains('active')) {
|
|
||||||
allDropdown.forEach(i=> {
|
|
||||||
const aLink = i.parentElement.querySelector('a:first-child');
|
|
||||||
|
|
||||||
aLink.classList.remove('active');
|
|
||||||
i.classList.remove('show');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.classList.toggle('active');
|
|
||||||
item.classList.toggle('show');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// SIDEBAR COLLAPSE
|
|
||||||
const toggleSidebar = document.querySelector('nav .toggle-sidebar');
|
|
||||||
const allSideDivider = document.querySelectorAll('#sidebar .divider');
|
|
||||||
|
|
||||||
if(sidebar.classList.contains('hide')) {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleSidebar.addEventListener('click', function () {
|
|
||||||
sidebar.classList.toggle('hide');
|
|
||||||
|
|
||||||
if(sidebar.classList.contains('hide')) {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sidebar.addEventListener('mouseleave', function () {
|
|
||||||
if(this.classList.contains('hide')) {
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sidebar.addEventListener('mouseenter', function () {
|
|
||||||
if(this.classList.contains('hide')) {
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PROFILE DROPDOWN
|
|
||||||
const profile = document.querySelector('nav .profile');
|
|
||||||
const imgProfile = profile.querySelector('img');
|
|
||||||
const dropdownProfile = profile.querySelector('.profile-link');
|
|
||||||
|
|
||||||
imgProfile.addEventListener('click', function () {
|
|
||||||
dropdownProfile.classList.toggle('show');
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// MENU
|
|
||||||
const allMenu = document.querySelectorAll('main .content-data .head .menu');
|
|
||||||
|
|
||||||
allMenu.forEach(item=> {
|
|
||||||
const icon = item.querySelector('.icon');
|
|
||||||
const menuLink = item.querySelector('.menu-link');
|
|
||||||
|
|
||||||
icon.addEventListener('click', function () {
|
|
||||||
menuLink.classList.toggle('show');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('click', function (e) {
|
|
||||||
if(e.target !== imgProfile) {
|
|
||||||
if(e.target !== dropdownProfile) {
|
|
||||||
if(dropdownProfile.classList.contains('show')) {
|
|
||||||
dropdownProfile.classList.remove('show');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allMenu.forEach(item=> {
|
|
||||||
const icon = item.querySelector('.icon');
|
|
||||||
const menuLink = item.querySelector('.menu-link');
|
|
||||||
|
|
||||||
if(e.target !== icon) {
|
|
||||||
if(e.target !== menuLink) {
|
|
||||||
if (menuLink.classList.contains('show')) {
|
|
||||||
menuLink.classList.remove('show')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -1,119 +0,0 @@
|
||||||
const formulario = document.getElementById("formulario-datos-basicos");
|
|
||||||
const notificacion = document.getElementById("mensaje-error");
|
|
||||||
|
|
||||||
// Función para validar el nombre
|
|
||||||
function validarNombre(nombre) {
|
|
||||||
const nombreRegex = /^[a-zA-ZÀ-ÿ\s]+$/; // Permite letras y espacios
|
|
||||||
return nombreRegex.test(nombre);
|
|
||||||
}
|
|
||||||
|
|
||||||
//funcion para validar apellido
|
|
||||||
function validarApellido(apellido) {
|
|
||||||
const apellidoRegex = /^[a-zA-ZÀ-ÿ]+$/; // Permite solo letras, sin espacios
|
|
||||||
return apellidoRegex.test(apellido);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Función para validar número telefónico (10 dígitos)
|
|
||||||
function validarTelefono(telefono) {
|
|
||||||
const telefonoRegex = /^\d{10}$/;
|
|
||||||
return telefonoRegex.test(telefono);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Función para validar correo electrónico
|
|
||||||
function validarCorreo(correo) {
|
|
||||||
const correoRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
||||||
return correoRegex.test(correo);
|
|
||||||
}
|
|
||||||
|
|
||||||
formulario.addEventListener("submit", async(event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
// Limpiar mensaje de error previo
|
|
||||||
notificacion.textContent = "";
|
|
||||||
notificacion.style.display = "none";
|
|
||||||
|
|
||||||
// Obtener valores de los campos
|
|
||||||
const idCandidato = document.getElementById('id_candidato').value;
|
|
||||||
const fechaEntrada = document.getElementById('fecha_entrada').value;
|
|
||||||
const fechaSalida = document.getElementById('fecha_salida').value;
|
|
||||||
|
|
||||||
const nombres = document.getElementById('nombres').value.trim();
|
|
||||||
const primerApellido = document.getElementById('primer_apellido').value.trim();
|
|
||||||
const segundoApellido = document.getElementById('segundo_apellido').value.trim();
|
|
||||||
const correo = document.getElementById('correo').value.trim();
|
|
||||||
const telefono = document.getElementById('telefono').value.trim();
|
|
||||||
|
|
||||||
const idExamen = document.getElementById('id_examen').value;
|
|
||||||
const idTipoId = document.getElementById('id_tipo_id').value;
|
|
||||||
const idRangoEdad = document.getElementById('id_rango_edad').value;
|
|
||||||
const idGenero = document.getElementById('id_genero').value;
|
|
||||||
|
|
||||||
// Validaciones
|
|
||||||
let errores = [];
|
|
||||||
|
|
||||||
// Validar correo electrónico
|
|
||||||
if (!validarCorreo(correo)) {
|
|
||||||
errores.push("El correo electrónico no es válido. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// validar nombre
|
|
||||||
if (!validarNombre(nombres)) {
|
|
||||||
errores.push("El nombre no tiene un formato válido. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// validar apellido
|
|
||||||
if (!validarApellido(primerApellido)) {
|
|
||||||
errores.push("El primer apellido no tiene un formato válido. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!validarApellido(segundoApellido)) {
|
|
||||||
errores.push("El segundo apellido no tiene un formato válido. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validar número telefónico
|
|
||||||
if (!validarTelefono(telefono)) {
|
|
||||||
errores.push("El número telefónico debe ser un número de 10 dígitos. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si hay errores, mostrarlos y detener el envío
|
|
||||||
if (errores.length > 0) {
|
|
||||||
notificacion.textContent = errores.join("\n");
|
|
||||||
notificacion.style.display = "block";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Preparar datos para envío
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append("id_candidato", idCandidato);
|
|
||||||
formData.append("fecha_entrada", fechaEntrada);
|
|
||||||
formData.append("fecha_salida", fechaSalida);
|
|
||||||
formData.append("nombres", nombres);
|
|
||||||
formData.append("primer_apellido", primerApellido);
|
|
||||||
formData.append("segundo_apellido", segundoApellido);
|
|
||||||
formData.append("correo", correo);
|
|
||||||
formData.append("telefono", telefono);
|
|
||||||
formData.append("id_examen", idExamen);
|
|
||||||
formData.append("id_tipo_id", idTipoId);
|
|
||||||
formData.append("id_rango_edad", idRangoEdad);
|
|
||||||
formData.append("id_genero", idGenero);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const respuesta = await fetch('ruta', {
|
|
||||||
method: "POST",
|
|
||||||
body: formData,
|
|
||||||
});
|
|
||||||
|
|
||||||
const resultado = await respuesta.json();
|
|
||||||
|
|
||||||
if (resultado.datosIngresados) {
|
|
||||||
alert('Se guardó la información correctamente');
|
|
||||||
window.location.href = 'inicio.html';
|
|
||||||
} else {
|
|
||||||
notificacion.textContent = resultado.mensaje;
|
|
||||||
notificacion.style.display = "block";
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
notificacion.textContent = "Lo sentimos, ocurrió un error: " + error.message;
|
|
||||||
notificacion.style.display = "block";
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,61 +0,0 @@
|
||||||
const formulario = document.getElementById("formulario-datos-extendido");
|
|
||||||
const notificacion = document.getElementById("mensaje-error");
|
|
||||||
|
|
||||||
formulario.addEventListener("submit", async(event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
// Limpiar mensaje de error previo
|
|
||||||
notificacion.textContent = "";
|
|
||||||
notificacion.style.display = "none";
|
|
||||||
|
|
||||||
// Obtener valores de los campos
|
|
||||||
const idCandidato = document.getElementById('id_candidato').value;
|
|
||||||
const idPais = document.getElementById('id_pais').value;
|
|
||||||
const codigoPostal = document.getElementById('codigo_postal').value; // campo numérico, no necesita trim
|
|
||||||
const idEstado = document.getElementById('id_estado').value;
|
|
||||||
const idMunicipio = document.getElementById('id_municipio').value;
|
|
||||||
const idColonia = document.getElementById('id_colonia').value;
|
|
||||||
|
|
||||||
const idNivel = document.getElementById('id_nivel').value;
|
|
||||||
const idGiro = document.getElementById('id_giro').value;
|
|
||||||
const nombreEmpresa = document.getElementById('nombre_empresa').value.trim();
|
|
||||||
const motivoExamen = document.getElementById('motivo_examen').value.trim();
|
|
||||||
|
|
||||||
const calificacionServicio = document.getElementById('calificacion_servicio').value;
|
|
||||||
const consentimientoPub = document.getElementById('consentimiento_pub').checked;
|
|
||||||
|
|
||||||
|
|
||||||
// Preparar datos para envío
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append("id_candidato", idCandidato);
|
|
||||||
formData.append("id_pais", idPais);
|
|
||||||
formData.append("codigo_postal", codigoPostal);
|
|
||||||
formData.append("id_estado", idEstado);
|
|
||||||
formData.append("id_municipio", idMunicipio);
|
|
||||||
formData.append("id_colonia", idColonia);
|
|
||||||
formData.append("id_nivel", idNivel);
|
|
||||||
formData.append("id_giro", idGiro);
|
|
||||||
formData.append("nombre_empresa", nombreEmpresa);
|
|
||||||
formData.append("motivo_examen", motivoExamen);
|
|
||||||
formData.append("calificacion_servicio", calificacionServicio);
|
|
||||||
formData.append("consentimiento_pub", consentimientoPub ? 1 : 0);
|
|
||||||
try {
|
|
||||||
const respuesta = await fetch('ruta', {
|
|
||||||
method: "POST",
|
|
||||||
body: formData,
|
|
||||||
});
|
|
||||||
|
|
||||||
const resultado = await respuesta.json();
|
|
||||||
|
|
||||||
if (resultado.datosIngresados) {
|
|
||||||
alert('Se guardó la información correctamente');
|
|
||||||
window.location.href = 'inicio.html';
|
|
||||||
} else {
|
|
||||||
notificacion.textContent = resultado.mensaje;
|
|
||||||
notificacion.style.display = "block";
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
notificacion.textContent = "Lo sentimos, ocurrió un error: " + error.message;
|
|
||||||
notificacion.style.display = "block";
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,389 +0,0 @@
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
const formulario = document.getElementById("formulario-datos-extendido");
|
|
||||||
const buscarBtn = document.getElementById("buscarBtn");
|
|
||||||
const paisSelect = document.getElementById("id_pais");
|
|
||||||
const inputCodigoPostal = document.getElementById("codigo_postal");
|
|
||||||
const inputButtonBuscarCodigoPostal = document.getElementById("buscarBtn");
|
|
||||||
const estadoSelect = document.getElementById("id_estado");
|
|
||||||
const municipioSelect = document.getElementById("id_municipio");
|
|
||||||
const coloniaSelect = document.getElementById("id_colonia");
|
|
||||||
const giroSelect = document.getElementById("id_giro");
|
|
||||||
const nivelEstudioSelect = document.getElementById("id_nivel");
|
|
||||||
const motivoExamenSelect = document.getElementById("motivo_examen");
|
|
||||||
const selectCalificacionServicio = document.getElementById("calificacion_servicio");
|
|
||||||
const dataListEmpresasInstituciones = document.getElementById("sugerencias_ei");
|
|
||||||
|
|
||||||
llenarSelectGiro();
|
|
||||||
llenarSelectNivelesEstudio();
|
|
||||||
llenarDataListEmpresasInstituciones();
|
|
||||||
llenarSelectMotivoExamen();
|
|
||||||
|
|
||||||
// FUNCIONES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
function llenarSelectGiro() {
|
|
||||||
// URL para la solicitud
|
|
||||||
let url = "../controllers/CatalogosController.php?obtener=giros";
|
|
||||||
|
|
||||||
// Realiza una solicitud HTTP GET a la URL especificada
|
|
||||||
fetch(url)
|
|
||||||
.then(response => {
|
|
||||||
// Verifica si la respuesta del servidor es exitosa
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("llenarSelectGiro(): Error en la respuesta del servidor.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convertir la respuesta a JSON
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
// Verifica si se recibieron datos
|
|
||||||
if (data.length > 0) {
|
|
||||||
|
|
||||||
// Añade las opciones de giros al elemento select
|
|
||||||
data.forEach(row => {
|
|
||||||
giroSelect.innerHTML += "<option value='" + row.id_giro + "'>" + row.descripcion + "</option>";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert("llenarSelectGiro(): No se encontraron datos para los giros.");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error("llenarSelectGiro(): Error en la solicitud. ", error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function llenarSelectNivelesEstudio(){
|
|
||||||
let url = "../controllers/CatalogosController.php?obtener=nivelesestudio";
|
|
||||||
// Petición fetch y llenado de select
|
|
||||||
fetch(url)
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("llenarSelectNivelesEstudio(): Error en la respuesta del servidor.");
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
if (data.length > 0) {
|
|
||||||
data.forEach(row => {
|
|
||||||
nivelEstudioSelect.innerHTML += "<option value='" + row.id_nivel + "'>" + row.descripcion + "</option>";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert("llenarSelectNivelesEstudio(): No se encontraron datos para los giros.");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error("llenarSelectNivelesEstudio(): Error en la solicitud. ", error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//##################################################################################################################
|
|
||||||
function llenarSelectMotivoExamen() {
|
|
||||||
// URL para la solicitud
|
|
||||||
let url = "../controllers/CatalogosController.php?obtener=motivos";
|
|
||||||
|
|
||||||
// Realiza una solicitud HTTP GET a la URL especificada
|
|
||||||
fetch(url)
|
|
||||||
.then(response => {
|
|
||||||
// Verifica si la respuesta del servidor es exitosa
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("Error en la respuesta del servidor.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convertir la respuesta a JSON
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
// Verifica si se recibieron datos
|
|
||||||
if (data.length > 0) {
|
|
||||||
|
|
||||||
// Añade las opciones de motivos al elemento select
|
|
||||||
data.forEach(row => {
|
|
||||||
motivoExamenSelect.innerHTML += "<option value='" + row.id + "'>" + row.descripcion + "</option>";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("llenarSelectMotivoExamen(): No se encontraron datos.");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error("llenarSelectMotivoExamen(): ", error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// #################################################################################################################
|
|
||||||
|
|
||||||
function llenarDataListEmpresasInstituciones(){
|
|
||||||
let url = "../controllers/CatalogosController.php?obtener=empresasinstituciones";
|
|
||||||
fetch(url)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.length > 0) {
|
|
||||||
data.forEach(row => {
|
|
||||||
dataListEmpresasInstituciones.innerHTML += "<option value='" + row.nombre_empresa_institucion + "'>" + row.nombre_empresa_institucion + "</option>";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("llenarDataListEmpresasInstituciones(): No se encontraron datos para las empresas o instituciones.");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error("llenarDataListEmpresasInstituciones(): Error en la solicitud. ", error);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Función para obtener fecha en formato: 2025-04-27 09:05:18
|
|
||||||
function obtenerFechaActual() {
|
|
||||||
const ahora = new Date();
|
|
||||||
|
|
||||||
const anio = ahora.getFullYear();
|
|
||||||
const mes = String(ahora.getMonth() + 1).padStart(2, '0'); // Mes comienza en 0
|
|
||||||
const dia = String(ahora.getDate()).padStart(2, '0');
|
|
||||||
|
|
||||||
const horas = String(ahora.getHours()).padStart(2, '0');
|
|
||||||
const minutos = String(ahora.getMinutes()).padStart(2, '0');
|
|
||||||
const segundos = String(ahora.getSeconds()).padStart(2, '0');
|
|
||||||
|
|
||||||
return `${anio}-${mes}-${dia} ${horas}:${minutos}:${segundos}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectPaisValido(){
|
|
||||||
return paisSelect.value !== "NULL";
|
|
||||||
}
|
|
||||||
function selectNivelEstudioValido(){
|
|
||||||
return nivelEstudioSelect.value !== "NULL";
|
|
||||||
}
|
|
||||||
function selectGiroValido(){
|
|
||||||
return giroSelect.value !== "NULL";
|
|
||||||
}
|
|
||||||
function selectCalificacionServicioValido(){
|
|
||||||
return selectCalificacionServicio.value !== "NULL";
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectEstadoValido(){
|
|
||||||
if(paisSelect.value === "1"){
|
|
||||||
return estadoSelect.value !== "NULL";
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function selectMunicipioValido(){
|
|
||||||
if(paisSelect.value === "1"){
|
|
||||||
return municipioSelect.value !== "NULL";
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function selectColoniaValido(){
|
|
||||||
if(paisSelect.value === "1"){
|
|
||||||
return coloniaSelect.value !== "NULL";
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FUNCIONES
|
|
||||||
|
|
||||||
// EVENTOS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
|
|
||||||
// Añadir un evento de cambio al select de país
|
|
||||||
paisSelect.addEventListener("change", function() {
|
|
||||||
// Si el país es México, habilitar el campo de código postal
|
|
||||||
if (paisSelect.value === "1") {
|
|
||||||
inputCodigoPostal.removeAttribute("disabled");
|
|
||||||
inputButtonBuscarCodigoPostal.removeAttribute("disabled");
|
|
||||||
} else {
|
|
||||||
inputCodigoPostal.value = "";
|
|
||||||
inputCodigoPostal.setAttribute("disabled", "");
|
|
||||||
inputButtonBuscarCodigoPostal.setAttribute("disabled", "");
|
|
||||||
estadoSelect.removeAttribute("required");
|
|
||||||
municipioSelect.removeAttribute("required");
|
|
||||||
coloniaSelect.removeAttribute("required");
|
|
||||||
estadoSelect.setAttribute("disabled", "");
|
|
||||||
municipioSelect.setAttribute("disabled", "");
|
|
||||||
coloniaSelect.setAttribute("disabled", "");
|
|
||||||
estadoSelect.innerHTML = "<option value='NULL'>Seleccione su estado</option>";
|
|
||||||
municipioSelect.innerHTML = "<option value='NULL'>Seleccione su municipio</option>";
|
|
||||||
coloniaSelect.innerHTML = "<option value='NULL'>Seleccione su colonia</option>";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//Añadir un evento al boton de buscar
|
|
||||||
buscarBtn.addEventListener("click", function () {
|
|
||||||
let inputCodigoPostal = document.getElementById("codigo_postal").value;
|
|
||||||
|
|
||||||
//verificar si el codigo postal esta vacio
|
|
||||||
if (inputCodigoPostal) {
|
|
||||||
|
|
||||||
// Limpia los selects antes de llenarlos
|
|
||||||
estadoSelect.innerHTML = "<option value='NULL'>Seleccione su estado</option>";
|
|
||||||
municipioSelect.innerHTML = "<option value='NULL'>Seleccione su municipio</option>";
|
|
||||||
coloniaSelect.innerHTML = "<option value='NULL'>Seleccione su colonia</option>";
|
|
||||||
|
|
||||||
// Construye la URL para la solicitud
|
|
||||||
let url = "../controllers/CatalogosController.php?codigo_postal=" + encodeURIComponent(inputCodigoPostal);
|
|
||||||
|
|
||||||
// Realiza una solicitud HTTP GET a la URL especificada
|
|
||||||
fetch(url)
|
|
||||||
.then(response => {
|
|
||||||
//console.log("Estado de la respuesta:", response.status);
|
|
||||||
//console.log("Contenido de la respuesta:", response.json());
|
|
||||||
|
|
||||||
// Verifica si la respuesta del servidor es exitosa
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("Error en la respuesta del servidor");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convertir la respuesta a JSON
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
// Verifica si se recibieron datos
|
|
||||||
if (data.length > 0) {
|
|
||||||
|
|
||||||
// Quitar disable a los selects
|
|
||||||
estadoSelect.removeAttribute("disabled");
|
|
||||||
estadoSelect.setAttribute("required", "required");
|
|
||||||
municipioSelect.removeAttribute("disabled");
|
|
||||||
municipioSelect.setAttribute("required", "required");
|
|
||||||
coloniaSelect.removeAttribute("disabled");
|
|
||||||
coloniaSelect.setAttribute("required", "required");
|
|
||||||
|
|
||||||
//Crea conjuntos para almacenar estados, ciudades y colonias
|
|
||||||
let estados = new Map();
|
|
||||||
let municipios = new Map();
|
|
||||||
let colonias = new Map();
|
|
||||||
|
|
||||||
// Itera sobre cada fila de datos recibidos
|
|
||||||
data.forEach(row => {
|
|
||||||
//console.log(row);
|
|
||||||
estados.set(row['id_estado'], row['estado']);
|
|
||||||
municipios.set(row['id_municipio'], row['municipio']);
|
|
||||||
colonias.set(row['id_colonia'], row['colonia']);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Añade las opciones de estados al elemento select
|
|
||||||
for (let [id_estado, estado] of estados) {
|
|
||||||
estadoSelect.innerHTML += "<option value='" + id_estado + "'>" + estado + "</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Añade las opciones de ciudades al elemento select
|
|
||||||
for (let [id_municipio, municipio] of municipios) {
|
|
||||||
municipioSelect.innerHTML += "<option value='" + id_municipio + "'>" + municipio + "</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Añade las opciones de colonias al elemento select
|
|
||||||
for (let [id_colonia, colonia] of colonias) {
|
|
||||||
coloniaSelect.innerHTML += "<option value='" + id_colonia + "'>" + colonia + "</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
alert("No se encontraron datos para el código postal ingresado.");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error("Error en la solicitud:", error);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert("Por favor, ingrese un código postal.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
formulario.addEventListener("submit", async(event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
// Obtener valores de los campos
|
|
||||||
const idCandidato = document.getElementById('id_candidato').value;
|
|
||||||
const idPais = document.getElementById('id_pais').value;
|
|
||||||
const codigoPostal = document.getElementById('codigo_postal').value;
|
|
||||||
const idEstado = document.getElementById('id_estado').value;
|
|
||||||
const idMunicipio = document.getElementById('id_municipio').value;
|
|
||||||
const idColonia = document.getElementById('id_colonia').value;
|
|
||||||
|
|
||||||
const idNivel = document.getElementById('id_nivel').value;
|
|
||||||
const idGiro = document.getElementById('id_giro').value;
|
|
||||||
const nombreEmpresa = document.getElementById('nombre_empresa').value.trim();
|
|
||||||
const motivoExamen = document.getElementById('motivo_examen').value;
|
|
||||||
|
|
||||||
const calificacionServicio = document.getElementById('calificacion_servicio').value;
|
|
||||||
const consentimientoPub = document.getElementById('consentimiento_pub').checked;
|
|
||||||
|
|
||||||
const fechaSalida = obtenerFechaActual();
|
|
||||||
|
|
||||||
|
|
||||||
let validaciones = [];
|
|
||||||
|
|
||||||
if(!selectPaisValido()){
|
|
||||||
validaciones.push("⦁ Seleccione un país. ");
|
|
||||||
}
|
|
||||||
if(!selectNivelEstudioValido()){
|
|
||||||
validaciones.push("⦁ Seleccione un nivel de estudio.");
|
|
||||||
}
|
|
||||||
if(!selectGiroValido()){
|
|
||||||
validaciones.push("⦁ Seleccione un giro. ");
|
|
||||||
}
|
|
||||||
if(!selectCalificacionServicioValido()){
|
|
||||||
validaciones.push("⦁ Seleccione una calificación de servicio. ");
|
|
||||||
}
|
|
||||||
if(!selectEstadoValido()){
|
|
||||||
validaciones.push("⦁ Seleccione un estado. ");
|
|
||||||
}
|
|
||||||
if(!selectMunicipioValido()){
|
|
||||||
validaciones.push("⦁ Seleccione un municipio. ");
|
|
||||||
}
|
|
||||||
if(!selectColoniaValido()){
|
|
||||||
validaciones.push("⦁ Seleccione una colonia. ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(validaciones.length > 0){
|
|
||||||
alert("Campos del formulario sin llenar\n" + validaciones.join("\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Preparar datos para envío
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append("id_candidato", idCandidato);
|
|
||||||
formData.append("id_pais", idPais);
|
|
||||||
formData.append("codigo_postal", codigoPostal);
|
|
||||||
formData.append("id_estado", idEstado);
|
|
||||||
formData.append("id_municipio", idMunicipio);
|
|
||||||
formData.append("id_colonia", idColonia);
|
|
||||||
formData.append("id_nivel", idNivel);
|
|
||||||
formData.append("id_giro", idGiro);
|
|
||||||
|
|
||||||
formData.append("nombre_empresa_institucion", nombreEmpresa);
|
|
||||||
formData.append("motivo_examen", motivoExamen);
|
|
||||||
|
|
||||||
formData.append("calificacion_servicio", calificacionServicio);
|
|
||||||
if (consentimientoPub) {
|
|
||||||
formData.append("consentimiento_pub", 1);
|
|
||||||
} else {
|
|
||||||
formData.append("consentimiento_pub", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
formData.append("fecha_salida", fechaSalida);
|
|
||||||
|
|
||||||
// TEST
|
|
||||||
//alert("FORMULARIO ENVIADO");
|
|
||||||
|
|
||||||
//TEST: Pintar en consola datos del formData
|
|
||||||
for (let [key, value] of formData.entries()) {
|
|
||||||
console.log(key + ": ", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const respuesta = await fetch('../controllers/RegistrarInfoCandidato.php', {
|
|
||||||
method: "POST",
|
|
||||||
body: formData,
|
|
||||||
});
|
|
||||||
|
|
||||||
const resultado = await respuesta.json();
|
|
||||||
|
|
||||||
if (resultado.estado === "exitoso") {
|
|
||||||
console.log(resultado.res);
|
|
||||||
alert('Se guardó la información correctamente');
|
|
||||||
window.location.href = 'pantalla-salida-form.html';
|
|
||||||
} else if(resultado.estado === "error") {
|
|
||||||
console.error("RegistrarInfoCandidato.php: " + resultado.res);
|
|
||||||
alert("Ocurrió un error, intentelo más tarde.");
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
alert("Ocurrió un error, intentelo más tarde.");
|
|
||||||
console.error("Error en try-catch de fetch a RegistrarInfoCandidato: " + error.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EVENTOS
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,158 +0,0 @@
|
||||||
async function recuperarCantidadGenero(tipoConsulta, filtros = {}) {
|
|
||||||
try {
|
|
||||||
const response = await fetch("../controllers/graficos.php", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify({ tipoConsulta, ...filtros }),
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
return data.cantidad || 0;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al recuperar datos:", error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function recuperarCantidadEdad(tipoConsulta, filtros = {}) {
|
|
||||||
try {
|
|
||||||
const response = await fetch("../controllers/graficos.php", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify({ tipoConsulta, ...filtros }),
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
return data.cantidad || 0;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al recuperar datos:", error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function recuperarCantidadEstado(tipoConsulta, filtros = {}) {
|
|
||||||
try {
|
|
||||||
const response = await fetch("../controllers/graficos.php", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify({ tipoConsulta, ...filtros }),
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
if (!Array.isArray(data)) throw new Error("La respuesta del backend no es un array.");
|
|
||||||
return data;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al recuperar datos de estados:", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function recuperarCantidadExamen(tipoConsulta, filtros = {}) {
|
|
||||||
try {
|
|
||||||
const response = await fetch("../controllers/graficos.php", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify({ tipoConsulta, ...filtros }),
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
if (!Array.isArray(data)) throw new Error("La respuesta del backend no es un array");
|
|
||||||
return data;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al recuperar datos de examenes:", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function recuperarCantidadFecha(tipoConsulta, filtros = {}) {
|
|
||||||
try {
|
|
||||||
const response = await fetch("../controllers/graficos.php", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify({ tipoConsulta, ...filtros }),
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
if (!Array.isArray(data)) throw new Error("La respuesta del backend no es un array.");
|
|
||||||
return data;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al recuperar datos de fechas:", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function obtenerDatosEdades(filtros = {}) {
|
|
||||||
const edad1 = await recuperarCantidadEdad("Menor de 18 años", filtros);
|
|
||||||
const edad2 = await recuperarCantidadEdad("18 a 24 años", filtros);
|
|
||||||
const edad3 = await recuperarCantidadEdad("25 a 34 años", filtros);
|
|
||||||
const edad4 = await recuperarCantidadEdad("35 a 44 años", filtros);
|
|
||||||
const edad5 = await recuperarCantidadEdad("45 a 54 años", filtros);
|
|
||||||
const edad6 = await recuperarCantidadEdad("55 a 64 años", filtros);
|
|
||||||
const edad7 = await recuperarCantidadEdad("65 años o más", filtros);
|
|
||||||
return [edad1, edad2, edad3, edad4, edad5, edad6, edad7];
|
|
||||||
}
|
|
||||||
|
|
||||||
async function obtenerDatosGeneros(filtros = {}) {
|
|
||||||
const femenino = await recuperarCantidadGenero("Femenino", filtros);
|
|
||||||
const masculino = await recuperarCantidadGenero("Masculino", filtros);
|
|
||||||
const noDefinido = await recuperarCantidadGenero("Prefiero no decirlo", filtros);
|
|
||||||
return [femenino, masculino, noDefinido];
|
|
||||||
}
|
|
||||||
|
|
||||||
async function obtenerDatosEstados(filtros = {}) {
|
|
||||||
try {
|
|
||||||
const estados = await recuperarCantidadEstado("Estados", filtros);
|
|
||||||
if (!Array.isArray(estados)) {
|
|
||||||
console.error("Error: 'estados' no es un array. Verifica la respuesta del backend");
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const estadosValidos = estados.filter(estado => estado.estado && estado.cantidad !== undefined);
|
|
||||||
return estadosValidos;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al obtener datos de estados:", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function obtenerDatosExamenes(filtros = {}) {
|
|
||||||
try {
|
|
||||||
const examenes = await recuperarCantidadExamen("Examenes", filtros);
|
|
||||||
if (!Array.isArray(examenes)) {
|
|
||||||
console.error("Error: 'examenes' no es un array. Verifica la respuesta del backend");
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const examenesValidos = examenes.filter(examen => examen.examen && examen.cantidad !== undefined);
|
|
||||||
return examenesValidos;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al obtener datos de examenes:", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function obtenerDatosFechas(filtros = {}) {
|
|
||||||
try {
|
|
||||||
const fechas = await recuperarCantidadFecha("Fechas", filtros);
|
|
||||||
if (!Array.isArray(fechas) || !fechas.length) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
// Solo un objeto con la cantidad total
|
|
||||||
return fechas;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al obtener datos de fechas:", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFiltrosSeleccionados() {
|
|
||||||
return {
|
|
||||||
id_rango_edad: document.getElementById('id_rango_edad')?.value || "NULL",
|
|
||||||
id_genero: document.getElementById('id_genero')?.value || "NULL",
|
|
||||||
id_examen: document.getElementById('id_examen')?.value || "NULL",
|
|
||||||
fechaInicio: document.getElementById('date1')?.value || "",
|
|
||||||
fechaFin: document.getElementById('date2')?.value || ""
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
obtenerDatosGeneros,
|
|
||||||
obtenerDatosEdades,
|
|
||||||
obtenerDatosEstados,
|
|
||||||
obtenerDatosExamenes,
|
|
||||||
obtenerDatosFechas,
|
|
||||||
getFiltrosSeleccionados
|
|
||||||
};
|
|
362
js/inicio.js
362
js/inicio.js
|
@ -1,362 +0,0 @@
|
||||||
// SIDEBAR DROPDOWN
|
|
||||||
const allDropdown = document.querySelectorAll('#sidebar .side-dropdown');
|
|
||||||
const sidebar = document.getElementById('sidebar');
|
|
||||||
|
|
||||||
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.addEventListener('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if(!this.classList.contains('active')) {
|
|
||||||
allDropdown.forEach(i=> {
|
|
||||||
const aLink = i.parentElement.querySelector('a:first-child');
|
|
||||||
|
|
||||||
aLink.classList.remove('active');
|
|
||||||
i.classList.remove('show');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.classList.toggle('active');
|
|
||||||
item.classList.toggle('show');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// SIDEBAR COLLAPSE
|
|
||||||
const toggleSidebar = document.querySelector('nav .toggle-sidebar');
|
|
||||||
const allSideDivider = document.querySelectorAll('#sidebar .divider');
|
|
||||||
|
|
||||||
if(sidebar.classList.contains('hide')) {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleSidebar.addEventListener('click', function () {
|
|
||||||
sidebar.classList.toggle('hide');
|
|
||||||
|
|
||||||
if(sidebar.classList.contains('hide')) {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sidebar.addEventListener('mouseleave', function () {
|
|
||||||
if(this.classList.contains('hide')) {
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sidebar.addEventListener('mouseenter', function () {
|
|
||||||
if(this.classList.contains('hide')) {
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PROFILE DROPDOWN
|
|
||||||
const profile = document.querySelector('nav .profile');
|
|
||||||
const imgProfile = profile.querySelector('img');
|
|
||||||
const dropdownProfile = profile.querySelector('.profile-link');
|
|
||||||
|
|
||||||
imgProfile.addEventListener('click', function () {
|
|
||||||
dropdownProfile.classList.toggle('show');
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// MENU
|
|
||||||
const allMenu = document.querySelectorAll('main .content-data .head .menu');
|
|
||||||
|
|
||||||
allMenu.forEach(item=> {
|
|
||||||
const icon = item.querySelector('.icon');
|
|
||||||
const menuLink = item.querySelector('.menu-link');
|
|
||||||
|
|
||||||
icon.addEventListener('click', function () {
|
|
||||||
menuLink.classList.toggle('show');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('click', function (e) {
|
|
||||||
if(e.target !== imgProfile) {
|
|
||||||
if(e.target !== dropdownProfile) {
|
|
||||||
if(dropdownProfile.classList.contains('show')) {
|
|
||||||
dropdownProfile.classList.remove('show');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allMenu.forEach(item=> {
|
|
||||||
const icon = item.querySelector('.icon');
|
|
||||||
const menuLink = item.querySelector('.menu-link');
|
|
||||||
|
|
||||||
if(e.target !== icon) {
|
|
||||||
if(e.target !== menuLink) {
|
|
||||||
if (menuLink.classList.contains('show')) {
|
|
||||||
menuLink.classList.remove('show')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PROGRESSBAR
|
|
||||||
const allProgress = document.querySelectorAll('main .card .progress');
|
|
||||||
|
|
||||||
allProgress.forEach(item=> {
|
|
||||||
item.style.setProperty('--value', item.dataset.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import {
|
|
||||||
obtenerDatosGeneros,
|
|
||||||
obtenerDatosEdades,
|
|
||||||
obtenerDatosEstados,
|
|
||||||
obtenerDatosExamenes,
|
|
||||||
obtenerDatosFechas,
|
|
||||||
getFiltrosSeleccionados
|
|
||||||
} from './funcionesGraficos.js';
|
|
||||||
|
|
||||||
// Variables globales para los graficos
|
|
||||||
let chartGenero = null;
|
|
||||||
let chartEdad = null;
|
|
||||||
let chartEstado = null;
|
|
||||||
let chartExamen = null;
|
|
||||||
let chartFecha = null;
|
|
||||||
|
|
||||||
// Controla si el filtro de fecha está activo
|
|
||||||
let filtroFechaActivo = false;
|
|
||||||
|
|
||||||
async function inicializarGraficoFecha(filtros) {
|
|
||||||
// Solo dibujar si ambas fechas están presentes y el filtro está activo
|
|
||||||
if (!filtroFechaActivo || !filtros.fechaInicio || !filtros.fechaFin) {
|
|
||||||
if (chartFecha) {
|
|
||||||
chartFecha.destroy();
|
|
||||||
chartFecha = null;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fechas = await obtenerDatosFechas(filtros);
|
|
||||||
|
|
||||||
if (!fechas.length) {
|
|
||||||
if (chartFecha) {
|
|
||||||
chartFecha.destroy();
|
|
||||||
chartFecha = null;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Solo un valor total
|
|
||||||
const cantidad = fechas[0].cantidad;
|
|
||||||
const label = `Del ${fechas[0].fechaInicio} al ${fechas[0].fechaFin}`;
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
series: [{
|
|
||||||
name: 'Candidatos',
|
|
||||||
data: [cantidad]
|
|
||||||
}],
|
|
||||||
chart: { height: 350, type: 'bar' },
|
|
||||||
xaxis: { categories: [label] },
|
|
||||||
dataLabels: { enabled: true },
|
|
||||||
tooltip: { y: { formatter: val => val + " candidatos" } }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (chartFecha) chartFecha.destroy();
|
|
||||||
chartFecha = new ApexCharts(document.querySelector("#chart5"), options);
|
|
||||||
chartFecha.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function inicializarGrafico(filtros) {
|
|
||||||
const [femenino, masculino, noDefinido] = await obtenerDatosGeneros(filtros);
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
series: [
|
|
||||||
{ name: 'Femenino', data: [femenino] },
|
|
||||||
{ name: 'Masculino', data: [masculino] },
|
|
||||||
{ name: 'Prefiero no decirlo', data: [noDefinido] },
|
|
||||||
],
|
|
||||||
chart: { height: 350, type: 'bar' },
|
|
||||||
plotOptions: { bar: { horizontal: false, columnWidth: '55%', borderRadius: 5 } },
|
|
||||||
dataLabels: { enabled: false },
|
|
||||||
xaxis: { categories: ['Géneros'] },
|
|
||||||
tooltip: { y: { formatter: val => val + " personas" } }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (chartGenero) chartGenero.destroy();
|
|
||||||
chartGenero = new ApexCharts(document.querySelector("#chart"), options);
|
|
||||||
chartGenero.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function inicializarGrafico2(filtros) {
|
|
||||||
const [edad1, edad2, edad3, edad4, edad5, edad6, edad7] = await obtenerDatosEdades(filtros);
|
|
||||||
|
|
||||||
const options2 = {
|
|
||||||
series: [
|
|
||||||
{ name: 'Menor de 18 años', data: [edad1] },
|
|
||||||
{ name: '18 a 24 años', data: [edad2] },
|
|
||||||
{ name: '25 a 34 años', data: [edad3] },
|
|
||||||
{ name: '35 a 44 años', data: [edad4] },
|
|
||||||
{ name: '45 a 54 años', data: [edad5] },
|
|
||||||
{ name: '55 a 64 años', data: [edad6] },
|
|
||||||
{ name: '65 años o más', data: [edad7] },
|
|
||||||
],
|
|
||||||
chart: { height: 350, type: 'bar' },
|
|
||||||
plotOptions: { bar: { horizontal: false, columnWidth: '55%', borderRadius: 5 } },
|
|
||||||
dataLabels: { enabled: false },
|
|
||||||
xaxis: { categories: ['Edades'] },
|
|
||||||
tooltip: { y: { formatter: val => val + " Años" } }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (chartEdad) chartEdad.destroy();
|
|
||||||
chartEdad = new ApexCharts(document.querySelector("#chart2"), options2);
|
|
||||||
chartEdad.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function inicializarGrafico3(filtros) {
|
|
||||||
const estados = await obtenerDatosEstados(filtros);
|
|
||||||
|
|
||||||
const seriesData = estados.map(estado => ({
|
|
||||||
name: estado.estado,
|
|
||||||
data: [estado.cantidad]
|
|
||||||
}));
|
|
||||||
|
|
||||||
const options3 = {
|
|
||||||
series: seriesData,
|
|
||||||
chart: { height: 350, type: 'bar' },
|
|
||||||
plotOptions: { bar: { horizontal: false, columnWidth: '55%', borderRadius: 5 } },
|
|
||||||
dataLabels: { enabled: false },
|
|
||||||
xaxis: { categories: estados.map(estado => estado.estado) },
|
|
||||||
tooltip: { y: { formatter: val => val + " personas" } }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (chartEstado) chartEstado.destroy();
|
|
||||||
chartEstado = new ApexCharts(document.querySelector("#chart3"), options3);
|
|
||||||
chartEstado.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function inicializarGrafico4(filtros) {
|
|
||||||
const examenes = await obtenerDatosExamenes(filtros);
|
|
||||||
|
|
||||||
const seriesData = examenes.map(examen => ({
|
|
||||||
name: examen.examen,
|
|
||||||
data: [examen.cantidad]
|
|
||||||
}));
|
|
||||||
|
|
||||||
const options4 = {
|
|
||||||
series: seriesData,
|
|
||||||
chart: { height: 350, type: 'bar' },
|
|
||||||
plotOptions: { bar: { horizontal: false, columnWidth: '55%', borderRadius: 5 } },
|
|
||||||
dataLabels: { enabled: false },
|
|
||||||
xaxis: { categories: examenes.map(examen => examen.examen) },
|
|
||||||
tooltip: { y: { formatter: val => val + " examenes" } }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (chartExamen) chartExamen.destroy();
|
|
||||||
chartExamen = new ApexCharts(document.querySelector("#chart4"), options4);
|
|
||||||
chartExamen.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function actualizarTodosLosGraficos() {
|
|
||||||
// Si el filtro de fecha está activo, se pasan las fechas, si no, se limpian
|
|
||||||
let filtros = getFiltrosSeleccionados();
|
|
||||||
if (!filtroFechaActivo) {
|
|
||||||
filtros.fechaInicio = "";
|
|
||||||
filtros.fechaFin = "";
|
|
||||||
}
|
|
||||||
await inicializarGrafico(filtros);
|
|
||||||
await inicializarGrafico2(filtros);
|
|
||||||
await inicializarGrafico3(filtros);
|
|
||||||
await inicializarGrafico4(filtros);
|
|
||||||
await inicializarGraficoFecha(filtros);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Espera a que el DOM esté listo antes de agregar eventos
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
// Solo combos, NO fechas
|
|
||||||
['id_rango_edad', 'id_genero', 'id_examen'].forEach(id => {
|
|
||||||
const el = document.getElementById(id);
|
|
||||||
if (el) el.addEventListener('change', actualizarTodosLosGraficos);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Botón buscar para fechas
|
|
||||||
const btnBuscar = document.getElementById('buscar');
|
|
||||||
if (btnBuscar) {
|
|
||||||
btnBuscar.addEventListener('click', () => {
|
|
||||||
const date1 = document.getElementById('date1').value;
|
|
||||||
const date2 = document.getElementById('date2').value;
|
|
||||||
// Solo activa el filtro si ambas fechas están presentes
|
|
||||||
filtroFechaActivo = !!(date1 && date2);
|
|
||||||
actualizarTodosLosGraficos();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Botón limpiar para quitar filtro de fecha
|
|
||||||
const btnLimpiar = document.getElementById('limpiar');
|
|
||||||
if (btnLimpiar) {
|
|
||||||
btnLimpiar.addEventListener('click', () => {
|
|
||||||
document.getElementById('date1').value = '';
|
|
||||||
document.getElementById('date2').value = '';
|
|
||||||
filtroFechaActivo = false;
|
|
||||||
actualizarTodosLosGraficos();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
filtroFechaActivo = false;
|
|
||||||
actualizarTodosLosGraficos();
|
|
||||||
});
|
|
52
js/login.js
52
js/login.js
|
@ -1,52 +0,0 @@
|
||||||
const formulario = document.getElementById("login-formulario");
|
|
||||||
const notificacion = document.getElementById("mensaje-error");
|
|
||||||
|
|
||||||
formulario.addEventListener("submit", async (event) => {
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const numeroPersonal = document.getElementById("numero-personal").value;
|
|
||||||
const contrasena = document.getElementById("contrasena").value;
|
|
||||||
const data = new FormData();
|
|
||||||
|
|
||||||
data.append("numero-personal", numeroPersonal);
|
|
||||||
data.append("contrasena", contrasena);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const respuestaPeticion = await fetch('controladores/login.php', {
|
|
||||||
method: "POST",
|
|
||||||
body: data,
|
|
||||||
});
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// const respuesta = await respuestaPeticion.json();
|
|
||||||
const respuesta = await respuestaPeticion.json();
|
|
||||||
|
|
||||||
if (respuesta.estado === 'exitoso') {
|
|
||||||
window.location.href = 'views/inicio.html';
|
|
||||||
|
|
||||||
} else if(respuesta.estado === 'error') {
|
|
||||||
notificacion.textContent = respuesta.mensaje;
|
|
||||||
if(respuesta.res){ // Si existe respuesta.res hubo un error y se imprime en consola
|
|
||||||
console.error(respuesta.res)
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
const verificarCredenciales = await respuestaPeticion.json();
|
|
||||||
|
|
||||||
if (verificarCredenciales.loginExitoso) {
|
|
||||||
window.location.href = 'inicio.html';
|
|
||||||
} else {
|
|
||||||
notificacion.textContent = "Usuario y/o contraseña incorrectos";
|
|
||||||
>>>>>>> parent of a8e2895 (archivos de merge desde la rama recuperar-cambios)
|
|
||||||
notificacion.style.display = "block";
|
|
||||||
|
|
||||||
} else {
|
|
||||||
notificacion.textContent = "Lo sentimos, el servicio no está disponible por el momento";
|
|
||||||
console.error("No se recibió la respuesta esperada del servidor");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
notificacion.textContent =
|
|
||||||
"Lo sentimos, el servicio no está disponible por el momento";
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,160 +0,0 @@
|
||||||
// SIDEBAR DROPDOWN
|
|
||||||
const allDropdown = document.querySelectorAll('#sidebar .side-dropdown');
|
|
||||||
const sidebar = document.getElementById('sidebar');
|
|
||||||
|
|
||||||
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.addEventListener('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if(!this.classList.contains('active')) {
|
|
||||||
allDropdown.forEach(i=> {
|
|
||||||
const aLink = i.parentElement.querySelector('a:first-child');
|
|
||||||
|
|
||||||
aLink.classList.remove('active');
|
|
||||||
i.classList.remove('show');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.classList.toggle('active');
|
|
||||||
item.classList.toggle('show');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// SIDEBAR COLLAPSE
|
|
||||||
// const toggleSidebar = document.querySelector('nav .toggle-sidebar');
|
|
||||||
const allSideDivider = document.querySelectorAll('#sidebar .divider');
|
|
||||||
|
|
||||||
if(sidebar.classList.contains('hide')) {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// toggleSidebar.addEventListener('click', function () {
|
|
||||||
// sidebar.classList.toggle('hide');
|
|
||||||
//
|
|
||||||
// if(sidebar.classList.contains('hide')) {
|
|
||||||
// allSideDivider.forEach(item=> {
|
|
||||||
// item.textContent = '-'
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// allDropdown.forEach(item=> {
|
|
||||||
// const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
// a.classList.remove('active');
|
|
||||||
// item.classList.remove('show');
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// allSideDivider.forEach(item=> {
|
|
||||||
// item.textContent = item.dataset.text;
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sidebar.addEventListener('mouseleave', function () {
|
|
||||||
if(this.classList.contains('hide')) {
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = '-'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sidebar.addEventListener('mouseenter', function () {
|
|
||||||
if(this.classList.contains('hide')) {
|
|
||||||
allDropdown.forEach(item=> {
|
|
||||||
const a = item.parentElement.querySelector('a:first-child');
|
|
||||||
a.classList.remove('active');
|
|
||||||
item.classList.remove('show');
|
|
||||||
})
|
|
||||||
allSideDivider.forEach(item=> {
|
|
||||||
item.textContent = item.dataset.text;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PROFILE DROPDOWN
|
|
||||||
// const profile = document.querySelector('nav .profile');
|
|
||||||
// const imgProfile = profile.querySelector('img');
|
|
||||||
// const dropdownProfile = profile.querySelector('.profile-link');
|
|
||||||
//
|
|
||||||
// imgProfile.addEventListener('click', function () {
|
|
||||||
// dropdownProfile.classList.toggle('show');
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// MENU
|
|
||||||
const allMenu = document.querySelectorAll('main .content-data .head .menu');
|
|
||||||
|
|
||||||
allMenu.forEach(item=> {
|
|
||||||
const icon = item.querySelector('.icon');
|
|
||||||
const menuLink = item.querySelector('.menu-link');
|
|
||||||
|
|
||||||
icon.addEventListener('click', function () {
|
|
||||||
menuLink.classList.toggle('show');
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// window.addEventListener('click', function (e) {
|
|
||||||
// if(e.target !== imgProfile) {
|
|
||||||
// if(e.target !== dropdownProfile) {
|
|
||||||
// if(dropdownProfile.classList.contains('show')) {
|
|
||||||
// dropdownProfile.classList.remove('show');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// allMenu.forEach(item=> {
|
|
||||||
// const icon = item.querySelector('.icon');
|
|
||||||
// const menuLink = item.querySelector('.menu-link');
|
|
||||||
//
|
|
||||||
// if(e.target !== icon) {
|
|
||||||
// if(e.target !== menuLink) {
|
|
||||||
// if (menuLink.classList.contains('show')) {
|
|
||||||
// menuLink.classList.remove('show')
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // PROGRESSBAR
|
|
||||||
// const allProgress = document.querySelectorAll('main .card .progress');
|
|
||||||
//
|
|
||||||
// allProgress.forEach(item=> {
|
|
||||||
// item.style.setProperty('--value', item.dataset.value)
|
|
||||||
// })
|
|
|
@ -1,59 +0,0 @@
|
||||||
|
|
||||||
async function recuperarCantidadGenero(tipoConsulta) {
|
|
||||||
try {
|
|
||||||
const response = await fetch("../controllers/graficosController.php", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ tipoConsulta }),
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
return data.cantidad || 0;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error al recuperar datos:", error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function obtenerPromedioPorGenero() {
|
|
||||||
// Obtener conteos de cada género
|
|
||||||
const femenino = await recuperarCantidadGenero("Femenino");
|
|
||||||
const masculino = await recuperarCantidadGenero("Masculino");
|
|
||||||
const noDefinido = await recuperarCantidadGenero("Prefiero no decirlo");
|
|
||||||
|
|
||||||
// Suma total de personas
|
|
||||||
const total = femenino + masculino + noDefinido;
|
|
||||||
|
|
||||||
// Evitar división por cero
|
|
||||||
if (total === 0) {
|
|
||||||
actualizarTarjetas(0, 0, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calcular el promedio (cantidad / total de registros)
|
|
||||||
// Aquí promedio es la proporción simple de cada género dentro del total
|
|
||||||
const promedioFemenino = femenino / total;
|
|
||||||
const promedioMasculino = masculino / total;
|
|
||||||
const promedioNoDefinido = noDefinido / total;
|
|
||||||
|
|
||||||
// Actualizar las tarjetas con los valores calculados
|
|
||||||
actualizarTarjetas(promedioFemenino, promedioMasculino, promedioNoDefinido);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Función para actualizar las tarjetas en el DOM
|
|
||||||
function actualizarTarjetas(promF, promM, promND) {
|
|
||||||
// Multiplicamos por 100 para mostrar el promedio como número decimal simple.
|
|
||||||
// Aquí simplemente mostramos el promedio como número decimal con 2 decimales
|
|
||||||
|
|
||||||
document.querySelector("#card-femenino h2").textContent = promF.toFixed(2)+ "%";;
|
|
||||||
document.querySelector("#card-masculino h2").textContent = promM.toFixed(2) + "%";;
|
|
||||||
document.querySelector("#card-nodefinido h2").textContent = promND.toFixed(2) + "%";;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ejecutar cuando el DOM esté listo
|
|
||||||
document.addEventListener("DOMContentLoaded", obtenerPromedioPorGenero);
|
|
|
@ -1,364 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../config/Database.php';
|
|
||||||
|
|
||||||
class CandidatoModel {
|
|
||||||
|
|
||||||
private $conn;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->conn = Database::getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registra la información de un candidato y su fecha de salida
|
|
||||||
*
|
|
||||||
* @param int $id_candidato ID del candidato
|
|
||||||
* @param int $id_pais ID del país
|
|
||||||
* @param int|null $id_estado ID del estado
|
|
||||||
* @param int|null $id_municipio ID del municipio
|
|
||||||
* @param int|null $id_colonia ID de la colonia
|
|
||||||
* @param int $id_nivel ID del nivel
|
|
||||||
* @param int $id_giro ID del giro
|
|
||||||
* @param string $nombre_empresa_institucion Nombre de la empresa o institución
|
|
||||||
* @param int $motivo_examen Motivo del examen
|
|
||||||
* @param int $calificacion_servicio Calificación del servicio
|
|
||||||
* @param int $consentimiento_pub Consentimiento de publicación
|
|
||||||
* @param string $fecha_salida Fecha de salida
|
|
||||||
* @return array Retorna un array asociativo con las claves "estado" y "mensaje"
|
|
||||||
*/
|
|
||||||
public function registrarInfoCandidatos(
|
|
||||||
$id_candidato,
|
|
||||||
$id_pais,
|
|
||||||
$id_estado,
|
|
||||||
$id_municipio,
|
|
||||||
$id_colonia,
|
|
||||||
$id_nivel,
|
|
||||||
$id_giro,
|
|
||||||
$nombre_empresa_institucion,
|
|
||||||
$motivo_examen,
|
|
||||||
$calificacion_servicio,
|
|
||||||
$consentimiento_pub,
|
|
||||||
$fecha_salida
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
$id_pais = (int)$id_pais;
|
|
||||||
// Si el país no es México (ID 1), se asignan valores nulos a los campos de ubicación
|
|
||||||
if ($id_pais !== 1) {
|
|
||||||
$id_estado = null;
|
|
||||||
$id_municipio = null;
|
|
||||||
$id_colonia = null;
|
|
||||||
} else {
|
|
||||||
$id_estado = (int)$id_estado;
|
|
||||||
$id_municipio = (int)$id_municipio;
|
|
||||||
$id_colonia = (int)$id_colonia;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO info_candidatos (
|
|
||||||
id_candidato, id_pais, id_estado, id_municipio, id_colonia,
|
|
||||||
id_nivel, id_giro, nombre_empresa_institucion, id_motivo_examen,
|
|
||||||
calificacion_servicio, consentimiento_pub
|
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
||||||
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
if ($stmt === false) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error en la preparación de la consulta: " . $this->conn->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->bind_param(
|
|
||||||
"iiiiiiisiii",
|
|
||||||
$id_candidato,
|
|
||||||
$id_pais,
|
|
||||||
$id_estado,
|
|
||||||
$id_municipio,
|
|
||||||
$id_colonia,
|
|
||||||
$id_nivel,
|
|
||||||
$id_giro,
|
|
||||||
$nombre_empresa_institucion,
|
|
||||||
$motivo_examen,
|
|
||||||
$calificacion_servicio,
|
|
||||||
$consentimiento_pub
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error al insertar datos del candidato: " . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
// Registrar fecha de salida
|
|
||||||
$resultadoFecha = $this->registrarFechaSalida($id_candidato, $fecha_salida);
|
|
||||||
if (isset($resultadoFecha["estado"]) && $resultadoFecha["estado"] === "error") {
|
|
||||||
return $resultadoFecha; // Propagar el error desde registrarFechaSalida
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retornar éxito
|
|
||||||
return [
|
|
||||||
"estado" => "exitoso",
|
|
||||||
"mensaje" => $id_candidato
|
|
||||||
];
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error en el registro: " . $e->getMessage()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registra la fecha de salida de un candidato
|
|
||||||
*
|
|
||||||
* @param int $id_candidato ID del candidato
|
|
||||||
* @param string $fecha_salida Fecha de salida
|
|
||||||
* @return array Retorna un array asociativo con las claves "estado" y "mensaje"
|
|
||||||
*/
|
|
||||||
private function registrarFechaSalida($id_candidato, $fecha_salida) {
|
|
||||||
try {
|
|
||||||
// Si no hay fecha de salida, retornar éxito sin hacer nada
|
|
||||||
if (empty($fecha_salida)) {
|
|
||||||
return [
|
|
||||||
"estado" => "exitoso",
|
|
||||||
"mensaje" => "No se registró fecha de salida"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Consulta update
|
|
||||||
$sql = "UPDATE candidato SET fecha_salida = ? WHERE id_candidato = ?";
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
|
|
||||||
if ($stmt === false) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error en la preparación de la consulta de fecha: " . $this->conn->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->bind_param("si",$fecha_salida,$id_candidato);
|
|
||||||
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error al registrar fecha de salida: " . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
return [
|
|
||||||
"estado" => "exitoso",
|
|
||||||
"mensaje" => "Fecha de salida registrada correctamente"
|
|
||||||
];
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error al registrar fecha de salida: " . $e->getMessage()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insertar un nuevo candidato en la base de datos.
|
|
||||||
* @param string $nombres Nombres del candidato.
|
|
||||||
* @param string $primer_apellido Primer apellido del candidato.
|
|
||||||
* @param string $segundo_apellido Segundo apellido del candidato.
|
|
||||||
* @param string $correo Correo electrónico del candidato.
|
|
||||||
* @param string $telefono Teléfono del candidato.
|
|
||||||
* @param int $id_examen ID del examen asociado al candidato.
|
|
||||||
* @param int $id_tipo_id ID del tipo de identificación del candidato.
|
|
||||||
* @param int $id_rango_edad ID del rango de edad del candidato.
|
|
||||||
* @param int $id_genero ID del género del candidato.
|
|
||||||
*/
|
|
||||||
public function registrarCandidato(
|
|
||||||
$nombres,
|
|
||||||
$primer_apellido,
|
|
||||||
$segundo_apellido,
|
|
||||||
$correo,
|
|
||||||
$telefono,
|
|
||||||
$id_examen,
|
|
||||||
$id_tipo_id,
|
|
||||||
$id_rango_edad,
|
|
||||||
$id_genero
|
|
||||||
) {
|
|
||||||
$sql = "INSERT INTO candidato (nombres, primer_apellido, segundo_apellido, correo, telefono, id_examen, id_tipo_id, id_rango_edad, id_genero) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
if ($stmt === false) {
|
|
||||||
throw new Exception("Error en la preparación de la consulta: " . $this->conn->error);
|
|
||||||
}
|
|
||||||
$stmt->bind_param(
|
|
||||||
"sssssiiii",
|
|
||||||
$nombres,
|
|
||||||
$primer_apellido,
|
|
||||||
$segundo_apellido,
|
|
||||||
$correo,
|
|
||||||
$telefono,
|
|
||||||
$id_examen,
|
|
||||||
$id_tipo_id,
|
|
||||||
$id_rango_edad,
|
|
||||||
$id_genero
|
|
||||||
);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
throw new Exception("Error al insertar candidato: " . $stmt->error);
|
|
||||||
}
|
|
||||||
$insertId = $stmt->insert_id;
|
|
||||||
$stmt->close();
|
|
||||||
return $insertId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verificar si ya existe un registro de información del candidato en la base de datos.
|
|
||||||
* @param int $id_candidato ID del candidato.
|
|
||||||
* @return bool true si existe un registro, false en caso contrario.
|
|
||||||
*/
|
|
||||||
public function verificarRegistroInfoCandidato($id_candidato) {
|
|
||||||
$sql = "SELECT COUNT(*) as count FROM info_candidatos WHERE id_candidato = ?";
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
if ($stmt === false) {
|
|
||||||
throw new Exception("Error en la preparación de la consulta: " . $this->conn->error);
|
|
||||||
}
|
|
||||||
$stmt->bind_param("i", $id_candidato);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
throw new Exception("Error al ejecutar la consulta: " . $stmt->error);
|
|
||||||
}
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
$row = $result->fetch_assoc();
|
|
||||||
$stmt->close();
|
|
||||||
return $row['count'] > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function existeIdCandidato($id_candidato) {
|
|
||||||
try {
|
|
||||||
$sql = "SELECT COUNT(*) as count FROM candidato WHERE id_candidato = ?";
|
|
||||||
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
if ($stmt === false) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error en la preparación de la consulta: " . $this->conn->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->bind_param("i", $id_candidato);
|
|
||||||
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error al ejecutar la consulta: " . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
$stmt->close();
|
|
||||||
$row = $result->fetch_assoc();
|
|
||||||
|
|
||||||
if($row['count'] > 0){
|
|
||||||
return [
|
|
||||||
"estado" => "exitoso",
|
|
||||||
"mensaje" => "ID de candidato existe"
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "ID de candidato no existe"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error al verificar ID de candidato: " . $e->getMessage()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerCandidatoPorId($id_candidato) {
|
|
||||||
$sql = "SELECT * FROM candidato WHERE id_candidato = ?";
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
if ($stmt === false) {
|
|
||||||
throw new Exception("Error en la preparación de la consulta: " . $this->conn->error);
|
|
||||||
}
|
|
||||||
$stmt->bind_param("i", $id_candidato);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
throw new Exception("Error al ejecutar la consulta: " . $stmt->error);
|
|
||||||
}
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
$candidato = $result->fetch_assoc();
|
|
||||||
$stmt->close();
|
|
||||||
return $candidato;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerInfoCandidatoPorId($id_candidato) {
|
|
||||||
$sql = "SELECT * FROM info_candidatos WHERE id_candidato = ?";
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
if ($stmt === false) {
|
|
||||||
throw new Exception("Error en la preparación de la consulta: " . $this->conn->error);
|
|
||||||
}
|
|
||||||
$stmt->bind_param("i", $id_candidato);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
throw new Exception("Error al ejecutar la consulta: " . $stmt->error);
|
|
||||||
}
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
$info = $result->fetch_assoc();
|
|
||||||
$stmt->close();
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtiene información de los candidatos que no han llenado el segundo formulario
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function obtenerCandidatosSinFechaSalida(){
|
|
||||||
$sql = "SELECT id_candidato, nombres, primer_apellido, segundo_apellido, fecha_entrada FROM lania_cc.candidato WHERE fecha_salida IS NULL ORDER BY fecha_entrada";
|
|
||||||
try {
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => $e->getMessage()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
// Si no hay registros pendientes
|
|
||||||
if($result->num_rows == 0){
|
|
||||||
return [
|
|
||||||
"estado" => "exitoso",
|
|
||||||
"mensaje" => "No hay registros pendientes"
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function eliminarCandidato($id_candidato){
|
|
||||||
$sql = "DELETE FROM candidato WHERE id_candidato = ?";
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
if ($stmt === false) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error en la preparación de la consulta: " . $this->conn->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$stmt->bind_param("i", $id_candidato);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
"estado" => "error",
|
|
||||||
"mensaje" => "Error al eliminar el candidato: " . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$stmt->close();
|
|
||||||
return [
|
|
||||||
"estado" => "exitoso",
|
|
||||||
"mensaje" => "Candidato eliminado correctamente."
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,155 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../config/Database.php';
|
|
||||||
|
|
||||||
class Catalogos{
|
|
||||||
private $conn;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->conn = Database::getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtiene el estado, municipio y colonia en base al código postal proporcionado.
|
|
||||||
* @param int $codigo_postal El código postal a buscar.
|
|
||||||
* @return array Un array con los datos de estado, municipio y colonia.
|
|
||||||
*/
|
|
||||||
public function obtenerInfiCodigoPostal($codigo_postal){
|
|
||||||
|
|
||||||
// Consulta SQL para obtener estado, ciudad y colonia en base al código postal
|
|
||||||
$sql = "SELECT e.id AS id_estado, e.nombre AS estado, m.id AS id_municipio, m.nombre AS municipio, c.id AS id_colonia, c.nombre AS colonia
|
|
||||||
FROM colonias c
|
|
||||||
JOIN municipios m ON c.municipio = m.id
|
|
||||||
JOIN estados e ON m.estado = e.id
|
|
||||||
WHERE c.codigo_postal = ?";
|
|
||||||
|
|
||||||
// Preparar la sentencia SQL
|
|
||||||
$stmt = $this->conn->prepare($sql);
|
|
||||||
$stmt->bind_param("i", $codigo_postal);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
// Obtener los resultados
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
$data = [];
|
|
||||||
// Verificar si hay resultados
|
|
||||||
if ($result->num_rows > 0) {
|
|
||||||
while ($row = $result->fetch_assoc()) {
|
|
||||||
$data[] = $row; // Agregar cada resultado a un array
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
} else {
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtiene los giros.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function obtenerGiros(){
|
|
||||||
$sql = "SELECT id_giro, descripcion FROM giro ORDER BY descripcion";
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
|
|
||||||
$giros = [];
|
|
||||||
while($row = $result->fetch_assoc()){
|
|
||||||
$giros[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $giros;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtiene los nombres de los examenes disponibles.
|
|
||||||
* @return array Lista del nombre de la institución a la que pertenece el examen.
|
|
||||||
*/
|
|
||||||
public function obtenerNombresExamenes(){
|
|
||||||
$sql = "SELECT id_examen, nombre_examen FROM examen ORDER BY nombre_examen";
|
|
||||||
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
|
|
||||||
$examenes = [];
|
|
||||||
while($row = $result->fetch_assoc()){
|
|
||||||
$examenes[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $examenes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtener los tipos de identificación.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function obtenerTiposIdentificacion(){
|
|
||||||
$sql = "SELECT id_tipo_id, descripcion FROM tipo_identificacion ORDER BY descripcion";
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
|
|
||||||
$tipos = [];
|
|
||||||
while($row = $result->fetch_assoc()){
|
|
||||||
$tipos[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tipos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtiene los rangos de edad.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function obtenerRangosEdad(){
|
|
||||||
$sql = "SELECT id_rango_edad, descripcion FROM rango_edad ORDER BY id_rango_edad";
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
|
|
||||||
$rangos = [];
|
|
||||||
while($row = $result->fetch_assoc()){
|
|
||||||
$rangos[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $rangos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtiene los niveles de estudio.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function obtenerNivelesEstudio(){
|
|
||||||
$sql = "SELECT id_nivel, descripcion FROM nivel_estudio ORDER BY id_nivel";
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
|
|
||||||
$niveles = [];
|
|
||||||
while($row = $result->fetch_assoc()){
|
|
||||||
$niveles[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $niveles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerNombresEmpresasInstituciones(){
|
|
||||||
$sql = "SELECT DISTINCT nombre_empresa_institucion FROM info_candidatos ORDER BY nombre_empresa_institucion";
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
|
|
||||||
$empresas = [];
|
|
||||||
while($row = $result->fetch_assoc()){
|
|
||||||
$empresas[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $empresas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerMotivosExamen(){
|
|
||||||
$sql = "SELECT id, descripcion FROM motivo_examen ORDER BY descripcion";
|
|
||||||
$result = $this->conn->query($sql);
|
|
||||||
|
|
||||||
$motivos = [];
|
|
||||||
while($row = $result->fetch_assoc()){
|
|
||||||
$motivos[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $motivos;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,526 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once '../config/Database.php';
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
$input = json_decode(file_get_contents('php://input'), true);
|
|
||||||
$tipoConsulta = $input['tipoConsulta'] ?? '';
|
|
||||||
|
|
||||||
$filtros = [
|
|
||||||
'id_rango_edad' => $input['id_rango_edad'] ?? null,
|
|
||||||
'id_genero' => $input['id_genero'] ?? null,
|
|
||||||
'id_examen' => $input['id_examen'] ?? null,
|
|
||||||
'fechaInicio' => $input['fechaInicio'] ?? null,
|
|
||||||
'fechaFin' => $input['fechaFin'] ?? null,
|
|
||||||
];
|
|
||||||
|
|
||||||
$graficos = new Graficos();
|
|
||||||
|
|
||||||
switch ($tipoConsulta) {
|
|
||||||
case 'Femenino':
|
|
||||||
$cantidad = $graficos->obtenerGeneroFemenino($filtros);
|
|
||||||
break;
|
|
||||||
case 'Masculino':
|
|
||||||
$cantidad = $graficos->obtenerGeneroMasculino($filtros);
|
|
||||||
break;
|
|
||||||
case 'Prefiero no decirlo':
|
|
||||||
$cantidad = $graficos->obtenerGeneroNoDefinido($filtros);
|
|
||||||
break;
|
|
||||||
case 'Menor de 18 años':
|
|
||||||
$cantidad = $graficos->obtenerEdadMenor18($filtros);
|
|
||||||
break;
|
|
||||||
case '18 a 24 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad1824($filtros);
|
|
||||||
break;
|
|
||||||
case '25 a 34 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad2434($filtros);
|
|
||||||
break;
|
|
||||||
case '35 a 44 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad3544($filtros);
|
|
||||||
break;
|
|
||||||
case '45 a 54 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad4554($filtros);
|
|
||||||
break;
|
|
||||||
case '55 a 64 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad5564($filtros);
|
|
||||||
break;
|
|
||||||
case '65 años o más':
|
|
||||||
$cantidad = $graficos->obtenerEdad65oMas($filtros);
|
|
||||||
break;
|
|
||||||
case 'Estados':
|
|
||||||
$cantidad = $graficos->obtenerEstados($filtros);
|
|
||||||
echo json_encode($cantidad);
|
|
||||||
exit;
|
|
||||||
case 'Examenes':
|
|
||||||
$cantidad = $graficos->obtenerExamenes($filtros);
|
|
||||||
echo json_encode($cantidad);
|
|
||||||
exit;
|
|
||||||
case 'Fechas':
|
|
||||||
$fechaInicio = $input['fechaInicio'] ?? '';
|
|
||||||
$fechaFin = $input['fechaFin'] ?? '';
|
|
||||||
$cantidad = $graficos->obtenerFecha($fechaInicio, $fechaFin);
|
|
||||||
echo json_encode($cantidad);
|
|
||||||
exit;
|
|
||||||
default:
|
|
||||||
$cantidad = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(['cantidad' => $cantidad]);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Graficos{
|
|
||||||
private $Database;
|
|
||||||
protected $db;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->Database = new Database();
|
|
||||||
$this->db = $this->Database->getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroFemenino($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS Femenino FROM candidato WHERE id_genero = 2";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['Femenino'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroMasculino($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS Masculino FROM candidato WHERE id_genero = 1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['Masculino'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroNoDefinido($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS NoDefinido FROM candidato WHERE id_genero = 3";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['NoDefinido'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdadMenor18($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS menorEdad FROM candidato WHERE id_rango_edad = 1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['menorEdad'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad1824($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad1824 FROM candidato WHERE id_rango_edad = 2";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad1824'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad2434($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad2434 FROM candidato WHERE id_rango_edad = 3";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad2434'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad3544($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad3544 FROM candidato WHERE id_rango_edad = 4";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad3544'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad4554($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad4554 FROM candidato WHERE id_rango_edad = 5";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad4554'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad5564($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad5564 FROM candidato WHERE id_rango_edad = 6";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad5564'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad65oMas($filtros = []) {
|
|
||||||
$sql = "SELECT COUNT(*) AS edad65oMas FROM candidato WHERE id_rango_edad = 7";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(fecha_entrada) >= ? AND DATE(fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
if ($resultado->num_rows > 0) {
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$output = $data['edad65oMas'];
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEstados($filtros = []) {
|
|
||||||
$sql = "SELECT estados.nombre AS estado, COUNT(*) AS cantidad
|
|
||||||
FROM candidato
|
|
||||||
INNER JOIN info_candidatos ON candidato.id_candidato = info_candidatos.id_candidato
|
|
||||||
INNER JOIN estados ON info_candidatos.id_estado = estados.id
|
|
||||||
WHERE 1=1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_genero']) && $filtros['id_genero'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_genero = ?";
|
|
||||||
$params[] = $filtros['id_genero'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(candidato.fecha_entrada) >= ? AND DATE(candidato.fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= " GROUP BY estados.nombre ORDER BY estados.nombre";
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$estados = [];
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$estados[] = $data;
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $estados;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerExamenes($filtros = []) {
|
|
||||||
$sql = "SELECT examen.nombre_examen AS examen, COUNT(*) AS cantidad
|
|
||||||
FROM candidato
|
|
||||||
LEFT JOIN examen ON candidato.id_examen = examen.id_examen
|
|
||||||
WHERE 1=1";
|
|
||||||
$params = [];
|
|
||||||
$types = "";
|
|
||||||
|
|
||||||
if (!empty($filtros['id_rango_edad']) && $filtros['id_rango_edad'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_rango_edad = ?";
|
|
||||||
$params[] = $filtros['id_rango_edad'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_genero']) && $filtros['id_genero'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_genero = ?";
|
|
||||||
$params[] = $filtros['id_genero'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['id_examen']) && $filtros['id_examen'] !== "NULL") {
|
|
||||||
$sql .= " AND candidato.id_examen = ?";
|
|
||||||
$params[] = $filtros['id_examen'];
|
|
||||||
$types .= "i";
|
|
||||||
}
|
|
||||||
if (!empty($filtros['fechaInicio']) && !empty($filtros['fechaFin'])) {
|
|
||||||
$sql .= " AND DATE(candidato.fecha_entrada) >= ? AND DATE(candidato.fecha_salida) <= ?";
|
|
||||||
$params[] = $filtros['fechaInicio'];
|
|
||||||
$params[] = $filtros['fechaFin'];
|
|
||||||
$types .= "ss";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= " GROUP BY examen.nombre_examen ORDER BY examen.nombre_examen";
|
|
||||||
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
if ($params) {
|
|
||||||
$query->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$examenes = [];
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$examenes[] = $data;
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
return $examenes;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerFecha($fechaInicio, $fechaFin) {
|
|
||||||
$sql = "SELECT COUNT(*) AS cantidad
|
|
||||||
FROM candidato
|
|
||||||
WHERE DATE(fecha_entrada) >= ? AND DATE(fecha_entrada) <= ?";
|
|
||||||
$query = $this->db->prepare($sql);
|
|
||||||
$query->bind_param("ss", $fechaInicio, $fechaFin);
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$data = $resultado->fetch_assoc();
|
|
||||||
$query->close();
|
|
||||||
// Devuelve un array con un solo objeto para mantener compatibilidad con el frontend
|
|
||||||
return [ [ 'cantidad' => $data['cantidad'], 'fechaInicio' => $fechaInicio, 'fechaFin' => $fechaFin ] ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,172 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../config/Database.php';
|
|
||||||
|
|
||||||
class UsuarioModel {
|
|
||||||
private $conn;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->conn = Database::getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registrar un nuevo usuario
|
|
||||||
* @param string $usuario Nombre de usuario
|
|
||||||
* @param string $contrasena Contraseña del usuario
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function crearUsuario($usuario, $contrasena){
|
|
||||||
// Hashear contraseña
|
|
||||||
$contrasena_hash = password_hash($contrasena, PASSWORD_DEFAULT);
|
|
||||||
|
|
||||||
$stmt = $this->conn->prepare("INSERT INTO usuario (usuario, contrasena) VALUES (?, ?)");
|
|
||||||
$stmt->bind_param("ss", $usuario, $contrasena_hash);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Error al registrar usuario: ' . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
return [
|
|
||||||
'estado' => 'exitoso',
|
|
||||||
'mensaje' => 'Usuario ' . $usuario . ' registrado exitosamente.'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function actualizarUsuario($id, $usuario, $contrasena){
|
|
||||||
// Hashear contraseña
|
|
||||||
$contrasena_hash = password_hash($contrasena, PASSWORD_DEFAULT);
|
|
||||||
|
|
||||||
$stmt = $this->conn->prepare("UPDATE usuario SET usuario = ?, contrasena = ? WHERE id = ?");
|
|
||||||
$stmt->bind_param("ssi", $usuario, $contrasena_hash, $id);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Error al actualizar usuario: ' . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
return [
|
|
||||||
'estado' => 'exitoso',
|
|
||||||
'mensaje' => 'Usuario ' . $usuario .' actualizado exitosamente.'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iniciar sesión de un usuario
|
|
||||||
* @param string $usuario Nombre de usuario
|
|
||||||
* @param string $contrasena Contraseña del usuario
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function iniciarSesion($usuario, $contrasena) {
|
|
||||||
$stmt = $this->conn->prepare("SELECT contrasena FROM usuario WHERE usuario = ?");
|
|
||||||
$stmt->bind_param("s", $usuario);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Error al iniciar sesión, intentelo más tarde.',
|
|
||||||
'res' => $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->store_result();
|
|
||||||
if ($stmt->num_rows == 0) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Usuario o contraseña incorrectos.'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->bind_result($contrasena_hash);
|
|
||||||
$stmt->fetch();
|
|
||||||
|
|
||||||
if (password_verify($contrasena, $contrasena_hash)){
|
|
||||||
return [
|
|
||||||
'estado' => 'exitoso',
|
|
||||||
'mensaje' => 'Inicio de sesión exitoso.'
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Usuario o contraseña incorrectos.'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerUsuarios() {
|
|
||||||
// Preparar la consulta mysql usando msqli
|
|
||||||
$stmt = $this->conn->prepare("SELECT id, usuario FROM usuario");
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Error al obtener usuarios: ' . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtener el resultado
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
|
|
||||||
// Si no hay resultados, retornar un array con estado y mensaje
|
|
||||||
if ($result->num_rows == 0) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'No hay usuarios registrados.'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buscarUsuario($usuario) {
|
|
||||||
$stmt = $this->conn->prepare("SELECT id, usuario FROM usuario WHERE usuario = ?");
|
|
||||||
$stmt->bind_param("s", $usuario);
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Error al verificar usuario: ' . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->store_result();
|
|
||||||
// Si no hay resultados, retornar un array con estado y mensaje
|
|
||||||
if ($stmt->num_rows == 0) {
|
|
||||||
return [
|
|
||||||
'estado' => 'exitoso',
|
|
||||||
'mensaje' => 'No existe el usuario.'
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$stmt->bind_result($id, $usuario);
|
|
||||||
$stmt->fetch();
|
|
||||||
return [
|
|
||||||
'estado' => 'exitoso',
|
|
||||||
'mensaje' => 'Usuario existe.',
|
|
||||||
'id' => $id,
|
|
||||||
'usuario' => $usuario
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function eliminarUsuario($id){
|
|
||||||
$stmt = $this->conn->prepare("DELETE FROM usuario WHERE id = ?");
|
|
||||||
$stmt->bind_param("i", $id);
|
|
||||||
|
|
||||||
if (!$stmt->execute()) {
|
|
||||||
return [
|
|
||||||
'estado' => 'error',
|
|
||||||
'mensaje' => 'Error al eliminar usuario: ' . $stmt->error
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
return [
|
|
||||||
'estado' => 'exitoso',
|
|
||||||
'mensaje' => 'Usuario eliminado exitosamente.'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,92 +0,0 @@
|
||||||
<?php
|
|
||||||
//session_start();
|
|
||||||
//
|
|
||||||
//if (!isset($_SESSION['usuario'])) {
|
|
||||||
// header('Location: ../index.html');
|
|
||||||
// session_destroy();
|
|
||||||
// exit();
|
|
||||||
//}
|
|
||||||
|
|
||||||
require_once __DIR__ . "/../controllers/UsuarioController.php";
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['id']) && isset($_GET['usuario'])) {
|
|
||||||
$id = $_GET['id'];
|
|
||||||
$usuario = $_GET['usuario'];
|
|
||||||
} else {
|
|
||||||
header('Location: ../views/control-usuarios.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="es">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="../font/bootstrap-icons.css">
|
|
||||||
<link rel="stylesheet" href="../css/inicio.css">
|
|
||||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css'>
|
|
||||||
<title>Modificar usuario</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- SIDEBAR -->
|
|
||||||
<section id="sidebar">
|
|
||||||
<a href="inicio.html" class="brand"><i class='bx bx-code-alt icon' ></i> LANIA</a>
|
|
||||||
|
|
||||||
<ul class="side-menu">
|
|
||||||
<li><a href="inicio.html"><i class='bx bxs-dashboard icon' ></i>Dashboard</a></li>
|
|
||||||
<li><a href="formulario-candidato.html" target="_blank"><i class='bx bxs-dashboard icon' ></i>Formulario de registro</a></li>
|
|
||||||
<li><a href="control-candidatos.php"><i class='bx bxs-dashboard icon' ></i>Control candidatos</a></li>
|
|
||||||
<li><a href="control-usuarios.php" class="active"><i class='bx bxs-dashboard icon' ></i>Control usuario</a></li>
|
|
||||||
<li><a href="../controllers/cerrarSesion.php"><i class="bi bi-box-arrow-left icon"></i>Cerrar sesión</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<!-- .SIDEBAR -->
|
|
||||||
|
|
||||||
|
|
||||||
<section id="content">
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<h1 class="title" style="margin: 2% 1%">Modificar usuario</h1>
|
|
||||||
|
|
||||||
<!-- div de formulario ------------------------------------------------------------------------------------- -->
|
|
||||||
<div class="bg-light-subtle border border-dark-subtle shadow-sm rounded-3" style="margin: 1%">
|
|
||||||
<div style="margin:5%;">
|
|
||||||
<form id="form">
|
|
||||||
|
|
||||||
<input type="hidden" id="id" value="<?php echo $id ?>"/>
|
|
||||||
|
|
||||||
<label class="form-label" for="usuario" style="margin: 8px 0px 8px 0px;"><i class="bi bi-person"></i> Nombre de usuario</label>
|
|
||||||
<input class="border rounded border-dark-subtle form-control" type="text" id="usuario" required="" minlength="1" maxlength="150" pattern="^[a-zA-Z0-9]+$" value="<?php echo $usuario ?>"/>
|
|
||||||
|
|
||||||
<label class="form-label" for="contrasena" style="margin: 8px 0px 8px 0px;"><i class="bi bi-key"></i> Contraseña</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input class="form-control" type="password" id="contrasena" required="" minlength="1"/>
|
|
||||||
<button class="btn btn-light" id="togglePassword" type="button" style="border: var(--bs-border-width) solid var(--bs-border-color);"><i class="bi bi-eye"></i></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label class="form-label" for="contrasena" style="margin: 8px 0px 8px 0px;"><i class="bi bi-key"></i> Vuelva a escribir la contraseña</label>
|
|
||||||
<input class="form-control" type="password" id="contrasena_verificacion" required="" minlength="1"/>
|
|
||||||
|
|
||||||
<input class="btn text-light w-100" type="submit" id="submit" style="margin: 8px 0px 8px 0px;background-color: #35245b"/ value="Modificar usuario">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- /div de formulario ------------------------------------------------------------------------------------ -->
|
|
||||||
</main>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<script src="../js/sidebar-navbar.js"></script>
|
|
||||||
<script src="../js/actualizar-usuario.js"></script>
|
|
||||||
|
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,53 +0,0 @@
|
||||||
<?php
|
|
||||||
// filepath: c:\xampp\htdocs\Proyecto_Lania\LANIA_Proyecto\php\buscarCodigo.php
|
|
||||||
include 'conexionBd.php'; // Asegúrate de que el archivo esté en la ruta correcta
|
|
||||||
|
|
||||||
header('Content-Type: application/json'); // Aseguramos que la respuesta sea JSON
|
|
||||||
|
|
||||||
// Crear instancia de la conexión
|
|
||||||
$conexion = new Conexion();
|
|
||||||
$conexionBD = $conexion->conectar(); // Establecer conexión
|
|
||||||
|
|
||||||
// Verificar que se ha enviado el parámetro 'codigo_postal'
|
|
||||||
if (isset($_GET['codigo_postal'])) {
|
|
||||||
$codigo_postal = $_GET['codigo_postal'];
|
|
||||||
|
|
||||||
// Consulta SQL para obtener estado, ciudad y colonia en base al código postal
|
|
||||||
$sql = "SELECT e.nombre AS estado, m.nombre AS municipio, c.nombre AS colonia
|
|
||||||
FROM colonias c
|
|
||||||
JOIN municipios m ON c.municipio = m.id
|
|
||||||
JOIN estados e ON m.estado = e.id
|
|
||||||
WHERE c.codigo_postal = ?";
|
|
||||||
|
|
||||||
// Verificar que la conexión a la base de datos esté activa
|
|
||||||
if ($conexionBD) {
|
|
||||||
// Preparar la sentencia SQL
|
|
||||||
$stmt = $conexionBD->prepare($sql);
|
|
||||||
$stmt->bind_param("i", $codigo_postal); // El parámetro es un entero (i)
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
// Obtener los resultados
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
|
|
||||||
// Verificar si hay resultados
|
|
||||||
if ($result->num_rows > 0) {
|
|
||||||
$data = [];
|
|
||||||
while ($row = $result->fetch_assoc()) {
|
|
||||||
$data[] = $row; // Agregar cada resultado a un array
|
|
||||||
}
|
|
||||||
echo json_encode($data); // Devolver los resultados en formato JSON
|
|
||||||
} else {
|
|
||||||
echo json_encode([]); // Si no hay resultados, devolver un array vacío
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
} else {
|
|
||||||
echo json_encode(["error" => "Conexión a la base de datos fallida."]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$conexionBD->close();
|
|
||||||
} else {
|
|
||||||
// Si no se recibe un código postal, respondemos con un error
|
|
||||||
echo json_encode(["error" => "Código postal no proporcionado."]);
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?php
|
|
||||||
class Conexion{
|
|
||||||
private $host = "localhost";
|
|
||||||
private $dbname = "lania_cc";
|
|
||||||
private $user = "root";
|
|
||||||
private $password = "password";
|
|
||||||
private $conexion;
|
|
||||||
|
|
||||||
|
|
||||||
public function conectar() {
|
|
||||||
$this->conexion = new mysqli($this->host, $this->user, $this->password, $this->dbname);
|
|
||||||
|
|
||||||
if ($this->conexion->connect_error) {
|
|
||||||
die('Error de conexión: ' . $this->conexion->connect_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->conexion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cerrarConexion() {
|
|
||||||
if ($this->conexion) {
|
|
||||||
$this->conexion->close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
294
php/graficos.php
294
php/graficos.php
|
@ -1,294 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once './conexionBd.php';
|
|
||||||
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
$input = json_decode(file_get_contents('php://input'), true);
|
|
||||||
$tipoConsulta = $input['tipoConsulta'] ?? '';
|
|
||||||
|
|
||||||
$graficos = new Graficos();
|
|
||||||
|
|
||||||
switch ($tipoConsulta) {
|
|
||||||
case 'Femenino':
|
|
||||||
$cantidad = $graficos->obtenerGeneroFemenino();
|
|
||||||
break;
|
|
||||||
case 'Masculino':
|
|
||||||
$cantidad = $graficos->obtenerGeneroMasculino();
|
|
||||||
break;
|
|
||||||
case 'Prefiero no decirlo':
|
|
||||||
$cantidad = $graficos->obtenerGeneroNoDefinido();
|
|
||||||
break;
|
|
||||||
case 'Menor de 18 años':
|
|
||||||
$cantidad = $graficos->obtenerEdadMenor18();
|
|
||||||
break;
|
|
||||||
case '18 a 24 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad1824();
|
|
||||||
break;
|
|
||||||
case '25 a 34 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad2434();
|
|
||||||
break;
|
|
||||||
case '35 a 44 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad3544();
|
|
||||||
break;
|
|
||||||
case '45 a 54 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad4554();
|
|
||||||
break;
|
|
||||||
case '55 a 64 años':
|
|
||||||
$cantidad = $graficos->obtenerEdad5564();
|
|
||||||
break;
|
|
||||||
case '65 años o más':
|
|
||||||
$cantidad = $graficos->obtenerEdad65oMas();
|
|
||||||
break;
|
|
||||||
case 'Estados':
|
|
||||||
$cantidad = $graficos->obtenerEstados();
|
|
||||||
echo json_encode($cantidad); // Devolver directamente el array de estados
|
|
||||||
exit; // Terminar la ejecucion aqui
|
|
||||||
case 'Examenes':
|
|
||||||
$cantidad = $graficos->obtenerExamenes();
|
|
||||||
echo json_encode($cantidad); // Devolver directamente el array de examenes
|
|
||||||
exit; // Terminar la ejecucion aqui
|
|
||||||
default:
|
|
||||||
$cantidad = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(['cantidad' => $cantidad]);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Graficos{
|
|
||||||
private $conexion;
|
|
||||||
protected $db;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->conexion = new Conexion();
|
|
||||||
$this->db = $this->conexion->conectar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function obtenerGeneroFemenino() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS Femenino FROM candidato WHERE id_genero = 2 ");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['Femenino'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroMasculino() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS Maculino FROM candidato WHERE id_genero = 1 ");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['Maculino'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerGeneroNoDefinido() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS NoDefinido FROM candidato WHERE id_genero = 3 ");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['NoDefinido'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdadMenor18() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS menorEdad FROM candidato WHERE id_rango_edad = 1");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['menorEdad'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad1824() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS edad1824 FROM candidato WHERE id_rango_edad = 2");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['edad1824'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad2434() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS edad2434 FROM candidato WHERE id_rango_edad = 3");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['edad2434'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad3544() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS edad3544 FROM candidato WHERE id_rango_edad = 4");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['edad3544'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function obtenerEdad4554() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS edad4554 FROM candidato WHERE id_rango_edad = 5");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['edad4554'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function obtenerEdad5564() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS edad5564 FROM candidato WHERE id_rango_edad = 6");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['edad5564'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEdad65oMas() {
|
|
||||||
$query = $this->db->prepare("SELECT COUNT(*) AS edad65oMas FROM candidato WHERE id_rango_edad = 7");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
$output = "0";
|
|
||||||
|
|
||||||
if($resultado->num_rows > 0) {
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$output= $data['edad65oMas'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$query->close();
|
|
||||||
$this->db->close();
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerEstados() {
|
|
||||||
try {
|
|
||||||
$query = $this->db->prepare("
|
|
||||||
SELECT estados.nombre AS estado, COUNT(*) AS cantidad
|
|
||||||
FROM estados
|
|
||||||
INNER JOIN info_candidatos ON info_candidatos.id_estado = estados.id
|
|
||||||
GROUP BY estados.nombre
|
|
||||||
ORDER BY estados.nombre
|
|
||||||
");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$estados = [];
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$estados[] = $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
$query->close();
|
|
||||||
|
|
||||||
error_log(json_encode($estados));
|
|
||||||
return $estados;
|
|
||||||
} catch (Exception $e) {
|
|
||||||
error_log("Error al obtener los estados: " . $e->getMessage());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function obtenerExamenes() {
|
|
||||||
try {
|
|
||||||
$query = $this->db->prepare("SELECT nombre_examen AS examen , COUNT(*) AS cantidad
|
|
||||||
FROM examen
|
|
||||||
INNER JOIN candidato ON candidato.id_examen = examen.id_examen
|
|
||||||
GROUP BY nombre_examen
|
|
||||||
ORDER BY nombre_examen;
|
|
||||||
");
|
|
||||||
$query->execute();
|
|
||||||
$resultado = $query->get_result();
|
|
||||||
|
|
||||||
$examenes = [];
|
|
||||||
while ($data = $resultado->fetch_assoc()) {
|
|
||||||
$examenes[] = $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
$query->close();
|
|
||||||
|
|
||||||
error_log(json_encode($examenes));
|
|
||||||
return $examenes;
|
|
||||||
} catch (Exception $e) {
|
|
||||||
error_log("Error al obtener los examenes: " . $e->getMessage());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
if (!isset($_SESSION['usuario'])) {
|
|
||||||
header('Location: index.html');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Pagina protegida</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Test</h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,67 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html data-bs-theme="light" lang="es-mx">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
|
||||||
<title>Formulario de registro</title>
|
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div style="background-color: #211b52;"><img src="assets/img/logo-lania-w.png" style="height: 5rem;margin: 0px 10px;"></div>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body" style="margin: 0px 30px;">
|
|
||||||
|
|
||||||
<!-- ==================== Formulario ==================== -->
|
|
||||||
<form style="margin: 0px 10%;" id="formulario-datos-basicos" action="" method="POST">
|
|
||||||
<h3>Registro</h3>
|
|
||||||
<label class="form-label" for="nombres" style="margin: 10px 0px 5px;">Nombre</label>
|
|
||||||
<input class="border rounded border-dark-subtle form-control" type="text" id="nombres" placeholder="Nombre/s" required="">
|
|
||||||
|
|
||||||
<label class="form-label" for="primer_apellido" style="margin: 10px 0px 5px;">Primer apellido</label>
|
|
||||||
<input class="border rounded border-dark-subtle form-control" type="text" id="primer_apellido" placeholder="Primer apellido" required="">
|
|
||||||
|
|
||||||
<label class="form-label" for="segundo_apellido" style="margin: 10px 0px 5px;">Segundo apellido</label>
|
|
||||||
<input class="border rounded border-dark-subtle form-control" type="text" id="segundo_apellido" placeholder="Segundo apellido">
|
|
||||||
|
|
||||||
<label class="form-label" for="correo" style="margin: 10px 0px 5px;">Correo electrónico</label>
|
|
||||||
<input class="border rounded border-dark-subtle form-control" type="email" id="correo" required="" placeholder="usuario@ejemplo.com">
|
|
||||||
|
|
||||||
<label class="form-label" for="telefono" style="margin: 10px 0px 5px;">Teléfono</label>
|
|
||||||
<input class="border rounded border-dark-subtle form-control" type="tel" id="telefono" placeholder="10 digitos de su número de teléfono" minlength="9" maxlength="10" required="">
|
|
||||||
|
|
||||||
<label class="form-label" for="id_examen" style="margin: 10px 0px 5px;">Examen</label>
|
|
||||||
<select class="border rounded border-dark-subtle form-select" id="id_examen" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_genero" style="margin: 10px 0px 5px;">Género</label>
|
|
||||||
<select class="border rounded border-dark-subtle form-select" id="id_genero" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
<option value="1">Masculino</option>
|
|
||||||
<option value="2">Femenino</option>
|
|
||||||
<option value="3">Prefiero no decir</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_rango_edad" style="margin: 10px 0px 5px;">Rango de edad</label>
|
|
||||||
<select class="border rounded border-dark-subtle form-select" id="id_rango_edad" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
<label class="form-label" for="id_tipo_id" style="margin: 10px 0px 5px;">Tipo de identificación</label>
|
|
||||||
<select class="border rounded border-dark-subtle form-select" id="id_tipo_id" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<input class="btn border rounded-3 border-3 border-primary-subtle w-100" type="submit" value="Enviar" style="margin: 15px 0px;background-color: #35245b;color: white;" name="btnEnviar"> </form>
|
|
||||||
<!-- ==================== Fin del formulario ==================== -->
|
|
||||||
<div id="mensaje-error"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
<script src="../js/formulario-candidato.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
|
@ -1,103 +0,0 @@
|
||||||
<?php
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['id_candidato'])) {
|
|
||||||
$id_candidato = $_GET['id_candidato'];
|
|
||||||
} else {
|
|
||||||
// Si no se pasa el id_candidato
|
|
||||||
header("Location: control-candidatos.php");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html data-bs-theme="light" lang="es-mx">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
|
||||||
<title>Formulario</title>
|
|
||||||
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div style="background-color: #211b52;"><img src="assets/img/logo-lania-w.png" style="height: 5rem;margin: 0px 10px;"></div>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body" style="margin: 0px 30px;">
|
|
||||||
<!-- ==================== Formulario ==================== -->
|
|
||||||
<form style="margin: 0px 10%;" id="formulario-datos-extendido" method="post" action="#">
|
|
||||||
<input class="border rounded-3 border-dark-subtle form-control" type="number" id="id_candidato" value="<?php echo $id_candidato; ?>" hidden="">
|
|
||||||
<h4>Información geográfica</h4>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_pais" style="margin: 10px 0px 5px;">País</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="id_pais" value="NULL" required="">
|
|
||||||
<option value="NULL">Seleccione un país</option>
|
|
||||||
<option value="1">México</option>
|
|
||||||
<option value="2">Otro</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<label class="form-label" for="codigo_postal" style="margin: 10px 0px 5px;">Código postal</label>
|
|
||||||
<input class="border rounded-3 border-dark-subtle form-control" type="number" id="codigo_postal" placeholder="Introduzca su código postal" style="margin: 0px 0px;" maxlength="5" disabled="">
|
|
||||||
|
|
||||||
<button class="btn bg-primary-subtle border rounded-3 border-dark-subtle btn-primary w-100" type="button" id="buscarBtn" style="margin: 15px 0px;color: rgb(0,0,0);" disabled="">Buscar</button>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_estado" style="margin: 10px 0px 5px;display: grid;">Estado</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="id_estado" disabled="">
|
|
||||||
<option value="NULL">Seleccione su estado</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_municipio" style="margin: 10px 0px 5px;">Municipio</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="id_municipio" disabled="">
|
|
||||||
<option value="NULL">Seleccione su municipio</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_colonia" style="margin: 10px 0px 5px;">Colonia</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="id_colonia" disabled="">
|
|
||||||
<option value="NULL">Seleccione su colonia</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<h4 style="margin: 20px 0px 0px;">Información académica/laboral</h4>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_nivel" style="margin: 10px 0px 5px;">Nivel de estudios</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="id_nivel" required="">
|
|
||||||
<option value="NULL">Seleccione su nivel de estudios</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<label class="form-label" for="nombre_empresa" style="margin: 10px 0px 5px;">Nombre de su empresa o institución</label>
|
|
||||||
<input class="border rounded-3 border-dark-subtle form-control" type="text" id="nombre_empresa" list="sugerencias_ei" placeholder="Introduzca el nombre de su empresa o institución" required="">
|
|
||||||
<datalist id="sugerencias_ei"></datalist>
|
|
||||||
|
|
||||||
<label class="form-label" for="id_giro" style="margin: 10px 0px 5px;">Giro de su empresa o institución</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="id_giro" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<label class="form-label" for="motivo_examen" style="margin: 10px 0px 5px;">Motivo de examen</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="motivo_examen" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<h4 style="margin: 20px 0px 0px;">Calificación del servicio</h4>
|
|
||||||
<label class="form-label" for="calificacion_servicio" style="margin: 10px 0px 5px;">¿Qué tan satisfecho está con nuestra institución, considerando la calidad de las instalaciones, la atención del personal y el proceso de aplicación del examen?</label>
|
|
||||||
<select class="border rounded-3 border-dark-subtle form-select" id="calificacion_servicio" required="">
|
|
||||||
<option value="NULL">Seleccione una opción</option>
|
|
||||||
<option value="1">🙁 Muy insatisfecho</option>
|
|
||||||
<option value="2">😕 Insatisfecho</option>
|
|
||||||
<option value="3">😐 Neutral</option>
|
|
||||||
<option value="4">🙂 Satisfecho</option>
|
|
||||||
<option value="5">😐 Muy satisfecho</option>
|
|
||||||
</select>
|
|
||||||
<br>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="consentimiento_pub" value="1" checked>
|
|
||||||
<label class="form-check-label" for="consentimiento_pub">Consiento que mis datos personales sean tratados de conformidad con los términos y condiciones informados en el presente <a href="#">aviso de privacidad</a>.</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input class="btn border rounded-3 border border-primary-subtle btn-primary w-100" type="submit" style="margin: 15px 0px;" value="Enviar" name="btnEnviar">
|
|
||||||
</form>
|
|
||||||
<!-- ==================== Fin del formulario ==================== -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="../js/formulario-datos-candidato.js"></script>
|
|
||||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue