diff --git a/healthmanager/package-lock.json b/healthmanager/package-lock.json index e18a08c..d6d596e 100644 --- a/healthmanager/package-lock.json +++ b/healthmanager/package-lock.json @@ -12,6 +12,7 @@ "@mui/material": "^5.15.15", "@mui/styled-engine": "^5.15.14", "axios": "^1.6.8", + "jspdf": "^2.5.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.23.0" @@ -1624,6 +1625,12 @@ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" }, + "node_modules/@types/raf": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz", + "integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==", + "optional": true + }, "node_modules/@types/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.1.tgz", @@ -1882,6 +1889,17 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "bin": { + "atob": "bin/atob.js" + }, + "engines": { + "node": ">= 4.5.0" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -1943,6 +1961,15 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "optional": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1985,6 +2012,17 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/btoa": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", + "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==", + "bin": { + "btoa": "bin/btoa.js" + }, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", @@ -2032,6 +2070,31 @@ } ] }, + "node_modules/canvg": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.10.tgz", + "integrity": "sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==", + "optional": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "@types/raf": "^3.4.0", + "core-js": "^3.8.3", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.7", + "rgbcolor": "^1.0.1", + "stackblur-canvas": "^2.0.0", + "svg-pathdata": "^6.0.3" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/canvg/node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "optional": true + }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -2089,6 +2152,17 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, + "node_modules/core-js": { + "version": "3.37.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.1.tgz", + "integrity": "sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==", + "hasInstallScript": true, + "optional": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/cosmiconfig": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", @@ -2118,6 +2192,15 @@ "node": ">= 8" } }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "optional": true, + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", @@ -2260,6 +2343,12 @@ "csstype": "^3.0.2" } }, + "node_modules/dompurify": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.5.4.tgz", + "integrity": "sha512-l5NNozANzaLPPe0XaAwvg3uZcHtDBnziX/HjsY1UcDj1MxTK8Dd0Kv096jyPK5HRzs/XM5IMj20dW8Fk+HnbUA==", + "optional": true + }, "node_modules/electron-to-chromium": { "version": "1.4.750", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.750.tgz", @@ -2818,6 +2907,11 @@ "reusify": "^1.0.4" } }, + "node_modules/fflate": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", + "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==" + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -3174,6 +3268,19 @@ "react-is": "^16.7.0" } }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "optional": true, + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -3667,6 +3774,23 @@ "node": ">=6" } }, + "node_modules/jspdf": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.1.tgz", + "integrity": "sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==", + "dependencies": { + "@babel/runtime": "^7.14.0", + "atob": "^2.1.2", + "btoa": "^1.2.1", + "fflate": "^0.4.8" + }, + "optionalDependencies": { + "canvg": "^3.0.6", + "core-js": "^3.6.0", + "dompurify": "^2.2.0", + "html2canvas": "^1.0.0-rc.5" + } + }, "node_modules/jsx-ast-utils": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", @@ -4051,6 +4175,12 @@ "node": ">=8" } }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "optional": true + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -4146,6 +4276,15 @@ } ] }, + "node_modules/raf": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "optional": true, + "dependencies": { + "performance-now": "^2.1.0" + } + }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", @@ -4307,6 +4446,15 @@ "node": ">=0.10.0" } }, + "node_modules/rgbcolor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz", + "integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==", + "optional": true, + "engines": { + "node": ">= 0.8.15" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -4520,6 +4668,15 @@ "node": ">=0.10.0" } }, + "node_modules/stackblur-canvas": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz", + "integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==", + "optional": true, + "engines": { + "node": ">=0.1.14" + } + }, "node_modules/string.prototype.matchall": { "version": "4.0.11", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz", @@ -4646,6 +4803,24 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/svg-pathdata": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-6.0.3.tgz", + "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==", + "optional": true, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "optional": true, + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -4811,6 +4986,15 @@ "punycode": "^2.1.0" } }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "optional": true, + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, "node_modules/vite": { "version": "5.2.10", "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.10.tgz", diff --git a/healthmanager/package.json b/healthmanager/package.json index d941ae7..894d783 100644 --- a/healthmanager/package.json +++ b/healthmanager/package.json @@ -14,6 +14,7 @@ "@mui/material": "^5.15.15", "@mui/styled-engine": "^5.15.14", "axios": "^1.6.8", + "jspdf": "^2.5.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.23.0" diff --git a/healthmanager/src/DescargaRecetas.css b/healthmanager/src/DescargaRecetas.css index e2c62ac..6cd524d 100644 --- a/healthmanager/src/DescargaRecetas.css +++ b/healthmanager/src/DescargaRecetas.css @@ -1,26 +1,54 @@ -.descarga-recetas { - padding: 2rem; - text-align: center; +#headerFacultad{ + margin-left: 50px; + text-align: left; + font-family: Arial, Helvetica, sans-serif; } - -.titulo { - margin-bottom: 2rem; +#box1{ + padding-top: 15px; + margin-right: 20px; } - -.contenedor-recetas { +#box2{ + padding-top: 15px; +} +#headerPublicaciones{ + margin-left: 50px; +} +#divPublicaciones{ display: flex; - flex-direction: column; - align-items: center; + padding: auto; } - -.receta-item { +#divsPublicaciones2{ + width: 600px; + text-align:justify; + font-family:Georgia, 'Times New Roman', Times, serif; + padding-top: 15px; + } +#boxCerrar{ + margin-left: auto; + margin-right: 100px; + padding: auto; +} +#division{ + margin-top: 20px; +} +#botonEliminar{ + margin: 0 auto; +} +#listaEliminar{ display: flex; - justify-content: space-between; - align-items: center; - width: 100%; - max-width: 600px; - margin-bottom: 1rem; - padding: 1rem; - background-color: #f5f5f5; - border-radius: 4px; + +} +#divLista2{ + width: 600px; + display: grid; + margin: 0 auto; +} +#divBotonesRecetas{ + display: flex; + margin-left: auto; + margin-right: 100px; +} +#leyendaPublicacion{ + margin-right: auto; + margin-left: 50px; } \ No newline at end of file diff --git a/healthmanager/src/DescargaRecetas.jsx b/healthmanager/src/DescargaRecetas.jsx index 86e313d..7e900c0 100644 --- a/healthmanager/src/DescargaRecetas.jsx +++ b/healthmanager/src/DescargaRecetas.jsx @@ -1,62 +1,117 @@ -import { useState, useEffect } from 'react'; -import axios from 'axios'; -import { Button, Box, Typography, List, ListItem, ListItemText } from '@mui/material'; -import './DescargaRecetas.css'; +/* eslint-disable no-unused-vars */ +import { Button, Box, TextField ,DialogContentText, Divider} from "@mui/material" +import axios from "axios" +import {useEffect,useState } from "react" +import './DescargaRecetas.css' +import { useNavigate } from 'react-router-dom' +import jsPDF from "jspdf" -function DescargaRecetas() { - const [recetas, setRecetas] = useState([]); - const [cargando, setCargando] = useState(false); - useEffect(() => { - const fetchRecetas = async () => { - setCargando(true); - try { - const respuesta = await axios.get('/api/recetas'); - setRecetas(respuesta.data); - } catch (error) { - console.error('Error al obtener las recetas:', error); - } - setCargando(false); - }; +// eslint-disable-next-line no-unused-vars +function DescargaRecetas(props) { + const navigate = useNavigate(); + const [publicacionesData, setPublicacionesData] = useState([]); + const [Cargando, setCargando] = useState (false) + const [datosID, setDatosID] = useState( {idPublicacion:''} ) + const nombreUsuario = window.localStorage.getItem("IDUsuario"); - fetchRecetas().then(() =>{}); - }, []); + const cambiosID = (evento) => { + const {name, value} = evento.target + setDatosID( { ...datosID, [name] : value }) + } - const descargarReceta = (recetaId) => { + const regresarPrincipal = () => { + navigate('/Principal'); + } - console.log('Descargando receta:', recetaId); + const cerrarSesion = () => { + navigate('/'); + } + + const obtenerListaMisPublicaciones = async () => { + try { + const response = await axios.get("http://localhost:4567/MisRecetas", { params: { idUsuario: nombreUsuario } }); + console.log(response.data) + console.log(nombreUsuario) + setPublicacionesData(response.data); + } catch (error) { + console.error('Error al obtener el id del usuario:', error); + } }; + obtenerListaMisPublicaciones() + + const peticionEliminar=async()=>{ + try { + const respuesta= await axios.post("https://back-endproyectofinal8-production-a397.up.railway.app/eliminarPublicacion",{params:{idPublicacion:window.localStorage.getItem("idePublicacion")}}); + return respuesta; + } catch (error) { + console.log(error); + } + } + + const procesarEliminacion=async()=>{ + setCargando(true); + try { + const respuesta=await peticionEliminar(); + console.log("Respuesta de publicacion a eliminar", respuesta.data); + alert("Publicacion eliminada",respuesta.data); + setCargando(false); + } catch (error) { + console.log(error); + setCargando(false); + } + } + + const generarPdf= (idReceta,nombreMedico,contactoMedico,fecha) =>{ + var doc = new jsPDF(); + const docWidth = doc.internal.pageSize.getWidth(); + doc.text(10, 10,'Receta No.'+ idReceta); + doc.line(0, 12, docWidth, 12); + doc.text(10, 20,'Medico: '+nombreMedico) + doc.text(10, 30,'Contacto: '+contactoMedico) + doc.text(10, 40,'Fecha: '+fecha) + doc.save('Receta '+ fecha + ' .pdf'); + } return ( -
- - Descargar Recetas Médicas - - - {cargando ? ( - Cargando recetas... - ) : ( - - {recetas.map((receta) => ( - - - - - ))} - - )} - -
- ); + <> +

Health Manager - Mis recetas

+ + + +
+

Visualiza tus recetas.

+ +
+
+
+ {publicacionesData.map((elemento) => ( +
+
+

Receta No. ({elemento.idRec})

+ +

{elemento.nombreMed}

+

{elemento.contactoMed}

+

{elemento.fecha}

+ + +
+
+ ))} +
+
+ + ) } -export default DescargaRecetas; \ No newline at end of file +export default DescargaRecetas \ No newline at end of file diff --git a/healthmanager/src/Login.css b/healthmanager/src/Login.css index 75339e6..9d25ff5 100644 --- a/healthmanager/src/Login.css +++ b/healthmanager/src/Login.css @@ -1,10 +1,12 @@ -body{ +#divPrincipalLog{ background-image: url("https://www.meditips.com/wp-content/uploads/2017/07/AdobeStock_103968342-scaled-uai-1032x688.jpeg"); background-repeat: no-repeat; background-attachment: fixed; background-size: cover; + height:708px; } -h1 { +.h1login { + padding-top: 10px; text-align: center; font-family: Arial, Helvetica, sans-serif; } @@ -25,6 +27,7 @@ h1 { padding-bottom: 15px; } #p2{ + margin-top: 20px; text-align: center; } form { diff --git a/healthmanager/src/Login.jsx b/healthmanager/src/Login.jsx index 3f2de70..49da7a1 100644 --- a/healthmanager/src/Login.jsx +++ b/healthmanager/src/Login.jsx @@ -4,17 +4,17 @@ import { useState } from "react" import './Login.css' import { Link, useNavigate } from 'react-router-dom' + // eslint-disable-next-line no-unused-vars function Login(props) { const navigate = useNavigate(); const [Cargando, setCargando] = useState (false) const [datosLogin, setDatosLogin] = useState( {correo:'', contraseña:''} ) - // eslint-disable-next-line no-unused-vars const hacerPeticion = async () => { // eslint-disable-next-line no-useless-catch try { - const response = await axios.post('https://back-endproyectofinal8-production-a397.up.railway.app/validacion',datosLogin) + const response = await axios.post('http://localhost:4567/validacion',datosLogin) console.log("hacerPeticion", response) return response; } catch (error) { @@ -33,14 +33,14 @@ function Login(props) { console.log("datos recuperados en el form: ", datosLogin) setCargando(true) try { - //const response = await hacerPeticion() + const response = await hacerPeticion() setCargando(false) - //if (response.data === 'Usuario Correcto') { + if (response.data === 'Usuario Correcto') { navigate('/Principal'); window.localStorage.setItem('Usuario',datosLogin.correo); - //} else { - //alert("Credenciales incorrectas, revisa tu correo o contraseña"); - //} + } else { + alert("Credenciales incorrectas, revisa tu correo o contraseña"); + } } catch (error) { console.log("error", error) setCargando(false) @@ -49,10 +49,11 @@ function Login(props) { return ( <> -

Health Manager

+
+

Health Manager

Seguimiento medico de pacientes

-

Inicia sesion para continuar

+

Inicia sesion para continuar

@@ -63,6 +64,7 @@ function Login(props) {

¿Aun no tienes una cuenta? {Registrarme}

+
) } diff --git a/healthmanager/src/MiPerfil.css b/healthmanager/src/MiPerfil.css new file mode 100644 index 0000000..837d6e4 --- /dev/null +++ b/healthmanager/src/MiPerfil.css @@ -0,0 +1,54 @@ +#headerFacultad{ + margin-left: 50px; + text-align: left; + font-family: Arial, Helvetica, sans-serif; +} +#headerMiPerfil{ + margin-left: 50px; +} +#divMiPerfil{ + display: flex; + padding: auto; +} +#divLista{ + width: 900px; + display:grid; + padding-top: 20px; +} +#dialogUsuario{ + padding-bottom: 10px; + font-family: Arial, Helvetica, sans-serif; +} +#dialogEdad{ + padding-top: 10px; + padding-bottom: 10px; + font-family: Arial, Helvetica, sans-serif; +} +#dialogPeso{ + padding-top: 10px; + padding-bottom: 10px; + font-family: Arial, Helvetica, sans-serif; +} +#dialogCorreo{ + padding-top: 10px; + padding-bottom: 10px; + font-family: Arial, Helvetica, sans-serif; +} +#dialogContraseña{ + padding-top: 10px; + padding-bottom: 10px; + font-family: Arial, Helvetica, sans-serif; +} +#leyendas{ + padding-top: 10px; + padding-bottom: 10px; +} +#divBotonesPerfil{ + display: flex; + margin-left: auto; + margin-right: 100px; +} +#leyendaPublicacion{ + margin-right: auto; + margin-left: 50px; +} diff --git a/healthmanager/src/MiPerfil.jsx b/healthmanager/src/MiPerfil.jsx new file mode 100644 index 0000000..d6efb48 --- /dev/null +++ b/healthmanager/src/MiPerfil.jsx @@ -0,0 +1,65 @@ +import { Button, Box,DialogContentText, Divider} from "@mui/material" +// eslint-disable-next-line no-unused-vars +import axios from "axios" +// eslint-disable-next-line no-unused-vars +import {useEffect,useState } from "react" +import './MiPerfil.css' +import { useNavigate } from 'react-router-dom' + +// eslint-disable-next-line no-unused-vars +function MiPerfil(props) { + const navigate = useNavigate(); + // eslint-disable-next-line no-unused-vars + const [Cargando, setCargando] = useState (false) + + //const [miPerfilData, setMiPerfilData] = useState({idUsuario:window.localStorage.getItem("ID"),correo:window.localStorage.getItem("Usuario"),contraseña:window.localStorage.getItem("Contraseña")}); + + const regresarPrincipal = () => { + navigate('/Principal'); + } + + const cerrarSesion = () => { + navigate('/'); + } + + return ( + <> +

