From 988b0e9d2c118508c3a17b048c5931cd1cef331b Mon Sep 17 00:00:00 2001 From: Yakuza Date: Wed, 24 Aug 2022 02:06:36 -0500 Subject: [PATCH 1/5] feat(front): update profile functionality --- package-lock.json | 20 ++ package.json | 1 + .../AcademicAccordion.jsx | 2 +- .../DescriptionAccordion.jsx | 1 + .../LaboralData.jsx | 197 ++++++++---------- .../PersonalData.jsx | 194 ++++++++++------- .../applicants_profile/ApplicantInfo.jsx | 2 +- .../register_components/LeftContent.jsx | 101 +++++---- 8 files changed, 290 insertions(+), 228 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4eb5458..f271e09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@testing-library/react": "^13.3.0", "@testing-library/user-event": "^13.5.0", "axios": "^0.27.2", + "lodash": "^4.17.21", "primeflex": "^3.2.1", "primeicons": "^5.0.0", "primereact": "^8.1.1", @@ -15596,6 +15597,19 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typescript": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -27766,6 +27780,12 @@ "is-typedarray": "^1.0.0" } }, + "typescript": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "peer": true + }, "unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index bd5fb92..4c146ad 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "@testing-library/react": "^13.3.0", "@testing-library/user-event": "^13.5.0", "axios": "^0.27.2", + "lodash": "^4.17.21", "primeflex": "^3.2.1", "primeicons": "^5.0.0", "primereact": "^8.1.1", diff --git a/src/components/profile_candidates_components/AcademicAccordion.jsx b/src/components/profile_candidates_components/AcademicAccordion.jsx index ede0fe8..85253ff 100644 --- a/src/components/profile_candidates_components/AcademicAccordion.jsx +++ b/src/components/profile_candidates_components/AcademicAccordion.jsx @@ -13,7 +13,7 @@ export const AcademicAccordion = () => { id='in' value={academic} onChange={(e)=>setAcademic(e.target.value)} - placeholder='DB Administrator' + defaultValue="" className='w-full h-max' /> diff --git a/src/components/profile_candidates_components/DescriptionAccordion.jsx b/src/components/profile_candidates_components/DescriptionAccordion.jsx index be24cbb..378aedd 100644 --- a/src/components/profile_candidates_components/DescriptionAccordion.jsx +++ b/src/components/profile_candidates_components/DescriptionAccordion.jsx @@ -11,6 +11,7 @@ export const DescriptionAccordion = () => { setDescription(e.target.value)} placeholder='Ingresa pequeña descripción sobre ti' className='w-full h-max' diff --git a/src/components/profile_candidates_components/LaboralData.jsx b/src/components/profile_candidates_components/LaboralData.jsx index 426f167..881dc7c 100644 --- a/src/components/profile_candidates_components/LaboralData.jsx +++ b/src/components/profile_candidates_components/LaboralData.jsx @@ -22,6 +22,7 @@ import { useStoreResumeOthers } from '../../storage/profile_zustand/ZustandOther import { Toast } from 'primereact/toast'; import DateService from '../../services/DateService'; import { useState } from 'react'; +import _ from 'lodash'; export const LaboralData = () => { // Controlled Hooks @@ -29,39 +30,13 @@ export const LaboralData = () => { // Zustand States const { userSession, token } = useStoreSession(); const { profile, setProfile, setIdResume, idResume } = useStoreResume(); - const { - formInputCertifications, - setFormInputCertifications, - toDeleteCertifications, - resetToDeleteCertifications, - } = useStoreCertifications(); - const { - formInputCourses, - setFormInputCourses, - toDeleteCourses, - resetToDeleteCourses, - } = useStoreCourses(); - const { - formInputExperience, - setFormInputExperience, - toDeleteExperience, - resetToDeleteExperience, - } = useStoreExperience(); + const { formInputCertifications, setFormInputCertifications, toDeleteCertifications, resetToDeleteCertifications, } = useStoreCertifications(); + const { formInputCourses, setFormInputCourses, toDeleteCourses, resetToDeleteCourses, } = useStoreCourses(); + const { formInputExperience, setFormInputExperience, toDeleteExperience, resetToDeleteExperience, } = useStoreExperience(); const { habilities, setHabilities } = useStoreHabilities(); - const { - formInputLanguages, - setFormInputLanguages, - toDeleteLanguages, - resetToDeleteLanguages, - } = useStoreLanguages(); - const { - formInputStudies, - setFormInputStudies, - toDeleteStudies, - resetToDeleteStudies, - } = useStoreStudies(); - const { academic, description, setAcademic, setDescription } = - useStoreResumeOthers(); + const { formInputLanguages, setFormInputLanguages, toDeleteLanguages, resetToDeleteLanguages, } = useStoreLanguages(); + const { formInputStudies, setFormInputStudies, toDeleteStudies, resetToDeleteStudies, } = useStoreStudies(); + const { academic, description, setAcademic, setDescription } = useStoreResumeOthers(); // API services const profileService = new ProfileService(); // Toast @@ -96,32 +71,26 @@ export const LaboralData = () => { // Certifications let certifications = []; toDeleteCertifications.map((c, i) => { - if (c.company != '') { + if (!_.isEmpty(c.company)) { certifications.push({ active: false, id: c.id, company: c.company, - expirationDate: `${DateService.parseToDate( - c.expirationDate, - )}T00:00:00`, + expirationDate: _.isEmpty(c.expirationDate) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(c.expirationDate)}T00:00:00`, name: c.name, - obtainedDate: `${DateService.parseToDate(c.obtainedDate)}T00:00:00`, + obtainedDate: _.isEmpty(c.obtainedDate) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(c.obtainedDate)}T00:00:00`, }); } }); formInputCertifications.map((c, i) => { - if (c.expirationDate != 'T00:00:00') { - certifications.push({ - active: true, - id: c.id, - company: c.company, - expirationDate: `${DateService.parseToDate( - c.expirationDate, - )}T00:00:00`, - name: c.name, - obtainedDate: `${DateService.parseToDate(c.obtainedDate)}T00:00:00`, - }); - } + certifications.push({ + active: true, + id: c.id, + company: c.company, + expirationDate: _.isEmpty(c.expirationDate) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(c.expirationDate)}T00:00:00`, + name: c.name, + obtainedDate: _.isEmpty(c.obtainedDate) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(c.obtainedDate)}T00:00:00`, + }); }); objSend.certifications = certifications; // Courses @@ -130,12 +99,12 @@ export const LaboralData = () => { courses.push({ active: false, id: c.id, - finishedDate: `${DateService.parseToDate(c.finishedDate)}T00:00:00`, + finishedDate: _.isEmpty(c.finishedDate) ? `0000-00-00T00:00:00` : + `${DateService.parseToDate(c.finishedDate)}T00:00:00`, hours: c.hours, name: c.name, - realizationDate: `${DateService.parseToDate( - c.realizationDate, - )}T00:00:00`, + realizationDate: _.isEmpty(c.realizationDate) ? `0000-00-00T00:00:00` : + `${DateService.parseToDate(c.realizationDate,)}T00:00:00`, trainingInstitution: c.trainingInstitution, }); }); @@ -143,12 +112,12 @@ export const LaboralData = () => { courses.push({ active: c.active, id: c.id, - finishedDate: `${DateService.parseToDate(c.finishedDate)}T00:00:00`, + finishedDate: _.isEmpty(c.finishedDate) ? `0000-00-00T00:00:00` : + `${DateService.parseToDate(c.finishedDate)}T00:00:00`, hours: c.hours, name: c.name, - realizationDate: `${DateService.parseToDate( - c.realizationDate, - )}T00:00:00`, + realizationDate: _.isEmpty(c.realizationDate) ? `0000-00-00T00:00:00` : + `${DateService.parseToDate(c.realizationDate,)}T00:00:00`, trainingInstitution: c.trainingInstitution, }); }); @@ -160,9 +129,9 @@ export const LaboralData = () => { id: o.id, active: false, activities: o.activities, - endPeriod: `${DateService.parseToDate(o.endPeriod)}T00:00:00`, + endPeriod: _.isEmpty(o.endPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(o.endPeriod)}T00:00:00`, position: o.position, - startPeriod: `${DateService.parseToDate(o.startPeriod)}T00:00:00`, + startPeriod: _.isEmpty(o.startPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(o.startPeriod)}T00:00:00`, }); }); formInputExperience.map((e, i) => { @@ -170,9 +139,9 @@ export const LaboralData = () => { id: e.id, active: true, activities: e.activities, - endPeriod: `${DateService.parseToDate(e.endPeriod)}T00:00:00`, + endPeriod: _.isEmpty(e.endPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(e.endPeriod)}T00:00:00`, position: e.position, - startPeriod: `${DateService.parseToDate(e.startPeriod)}T00:00:00`, + startPeriod: _.isEmpty(e.startPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(e.startPeriod)}T00:00:00`, }); }); objSend.experiences = experiences; @@ -207,18 +176,18 @@ export const LaboralData = () => { studies.push({ id: s.id, active: false, - endPeriod: `${DateService.parseToDate(s.endPeriod)}T00:00:00`, + endPeriod: _.isEmpty(s.endPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(s.endPeriod)}T00:00:00`, name: s.name, - startPeriod: `${DateService.parseToDate(s.startPeriod)}T00:00:00`, + startPeriod: _.isEmpty(s.startPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(s.startPeriod)}T00:00:00`, }); }); formInputStudies.map((s, i) => { studies.push({ id: s.id, active: true, - endPeriod: `${DateService.parseToDate(s.endPeriod)}T00:00:00`, + endPeriod: _.isEmpty(s.endPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(s.endPeriod)}T00:00:00`, name: s.name, - startPeriod: `${DateService.parseToDate(s.startPeriod)}T00:00:00`, + startPeriod: _.isEmpty(s.startPeriod) ? `0000-00-00T00:00:00` : `${DateService.parseToDate(s.startPeriod)}T00:00:00`, }); }); objSend.studies = studies; @@ -273,49 +242,65 @@ export const LaboralData = () => { }; const saveLaboralData = () => { + let flagLaboral = false let resume = setValuesResume(); - setFlag(true); - toast.current.show({ - severity: 'info', - summary: 'Información', - detail: - 'Sus datos estan siendo guardados, espere un momento por favor.', - sticky: true, + Object.entries(resume).forEach(([key, value]) => { + if (_.isEmpty(value) && key != "completed" && key != "id" && key != "active" || _.lte(value,0) ){ + flagLaboral = true + } }); - profileService - .saveResumeUser(userSession.username, token, resume) - .then((res) => { - switch (res.status) { - case 200: - toast.current.show({ - severity: 'success', - summary: 'Exito', - detail: '¡Listo!, tus datos se han actualizado correctamente', - sticky: true, - }); - setFlag(false); - deleteAllsThings(); - break; - case 403: - toast.current.show({ - severity: 'warn', - summary: 'Atención', - detail: - 'No cuentas con los permisos suficientes para hacer esta acción.', - sticky: true, - }); - break; - case 404: - toast.current.show({ - severity: 'warn', - summary: 'Mensaje de información', - detail: '¡Revise que todos sus datos sean correctos!', - sticky: true, - }); - break; - } - }) - .catch((error) => console.log(error)); + if (!flagLaboral){ + toast.current.show({ + severity: 'info', + summary: 'Información', + detail: + 'Sus datos estan siendo guardados, espere un momento por favor.', + sticky: true, + }); + profileService + .saveResumeUser(userSession.username, token, resume) + .then((res) => { + switch (res.status) { + case 200: + toast.current.show({ + severity: 'success', + summary: 'Exito', + detail: '¡Listo!, tus datos se han actualizado correctamente', + sticky: true, + }); + setFlag(false); + deleteAllsThings(); + break; + case 403: + toast.current.show({ + severity: 'warn', + summary: 'Atención', + detail: + 'No cuentas con los permisos suficientes para hacer esta acción.', + sticky: true, + }); + break; + case 404: + toast.current.show({ + severity: 'warn', + summary: 'Mensaje de información', + detail: '¡Revise que todos sus datos sean correctos!', + sticky: true, + }); + break; + } + }) + .catch((error) => console.log(error)); + }else{ + toast.current.show({ + severity: 'warn', + summary: '¡Atención!', + detail: + 'Revise que todos sus datos sean correctos o esten completos.', + sticky: true, + }); + } + console.log(resume) }; useEffect(() => { diff --git a/src/components/profile_candidates_components/PersonalData.jsx b/src/components/profile_candidates_components/PersonalData.jsx index 3bf7ec7..077e321 100644 --- a/src/components/profile_candidates_components/PersonalData.jsx +++ b/src/components/profile_candidates_components/PersonalData.jsx @@ -8,6 +8,7 @@ import { ProfileService } from '../../services/ProfileService'; import DateService from '../../services/DateService'; import { useEffect } from 'react'; import { useStoreSession } from '../../storage/LoginZustand'; +import _ from 'lodash'; export const PersonalData = () => { let profileService = new ProfileService(); @@ -39,6 +40,7 @@ export const PersonalData = () => { } const partialUpdateProfile = () => { + let flagSend = false toast.current.show({ severity: 'info', summary: 'Información', @@ -46,43 +48,64 @@ export const PersonalData = () => { 'Sus datos estan siendo guardados, espere un momento por favor.', sticky: true, }); - setValuesProfile('birthDate',DateService.parseToDate(profile.birthDate)) - setValuesProfile('image', `https://avatars.dicebear.com/api/initials/${userSession.username}.svg`) - profileService.updateProfile(token,userSession.username,profile) - .then((res)=>{ - switch (res.status) { - case 200: - toast.current.show({ - severity: 'success', - summary: 'Exito', - detail: '¡Listo!, tus datos se han actualizado correctamente.', - sticky: true, - }); - break; - case 403: - toast.current.show({ - severity: 'warn', - summary: 'Atención', - detail: 'No cuentas con los permisos suficientes para hacer esta acción.', - sticky: true, - }); - break; - case 404: - toast.current.show({ - severity: 'error', - summary: 'Advertencia', - detail: 'Ocurrio un error al guardar los datos.', - sticky: true, - }); - break; - } - }) - .catch((error)=>{ - console.log(error) - }) + + Object.entries(profile).forEach(([key, value]) => { + if (_.isEmpty(value) && key != "completed" && key != "id"){ + flagSend = true + } + }); + + if (_.isEmpty(email)){ + flagSend = true + } + + if (!flagSend){ + setValuesProfile('birthDate',DateService.parseToDate(profile.birthDate)) + setValuesProfile('image', `https://avatars.dicebear.com/api/initials/${userSession.username}.svg`) + profileService.updateProfile(token,userSession.username,profile) + .then((res)=>{ + switch (res.status) { + case 200: + toast.current.show({ + severity: 'success', + summary: 'Exito', + detail: '¡Listo!, tus datos se han actualizado correctamente.', + sticky: true, + }); + break; + case 403: + toast.current.show({ + severity: 'warn', + summary: 'Atención', + detail: 'No cuentas con los permisos suficientes para hacer esta acción.', + sticky: true, + }); + break; + case 404: + toast.current.show({ + severity: 'error', + summary: 'Advertencia', + detail: 'Ocurrio un error al guardar los datos.', + sticky: true, + }); + break; + } + }) + .catch((error)=>{ + console.log(error) + }) + }else{ + toast.current.show({ + severity: 'warn', + summary: 'Atención', + detail: 'Verifique que sus datos sean correctos o esten completos.', + sticky: true, + }); + } } const updateProfile = () => { + let flagFirst = false toast.current.show({ severity: 'info', summary: 'Información', @@ -90,49 +113,67 @@ export const PersonalData = () => { 'Sus datos estan siendo guardados, espere un momento por favor.', sticky: true, }); - profileService - .saveProfile(userSession.username, profile, token) - .then((res) => { - switch (res.status) { - case 200: - toast.current.show({ - severity: 'success', - summary: 'Exito', - detail: '¡Listo!, tus datos se han actualizado correctamente. Reinice su sesión para ver sus cambios.', - sticky: true, - }); - afterUpdate() - break; - case 403: - toast.current.show({ - severity: 'warn', - summary: 'Atención', - detail: 'No cuentas con los permisos suficientes para hacer esta acción.', - sticky: true, - }); - break; - case 404: - toast.current.show({ - severity: 'info', - summary: 'Mensaje de información', - detail: '¡Revise que todos sus datos sean correctos!', - sticky: true, - }); - break; - } - }) - .catch((error) => { - console.log(error); - toast.current.show({ - severity: 'error', - summary: 'Advertencia', - detail: 'Ocurrio un error al guardar los datos', - sticky: true, + Object.entries(profile).forEach(([key, value]) => { + if (_.isEmpty(value) && key != "completed" && key != "id"){ + flagFirst = true + } + }); + if (_.isEmpty(email)){ + flagFirst = true + } + + if (!flagFirst){ + profileService + .saveProfile(userSession.username, profile, token) + .then((res) => { + switch (res.status) { + case 200: + toast.current.show({ + severity: 'success', + summary: 'Exito', + detail: '¡Listo!, tus datos se han actualizado correctamente. Reinice su sesión para ver sus cambios.', + sticky: true, + }); + afterUpdate() + break; + case 403: + toast.current.show({ + severity: 'warn', + summary: 'Atención', + detail: 'No cuentas con los permisos suficientes para hacer esta acción.', + sticky: true, + }); + break; + case 404: + toast.current.show({ + severity: 'info', + summary: 'Mensaje de información', + detail: '¡Revise que todos sus datos sean correctos!', + sticky: true, + }); + break; + } + }) + .catch((error) => { + console.log(error); + toast.current.show({ + severity: 'error', + summary: 'Advertencia', + detail: 'Ocurrio un error al guardar los datos', + sticky: true, + }); + setTimeout(() => { + setFlag(false); + }, 2000); }); - setTimeout(() => { - setFlag(false); - }, 2000); + }else{ + toast.current.show({ + severity: 'warn', + summary: 'Atención', + detail: 'Verifique que sus datos sean correctos o esten completos.', + sticky: true, }); + } }; useEffect(() => { @@ -150,6 +191,7 @@ export const PersonalData = () => { .getProfileUser(token, userSession.username) .then((response) => response.json()) .then((result) => { + console.log(result) setProfile(result); }) .catch((error) => { @@ -221,7 +263,7 @@ export const PersonalData = () => { id='in' style={{ width: 250 }} type='date' - value={DateService.parseToDate(profile.birthDate)} + value={_.isEmpty(profile.birthDate) ? "0000-00-00":DateService.parseToDate(profile.birthDate)} onChange={(e) => setValuesProfile('birthDate', e.target.value)} className='m-1' /> diff --git a/src/components/recruiter_components/applicants_profile/ApplicantInfo.jsx b/src/components/recruiter_components/applicants_profile/ApplicantInfo.jsx index f2e42de..f7eb012 100644 --- a/src/components/recruiter_components/applicants_profile/ApplicantInfo.jsx +++ b/src/components/recruiter_components/applicants_profile/ApplicantInfo.jsx @@ -18,7 +18,7 @@ export const ApplicantInfo = () => {
Image { const registerService = new RegisterService(); @@ -25,51 +26,63 @@ const LeftContent = () => { const register = () => { setDisabledButton(true); - registerService - .RegisterUser(username, email, password, role) - .then((data) => { - switch (data.status) { - case 200: - toast.current.show({ - severity: 'success', - summary: 'Exito', - detail: 'El registro de los datos se hizo correctamente', - sticky: true, - }); - break; - case 403: - toast.current.show({ - severity: 'warn', - summary: 'Atención', - detail: 'No cuentas con los permisos suficientes para hacer esta acción', - sticky: true, - }); - break; - case 404 || 505: - toast.current.show({ - severity: 'error', - summary: 'Error de la aplicación', - detail: 'A ocurrio un error en el servidor', - sticky: true, - }); - break; - } - cleanAllData(); - setDisabledButton(false); - }) - .catch((error) => { - console.log(error); - toast.current.show({ - severity: 'warn', - summary: 'Advertencia', - detail: 'Datos invalidos del usuario', - sticky: true, - }); - setTimeout(() => { - cleanAllData() - setDisabledButton(false); - }, 2000); + if (_.isEmpty(username) && _.isEmpty(email) && _.isEmpty(password)){ + toast.current.show({ + severity: 'warn', + summary: '¡Atención!', + detail: 'Verifique que sus datos esten correctos o esten completos.', + sticky: true, }); + setTimeout(()=>{ + setDisabledButton(false) + },1000) + }else{ + registerService + .RegisterUser(username, email, password, role) + .then((data) => { + switch (data.status) { + case 200: + toast.current.show({ + severity: 'success', + summary: 'Exito', + detail: 'El registro de los datos se hizo correctamente', + sticky: true, + }); + break; + case 403: + toast.current.show({ + severity: 'warn', + summary: 'Atención', + detail: 'No cuentas con los permisos suficientes para hacer esta acción', + sticky: true, + }); + break; + case 404 || 505: + toast.current.show({ + severity: 'error', + summary: 'Error de la aplicación', + detail: 'A ocurrio un error en el servidor', + sticky: true, + }); + break; + } + cleanAllData(); + setDisabledButton(false); + }) + .catch((error) => { + console.log(error); + toast.current.show({ + severity: 'warn', + summary: 'Advertencia', + detail: 'Datos invalidos del usuario', + sticky: true, + }); + setTimeout(() => { + cleanAllData() + setDisabledButton(false); + }, 2000); + }); + } }; return ( From 1bfcd0cec5241da7d6559097c5fbbb8c07a09b74 Mon Sep 17 00:00:00 2001 From: Yakuza Date: Wed, 24 Aug 2022 18:47:14 -0500 Subject: [PATCH 2/5] feat(front): update profile functionality --- .../templates_components/Aptitudes.jsx | 59 +++--- .../templates_components/Certifications.jsx | 113 ++++++----- .../templates_components/Courses.jsx | 113 ++++++----- .../templates_components/Experience.jsx | 117 +++++++----- .../templates_components/Languages.jsx | 55 +++--- .../templates_components/MainTemplate.jsx | 51 +++-- .../templates_components/PerfilCard.jsx | 178 ++++++++++-------- .../templates_components/Studies.jsx | 95 ++++++---- .../LaboralData.jsx | 1 - .../PersonalData.jsx | 1 + 10 files changed, 458 insertions(+), 325 deletions(-) diff --git a/src/components/candidates_components/templates_components/Aptitudes.jsx b/src/components/candidates_components/templates_components/Aptitudes.jsx index d96dcda..6d8190e 100644 --- a/src/components/candidates_components/templates_components/Aptitudes.jsx +++ b/src/components/candidates_components/templates_components/Aptitudes.jsx @@ -1,24 +1,37 @@ -export const Aptitudes = ({ resume,color }) => { - return ( - <> -
-
-
-
Habilidades:
-
-
-
- {resume.aptitudes.map((r, i) => { - return( -
- • {r.name} +import _ from 'lodash'; + +export const Aptitudes = ({ resume, color }) => { + return ( + <> +
+
+
+
+ Habilidades: +
- ) - })} -
-
-
-
- - ) -} \ No newline at end of file +
+
+ {_.size(resume.aptitudes)>0 ? ( + <> + {resume.aptitudes.map((r, i) => { + return ( +
+ • {r.name} +
+ ); + })} + + ):( +
+ Sin datos. +
+ )} +
+
+
+
+ + ); +}; diff --git a/src/components/candidates_components/templates_components/Certifications.jsx b/src/components/candidates_components/templates_components/Certifications.jsx index 9db39ba..ce4b615 100644 --- a/src/components/candidates_components/templates_components/Certifications.jsx +++ b/src/components/candidates_components/templates_components/Certifications.jsx @@ -1,50 +1,69 @@ import DateService from '../../../services/DateService'; -export const Certifications = ({resume,color}) => { - return ( - <> -
-
-
-
Certificación:
-
-
-
-
Nombre
- {resume.certifications.map((r, i) => { - return ( -
{r.name}
- ) - })} -
+export const Certifications = ({ resume, color }) => { + return ( + <> +
+
+
+
+ Certificación: +
+
+
+
+
+ Nombre +
+ {resume.certifications.map((r, i) => { + return ( +
+ {r.name} +
+ ); + })} +
-
-
Compañia
- {resume.certifications.map((r,i)=>{ - return( -
{r.company}
- ) - })} -
-
-
Logro
- {resume.certifications.map((r,i)=>{ - return( -
{DateService.parseToDate(r.obtainedDate)}
- ) - })} -
-
-
Expiración
- {resume.certifications.map((r,i)=>{ - return( -
{DateService.parseToDate(r.expirationDate)}
- ) - })} -
-
-
-
- - ) - } \ No newline at end of file +
+
+ Compañia +
+ {resume.certifications.map((r, i) => { + return ( +
+ {r.company} +
+ ); + })} +
+
+
+ Logro +
+ {resume.certifications.map((r, i) => { + return ( +
+ {DateService.parseToDate(r.obtainedDate)} +
+ ); + })} +
+
+
+ Expiración +
+ {resume.certifications.map((r, i) => { + return ( +
+ {DateService.parseToDate(r.expirationDate)} +
+ ); + })} +
+
+
+
+ + ); +}; diff --git a/src/components/candidates_components/templates_components/Courses.jsx b/src/components/candidates_components/templates_components/Courses.jsx index d548f19..54e5779 100644 --- a/src/components/candidates_components/templates_components/Courses.jsx +++ b/src/components/candidates_components/templates_components/Courses.jsx @@ -1,50 +1,69 @@ import DateService from '../../../services/DateService'; -export const Courses = ({ resume,color }) => { - return ( - <> -
-
-
-
Cursos:
-
+export const Courses = ({ resume, color }) => { + return ( + <> +
+
+
+
+ Cursos: +
+
-
-
-
Nombre
- {resume.courses.map((r, i) => { - return ( -
{r.name}
- ) - })} -
-
-
Instituto
- {resume.courses.map((r, i) => { - return ( -
{r.trainingInstitution}
- ) - })} -
-
-
Realización
- {resume.courses.map((r, i) => { - return ( -
{DateService.parseToDate(r.realizationDate)}
- ) - })} -
-
-
Horas
- {resume.courses.map((r, i) => { - return ( -
{r.hours}
- ) - })} -
-
-
-
- - ) -} \ No newline at end of file +
+
+
+ Nombre +
+ {resume.courses.map((r, i) => { + return ( +
+ {r.name} +
+ ); + })} +
+
+
+ Instituto +
+ {resume.courses.map((r, i) => { + return ( +
+ {r.trainingInstitution} +
+ ); + })} +
+
+
+ Realización +
+ {resume.courses.map((r, i) => { + return ( +
+ {DateService.parseToDate(r.realizationDate)} +
+ ); + })} +
+
+
+ Horas +
+ {resume.courses.map((r, i) => { + return ( +
+ {r.hours} +
+ ); + })} +
+
+
+
+ + ); +}; diff --git a/src/components/candidates_components/templates_components/Experience.jsx b/src/components/candidates_components/templates_components/Experience.jsx index 5d238e9..6f97f56 100644 --- a/src/components/candidates_components/templates_components/Experience.jsx +++ b/src/components/candidates_components/templates_components/Experience.jsx @@ -1,49 +1,68 @@ -import DateService from "../../../services/DateService" -export const Experience = ({ resume,color}) => { - return ( - <> -
-
-
-
Experiencia:
-
- -
-
-
Nombre
- {resume.experiences.map((r, i) => { - return ( -
{r.activities}
- ) - })} -
-
-
Puesto
- {resume.experiences.map((r, i) => { - return ( -
{r.position}
- ) - })} -
-
-
Inicio
- {resume.experiences.map((r, i) => { - return ( -
{DateService.parseToDate(r.startPeriod)}
- ) - })} -
-
-
Fin
- {resume.experiences.map((r, i) => { - return ( -
{DateService.parseToDate(r.endPeriod)}
- ) - })} -
-
-
-
- - ) -} \ No newline at end of file +import DateService from '../../../services/DateService'; +export const Experience = ({ resume, color }) => { + return ( + <> +
+
+
+
+ Experiencia: +
+
+ +
+
+
+ Nombre +
+ {resume.experiences.map((r, i) => { + return ( +
+ {r.activities} +
+ ); + })} +
+
+
+ Puesto +
+ {resume.experiences.map((r, i) => { + return ( +
+ {r.position} +
+ ); + })} +
+
+
+ Inicio +
+ {resume.experiences.map((r, i) => { + return ( +
+ {DateService.parseToDate(r.startPeriod)} +
+ ); + })} +
+
+
+ Fin +
+ {resume.experiences.map((r, i) => { + return ( +
+ {DateService.parseToDate(r.endPeriod)} +
+ ); + })} +
+
+
+
+ + ); +}; diff --git a/src/components/candidates_components/templates_components/Languages.jsx b/src/components/candidates_components/templates_components/Languages.jsx index 482f7ae..5682596 100644 --- a/src/components/candidates_components/templates_components/Languages.jsx +++ b/src/components/candidates_components/templates_components/Languages.jsx @@ -1,24 +1,31 @@ -export const Languages = ({ resume,color }) => { - return ( - <> -
-
-
-
Idiomas:
-
-
- {resume.languages.map((r, i) => { - return ( -
-
• {r.language.language}
-
{r.level}
-
- ) - })} -
- -
-
- - ) -} \ No newline at end of file +export const Languages = ({ resume, color }) => { + return ( + <> +
+
+
+
+ Idiomas: +
+
+
+ {resume.languages.map((r, i) => { + return ( +
+
+ • {r.language.language}{' '} +
+
+ {' '} + {r.level} +
+
+ ); + })} +
+
+
+ + ); +}; diff --git a/src/components/candidates_components/templates_components/MainTemplate.jsx b/src/components/candidates_components/templates_components/MainTemplate.jsx index 3138aec..bb7d680 100644 --- a/src/components/candidates_components/templates_components/MainTemplate.jsx +++ b/src/components/candidates_components/templates_components/MainTemplate.jsx @@ -18,7 +18,6 @@ export const MainTemplate = () => { const [color, setColor] = useState(''); useEffect(() => { - {console.log(id)} serviceTemplate .getResumeUser(token, userSession.username) .then((res) => res.json()) @@ -28,14 +27,14 @@ export const MainTemplate = () => { .catch((error) => console.log(error)); switch (id) { - case "1": + case '1': setColor('bg-blue-900'); break; - case "2": + case '2': setColor('bg-teal-600'); break; - case "3": + case '3': setColor('bg-red-600'); break; default: @@ -48,7 +47,7 @@ export const MainTemplate = () => {
- {resume != null && ( + {resume != null ? ( <>
{ />
- +
- +
- +
- +
- +
- +
+ ) : ( +
+
+ Sin datos registrados. +
+
)}
diff --git a/src/components/candidates_components/templates_components/PerfilCard.jsx b/src/components/candidates_components/templates_components/PerfilCard.jsx index 2ca5b85..988b62e 100644 --- a/src/components/candidates_components/templates_components/PerfilCard.jsx +++ b/src/components/candidates_components/templates_components/PerfilCard.jsx @@ -1,80 +1,104 @@ import { Button } from 'primereact/button'; import { useStoreSession } from '../../../storage/LoginZustand'; -export const PerfilCard = ({ resume,color }) => { - const { token, userSession } = useStoreSession() - return ( - <> -
-
-
-
- -
- { - ( -
{resume.curricularTitle}
- ) - } -
-
- { - ( -
{resume.profile.name.concat(' ', resume.profile.firstName, ' ', resume.profile.secondName)}
) - } -
-
-
-
-
-
-
-
-
- { - ( -
{resume.profile.phoneNumber}
- ) - } +export const PerfilCard = ({ resume, color }) => { + const { token, userSession } = useStoreSession(); + return ( + <> +
+
+
+
+ +
+ { +
+ {resume.curricularTitle} +
+ } +
+
+ { +
+ {resume.profile.name.concat( + ' ', + resume.profile.firstName, + ' ', + resume.profile.secondName, + )} +
+ } +
+
+
+
+
+
+
+
+
+ { +
+ {resume.profile.phoneNumber} +
+ } +
+
+
+
+
+ {userSession.email} +
+
+
+
+
+ { +
+ {resume.profile.state.name} +
+ } +
+
+
+
+
+
+
+ Resumen: +
+
-
-
-
-
{userSession.email}
-
-
-
-
- { - ( -
{resume.profile.state.name}
- ) - } -
-
-
-
-
-
-
Resumen:
-
- -
-
- { - ( -
- {resume.description} -
) - } - -
-
-
-
- - ) -} \ No newline at end of file +
+
+ { +
+ {resume.description} +
+ } +
+
+
+
+ + ); +}; diff --git a/src/components/candidates_components/templates_components/Studies.jsx b/src/components/candidates_components/templates_components/Studies.jsx index 300f405..8a2e100 100644 --- a/src/components/candidates_components/templates_components/Studies.jsx +++ b/src/components/candidates_components/templates_components/Studies.jsx @@ -1,43 +1,58 @@ import DateService from '../../../services/DateService'; -export const Studies = ({resume,color}) => { - return ( - <> -
-
-
-
Estudios:
-
- -
-
-
Nombre
- {resume.studies.map((r, i) => { - return ( -
{r.name}
- ) - })} -
+export const Studies = ({ resume, color }) => { + return ( + <> +
+
+
+
+ Estudios: +
+
-
-
Inicio
- {resume.studies.map((r,i)=>{ - return( -
{DateService.parseToDate(r.startPeriod)}
- ) - })} -
-
-
Fin
- {resume.studies.map((r,i)=>{ - return( -
{DateService.parseToDate(r.endPeriod)}
- ) - })} -
-
-
-
- - ) -} \ No newline at end of file +
+
+
+ Nombre +
+ {resume.studies.map((r, i) => { + return ( +
+ {r.name} +
+ ); + })} +
+ +
+
+ Inicio +
+ {resume.studies.map((r, i) => { + return ( +
+ {DateService.parseToDate(r.startPeriod)} +
+ ); + })} +
+
+
+ Fin +
+ {resume.studies.map((r, i) => { + return ( +
+ {DateService.parseToDate(r.endPeriod)} +
+ ); + })} +
+
+
+
+ + ); +}; diff --git a/src/components/profile_candidates_components/LaboralData.jsx b/src/components/profile_candidates_components/LaboralData.jsx index 881dc7c..7929f08 100644 --- a/src/components/profile_candidates_components/LaboralData.jsx +++ b/src/components/profile_candidates_components/LaboralData.jsx @@ -300,7 +300,6 @@ export const LaboralData = () => { sticky: true, }); } - console.log(resume) }; useEffect(() => { diff --git a/src/components/profile_candidates_components/PersonalData.jsx b/src/components/profile_candidates_components/PersonalData.jsx index 077e321..2c94bca 100644 --- a/src/components/profile_candidates_components/PersonalData.jsx +++ b/src/components/profile_candidates_components/PersonalData.jsx @@ -263,6 +263,7 @@ export const PersonalData = () => { id='in' style={{ width: 250 }} type='date' + defaultValue="2000-01-01" value={_.isEmpty(profile.birthDate) ? "0000-00-00":DateService.parseToDate(profile.birthDate)} onChange={(e) => setValuesProfile('birthDate', e.target.value)} className='m-1' From a2eda3f43e25922b367b41a4a5ad508d47a70fb3 Mon Sep 17 00:00:00 2001 From: HectorSaldes <20193tn070@utez.edu.mx> Date: Wed, 24 Aug 2022 21:17:31 -0500 Subject: [PATCH 3/5] Change titles index html --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 623899a..42e2297 100644 --- a/public/index.html +++ b/public/index.html @@ -16,7 +16,7 @@ /> - React App + PIBE From e357db52dfbd0116c024d44c27244ed265c7d6f4 Mon Sep 17 00:00:00 2001 From: HectorSaldes <20193tn070@utez.edu.mx> Date: Wed, 24 Aug 2022 21:54:27 -0500 Subject: [PATCH 4/5] feat: Change files --- src/components/landing_page/Footer.jsx | 8 ++++---- src/components/navbar/LeftContents.jsx | 1 - .../profile_candidates_components/PersonalData.jsx | 1 - .../applicants_grid/ApplicantsCard.jsx | 1 - .../create_vacants/BenefitsVacant.jsx | 1 - .../create_vacants/PrincipalContent.jsx | 2 +- .../recruiter_components/edit_vacants/BenefitsVacant.jsx | 1 - 7 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/landing_page/Footer.jsx b/src/components/landing_page/Footer.jsx index 9da59fd..167bc21 100644 --- a/src/components/landing_page/Footer.jsx +++ b/src/components/landing_page/Footer.jsx @@ -2,10 +2,10 @@ import React from "react"; import Logo from "../../resources/static/img/logo.svg" export const Footer = () => { return ( -