From 48144f8cdaf797492c98a739f4b7dae6a7e598e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Tue, 30 Apr 2024 10:26:28 -0600 Subject: [PATCH 01/93] Se instalaron los paquetes de hook resolvers y yup --- web/package-lock.json | 49 ++++++++++++++++++++++++++++++++++++++++++- web/package.json | 4 +++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index dd8e9e47..5b6f1df1 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@fortawesome/free-solid-svg-icons": "^6.5.1", "@fortawesome/react-fontawesome": "^0.2.0", + "@hookform/resolvers": "^3.3.4", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -27,7 +28,8 @@ "react-scripts": "5.0.1", "react-toastify": "^10.0.5", "typescript": "^4.9.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "yup": "^1.4.0" }, "devDependencies": { "tailwindcss": "^3.4.1" @@ -2595,6 +2597,14 @@ "react": ">=16.3" } }, + "node_modules/@hookform/resolvers": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.3.4.tgz", + "integrity": "sha512-o5cgpGOuJYrd+iMKvkttOclgwRW86EsWJZZRC23prf0uU2i48Htq4PuT73AVb9ionFyZrwYEITuOFGF+BydEtQ==", + "peerDependencies": { + "react-hook-form": "^7.0.0" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", @@ -14806,6 +14816,11 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/property-expr": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.6.tgz", + "integrity": "sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==" + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -17033,6 +17048,11 @@ "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" }, + "node_modules/tiny-case": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-case/-/tiny-case-1.0.3.tgz", + "integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==" + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -17065,6 +17085,11 @@ "node": ">=0.6" } }, + "node_modules/toposort": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", + "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==" + }, "node_modules/tough-cookie": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", @@ -18517,6 +18542,28 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/yup": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/yup/-/yup-1.4.0.tgz", + "integrity": "sha512-wPbgkJRCqIf+OHyiTBQoJiP5PFuAXaWiJK6AmYkzQAh5/c2K9hzSApBZG5wV9KoKSePF7sAxmNSvh/13YHkFDg==", + "dependencies": { + "property-expr": "^2.0.5", + "tiny-case": "^1.0.3", + "toposort": "^2.0.2", + "type-fest": "^2.19.0" + } + }, + "node_modules/yup/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/web/package.json b/web/package.json index 3ac96a94..e0ae714e 100644 --- a/web/package.json +++ b/web/package.json @@ -5,6 +5,7 @@ "dependencies": { "@fortawesome/free-solid-svg-icons": "^6.5.1", "@fortawesome/react-fontawesome": "^0.2.0", + "@hookform/resolvers": "^3.3.4", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -22,7 +23,8 @@ "react-scripts": "5.0.1", "react-toastify": "^10.0.5", "typescript": "^4.9.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "yup": "^1.4.0" }, "scripts": { "start": "react-scripts start", -- GitLab From 79efcdd6150dca7dbdd4c24ea94095c18069439d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Tue, 30 Apr 2024 11:07:35 -0600 Subject: [PATCH 02/93] Se valida que haya un archivo --- web/src/components/image_dropzone/image_dropzone.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/components/image_dropzone/image_dropzone.tsx b/web/src/components/image_dropzone/image_dropzone.tsx index add3c59c..0efa3855 100644 --- a/web/src/components/image_dropzone/image_dropzone.tsx +++ b/web/src/components/image_dropzone/image_dropzone.tsx @@ -37,7 +37,7 @@ export const ImageDropzone = ({setValue}: props) => { }))); acceptedFiles.map((file)=>{ - {setValue('imageURL',file)} + {setValue('imageURL',file,{shouldValidate: true})} }); file.onload = () => { -- GitLab From 049c1eea8ac6ae30e6351afee11ca07ba6fb088b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Tue, 30 Apr 2024 11:08:40 -0600 Subject: [PATCH 03/93] =?UTF-8?q?Se=20agrega=20los=20campos=20para=20las?= =?UTF-8?q?=20descripciones=20en=20espa=C3=B1ol=20e=20ingl=C3=A9s,=20adem?= =?UTF-8?q?=C3=A1s=20se=20muestran=20mensajes=20de=20error=20si=20hay=20ca?= =?UTF-8?q?mpos=20faltantes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sa_panel_town_register.tsx | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/web/src/components/sa_panel_town/sa_panel_town_register/sa_panel_town_register.tsx b/web/src/components/sa_panel_town/sa_panel_town_register/sa_panel_town_register.tsx index 9f796dd5..0d6887d8 100644 --- a/web/src/components/sa_panel_town/sa_panel_town_register/sa_panel_town_register.tsx +++ b/web/src/components/sa_panel_town/sa_panel_town_register/sa_panel_town_register.tsx @@ -4,6 +4,7 @@ import './css/styles.css' import { ImageDropzone } from "../../image_dropzone/image_dropzone"; import { Dispatch, SetStateAction, useState } from "react"; import { useTownRegister } from "../../../hooks/useTownRegister"; +import { ToastContainer } from "react-toastify"; interface props { setWindowActive: Dispatch>, @@ -14,10 +15,10 @@ export const SuperadminPanelTownRegister = ({setWindowActive, setShowRegisterPan const { statesList, register, - setValue, + setValue, + errors, handleSubmit, - errors, - onSubmit + onSubmit, } = useTownRegister(); const [isEnglish, setIsEnglish] = useState(false); const [spanishDescription, setSpanishDescription] = useState(""); @@ -33,36 +34,21 @@ export const SuperadminPanelTownRegister = ({setWindowActive, setShowRegisterPan
-
- - - setIsEnglish(!isEnglish) - } - /> -
+ /> +

{errors.name?.message}

- {statesList == null ? + {statesList == null || statesList.length==0 ? : } +

{errors.state?.message}

-
Descripción del pueblo mágico
+
+
Descripción del pueblo mágico
+
+ + + setIsEnglish(!isEnglish) + } + /> +
+
{ isEnglish ? @@ -85,7 +89,7 @@ export const SuperadminPanelTownRegister = ({setWindowActive, setShowRegisterPan setEnglishDescription(event.target.value); }, })} - required/> + /> :