diff --git a/cosiap_api/cosiap_api/.env b/cosiap_api/cosiap_api/.env index 1b8c473086c249755da5edce9d772d86374b1358..1b59abace1cfbdfced37e164e8a9617b5a7b145f 100644 --- a/cosiap_api/cosiap_api/.env +++ b/cosiap_api/cosiap_api/.env @@ -14,8 +14,8 @@ DATABASES_DEFAULT_PORT="3306" EMAIL_HOST="sandbox.smtp.mailtrap.io" EMAIL_FROM="cosiap@example.com" -EMAIL_HOST_USER="3b48193365f615" -EMAIL_HOST_PASSWORD="37f89fc1d98f48" +EMAIL_HOST_USER="52e12fdcb768cc" +EMAIL_HOST_PASSWORD="03520623807dea" EMAIL_PORT="2525" EMAIL_USE_TLS=True diff --git a/cosiap_frontend/src/App.jsx b/cosiap_frontend/src/App.jsx index aa35a90602e7c0af35c1a8245cf287b9c84f80aa..a5d5132de5110ed6d534924151482c934f466732 100644 --- a/cosiap_frontend/src/App.jsx +++ b/cosiap_frontend/src/App.jsx @@ -27,6 +27,7 @@ import Modalidades from "@/components/modalidades/Modalidades"; import CreateModalidad from "./components/modalidades/CrearModalidad"; import EditModalidad from "./components/modalidades/EditarModalidad"; import SolicitarModalidad from "./components/modalidades/Modalidad"; +import Perfil from '@/components/users/Perfil/Perfil'; function App() { const [viewPageLoader, setViewPageLoader] = useState(false); @@ -100,7 +101,7 @@ function RoutesApp({ setViewPageLoader }) { } /> } /> } /> - } /> + } /> {/* Solo administradores pueden acceder a estas url */} ax.get(`api/usuarios/solicitantes/${id}`), update: (id, data) => ax.put(`api/usuarios/solicitantes/${id}`, data), }, + + municipios: { + get: () => ax.get('api/usuarios/municipios'), + }, + estados: { + get: () => ax.get('api/usuarios/estados'), + } }, administracion: { //Aun por declarar diff --git a/cosiap_frontend/src/components/FormsValidations.jsx b/cosiap_frontend/src/components/FormsValidations.jsx index 626e4d9634345254ecdd1b6e1215641da98a0787..a9ec178075353e00f9e5db491b8d78c50580dcae 100644 --- a/cosiap_frontend/src/components/FormsValidations.jsx +++ b/cosiap_frontend/src/components/FormsValidations.jsx @@ -3,12 +3,19 @@ import * as Yup from "yup"; // Variable de formato para validación de formato de CURP const CURP_REGEX = /^[A-Z]{1}[AEIOU]{1}[A-Z]{2}[0-9]{2}(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[HM]{1}(AS|BC|BS|CC|CH|CL|CM|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS|NE)[B-DF-HJ-NP-TV-Z]{3}[0-9A-Z]{1}[0-9]{1}$/; +//Variable de formato para validación de campo de RFC +const RFC_REGEX = /^([A-ZÑ&]{3,4})?(?:-)?([0-9]{2})(?:-)?(0[1-9]|1[0-2])(?:-)?([0-2][0-9]|3[0-1])(?:-)?([A-Z\d]{2})([A\d])$/; // Validación de un campo CURP const CURP_VALIDATION = Yup.string() .required("La CURP es requerida") .matches(CURP_REGEX, "Formato de CURP inválido"); +// Validacion de un campo RFC +const RFC_VALIDATION = Yup.string() + .required("El RFC es requerido") + .matches(RFC_REGEX, "Formato de RFC inválido"); + const PASSWORD_CREATION_VALIDATION = Yup.string() .required("La contraseña es requerida") .min(8, "La contraseña debe tener al menos 8 caracteres") @@ -70,3 +77,43 @@ export const FormValidationSchema = Yup.object({ archivo: PDF_FileValidation, monto: MontoValidation, }); + +export const PersonalInformationValidationSchema = Yup.object().shape({ + nombre: Yup.string() + .required('El nombre es requerido'), + ap_paterno: Yup.string() + .required('El apellido paterno es requerido'), + ap_materno: Yup.string(), + sexo: Yup.string() + .required('El sexo es requerido'), + telefono: Yup.string() + .required('El telefono es requerido') + .matches(/^[0-9]{10}$/, 'El número debe tener 10 dígitos'), + email: Yup.string() + .required("El correo electronico es requerido") + .email("El correo electronico no es válido") +}); + +export const DirectionInformationValidationSchema = Yup.object().shape({ + direccion : Yup.string().required('La dirección es requerida'), + estado : Yup.string().required('El estado es requerido'), + municipio : Yup.string().required('El municipio es requerido'), + codigo_postal : Yup.string() + .required('El código postal es requerido') + .matches(/^[0-9]{5}$/, 'El código postal debe tener 5 dígitos'), + poblacion : Yup.string().required("La población es requerida") +}); + + +export const IdentificationValidationSchema = Yup.object().shape({ + RFC: RFC_VALIDATION, + curp: CURP_VALIDATION, + INE: Yup.mixed() + .test("required", "El archivo INE es requerido", (value) => value && value.length > 0) // Validar si el archivo está vacío + .test("fileFormat", "Formato de archivo no soportado", (value) => { + return value && value[0] && ["application/pdf"].includes(value[0].type); // Asegúrate de validar solo si hay un archivo + }) + .test("fileSize", "El archivo supera el tamaño máximo", (value) => { + return value && value[0] && value[0].size <= FILE_SIZE; + }) +}); \ No newline at end of file diff --git a/cosiap_frontend/src/components/common/base/FormInput.jsx b/cosiap_frontend/src/components/common/base/FormInput.jsx index d0ad401e30b12d7792ac55035d5c53ccb8db0691..51feab62b5a9aa5c15d96567b477549cde94335e 100644 --- a/cosiap_frontend/src/components/common/base/FormInput.jsx +++ b/cosiap_frontend/src/components/common/base/FormInput.jsx @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import {ErrorDisplay} from '@/components/common/ui/ErrorDisplay' -export function FormInput({ id, name, type, placeholder, className, register, errors, onChange }) { +export function FormInput({ id, name, type, placeholder, className, register, errors, onChange, isDisabled }) { return ( <> @@ -25,6 +27,7 @@ FormInput.propTypes = { placeholder: PropTypes.string, className: PropTypes.string, onChange: PropTypes.func, + isDisabled: PropTypes.bool, register: PropTypes.func.isRequired, errors: PropTypes.oneOfType([ PropTypes.object, diff --git a/cosiap_frontend/src/components/common/base/FormSelect.jsx b/cosiap_frontend/src/components/common/base/FormSelect.jsx new file mode 100644 index 0000000000000000000000000000000000000000..983b1c197a63b2fdaf723a52bdfdff02c5177232 --- /dev/null +++ b/cosiap_frontend/src/components/common/base/FormSelect.jsx @@ -0,0 +1,41 @@ +import PropTypes from 'prop-types'; +import { ErrorDisplay } from '@/components/common/ui/ErrorDisplay'; + +export function FormSelect({ id, name, options, className, register, errors, onChange, isDisabled, value}) { + return ( + <> + + + + ); +} + +FormSelect.propTypes = { + id: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + options: PropTypes.arrayOf( + PropTypes.shape({ + value: PropTypes.string.isRequired, + label: PropTypes.string.isRequired, + }) + ).isRequired, + className: PropTypes.string, + onChange: PropTypes.func, + isDisabled: PropTypes.bool, + register: PropTypes.func.isRequired, + errors: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]), +}; \ No newline at end of file diff --git a/cosiap_frontend/src/components/common/layouts/LayoutBaseNavigation.jsx b/cosiap_frontend/src/components/common/layouts/LayoutBaseNavigation.jsx index d0e3cab6fc30781220291706a7ac958294e2391e..d24a7f67581868cacef44eb7ad3807a4b4a7a6c7 100644 --- a/cosiap_frontend/src/components/common/layouts/LayoutBaseNavigation.jsx +++ b/cosiap_frontend/src/components/common/layouts/LayoutBaseNavigation.jsx @@ -144,7 +144,7 @@ export default function LayoutBaseNavigation() {
setViewSettings(!viewSettings)} > @@ -153,7 +153,7 @@ export default function LayoutBaseNavigation() { )} -
+
diff --git a/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/MobileMenu.jsx b/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/MobileMenu.jsx index 78089a0bbd16d2417f46a0e6a51f9975977a1486..3fe95cf6af652dcb92202e36d5ec984741c24ec2 100644 --- a/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/MobileMenu.jsx +++ b/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/MobileMenu.jsx @@ -12,7 +12,7 @@ export default function MobileMenu({ menuRef, linksItems }) { return ( <> {/* Contenedor principal del menú móvil */} -
+
{ // Si existe linksItems, mapea cada uno para generar enlaces diff --git a/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/Navbar.jsx b/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/Navbar.jsx index 7350992335176f534631fbbd5367f03ffc1b9d6a..b1cbe2d0f88c95bcbb13ec5ca0eede0e6315ea53 100644 --- a/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/Navbar.jsx +++ b/cosiap_frontend/src/components/common/layouts/LayoutsNavigation/Navbar/Navbar.jsx @@ -50,10 +50,10 @@ export default function Navbar({ linksItems, viewMenu, setViewMenu }) { <>