${labelText.innerText}
${checkField}`;\n }\n }\n }\n return (extrafieldsText);\n }, [extraFieldsResponse]);\n\n const validateSubmit = useCallback(() => {\n if (fieldsCodes.current.length > 0) {\n for (let i = 0; i < fieldsCodes.current.length; i += 1) {\n const response = extraFieldsResponse as AxiosResponse;\n const filtered = response.data.filter((data: {codigoCampo: string}) => (\n String(data.codigoCampo) === String(fieldsCodes.current[i])\n ));\n const { codigoCampo, descricaoCampo, campoObrigatorio } = filtered[0];\n if (String(campoObrigatorio) === 'S') {\n const checkField = inputValues.current[Number(codigoCampo)];\n if (!checkField) {\n addToast(`É obrigatório preencher o campo ${descricaoCampo} !`, {\n appearance: 'warning',\n autoDismiss: true,\n });\n return false;\n }\n }\n }\n }\n if (!service.current) {\n addToast('É obrigatório escolher um serviço!', {\n appearance: 'warning',\n autoDismiss: true,\n });\n return false;\n }\n if (!richEditorValue.current) {\n addToast('É obrigatório informar uma descrição!', {\n appearance: 'warning',\n autoDismiss: true,\n });\n return false;\n }\n return true;\n }, [addToast, extraFieldsResponse]);\n\n const sendAttendance = useCallback(async () => {\n if (validateSubmit()) {\n setLoading(true);\n const isClient = userInfo.isCliRep !== 'CLI';\n const clientCode = isClient ? 0 : userInfo.codCliRep;\n const repCode = isClient ? userInfo.codCliRep : '';\n const data = new FormData();\n let extraFieldsData;\n\n if (fieldsCodes.current.length > 0) {\n extraFieldsData = '[';\n for (let i1 = 0; i1 < fieldsCodes.current.length; i1 += 1) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const filtered = extraFieldsResponse.data.filter((eFData: {codigoCampo: string}) => (\n String(eFData.codigoCampo) === String(fieldsCodes.current[i1])\n ));\n const { codigoCampo } = filtered[0];\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const fieldValue = inputRef.current[codigoCampo].value;\n if (fieldValue !== '') {\n extraFieldsData += `${JSON.stringify({\n campoExtra: codigoCampo,\n descricao: fieldValue,\n })},`;\n }\n }\n extraFieldsData = extraFieldsData.replace(/,([^,]*)$/, '$1');\n extraFieldsData += ']';\n }\n\n const movimentData = JSON.stringify({\n instrucaoMovimento: getInstructionConcat(),\n usuarioOrigem: 21,\n usuarioDestino: 21,\n status: 1,\n avisarCliente: 'C',\n analise: 'N',\n reuniao: 'N',\n data: '',\n horasTrabalhadas: '00:00',\n });\n\n data.append('codigoCliente', String(clientCode));\n data.append('codigoRepresentante', repCode);\n data.append('codigoPessoaSolicitante', String(userInfo.personCode));\n data.append('codigoUsuarioCriacao', String(21));\n data.append('codigoPortfolio', String(service.current));\n data.append('movimentos', movimentData);\n\n if (images.length > 0) {\n for (let i = 0; i < images.length; i += 1) {\n data.append(`anexos[${i}]`, images[i]);\n }\n }\n\n if (extraFieldsData) {\n data.append('camposExtras', extraFieldsData);\n }\n\n await apiGestor.post('atendimentos/externos', data)\n .then(() => {\n onTrigger();\n })\n .catch(() => {\n addToast('Não foi possível criar o atendimento', {\n appearance: 'error',\n autoDismiss: true,\n });\n setLoading(false);\n });\n }\n }, [validateSubmit, userInfo.isCliRep, userInfo.codCliRep, userInfo.personCode,\n getInstructionConcat, extraFieldsResponse, onTrigger, addToast, images]);\n\n const classes = useStyles();\n const classesTab = useStylesTab();\n const classesGrid = useStylesGrid();\n\n return (\nA página que você procura não existe.
\n{this.state.error && this.state.error.toString()}
\n\n { // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.state.errorInfo?.componentStack\n }\n
\n