{"version":3,"sources":["redux/actions/ui.js","components/login/HeadLogin.jsx","components/login/SelectOptions.jsx","components/login/Login.jsx"],"names":["setError","err","type","types","ui_SetError","payload","message","removeError","ui_RemoveError","startLoading","ui_StartLoading","finishLoading","ui_FinishLoading","HeadLogin","title","subtitle","className","style","fontSize","SelectOptions","data","propertyKey","propertyValue","map","element","index","key","value","schemaInputsForm","yup","shape","username","password","idapplication","remember","Login","dispatch","useDispatch","useSelector","state","ui","messageError","loading","useState","titleSubtitleText","setTitleSubtitleText","idsRecordados","setIdsRecordados","showIds","setShowIds","idApp","setIdApp","useForm","resolver","yupResolver","register","handleSubmit","onSubmit","a","validateInputs","error_validate","messageErrorForm","parameters","usuario","guia","id_aplicacion","aplicacion","AuthLogin","window","location","assign","URL_CLIENT","inputs","trim","length","validateNumber","useEffect","ids","localStorage","getItem","JSON","parse","md","name","required","placeholder","autoComplete","ref","maxLength","onChange","e","valor","target","content","color","onClick","id","htmlFor","fontWeight","xs","marginTop","disabled","width","backgroundImage","backgroundPosition","backgroundRepeat","backgroundSize","backgroundColor"],"mappings":"6KAAA,oJAEaA,EAAW,SAACC,GAAD,MAAU,CAC9BC,KAAMC,IAAMC,YACZC,QAAS,CACLC,QAASL,KAIJM,EAAc,iBAAO,CAC9BL,KAAMC,IAAMK,iBAGHC,EAAe,iBAAO,CAC/BP,KAAMC,IAAMO,kBAGHC,EAAgB,iBAAO,CAChCT,KAAMC,IAAMS,oB,sNCfD,SAASC,EAAT,GAAyC,IAApBC,EAAmB,EAAnBA,MAAOC,EAAY,EAAZA,SAC1C,OACC,oCACC,4BAAI,uBAAGC,UAAU,mBAAjB,IAAwCF,GAEvCC,GAAY,uBAAGC,UAAU,aAAaC,MAAO,CAAEC,SAAU,KAAOH,ICN7D,IAAMI,EAAgB,SAAC,GAA0C,IAAxCC,EAAuC,EAAvCA,KAAMC,EAAiC,EAAjCA,YAAaC,EAAoB,EAApBA,cACjD,OACE,oCACGF,EAAKG,KAAI,SAACC,EAASC,GAA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AaI,WAAY,SAAWzD,GAC7F,kBAAC,IAAD,KACE,kBAAC,IAAD,CAAM0D,GAAG,KACP,kBAAC,IAAD,CAASL,MAAM,UAAU9E,UAAU,OAAOd,KAAK,SAASe,MAAO,CAAEmF,UAAW,IAAMC,WAAU3D,GAA5F,iBAQV,kBAAC,IAAD,CACE1B,UAAU,0CACVC,MAAO,CACLqF,MAAO,MACPC,gBAAgB,gCAChBC,mBAAoB,SACpBC,iBAAkB,YAClBC,eAAgB,OAChBC,gBAAiB","file":"static/js/35.f8898a6d.chunk.js","sourcesContent":["import { types } from \"../../types/types\";\n\nexport const setError = (err) => ({\n type: types.ui_SetError,\n payload: {\n message: err\n }\n});\n\nexport const removeError = () => ({\n type: types.ui_RemoveError\n});\n\nexport const startLoading = () => ({\n type: types.ui_StartLoading\n});\n\nexport const finishLoading = () => ({\n type: types.ui_FinishLoading\n});\n","import React from \"react\";\nimport PropTypes from 'prop-types';\n\nexport default function HeadLogin({ title, subtitle }) {\n\treturn (\n\t\t<>\n\t\t\t

{title}

\n\t\t\t{\n\t\t\t\tsubtitle &&

{subtitle}

\n\t\t\t}\n\t\t\n\t);\n}\n\nHeadLogin.propTypes = {\n\ttitle: PropTypes.string.isRequired,\n\tsubtitle: PropTypes.string\n};","import React from \"react\";\n\nexport const SelectOptions = ({ data, propertyKey, propertyValue }) => {\n return (\n <>\n {data.map((element, index) => (\n \n ))}\n \n );\n};\n","import React, { useState, useEffect } from 'react'\nimport { useDispatch, useSelector } from \"react-redux\"\nimport { useForm } from \"react-hook-form\"\nimport { yupResolver } from \"@hookform/resolvers/yup\"\nimport * as yup from \"yup\"\n\nimport {\n CButton,\n CCard,\n CCardBody,\n CCardGroup,\n CCol,\n CContainer,\n CForm,\n CInputGroup,\n CInputGroupPrepend,\n CInputGroupText,\n CRow,\n CTooltip\n} from '@coreui/react'\nimport CIcon from '@coreui/icons-react'\n\nimport { AuthLogin } from '../../services/login.services'\nimport { URL_CLIENT, validateNumber } from \"../../utils/helpers\"\nimport { finishLoading, removeError, setError, startLoading } from '../../redux/actions/ui'\nimport HeadLogin from './HeadLogin'\nimport { SelectOptions } from './SelectOptions'\n\nconst schemaInputsForm = yup.object().shape({\n username: yup.string(),\n password: yup.string(),\n idapplication: yup.string(),\n remember: yup.bool()\n});\n\nexport default function Login() {\n const dispatch = useDispatch();\n const { messageError, loading } = useSelector(state => state.ui);\n const [titleSubtitleText, setTitleSubtitleText] = useState({ title: null, subtitle: null });\n const [idsRecordados, setIdsRecordados] = useState([]);\n const [showIds, setShowIds] = useState(false);\n const [idApp, setIdApp] = useState('');\n const { register, handleSubmit } = useForm({\n resolver: yupResolver(schemaInputsForm)\n });\n\n const onSubmit = async (data) => {\n const { error_validate, messageErrorForm } = validateInputs(data);\n if (error_validate) {\n return dispatch(setError(messageErrorForm));\n }\n\n dispatch(removeError());\n dispatch(startLoading());\n setTitleSubtitleText({ subtitle: \"Iniciando sesión...\", title: null });\n\n const parameters = {\n usuario: data.username,\n guia: data.password,\n id_aplicacion: data.idapplication,\n aplicacion: \"agrotrack\"\n }\n\n try {\n await AuthLogin({ parameters }, data.remember);\n return window.location.assign(\n `${URL_CLIENT}`\n );\n } catch (error) {\n setTitleSubtitleText({ subtitle: \"Identificación de Usuario\", title: \"Login Agrotrack\" });\n dispatch(setError(error));\n dispatch(finishLoading());\n }\n }\n\n const validateInputs = (inputs) => {\n if (inputs.username.trim().length === 0) {\n return { error_validate: true, messageErrorForm: \"Debes ingresar el nombre de usuario\" };\n }\n if (inputs.username.trim().length > 15) {\n return { error_validate: true, messageErrorForm: \"El nombre de usuario no es válido\" };\n }\n if (inputs.password.trim().length === 0) {\n return { error_validate: true, messageErrorForm: \"Debes ingresar tu password\" };\n }\n if (inputs.password.trim().length > 15) {\n return { error_validate: true, messageErrorForm: \"El password no es válido.\" };\n }\n if (inputs.idapplication.trim().length === 0) {\n return { error_validate: true, messageErrorForm: \"Debes ingresar el id aplicación\" };\n }\n if (!validateNumber(inputs.idapplication)) {\n return { error_validate: true, messageErrorForm: \"Debes ingresar el id aplicación correctamente\" };\n }\n if (inputs.idapplication.trim().length !== 9) {\n return { error_validate: true, messageErrorForm: \"El id aplicación no es válido\" };\n }\n\n return { error_validate: false };\n }\n\n const handleInput = (e) => {\n const valor = e.target.value\n setIdApp((state) => {\n if(valor.length > 9){\n return state;\n }else{\n return valor;\n }\n });\n }\n\n const handleSelect = (e) => {\n setIdApp(e.target.value)\n }\n\n useEffect(() => {\n const ids = localStorage.getItem('ids_recordados') ? JSON.parse(localStorage.getItem('ids_recordados')) : [];\n setIdsRecordados(ids);\n }, [])\n\n return (\n
\n \n \n \n \n \n \n \n {\n loading ? \n : \n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n { idsRecordados.length > 0 && (\n \n setShowIds(!showIds)}>\n \n \n \n )}\n \n { idsRecordados.length > 0 && showIds && (\n \n \n \n )}\n \n
\n \n \n
\n
\n {messageError && {messageError}}\n \n \n \n Ingresar\n \n \n \n
\n
\n
\n \n \n
\n
\n
\n
\n
\n )\n}\n"],"sourceRoot":""}