usuario interfaz sin estilo

This commit is contained in:
Roberto 2024-05-26 17:56:05 -06:00
parent 2c036fa354
commit 6fd18bab86
11 changed files with 599 additions and 163 deletions

View File

@ -12,6 +12,7 @@
"@mui/material": "^5.15.15", "@mui/material": "^5.15.15",
"@mui/styled-engine": "^5.15.14", "@mui/styled-engine": "^5.15.14",
"axios": "^1.6.8", "axios": "^1.6.8",
"jspdf": "^2.5.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.23.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", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz",
"integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" "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": { "node_modules/@types/react": {
"version": "18.3.1", "version": "18.3.1",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.1.tgz", "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", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" "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": { "node_modules/available-typed-arrays": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@ -1943,6 +1961,15 @@
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true "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": { "node_modules/brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "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": "^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": { "node_modules/call-bind": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "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": { "node_modules/chalk": {
"version": "2.4.2", "version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@ -2089,6 +2152,17 @@
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
"dev": true "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": { "node_modules/cosmiconfig": {
"version": "7.1.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz",
@ -2118,6 +2192,15 @@
"node": ">= 8" "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": { "node_modules/csstype": {
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
@ -2260,6 +2343,12 @@
"csstype": "^3.0.2" "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": { "node_modules/electron-to-chromium": {
"version": "1.4.750", "version": "1.4.750",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.750.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.750.tgz",
@ -2818,6 +2907,11 @@
"reusify": "^1.0.4" "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": { "node_modules/file-entry-cache": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@ -3174,6 +3268,19 @@
"react-is": "^16.7.0" "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": { "node_modules/ignore": {
"version": "5.3.1", "version": "5.3.1",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
@ -3667,6 +3774,23 @@
"node": ">=6" "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": { "node_modules/jsx-ast-utils": {
"version": "3.3.5", "version": "3.3.5",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz",
@ -4051,6 +4175,12 @@
"node": ">=8" "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": { "node_modules/picocolors": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "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": { "node_modules/react": {
"version": "18.3.1", "version": "18.3.1",
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
@ -4307,6 +4446,15 @@
"node": ">=0.10.0" "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": { "node_modules/rimraf": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
@ -4520,6 +4668,15 @@
"node": ">=0.10.0" "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": { "node_modules/string.prototype.matchall": {
"version": "4.0.11", "version": "4.0.11",
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz", "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" "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": { "node_modules/text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -4811,6 +4986,15 @@
"punycode": "^2.1.0" "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": { "node_modules/vite": {
"version": "5.2.10", "version": "5.2.10",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.2.10.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.10.tgz",

View File

@ -14,6 +14,7 @@
"@mui/material": "^5.15.15", "@mui/material": "^5.15.15",
"@mui/styled-engine": "^5.15.14", "@mui/styled-engine": "^5.15.14",
"axios": "^1.6.8", "axios": "^1.6.8",
"jspdf": "^2.5.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.23.0" "react-router-dom": "^6.23.0"

View File

@ -1,26 +1,54 @@
.descarga-recetas { #headerFacultad{
padding: 2rem; margin-left: 50px;
text-align: center; text-align: left;
font-family: Arial, Helvetica, sans-serif;
} }
#box1{
.titulo { padding-top: 15px;
margin-bottom: 2rem; margin-right: 20px;
} }
#box2{
.contenedor-recetas { padding-top: 15px;
}
#headerPublicaciones{
margin-left: 50px;
}
#divPublicaciones{
display: flex; display: flex;
flex-direction: column; padding: auto;
align-items: center;
} }
#divsPublicaciones2{
.receta-item { 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; display: flex;
justify-content: space-between;
align-items: center; }
width: 100%; #divLista2{
max-width: 600px; width: 600px;
margin-bottom: 1rem; display: grid;
padding: 1rem; margin: 0 auto;
background-color: #f5f5f5; }
border-radius: 4px; #divBotonesRecetas{
display: flex;
margin-left: auto;
margin-right: 100px;
}
#leyendaPublicacion{
margin-right: auto;
margin-left: 50px;
} }

View File

@ -1,62 +1,117 @@
import { useState, useEffect } from 'react'; /* eslint-disable no-unused-vars */
import axios from 'axios'; import { Button, Box, TextField ,DialogContentText, Divider} from "@mui/material"
import { Button, Box, Typography, List, ListItem, ListItemText } from '@mui/material'; import axios from "axios"
import './DescargaRecetas.css'; 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(() => { // eslint-disable-next-line no-unused-vars
const fetchRecetas = async () => { 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");
const cambiosID = (evento) => {
const {name, value} = evento.target
setDatosID( { ...datosID, [name] : value })
}
const regresarPrincipal = () => {
navigate('/Principal');
}
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); setCargando(true);
try { try {
const respuesta = await axios.get('/api/recetas'); const respuesta=await peticionEliminar();
setRecetas(respuesta.data); console.log("Respuesta de publicacion a eliminar", respuesta.data);
} catch (error) { alert("Publicacion eliminada",respuesta.data);
console.error('Error al obtener las recetas:', error);
}
setCargando(false); setCargando(false);
}; } catch (error) {
console.log(error);
setCargando(false);
}
}
fetchRecetas().then(() =>{}); const generarPdf= (idReceta,nombreMedico,contactoMedico,fecha) =>{
}, []); var doc = new jsPDF();
const docWidth = doc.internal.pageSize.getWidth();
const descargarReceta = (recetaId) => { doc.text(10, 10,'Receta No.'+ idReceta);
doc.line(0, 12, docWidth, 12);
console.log('Descargando receta:', recetaId); doc.text(10, 20,'Medico: '+nombreMedico)
}; doc.text(10, 30,'Contacto: '+contactoMedico)
doc.text(10, 40,'Fecha: '+fecha)
doc.save('Receta '+ fecha + ' .pdf');
}
return ( return (
<div className="descarga-recetas"> <>
<Typography variant="h4" component="h1" className="titulo"> <h1 id="headerFacultad">Health Manager - Mis recetas</h1>
Descargar Recetas Médicas <Divider />
</Typography> <nav id="divPublicaciones">
<Box className="contenedor-recetas"> <h1 id="headerPublicaciones">Mis publicaciones</h1>
{cargando ? ( <div id="divBotonesRecetas">
<Typography variant="body1">Cargando recetas...</Typography> <Box id="box1" m={0}>
) : ( <Button id="regresarMenu" variant="contained" type="submit" color="warning" onClick={regresarPrincipal}>Regresar al Menu</Button>
<List> </Box>
{recetas.map((receta) => ( <Box id="box2" m={0}>
<ListItem key={receta.id} className="receta-item"> <Button id="cerrarSesion" variant="contained" type="submit" color="warning" onClick={cerrarSesion}>Cerrar sesion</Button>
<ListItemText
primary={receta.nombre}
secondary={`fetch: ${receta.fecha}`}
/>
<Button
variant="contained"
color="primary"
onClick={() => descargarReceta(receta.id)}
>
Descargar
</Button>
</ListItem>
))}
</List>
)}
</Box> </Box>
</div> </div>
); </nav>
<Divider />
<div id="divLeyenda">
<p id="leyendaPublicacion">Visualiza tus recetas.</p>
<Divider />
</div>
<div id="listaEliminar">
<div id="divLista2">
{publicacionesData.map((elemento) => (
<div id="divsPublicaciones2" key={elemento.idRec}>
<div className='informacionPublicacion'>
<p id="parrafoNum">Receta No. ({elemento.idRec})</p>
<Divider id="division" color="primary"/>
<p id="parrafoMed">{elemento.nombreMed}</p>
<p id="parrafoCon">{elemento.contactoMed}</p>
<p id="parrafoFecha"className='parrafoFecha'>{elemento.fecha}</p>
<Button id="btnDescargar" variant="contained" type="submit" color="warning" onClick={()=>generarPdf(elemento.idRec,elemento.nombreMed,elemento.contactoMed,elemento.fecha)}>Descargar</Button>
<Divider id="division" color="primary"/>
</div>
</div>
))}
</div>
</div>
</>
)
} }
export default DescargaRecetas; export default DescargaRecetas

View File

@ -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-image: url("https://www.meditips.com/wp-content/uploads/2017/07/AdobeStock_103968342-scaled-uai-1032x688.jpeg");
background-repeat: no-repeat; background-repeat: no-repeat;
background-attachment: fixed; background-attachment: fixed;
background-size: cover; background-size: cover;
height:708px;
} }
h1 { .h1login {
padding-top: 10px;
text-align: center; text-align: center;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
} }
@ -25,6 +27,7 @@ h1 {
padding-bottom: 15px; padding-bottom: 15px;
} }
#p2{ #p2{
margin-top: 20px;
text-align: center; text-align: center;
} }
form { form {

View File

@ -4,17 +4,17 @@ import { useState } from "react"
import './Login.css' import './Login.css'
import { Link, useNavigate } from 'react-router-dom' import { Link, useNavigate } from 'react-router-dom'
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
function Login(props) { function Login(props) {
const navigate = useNavigate(); const navigate = useNavigate();
const [Cargando, setCargando] = useState (false) const [Cargando, setCargando] = useState (false)
const [datosLogin, setDatosLogin] = useState( {correo:'', contraseña:''} ) const [datosLogin, setDatosLogin] = useState( {correo:'', contraseña:''} )
// eslint-disable-next-line no-unused-vars
const hacerPeticion = async () => { const hacerPeticion = async () => {
// eslint-disable-next-line no-useless-catch // eslint-disable-next-line no-useless-catch
try { 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) console.log("hacerPeticion", response)
return response; return response;
} catch (error) { } catch (error) {
@ -33,14 +33,14 @@ function Login(props) {
console.log("datos recuperados en el form: ", datosLogin) console.log("datos recuperados en el form: ", datosLogin)
setCargando(true) setCargando(true)
try { try {
//const response = await hacerPeticion() const response = await hacerPeticion()
setCargando(false) setCargando(false)
//if (response.data === 'Usuario Correcto') { if (response.data === 'Usuario Correcto') {
navigate('/Principal'); navigate('/Principal');
window.localStorage.setItem('Usuario',datosLogin.correo); window.localStorage.setItem('Usuario',datosLogin.correo);
//} else { } else {
//alert("Credenciales incorrectas, revisa tu correo o contraseña"); alert("Credenciales incorrectas, revisa tu correo o contraseña");
//} }
} catch (error) { } catch (error) {
console.log("error", error) console.log("error", error)
setCargando(false) setCargando(false)
@ -49,10 +49,11 @@ function Login(props) {
return ( return (
<> <>
<h1>Health Manager</h1> <div id="divPrincipalLog">
<h1 className="h1login">Health Manager</h1>
<p id="p1">Seguimiento medico de pacientes</p> <p id="p1">Seguimiento medico de pacientes</p>
<form id="formLogin" onSubmit={ procesarLogin }> <form id="formLogin" onSubmit={ procesarLogin }>
<h1 id="headerForm">Inicia sesion para continuar</h1> <h1 className="h1login" id="headerForm">Inicia sesion para continuar</h1>
<Box m={5}> <Box m={5}>
<TextField label="Correo" variant="standard" fullWidth onChange={cambiosLogin} name="correo" value={datosLogin.correo}></TextField> <TextField label="Correo" variant="standard" fullWidth onChange={cambiosLogin} name="correo" value={datosLogin.correo}></TextField>
</Box> </Box>
@ -63,6 +64,7 @@ function Login(props) {
<p id="p2">¿Aun no tienes una cuenta? {<Link to="/Registro" className="link_SingUp">Registrarme</Link>}</p> <p id="p2">¿Aun no tienes una cuenta? {<Link to="/Registro" className="link_SingUp">Registrarme</Link>}</p>
</form> </form>
</div>
</> </>
) )
} }

View File

@ -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;
}

View File

@ -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 (
<>
<h1 id="headerFacultad">HealthManager - Mi Perfil</h1>
<Divider />
<nav id="divMiPerfil">
<h1 id="headerMiPerfil">Mi Perfil</h1>
<div id="divBotonesPerfil">
<Box m={1}>
<Button id="regresarMenu" variant="contained" type="submit" color="warning" onClick={regresarPrincipal}>Regresar al Menu</Button>
</Box>
<Box m={1}>
<Button id="cerrarSesion" variant="contained" type="submit" color="warning" onClick={cerrarSesion}>Cerrar sesion</Button>
</Box>
</div>
</nav>
<Divider />
<div id="divLeyenda">
<p id="leyendaPublicacion">Visualiza tu datos como Usuario, Correo y Contraseña.</p>
</div>
<div id="divLista">
<leyend id="leyendas">Nombre</leyend>
<DialogContentText id="dialogUsuario" variant="contained" className='contenidoText'>{window.localStorage.getItem("ID")}</DialogContentText>
<Divider color="primary"/>
<leyend id="leyendas">Edad</leyend>
<DialogContentText id="dialogEdad" variant="contained" className='contenidoText'>{window.localStorage.getItem("Edad")} años</DialogContentText>
<Divider color="primary"/>
<leyend id="leyendas">Peso</leyend>
<DialogContentText id="dialogPeso" variant="contained" className='contenidoText'>{window.localStorage.getItem("Peso")} kg</DialogContentText>
<Divider color="primary"/>
<leyend id="leyendas">Correo</leyend>
<DialogContentText id="dialogCorreo" variant="contained" className='contenidoText'>{window.localStorage.getItem("Usuario")}</DialogContentText>
<Divider color="primary"/>
<leyend id="leyendas">Contraseña</leyend>
<DialogContentText id="dialogContraseña" variant="contained" className='contenidoText'>{window.localStorage.getItem("Contraseña")}</DialogContentText>
<Divider color="primary"/>
</div>
</>
)
}
export default MiPerfil

View File

@ -1,12 +1,12 @@
h1 { #headerSistema {
text-align: center; margin-top: 10px;
margin-left: 50px;
text-align: left;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
} }
body{
background-color: aliceblue;
background-image: none;
}
#bienvenidoUsuario { #bienvenidoUsuario {
margin-top: 10px;
margin-bottom: 10px;
margin-left: 50px; margin-left: 50px;
text-align: left; text-align: left;
font-size: medium; font-size: medium;
@ -41,15 +41,14 @@ body{
#headerForm { #headerForm {
font-size: small; font-size: small;
} }
#divMenu { #divBotones {
font-family:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif;
margin-left: auto; margin-top: 80px;
margin-right: 150px; margin-left: 35px;
padding: 10px; }
#img1{
margin-right: 10px;
}
#img2{
margin-right: 10px;
} }
#cerrarSesion{
align-items: center;
}
#divBotones{
padding-top: 30px;
}

View File

@ -23,9 +23,10 @@ function Principal(props) {
const datosUsuario = async () => { const datosUsuario = async () => {
try { try {
const respuesta = await axios.get( const respuesta = await axios.get(
"https://back-endproyectofinal8-production-a397.up.railway.app/datosUsuario", "http://localhost:4567/datosUsuario",
{ params: { correo: correoUsuario } } { params: { correo: correoUsuario }}
); );
console.log("Entrando")
return respuesta.data; return respuesta.data;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -35,10 +36,17 @@ function Principal(props) {
const UsuarioData = async () => { const UsuarioData = async () => {
try { try {
const respuesta = await datosUsuario(); const respuesta = await datosUsuario();
const nombreUsuarioSesion = respuesta.idUsuario; const nombreUsuarioSesion = respuesta.nombre;
const contraseñaUsuarioSesion = respuesta.contraseña; const edadUsuarioSesion = respuesta.edad;
const pesoUsuarioSesion = respuesta.peso;
const idUsuarioSesion = respuesta.idUsuario;
window.localStorage.setItem("ID", nombreUsuarioSesion); 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) { } catch (error) {
console.log("holaa"); console.log("holaa");
console.log(error); console.log(error);
@ -50,60 +58,44 @@ function Principal(props) {
navigate("/"); navigate("/");
}; };
const misRecetas = () => {
navigate("/DescargaRecetas");
};
const miPerfil = () => { const miPerfil = () => {
navigate("/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 usuarioSesion = window.localStorage.getItem("ID");
const images = [ const image1 =
{ {
url: "https://www.meditips.com/wp-content/uploads/2019/03/recetas-medicas-1200x600-1.jpg", url: "https://www.meditips.com/wp-content/uploads/2019/03/recetas-medicas-1200x600-1.jpg",
title: "Mis recetas", 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", 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", title: "Cerrar Sesion",
width: "33%", width: "32%",
}, };
];
const ImageButton = styled(ButtonBase)(({ theme }) => ({ const ImageButton = styled(ButtonBase)(({ theme }) => ({
position: "relative", position: "relative",
height: 510, height: 400,
[theme.breakpoints.down("sm")]: { [theme.breakpoints.down("sm")]: {
width: "100% !important", // Overrides inline-style width: "100% !important", // Overrides inline-style
height: 100, height: 80,
}, },
"&:hover, &.Mui-focusVisible": { "&:hover, &.Mui-focusVisible": {
zIndex: 1, zIndex: 1,
@ -162,29 +154,86 @@ function Principal(props) {
transition: theme.transitions.create("opacity"), transition: theme.transitions.create("opacity"),
})); }));
//<Button id="botonMiPerfil" variant="contained" type="button" color="primary" disabled={Cargando} onClick={miPerfil}>Mi perfil</Button>
//<Button id="botonMisPublicaciones" variant="contained" type="submit" color="primary" disabled={Cargando} onClick={publicaciones}>Mis recetas</Button>
//<h1 id="headerPublicaciones">Menu Principal</h1>
return ( return (
<> <>
<div id="divPrincipal"> <div id="divPrincipal">
<h1 id="headerFacultad">Health Manager - Menu Principal</h1> <h1 id="headerSistema">Health Manager - Menu Principal</h1>
<Divider /> <Divider />
<div id="divPublicaciones"> <div id="divPublicaciones">
<h1 id="bienvenidoUsuario">¡Hola {usuarioSesion}! </h1> <h1 id="bienvenidoUsuario">¡Hola {usuarioSesion}! </h1>
<Box id="boxCerrar" m={0}>
<Button id="cerrarSesion"
variant="contained"
type="submit"
color="warning"
onClick={cerrarSesion}>
Cerrar sesion
</Button>
</Box>
</div> </div>
<Divider /> <Divider />
<div id="divBotones"> <div id="divBotones">
<Box <ImageButton id="img1" focusRipple key={image1.title} style={{width:image1.width,}} onClick={misRecetas}>
<ImageSrc style={{ backgroundImage: `url(${image1.url})` }} />
<ImageBackdrop className="MuiImageBackdrop-root" />
<Image>
<Typography
component="span"
variant="subtitle1"
color="inherit"
sx={{
position: "relative",
p: 4,
pt: 2,
pb: (theme) => `calc(${theme.spacing(1)} + 6px)`,
}}
>
{image1.title}
<ImageMarked className="MuiImageMarked-root" />
</Typography>
</Image>
</ImageButton>
<ImageButton id="img2" focusRipple key={image2.title} style={{width:image2.width,}} onClick={miPerfil}>
<ImageSrc style={{ backgroundImage: `url(${image2.url})` }} />
<ImageBackdrop className="MuiImageBackdrop-root" />
<Image>
<Typography
component="span"
variant="subtitle1"
color="inherit"
sx={{
position: "relative",
p: 4,
pt: 2,
pb: (theme) => `calc(${theme.spacing(1)} + 6px)`,
}}
>
{image2.title}
<ImageMarked className="MuiImageMarked-root" />
</Typography>
</Image>
</ImageButton>
<ImageButton id="img3" focusRipple key={image3.title} style={{width:image3.width,}} onClick={cerrarSesion}>
<ImageSrc style={{ backgroundImage: `url(${image3.url})` }} />
<ImageBackdrop className="MuiImageBackdrop-root" />
<Image>
<Typography
component="span"
variant="subtitle1"
color="inherit"
sx={{
position: "relative",
p: 4,
pt: 2,
pb: (theme) => `calc(${theme.spacing(1)} + 6px)`,
}}
>
{image3.title}
<ImageMarked className="MuiImageMarked-root" />
</Typography>
</Image>
</ImageButton>
</div>
</div>
</>
);
}
export default Principal;
/*
<Box
sx={{ sx={{
display: "flex", display: "flex",
flexWrap: "wrap", flexWrap: "wrap",
@ -221,10 +270,5 @@ function Principal(props) {
</ImageButton> </ImageButton>
))} ))}
</Box> </Box>
</div>
</div>
</>
);
}
export default Principal; */

View File

@ -4,6 +4,7 @@ import Login from './Login.jsx'
import { RouterProvider, createHashRouter } from 'react-router-dom' import { RouterProvider, createHashRouter } from 'react-router-dom'
import Principal from './Principal.jsx' import Principal from './Principal.jsx'
import DescargaRecetas from './DescargaRecetas.jsx' import DescargaRecetas from './DescargaRecetas.jsx'
import MiPerfil from './MiPerfil.jsx'
//import registrarPaciente from './registrarPaciente.html' //import registrarPaciente from './registrarPaciente.html'
//import Publicaciones from './Publicaciones' //import Publicaciones from './Publicaciones'
@ -21,13 +22,13 @@ import DescargaRecetas from './DescargaRecetas.jsx'
element: <Principal/> element: <Principal/>
}/*, }/*,
{ {
path: "/registrarPaciente", path: "/MiPerfil",
element:<registrarPaciente/> element:<MiPerfil/>
}, }*/,
{ {
path: "/MiPerfil", path: "/MiPerfil",
element:<MiPerfil/> element:<MiPerfil/>
}*/ }
]) ])
ReactDOM.createRoot(document.getElementById('root')).render( ReactDOM.createRoot(document.getElementById('root')).render(