Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c4449c0f1 |
@@ -1,50 +0,0 @@
|
|||||||
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 }}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
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,10 +19,6 @@ const eslintConfig = [
|
|||||||
"build/**",
|
"build/**",
|
||||||
"next-env.d.ts",
|
"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
-4
@@ -35,10 +35,6 @@
|
|||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "15.5.3",
|
"eslint-config-next": "15.5.3",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "22.21.1",
|
|
||||||
"npm": "10.9.4"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
|
|||||||
+1
-6
@@ -36,10 +36,5 @@
|
|||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "15.5.3",
|
"eslint-config-next": "15.5.3",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
},
|
}
|
||||||
"engines": {
|
|
||||||
"node": "22.21.1",
|
|
||||||
"npm": "10.9.4"
|
|
||||||
},
|
|
||||||
"packageManager": "npm@10.9.4"
|
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-27
@@ -30,33 +30,6 @@ export default function EditarCasoEspecial() {
|
|||||||
|
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const idCasoEspe = Number(params.idCasoEspecial);
|
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)) {
|
if (isNaN(idCasoEspe)) {
|
||||||
return <p>Servicio inválido</p>;
|
return <p>Servicio inválido</p>;
|
||||||
}
|
}
|
||||||
@@ -127,6 +100,29 @@ export default function EditarCasoEspecial() {
|
|||||||
|
|
||||||
const updateIsLoading = (value: boolean) => setIsLoading(value);
|
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 (
|
return (
|
||||||
<section className="container px-2 pb-5">
|
<section className="container px-2 pb-5">
|
||||||
<BotonRegresar />
|
<BotonRegresar />
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import Cuestionario from "@/components/administrador/cuestionario";
|
import Cuestionario from "@/components/administrador/cuestionario";
|
||||||
import GustavoBazPrada from "@/components/administrador/gustavo-baz-prada";
|
import GustavoBazPrada from "@/components/administrador/gustavo-baz-prada";
|
||||||
import Reporte from "@/components/administrador/reporte";
|
import Reporte from "@/components/administrador/reporte";
|
||||||
import ReporteCasoEspecial from "@/components/administrador/reporte-caso-especial";
|
|
||||||
import BotonRegresar from "@/components/boton-regresar";
|
import BotonRegresar from "@/components/boton-regresar";
|
||||||
import { type } from "node:os";
|
import { type } from "node:os";
|
||||||
import { useEffect, useState, useMemo } from "react";
|
import { useEffect, useState, useMemo } from "react";
|
||||||
@@ -47,8 +46,6 @@ export default function Registro() {
|
|||||||
<GustavoBazPrada
|
<GustavoBazPrada
|
||||||
years={years}
|
years={years}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ReporteCasoEspecial />
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ import { axiosInstance } from "@/api/config";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
import Swal from "sweetalert2";
|
import Swal from "sweetalert2";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
|||||||
@@ -20,32 +20,7 @@ export default function Cuestionario({ years, admin, updateIsLoading }: Props) {
|
|||||||
try {
|
try {
|
||||||
//updateIsLoading(true);
|
//updateIsLoading(true);
|
||||||
//const res = await axiosInstance.get(`/cuestionario_alumno?year=${selectedCuestionario}&version=${version}`, {
|
//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 },
|
params: { anio: selectedYear, version },
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
});
|
});
|
||||||
@@ -110,8 +85,8 @@ export default function Cuestionario({ years, admin, updateIsLoading }: Props) {
|
|||||||
<InputGroup>
|
<InputGroup>
|
||||||
<FormSelect onChange={(e) => setSelectedCuestionario(e.target.value)}>
|
<FormSelect onChange={(e) => setSelectedCuestionario(e.target.value)}>
|
||||||
<option value="">Seleccione un cuestionario:</option>
|
<option value="">Seleccione un cuestionario:</option>
|
||||||
<option value="cuestionario-alumno2">Cuestionario de Alumnos</option>
|
<option value="cuestionario_alumno">Cuestionario de Alumnos</option>
|
||||||
<option value="cuestionario-programa2">Cuestionario de Programas</option>
|
<option value="cuestionario_programa">Cuestionario de Programas</option>
|
||||||
</FormSelect>
|
</FormSelect>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { isAxiosError } from "axios";
|
|||||||
import validator from "validator";
|
import validator from "validator";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import Swal from "sweetalert2";
|
import Swal from "sweetalert2";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
interface Responsable {
|
interface Responsable {
|
||||||
idUsuario?: number;
|
idUsuario?: number;
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ interface Datos {
|
|||||||
fechaLiberacion?: string;
|
fechaLiberacion?: string;
|
||||||
telefono?: string;
|
telefono?: string;
|
||||||
direccion?: string;
|
direccion?: string;
|
||||||
responsableIntermo?: string;
|
|
||||||
/*
|
/*
|
||||||
cartaAceptacion?: boolean;
|
cartaAceptacion?: boolean;
|
||||||
cartaTermino?: boolean;
|
cartaTermino?: boolean;
|
||||||
@@ -146,7 +145,7 @@ export default function InformacionServicio({ admin, imprimirError, updateIsLoad
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label className="form-label fw-semibold">Programa interno:</label>
|
<label className="form-label fw-semibold">Programa:</label>
|
||||||
<p className="form-control">{datos.programa?.programa}</p>
|
<p className="form-control">{datos.programa?.programa}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -160,11 +159,6 @@ export default function InformacionServicio({ admin, imprimirError, updateIsLoad
|
|||||||
<p className="form-control">{datos.programa?.usuario?.nombre}</p>
|
<p className="form-control">{datos.programa?.usuario?.nombre}</p>
|
||||||
</div>
|
</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">
|
<div className="mb-3">
|
||||||
<label className="form-label fw-semibold">Correo:</label>
|
<label className="form-label fw-semibold">Correo:</label>
|
||||||
<p className="form-control">{datos.programa?.usuario?.usuario}</p>
|
<p className="form-control">{datos.programa?.usuario?.usuario}</p>
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
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>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -205,7 +205,7 @@ Codigo anterior para el envio del archivo
|
|||||||
{file?.name || 'Arrastra aquì tu archivo o da click aquì para buscar'}
|
{file?.name || 'Arrastra aquì tu archivo o da click aquì para buscar'}
|
||||||
</p>
|
</p>
|
||||||
<p className="is-size-6">Tamaño maximo 20MB</p>
|
<p className="is-size-6">Tamaño maximo 20MB</p>
|
||||||
<p className="is-size-7">Sia al momento de elegir un archivo este no se selecciona, haga click en cancelar en la ventana emergente e intente de nuevo.</p>
|
<p className="is-size-7">Si al momento de elegir un archivo este no se selecciona, haga click en cancelar en la ventana emergente e intente de nuevo.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
|
|||||||
Reference in New Issue
Block a user