HealthManager - Mi Perfil

+ + + +
+

Visualiza tu datos como Usuario, Correo y Contraseña.

+
+
+ Nombre + {window.localStorage.getItem("ID")} + + Edad + {window.localStorage.getItem("Edad")} años + + Peso + {window.localStorage.getItem("Peso")} kg + + Correo + {window.localStorage.getItem("Usuario")} + + Contraseña + {window.localStorage.getItem("Contraseña")} + +
+ + ) +} + +export default MiPerfil \ No newline at end of file diff --git a/healthmanager/src/Principal.css b/healthmanager/src/Principal.css index 54a34c3..e458c16 100644 --- a/healthmanager/src/Principal.css +++ b/healthmanager/src/Principal.css @@ -1,12 +1,12 @@ -h1 { - text-align: center; +#headerSistema { + margin-top: 10px; + margin-left: 50px; + text-align: left; font-family: Arial, Helvetica, sans-serif; } -body{ - background-color: aliceblue; - background-image: none; -} #bienvenidoUsuario { + margin-top: 10px; + margin-bottom: 10px; margin-left: 50px; text-align: left; font-size: medium; @@ -41,15 +41,14 @@ body{ #headerForm { font-size: small; } - #divMenu { + #divBotones { font-family:Arial, Helvetica, sans-serif; - margin-left: auto; - margin-right: 150px; - padding: 10px; + margin-top: 80px; + margin-left: 35px; + } + #img1{ + margin-right: 10px; + } + #img2{ + margin-right: 10px; } -#cerrarSesion{ - align-items: center; -} -#divBotones{ - padding-top: 30px; -} \ No newline at end of file diff --git a/healthmanager/src/Principal.jsx b/healthmanager/src/Principal.jsx index b5aaf7b..4b9490d 100644 --- a/healthmanager/src/Principal.jsx +++ b/healthmanager/src/Principal.jsx @@ -23,9 +23,10 @@ function Principal(props) { const datosUsuario = async () => { try { const respuesta = await axios.get( - "https://back-endproyectofinal8-production-a397.up.railway.app/datosUsuario", - { params: { correo: correoUsuario } } + "http://localhost:4567/datosUsuario", + { params: { correo: correoUsuario }} ); + console.log("Entrando") return respuesta.data; } catch (error) { console.log(error); @@ -35,10 +36,17 @@ function Principal(props) { const UsuarioData = async () => { try { const respuesta = await datosUsuario(); - const nombreUsuarioSesion = respuesta.idUsuario; - const contraseñaUsuarioSesion = respuesta.contraseña; + const nombreUsuarioSesion = respuesta.nombre; + const edadUsuarioSesion = respuesta.edad; + const pesoUsuarioSesion = respuesta.peso; + const idUsuarioSesion = respuesta.idUsuario; + window.localStorage.setItem("ID", nombreUsuarioSesion); - window.localStorage.setItem("Contraseña", contraseñaUsuarioSesion); + window.localStorage.setItem("Edad", edadUsuarioSesion); + window.localStorage.setItem("Peso", pesoUsuarioSesion); + window.localStorage.setItem("IDUsuario",idUsuarioSesion) + + console.log(idUsuarioSesion) } catch (error) { console.log("holaa"); console.log(error); @@ -50,60 +58,44 @@ function Principal(props) { navigate("/"); }; + const misRecetas = () => { + navigate("/DescargaRecetas"); + }; + const miPerfil = () => { navigate("/MiPerfil"); }; - const publicaciones = () => { - navigate("/Publicaciones"); - }; - - const crearPublicacion = () => { - navigate("/CrearPublicacion"); - }; - - useEffect(() => { - const fetchData = async () => { - // eslint-disable-next-line no-useless-catch - try { - const res = await axios.get( - "https://back-endproyectofinal8-production-a397.up.railway.app/Publicaciones" - ); - console.log("Publicaciones data: ", res.data); - setPublicacionesData(res.data); - } catch (error) { - throw error; - } - }; - fetchData(); - }, []); const usuarioSesion = window.localStorage.getItem("ID"); - const images = [ + const image1 = { url: "https://www.meditips.com/wp-content/uploads/2019/03/recetas-medicas-1200x600-1.jpg", title: "Mis recetas", - width: "33%", - }, + width: "32%", + }; + + const image2 = { - url: "https://th.bing.com/th/id/OIP.UKTXt_LSCslIT1KFUc-oYQAAAA?w=415&h=404&rs=1&pid=ImgDetMain", + url: "https://roianalytics.agency/wp-content/uploads/2020/09/Perfil-de-usuario.png", title: "Mi perfil", - width: "33%", - }, + width: "32%", + }; + + const image3 = { - url: "https://cdn-icons-png.flaticon.com/512/1053/1053210.png", + url: "https://image.freepik.com/vector-gratis/hombre-saliendo-puerta_1133-32.jpg", title: "Cerrar Sesion", - width: "33%", - }, - ]; + width: "32%", + }; const ImageButton = styled(ButtonBase)(({ theme }) => ({ position: "relative", - height: 510, + height: 400, [theme.breakpoints.down("sm")]: { width: "100% !important", // Overrides inline-style - height: 100, + height: 80, }, "&:hover, &.Mui-focusVisible": { zIndex: 1, @@ -162,29 +154,86 @@ function Principal(props) { transition: theme.transitions.create("opacity"), })); - // - // - //

Menu Principal

return ( <>
-

Health Manager - Menu Principal

+

Health Manager - Menu Principal

¡Hola {usuarioSesion}!

- - -
- + + + + `calc(${theme.spacing(1)} + 6px)`, + }} + > + {image1.title} + + + + + + + + + `calc(${theme.spacing(1)} + 6px)`, + }} + > + {image2.title} + + + + + + + + + `calc(${theme.spacing(1)} + 6px)`, + }} + > + {image3.title} + + + + +
+
+ + ); +} + +export default Principal; + +/* + ))} - - - - ); -} -export default Principal; +*/ \ No newline at end of file diff --git a/healthmanager/src/main.jsx b/healthmanager/src/main.jsx index 58e6e0d..69fca1c 100644 --- a/healthmanager/src/main.jsx +++ b/healthmanager/src/main.jsx @@ -4,6 +4,7 @@ import Login from './Login.jsx' import { RouterProvider, createHashRouter } from 'react-router-dom' import Principal from './Principal.jsx' import DescargaRecetas from './DescargaRecetas.jsx' +import MiPerfil from './MiPerfil.jsx' //import registrarPaciente from './registrarPaciente.html' //import Publicaciones from './Publicaciones' @@ -21,13 +22,13 @@ import DescargaRecetas from './DescargaRecetas.jsx' element: }/*, { - path: "/registrarPaciente", - element: - }, + path: "/MiPerfil", + element: + }*/, { path: "/MiPerfil", element: - }*/ + } ]) ReactDOM.createRoot(document.getElementById('root')).render(