new file
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
"use client"
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
import axios from "axios";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
interface Periodo{
|
||||
semestre:string,
|
||||
}
|
||||
|
||||
export default function Inscripciones() {
|
||||
const [periodo,setPeriodo]= useState<Periodo[]>([])
|
||||
|
||||
useEffect(()=>{
|
||||
const getPeriodo = async()=>{
|
||||
const response = await axios.get(`${envConfig.apiUrl}/periodo`)
|
||||
setPeriodo(response.data)
|
||||
}
|
||||
getPeriodo()
|
||||
},[])
|
||||
|
||||
return (
|
||||
<section className="containerSection">
|
||||
<h2 className="title"> INSCRITOS </h2>
|
||||
|
||||
<form className="containerForm">
|
||||
<label>Seleccione el periodo</label>
|
||||
<div className="groupInput">
|
||||
<select>
|
||||
{periodo.map((p,index)=>(
|
||||
<option key={index}>
|
||||
{p.semestre}
|
||||
</option>))}
|
||||
</select>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Buscar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Carrera</th>
|
||||
<th>Genero</th>
|
||||
<th>Profesores</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Impresione B/N</th>
|
||||
<th>Impresiones Color</th>
|
||||
<th>Plotteo</th>
|
||||
<th>Escaner</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>5,000</td>
|
||||
<td>10,000</td>
|
||||
<td>10,000</td>
|
||||
<td>20,000</td>
|
||||
<td>45,000</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
//IO
|
||||
@@ -1,3 +1,5 @@
|
||||
import Inscripciones from "./Inscripciones";
|
||||
|
||||
export default async function Page(props: {
|
||||
searchParams?: Promise<{
|
||||
period: string;
|
||||
@@ -6,65 +8,6 @@ export default async function Page(props: {
|
||||
const params = await props.searchParams;
|
||||
const period = params?.period ? params.period : null;
|
||||
|
||||
return (
|
||||
<section className="containerSection">
|
||||
<h2 className="title"> INSCRITOS </h2>
|
||||
|
||||
<form className="containerForm">
|
||||
<label>Seleccione el periodo</label>
|
||||
<div className="groupInput">
|
||||
<select>
|
||||
<option value="">-- Seleccione el periodo --</option>
|
||||
<option value="15">1 </option>
|
||||
<option value="30">2 </option>
|
||||
<option value="45">3 </option>
|
||||
<option value="60">4 </option>
|
||||
<option value="90">5 </option>
|
||||
<option value="120">6 </option>
|
||||
</select>
|
||||
<button className="button buttonSearch" type="submit">
|
||||
Buscar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Carrera</th>
|
||||
<th>Genero</th>
|
||||
<th>Profesores</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Impresione B/N</th>
|
||||
<th>Impresiones Color</th>
|
||||
<th>Plotteo</th>
|
||||
<th>Escaner</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>5,000</td>
|
||||
<td>10,000</td>
|
||||
<td>10,000</td>
|
||||
<td>20,000</td>
|
||||
<td>45,000</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
return <Inscripciones />;
|
||||
}
|
||||
//IO
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
"use client";
|
||||
import apiClient from "@/app/lib/apiClient";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export default function ChangePassword() {
|
||||
const [pass, setPass] = useState("");
|
||||
const [newPass, setNewPass] = useState("");
|
||||
const [password, setPass] = useState("");
|
||||
const [newPassword, setNewPass] = useState("");
|
||||
const [confirmNewPass, setconfirmNewPass] = useState("");
|
||||
|
||||
const handleChangePass = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault;
|
||||
const data = { pass, newPass, confirmNewPass };
|
||||
e.preventDefault();
|
||||
const data = { password, newPassword };
|
||||
|
||||
await apiClient.post("/user/create", data);
|
||||
try{
|
||||
const response = await apiClient.post("/user/changePassword", data);
|
||||
toast.success( `${response.data.message}`)
|
||||
}catch{
|
||||
toast.error( `No es la contraseña actual`)
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -21,7 +28,8 @@ export default function ChangePassword() {
|
||||
<label className="label">Contraseña actual</label>
|
||||
<input
|
||||
placeholder="Coloca tu contraseña..."
|
||||
value={pass}
|
||||
value={password}
|
||||
type="password"
|
||||
onChange={(e) => {
|
||||
setPass(e.target.value);
|
||||
}}
|
||||
@@ -33,7 +41,8 @@ export default function ChangePassword() {
|
||||
<label className="label">Nueva contraseña</label>
|
||||
<input
|
||||
placeholder="Coloca tu nueva contraseña..."
|
||||
value={newPass}
|
||||
value={newPassword}
|
||||
type="password"
|
||||
onChange={(e) => {
|
||||
setNewPass(e.target.value);
|
||||
}}
|
||||
@@ -46,6 +55,7 @@ export default function ChangePassword() {
|
||||
<input
|
||||
placeholder="Coloca tu nueva contraseña..."
|
||||
value={confirmNewPass}
|
||||
type="password"
|
||||
onChange={(e) => {
|
||||
setconfirmNewPass(e.target.value);
|
||||
}}
|
||||
@@ -57,7 +67,6 @@ export default function ChangePassword() {
|
||||
<button
|
||||
className="button buttonSearch"
|
||||
style={{ maxWidth: "100%", width: "100%" }}
|
||||
type="submit"
|
||||
>
|
||||
Confirmar
|
||||
</button>
|
||||
@@ -65,7 +74,6 @@ export default function ChangePassword() {
|
||||
<button
|
||||
className="button buttonCancel"
|
||||
style={{ maxWidth: "100%", width: "100%" }}
|
||||
type="submit"
|
||||
>
|
||||
Cancelar
|
||||
</button>
|
||||
@@ -74,3 +82,4 @@ export default function ChangePassword() {
|
||||
</section>
|
||||
);
|
||||
}
|
||||
//IO
|
||||
@@ -37,18 +37,9 @@ apiClient.interceptors.response.use(
|
||||
Cookies.remove("token");
|
||||
Cookies.remove("user");
|
||||
|
||||
if (
|
||||
typeof window !== "undefined" &&
|
||||
!window.location.pathname.includes("/")
|
||||
) {
|
||||
window.location.href = "/";
|
||||
}
|
||||
}
|
||||
|
||||
if (status === 403) {
|
||||
if (typeof window !== "undefined") {
|
||||
window.location.href = "/Impresiones";
|
||||
}
|
||||
}
|
||||
}
|
||||
return Promise.reject(error);
|
||||
|
||||
Reference in New Issue
Block a user