Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d43c11f98 | |||
| f14dda7eff | |||
| 51aa3121bc | |||
| 4b7516f9ec | |||
| ef43cf238c |
@@ -0,0 +1,50 @@
|
||||
name: Validar iris
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Obtener código
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Configurar Node.js
|
||||
uses: https://github.com/actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: npm
|
||||
|
||||
- name: Mostrar versiones
|
||||
run: |
|
||||
node --version
|
||||
npm --version
|
||||
|
||||
- name: Instalar dependencias
|
||||
run: npm ci
|
||||
|
||||
- name: Build obligatorio
|
||||
run: npm run build
|
||||
|
||||
deploy-dev:
|
||||
needs: validate
|
||||
if: github.event_name == 'push' && github.ref_name == 'develop'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Desplegar iris en pruebas
|
||||
uses: CIDWA/infra-actions/deploy-ssh@main
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
|
||||
known-hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
|
||||
host: 10.10.10.11
|
||||
user: deploy
|
||||
deploy-script: /var/deploy/scripts/deploy-node-app.sh iris-dev
|
||||
commit-sha: ${{ github.sha }}
|
||||
@@ -0,0 +1,25 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "iris-dev",
|
||||
cwd: "/var/www/html/front/pruebas/iris",
|
||||
script: "node_modules/next/dist/bin/next",
|
||||
args: "start",
|
||||
|
||||
interpreter: "/home/deploy/.nvm/versions/node/v22.21.1/bin/node",
|
||||
|
||||
env: {
|
||||
NODE_ENV: "production",
|
||||
PORT: 3376,
|
||||
HOSTNAME: "0.0.0.0",
|
||||
},
|
||||
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
min_uptime: "10s",
|
||||
max_restarts: 10,
|
||||
restart_delay: 3000,
|
||||
time: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -19,6 +19,10 @@ const eslintConfig = [
|
||||
"build/**",
|
||||
"next-env.d.ts",
|
||||
],
|
||||
rules: {
|
||||
// permit using `any` in the codebase, otherwise Next's defaults treat it as an error
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Generated
+5
-13
@@ -35,6 +35,10 @@
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.5.3",
|
||||
"typescript": "^5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "22.21.1",
|
||||
"npm": "10.9.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
@@ -1313,7 +1317,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
||||
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
@@ -1464,7 +1467,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.9.tgz",
|
||||
"integrity": "sha512-Lpo8kgb/igvMIPeNV2rsYKTgaORYdO1XGVZ4Qz3akwOj0ySGYMPlQWa8BaLn0G63D1aSaAQ5ldR06wCpChQCjA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"csstype": "^3.2.2"
|
||||
}
|
||||
@@ -1546,7 +1548,6 @@
|
||||
"integrity": "sha512-nm3cvFN9SqZGXjmw5bZ6cGmvJSyJPn0wU9gHAZZHDnZl2wF9PhHv78Xf06E0MaNk4zLVHL8hb2/c32XvyJOLQg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.53.1",
|
||||
"@typescript-eslint/types": "8.53.1",
|
||||
@@ -2033,7 +2034,6 @@
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -2580,8 +2580,7 @@
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/damerau-levenshtein": {
|
||||
"version": "1.0.8",
|
||||
@@ -2979,7 +2978,6 @@
|
||||
"integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
@@ -5061,7 +5059,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz",
|
||||
"integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -5117,7 +5114,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz",
|
||||
"integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.26.0"
|
||||
},
|
||||
@@ -5385,7 +5381,6 @@
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.97.3.tgz",
|
||||
"integrity": "sha512-fDz1zJpd5GycprAbu4Q2PV/RprsRtKC/0z82z0JLgdytmcq0+ujJbJ/09bPGDxCLkKY3Np5cRAOcWiVkLXJURg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.0",
|
||||
"immutable": "^5.0.2",
|
||||
@@ -5833,7 +5828,6 @@
|
||||
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.26.17.tgz",
|
||||
"integrity": "sha512-kkaySn1IRfwNlf9AkZVqDmBINDWw9NRR6Ij0O5dBRBOD1+mbtZJWxxR9/pA90nce9E5tIIkJ7SWij4rMWXtA1g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/limonte"
|
||||
@@ -5897,7 +5891,6 @@
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -6047,7 +6040,6 @@
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
||||
+6
-1
@@ -36,5 +36,10 @@
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.5.3",
|
||||
"typescript": "^5"
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": "22.21.1",
|
||||
"npm": "10.9.4"
|
||||
},
|
||||
"packageManager": "npm@10.9.4"
|
||||
}
|
||||
|
||||
+27
-23
@@ -30,6 +30,33 @@ export default function EditarCasoEspecial() {
|
||||
|
||||
const params = useParams();
|
||||
const idCasoEspe = Number(params.idCasoEspecial);
|
||||
|
||||
// fetch local storage and user data when component mounts
|
||||
useEffect(() => {
|
||||
const fetchUser = async () => {
|
||||
await getLocalInfo();
|
||||
|
||||
if (!idCasoEspecial) return;
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const data = await getUserCasoEspecial(idCasoEspecial);
|
||||
|
||||
setDatos(data);
|
||||
} catch (error: unknown) {
|
||||
const axiosErr = error as AxiosError<{ message: string }>;
|
||||
const mensaje = axiosErr?.response?.data?.message || 'No se pudo obtener la infromacion del caso especial.';
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
icon: 'error',
|
||||
text: mensaje,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
fetchUser();
|
||||
}, []);
|
||||
|
||||
if (isNaN(idCasoEspe)) {
|
||||
return <p>Servicio inválido</p>;
|
||||
}
|
||||
@@ -100,29 +127,6 @@ export default function EditarCasoEspecial() {
|
||||
|
||||
const updateIsLoading = (value: boolean) => setIsLoading(value);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchUser = async () => {
|
||||
await getLocalInfo();
|
||||
|
||||
if (!idCasoEspecial) return
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const data = await getUserCasoEspecial(idCasoEspecial)
|
||||
|
||||
setDatos(data);
|
||||
} catch (error) {
|
||||
const axiosErr = error as AxiosError<any>;
|
||||
const mensaje = axiosErr?.response?.data?.message || 'No se pudo obtener la infromacion del caso especial.'
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
icon: 'error',
|
||||
text: mensaje,
|
||||
})
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<section className="container px-2 pb-5">
|
||||
<BotonRegresar />
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import Cuestionario from "@/components/administrador/cuestionario";
|
||||
import GustavoBazPrada from "@/components/administrador/gustavo-baz-prada";
|
||||
import Reporte from "@/components/administrador/reporte";
|
||||
import ReporteCasoEspecial from "@/components/administrador/reporte-caso-especial";
|
||||
import BotonRegresar from "@/components/boton-regresar";
|
||||
import { type } from "node:os";
|
||||
import { useEffect, useState, useMemo } from "react";
|
||||
@@ -46,6 +47,8 @@ export default function Registro() {
|
||||
<GustavoBazPrada
|
||||
years={years}
|
||||
/>
|
||||
|
||||
<ReporteCasoEspecial />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,6 @@ import { axiosInstance } from "@/api/config";
|
||||
import Image from "next/image";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React, { useState } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
import Swal from "sweetalert2";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -20,7 +20,32 @@ export default function Cuestionario({ years, admin, updateIsLoading }: Props) {
|
||||
try {
|
||||
//updateIsLoading(true);
|
||||
//const res = await axiosInstance.get(`/cuestionario_alumno?year=${selectedCuestionario}&version=${version}`, {
|
||||
const res = await axiosInstance.get(`/cuestionario-alumno2`, {
|
||||
|
||||
// Hacer la validacion de que tipo de cuestionario quiere
|
||||
// if(selectedCuestionario === "cuestionario_alumno") {
|
||||
// var res = await axiosInstance.get(`/cuestionario-alumno2`, {
|
||||
// params: { anio: selectedYear, version },
|
||||
// responseType: "blob",
|
||||
// });
|
||||
// } else if(selectedCuestionario === "cuestionario_programa") {
|
||||
// var res = await axiosInstance.get(`/cuestionario-programa2`, {
|
||||
// params: { anio: selectedYear, version },
|
||||
// responseType: "blob",
|
||||
// });
|
||||
// } else {
|
||||
// Swal.fire({
|
||||
// title: 'Error',
|
||||
// text: 'Seleccione un cuestionario válido.',
|
||||
// icon: 'error',
|
||||
// })
|
||||
// return;
|
||||
// }
|
||||
|
||||
// antes
|
||||
|
||||
console.log("Estos son los datos que se van a enviar para descargar el cuestionario", { selectedCuestionario, version, selectedYear })
|
||||
|
||||
const res = await axiosInstance.get(`/${selectedCuestionario}`, {
|
||||
params: { anio: selectedYear, version },
|
||||
responseType: "blob",
|
||||
});
|
||||
@@ -85,8 +110,8 @@ export default function Cuestionario({ years, admin, updateIsLoading }: Props) {
|
||||
<InputGroup>
|
||||
<FormSelect onChange={(e) => setSelectedCuestionario(e.target.value)}>
|
||||
<option value="">Seleccione un cuestionario:</option>
|
||||
<option value="cuestionario_alumno">Cuestionario de Alumnos</option>
|
||||
<option value="cuestionario_programa">Cuestionario de Programas</option>
|
||||
<option value="cuestionario-alumno2">Cuestionario de Alumnos</option>
|
||||
<option value="cuestionario-programa2">Cuestionario de Programas</option>
|
||||
</FormSelect>
|
||||
</InputGroup>
|
||||
</FormGroup>
|
||||
|
||||
@@ -6,7 +6,6 @@ import { isAxiosError } from "axios";
|
||||
import validator from "validator";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Swal from "sweetalert2";
|
||||
import { toast } from "react-toastify";
|
||||
|
||||
interface Responsable {
|
||||
idUsuario?: number;
|
||||
|
||||
@@ -47,6 +47,7 @@ interface Datos {
|
||||
fechaLiberacion?: string;
|
||||
telefono?: string;
|
||||
direccion?: string;
|
||||
responsableIntermo?: string;
|
||||
/*
|
||||
cartaAceptacion?: boolean;
|
||||
cartaTermino?: boolean;
|
||||
@@ -145,7 +146,7 @@ export default function InformacionServicio({ admin, imprimirError, updateIsLoad
|
||||
</div>
|
||||
|
||||
<div className="mb-3">
|
||||
<label className="form-label fw-semibold">Programa:</label>
|
||||
<label className="form-label fw-semibold">Programa interno:</label>
|
||||
<p className="form-control">{datos.programa?.programa}</p>
|
||||
</div>
|
||||
|
||||
@@ -159,6 +160,11 @@ export default function InformacionServicio({ admin, imprimirError, updateIsLoad
|
||||
<p className="form-control">{datos.programa?.usuario?.nombre}</p>
|
||||
</div>
|
||||
|
||||
<div className="mb-3">
|
||||
<label className="form-label fw-semibold">Profesor:</label>
|
||||
<p className="form-control">{datos?.responsableIntermo || '-'}</p>
|
||||
</div>
|
||||
|
||||
<div className="mb-3">
|
||||
<label className="form-label fw-semibold">Correo:</label>
|
||||
<p className="form-control">{datos.programa?.usuario?.usuario}</p>
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
import { axiosInstance } from "@/api/config";
|
||||
import moment from "moment";
|
||||
import { title } from "process";
|
||||
import { useState } from "react";
|
||||
import { Button, Col, Form, InputGroup } from "react-bootstrap";
|
||||
import { FaRegCalendar } from "react-icons/fa6";
|
||||
import Swal from "sweetalert2";
|
||||
|
||||
export default function ReporteCasoEspecial() {
|
||||
const [selectedInicio, setSelectedInicio] = useState<Date | null>(null);
|
||||
const [selectedFin, setSelectedFin] = useState<Date | null>(null);
|
||||
|
||||
const descargar = async () => {
|
||||
console.log("Descargando reporte de caso especial...");
|
||||
|
||||
try {
|
||||
const res = await axiosInstance.get("/caso-especial/reporte", {
|
||||
params: {
|
||||
inicio: moment(selectedInicio).format("YYYY-MM-DD"), // Aquí puedes agregar los parámetros necesarios para el reporte de caso especial
|
||||
fin: moment(selectedFin).format("YYYY-MM-DD"),
|
||||
// Aquí puedes agregar los parámetros necesarios para el reporte de caso especial
|
||||
},
|
||||
responseType: "blob",
|
||||
});
|
||||
|
||||
const blob = new Blob([res.data], { type: "text/csv" });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "reporte_caso_especial.csv";
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
Swal.fire({
|
||||
title: "Reporte de caso especial descargado",
|
||||
text: "El reporte de caso especial se ha descargado correctamente.",
|
||||
icon: "success",
|
||||
});
|
||||
|
||||
setSelectedInicio(null);
|
||||
setSelectedFin(null);
|
||||
|
||||
} catch {
|
||||
Swal.fire({
|
||||
title: "Error al descargar el reporte de caso especial",
|
||||
text: "Hubo un error al descargar el reporte de caso especial. Por favor, inténtalo de nuevo.",
|
||||
icon: "error",
|
||||
});
|
||||
// console.error("Error al descargar el reporte de caso especial.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="columns">
|
||||
<h4 className="mb-3">Reporte Caso Especial</h4>
|
||||
|
||||
<section>
|
||||
<Col>
|
||||
<Form.Group>
|
||||
<Form.Label>Seleccione una fecha de inicio:</Form.Label>
|
||||
<InputGroup.Text>
|
||||
<FaRegCalendar />
|
||||
<Form.Control type="date" placeholder="Seleccione una fecha de inicio" value={selectedInicio ? moment(selectedInicio).format("YYYY-MM-DD") : ""} onChange={(e) => setSelectedInicio(e.target.value ? new Date(e.target.value) : null)} />
|
||||
</InputGroup.Text>
|
||||
|
||||
</Form.Group>
|
||||
</Col>
|
||||
|
||||
<Col>
|
||||
<Form.Group>
|
||||
<Form.Label>Seleccione una fecha de fin:</Form.Label>
|
||||
<InputGroup.Text>
|
||||
<FaRegCalendar />
|
||||
<Form.Control type="date" placeholder="Seleccione una fecha de fin" value={selectedFin ? moment(selectedFin).format("YYYY-MM-DD") : ""} onChange={(e) => setSelectedFin(e.target.value ? new Date(e.target.value) : null)} />
|
||||
</InputGroup.Text>
|
||||
</Form.Group>
|
||||
</Col>
|
||||
</section>
|
||||
|
||||
<div className="mt-4 mb-3">
|
||||
<Button onClick={descargar} disabled={false}>Descargar Reporte</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user