\n localStorage.getItem('user') ? (\n \n \n \n \n \n ) : (\n \n )\n }\n />\n )\n}\n\nPrivateRouteWithLayout.propTypes = {\n component: PropTypes.any.isRequired,\n type: PropTypes.string,\n layout: PropTypes.any.isRequired,\n path: PropTypes.string\n}\n\nexport default PrivateRouteWithLayout\n","import React from 'react'\nimport { ToastContainer, toast } from 'react-toastify'\nimport \"react-toastify/dist/ReactToastify.css\";\n\nexport default (props) => \n","/* eslint-disable no-undef */\nimport React, { useEffect } from 'react'\nimport { Helmet } from 'react-helmet'\nimport PropTypes from 'prop-types'\n\nimport useRouter from 'utils/useRouter'\n\nconst NODE_ENV = process.env.NODE_ENV\nconst GA_MEASUREMENT_ID = process.env.REACT_APP_GA_MEASUREMENT_ID\n\nconst Page = (props) => {\n const { title, children, ...rest } = props\n\n const router = useRouter()\n\n useEffect(() => {\n if (NODE_ENV !== 'production') {\n return\n }\n\n if (window.gtag) {\n window.gtag('config', GA_MEASUREMENT_ID, {\n page_path: router.location.pathname,\n page_name: title\n })\n }\n }, [title, router])\n\n return (\n \n \n {title}\n \n {children}\n
\n )\n}\n\nPage.propTypes = {\n children: PropTypes.node,\n title: PropTypes.string\n}\n\nexport default Page\n","import { useContext } from 'react'\nimport { __RouterContext } from 'react-router'\n\nexport default () => useContext(__RouterContext)\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport { Typography, colors } from '@mui/material'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexGrow: 0,\n flexShrink: 0,\n borderRadius: theme.shape.borderRadius,\n lineHeight: '10px',\n fontSize: '10px',\n height: 20,\n minWidth: 20,\n whiteSpace: 'nowrap',\n padding: theme.spacing(0.5, 1)\n },\n rounded: {\n borderRadius: 10,\n padding: theme.spacing(0.5)\n }\n}))\n\nconst Label = (props) => {\n const { className, variant, color, shape, children, style, ...rest } = props\n\n const classes = useStyles()\n\n const rootClassName = clsx(\n {\n [classes.root]: true,\n [classes.rounded]: shape === 'rounded'\n },\n className\n )\n\n const finalStyle = { ...style }\n\n if (variant === 'contained') {\n finalStyle.backgroundColor = color\n finalStyle.color = '#FFF'\n } else {\n finalStyle.border = `1px solid ${color}`\n finalStyle.color = color\n }\n\n return (\n \n {children}\n \n )\n}\n\nLabel.propTypes = {\n children: PropTypes.node,\n className: PropTypes.string,\n color: PropTypes.string,\n shape: PropTypes.oneOf(['square', 'rounded']),\n style: PropTypes.object,\n variant: PropTypes.oneOf(['contained', 'outlined'])\n}\n\nLabel.defaultProps = {\n style: {},\n color: colors.grey[600],\n variant: 'contained',\n shape: 'square'\n}\n\nexport default Label\n","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport {\n Button,\n Chip,\n Collapse,\n Divider,\n Drawer,\n FormControlLabel,\n Radio,\n RadioGroup,\n Slider,\n TextField,\n Typography\n} from '@mui/material'\nimport { ToggleButton, ToggleButtonGroup } from '@mui/lab'\nimport ExpandLessIcon from '@mui/icons-material/ExpandLess'\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore'\nimport CloseIcon from '@mui/icons-material/Close'\nimport DeleteIcon from '@mui/icons-material/DeleteOutlined'\nimport AddIcon from '@mui/icons-material/Add'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n height: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n drawer: {\n width: 420,\n maxWidth: '100%'\n },\n header: {\n padding: theme.spacing(2, 1),\n display: 'flex',\n justifyContent: 'space-between'\n },\n buttonIcon: {\n marginRight: theme.spacing(1)\n },\n content: {\n padding: theme.spacing(0, 3),\n flexGrow: 1\n },\n contentSection: {\n padding: theme.spacing(2, 0)\n },\n contentSectionHeader: {\n display: 'flex',\n justifyContent: 'space-between',\n cursor: 'pointer'\n },\n contentSectionContent: {},\n formGroup: {\n padding: theme.spacing(2, 0)\n },\n fieldGroup: {\n display: 'flex',\n alignItems: 'center'\n },\n field: {\n marginTop: 0,\n marginBottom: 0\n },\n flexGrow: {\n flexGrow: 1\n },\n addButton: {\n marginLeft: theme.spacing(1)\n },\n tags: {\n marginTop: theme.spacing(1)\n },\n minAmount: {\n marginRight: theme.spacing(3)\n },\n maxAmount: {\n marginLeft: theme.spacing(3)\n },\n radioGroup: {},\n actions: {\n padding: theme.spacing(3),\n '& > * + *': {\n marginTop: theme.spacing(2)\n }\n }\n}))\n\nconst Filter = (props) => {\n const { open, onClose, onFilter, className, ...rest } = props\n\n const classes = useStyles()\n\n const initialValues = {\n paymentStatus: '',\n tag: '',\n tags: ['Full-Time'],\n amount: [1, 7],\n projectStatus: 'ended',\n customerName: '',\n customerType: 'freelancer',\n customerEmail: '',\n customerPhone: '',\n customerAge: ''\n }\n\n const [expandProject, setExpandProject] = useState(true)\n const [expandCustomer, setExpandCustomer] = useState(false)\n const [values, setValues] = useState({ ...initialValues })\n\n const handleClear = () => {\n setValues({ ...initialValues })\n }\n\n const handleFieldChange = (event, field, value) => {\n event.persist && event.persist()\n setValues((values) => ({\n ...values,\n [field]: value\n }))\n }\n\n const handleTagAdd = () => {\n setValues((values) => {\n const newValues = { ...values }\n\n if (newValues.tag && !newValues.tags.includes(newValues.tag)) {\n newValues.tags = [...newValues.tags]\n newValues.tags.push(newValues.tag)\n }\n\n newValues.tag = ''\n\n return newValues\n })\n }\n\n const handleTagDelete = (tag) => {\n setValues((values) => {\n const newValues = { ...values }\n\n newValues.tags = newValues.tags.filter((t) => t !== tag)\n\n return newValues\n })\n }\n\n const handleToggleProject = () => {\n setExpandProject((expandProject) => !expandProject)\n }\n\n const handleToggleCustomer = () => {\n setExpandCustomer((expandCustomer) => !expandCustomer)\n }\n\n const handleSubmit = (event) => {\n event.preventDefault()\n onFilter && onFilter(values)\n }\n\n const paymentStatusOptions = ['Pending', 'Canceled', 'Completed', 'Rejected']\n const customerAgeOption = ['18 - 30', '30 - 45', '50 - 60', '60+']\n\n return (\n \n \n \n )\n}\n\nFilter.propTypes = {\n className: PropTypes.string,\n onClose: PropTypes.func,\n onFilter: PropTypes.func,\n open: PropTypes.bool.isRequired\n}\n\nexport default Filter\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport { Paper, Button, Input } from '@mui/material'\nimport SearchIcon from '@mui/icons-material/Search'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n display: 'flex',\n alignItems: 'center'\n },\n search: {\n flexGrow: 1,\n height: 42,\n padding: theme.spacing(0, 2),\n display: 'flex',\n alignItems: 'center'\n },\n searchIcon: {\n marginRight: theme.spacing(2),\n color: theme.palette.icon\n },\n searchInput: {\n flexGrow: 1\n },\n searchButton: {\n marginLeft: theme.spacing(2)\n }\n}))\n\nconst Search = (props) => {\n const { onSearch, className, ...rest } = props\n\n const classes = useStyles()\n\n return (\n \n
\n \n \n \n
\n
\n )\n}\n\nSearch.propTypes = {\n className: PropTypes.string,\n onSearch: PropTypes.func\n}\n\nexport default Search\n","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport { Grid, Button } from '@mui/material'\nimport FilterListIcon from '@mui/icons-material/FilterList'\n\nimport { Search, Filter } from './components'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexWrap: 'wrap'\n },\n search: {\n flexGrow: 1,\n maxWidth: 480,\n flexBasis: 480\n },\n filterButton: {\n marginLeft: 'auto'\n },\n filterIcon: {\n marginRight: theme.spacing(1)\n }\n}))\n\nconst SearchBar = (props) => {\n const { onFilter, onSearch, className, ...rest } = props\n\n const classes = useStyles()\n\n const [openFilter, setOpenFilter] = useState(false)\n\n const handleFilterOpen = () => {\n setOpenFilter(true)\n }\n\n const handleFilterClose = () => {\n setOpenFilter(false)\n }\n\n return (\n \n \n \n \n \n \n \n \n \n )\n}\n\nSearchBar.propTypes = {\n className: PropTypes.string,\n onFilter: PropTypes.func,\n onSearch: PropTypes.func\n}\n\nexport default SearchBar\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport { Typography } from '@mui/material'\n\nconst useStyles = makeStyles(() => ({\n root: {}\n}))\n\nconst Header = (props) => {\n const { className, ...rest } = props\n\n const classes = useStyles()\n\n return (\n \n \n {props.subtitle}\n \n \n {props.title}\n \n
\n )\n}\n\nHeader.propTypes = {\n className: PropTypes.string,\n subtitle: PropTypes.string,\n title: PropTypes.string.isRequired\n}\n\nexport default Header\n","import React from 'react'\nimport cx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport Card from '@mui/material/Card'\nimport Button from '@mui/material/Button'\nimport { Column, Item } from '@mui-treasury/components/flex'\nimport { Info, InfoTitle, InfoSubtitle } from '@mui-treasury/components/info'\nimport { useSoftRiseShadowStyles } from '@mui-treasury/styles/shadow/softRise'\nimport { Hidden } from '@mui/material'\n\nconst useStyles = makeStyles((theme) => ({\n card: {\n position: 'relative',\n borderRadius: 16,\n padding: 12,\n backgroundColor: '#f8f7ef',\n minWidth: 300\n },\n learnMore: {\n backgroundColor: '#fed42c !important',\n color: '#575754',\n borderRadius: 20,\n minWidth: 120,\n minHeight: 42,\n textTransform: 'initial',\n fontSize: '0.875rem',\n fontWeight: 700,\n letterSpacing: 0\n },\n img: {\n position: 'absolute',\n width: '10%',\n bottom: '40%',\n right: '25%',\n display: 'block'\n },\n img2: {\n position: 'absolute',\n width: '20%',\n bottom: 0,\n right: 0,\n display: 'block'\n },\n shell: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n transform: 'translate(70%, 50%)',\n borderRadius: '50%',\n backgroundColor: 'rgba(167, 153, 71, 0.12)',\n padding: '40%',\n '&:before': {\n position: 'absolute',\n borderRadius: '50%',\n content: '\"\"',\n display: 'block',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n margin: '-16%',\n backgroundColor: 'rgba(167, 149, 71, 0.08)'\n }\n }\n}))\n\nconst useOfferInfoStyles = makeStyles(() => {\n return {\n title: {\n color: '#545454',\n fontSize: '1.125rem',\n fontWeight: 700\n },\n subtitle: {\n color: '#7e7e7e',\n fontSize: '0.875rem',\n fontWeight: 500\n }\n }\n})\n\nexport const PickbusBanner = React.memo(function OfferCard() {\n const styles = useStyles()\n const shadowStyles = useSoftRiseShadowStyles()\n return (\n <>\n \n \n \n \n Que tal disponibilizar um transporte para seu evento?\n \n \n A ferramenta que veio para facilitar e agilizar a organização de\n transportes fretados!\n \n \n - \n \n
\n \n \n
\n
\n \n \n \n >\n )\n})\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport { Tooltip } from '@mui/material'\nimport HelpOutlineRoundedIcon from '@mui/icons-material/HelpOutlineRounded'\nconst useStyles = makeStyles((theme) => ({\n root: {\n display: 'flex',\n paddingLeft: theme.spacing(1)\n },\n icon: {\n fontSize: 14,\n '&:hover': {\n color: theme.palette.primary.main,\n cursor: 'help'\n }\n }\n}))\n\nconst HelperToolTip = (props) => {\n const { className, ...rest } = props\n\n const classes = useStyles()\n\n return (\n \n \n \n \n
\n )\n}\n\nHelperToolTip.propTypes = {\n children: PropTypes.node.isRequired\n}\n\nexport default HelperToolTip\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n padding: theme.spacing(4)\n },\n icon: {\n width: '18px',\n height: '18px',\n position: 'relative',\n top: '3px'\n }\n}))\n\nconst Footer = (props) => {\n const { className, ...rest } = props\n\n const classes = useStyles()\n\n return (\n \n \n
\n )\n}\n\nFooter.propTypes = {\n className: PropTypes.string\n}\n\nexport default Footer\n","import { createBrowserHistory } from 'history'\nexport const history = createBrowserHistory()\n","export const slugMask = (value) => {\n if (value !== null && value !== undefined) {\n return value\n .normalize('NFD')\n .replace(/(^-+|-+$)/, '') // Remove hífens extras do final ou do inicio da string\n .replace(/[\\u0300-\\u036f]/g, '') // Remove acentos\n .replace(/([^\\w]+|\\s+)/g, '-') // Substitui espaço e outros caracteres por hífen\n .replace(/\\-\\-+/g, '-') // Substitui multiplos hífens por um único hífen\n .toLowerCase() //tudo em letra minuscula\n }\n}\n\nexport const cpfCnpjMask = (value) => {\n if (value !== null && value !== undefined) {\n if (value.length === 14 && value.includes('-')) {\n return cpfMask(value)\n }\n if (value.length >= 14) {\n return cnpjMask(value)\n } else {\n return cpfMask(value)\n }\n }\n}\n\nexport const cpfMask = (value) => {\n if (value !== null && value !== undefined) {\n return value\n .replace(/\\D/g, '') // substitui qualquer caracter que nao seja numero por nada\n .replace(/(\\d{3})(\\d)/, '$1.$2') // captura 2 grupos de numero o primeiro de 3 e o segundo de 1, apos capturar o primeiro grupo ele adiciona um ponto antes do segundo grupo de numero\n .replace(/(\\d{3})(\\d)/, '$1.$2')\n .replace(/(\\d{3})(\\d{1,2})/, '$1-$2')\n .replace(/(-\\d{2})\\d+?$/, '$1') // captura 2 numeros seguidos de um traço e não deixa ser digitado mais nada\n }\n}\nexport const cnpjMask = (value) => {\n if (value !== null && value !== undefined) {\n return value\n .replace(/\\D/g, '')\n .replace(/(\\d{2})(\\d)/, '$1.$2')\n .replace(/(\\d{3})(\\d)/, '$1.$2')\n .replace(/(\\d{3})(\\d)/, '$1/$2')\n .replace(/(\\d{4})(\\d)/, '$1-$2')\n .replace(/(-\\d{2})\\d+?$/, '$1')\n }\n}\n\nexport const phoneMask = (value) => {\n if (value !== null && value !== undefined) {\n return value\n .replace(/\\D/g, '')\n .replace(/(\\d{2})(\\d)/, '($1) $2')\n .replace(/(\\d{4})(\\d)/, '$1-$2')\n .replace(/(\\d{4})-(\\d)(\\d{4})/, '$1$2-$3')\n .replace(/(-\\d{4})\\d+?$/, '$1')\n }\n}\n\nexport const cepMask = (value) => {\n if (value !== null && value !== undefined) {\n return value\n .replace(/\\D/g, '')\n .replace(/(\\d{5})(\\d)/, '$1-$2')\n .replace(/(-\\d{3})\\d+?$/, '$1')\n }\n}\n\nexport const pisMask = (value) => {\n if (value !== null && value !== undefined) {\n return value\n .replace(/\\D/g, '')\n .replace(/(\\d{3})(\\d)/, '$1.$2')\n .replace(/(\\d{5})(\\d)/, '$1.$2')\n .replace(/(\\d{5}\\.)(\\d{2})(\\d)/, '$1$2-$3')\n .replace(/(-\\d{1})\\d+?$/, '$1')\n }\n}\n\nexport const dataMask = (value) => {\n if (value !== null && value !== undefined) {\n return value\n .replace(/\\D/g, '')\n .replace(/(\\d{2})(\\d)/, '$1/$2')\n .replace(/(\\d{2})(\\d)/, '$1/$2')\n .replace(/(\\d{2})(\\d{2})$/, '$1$2')\n }\n}\n","export function getNomeEvento(evento) {\n try {\n if (evento.tipo == \"1\") {\n return \"PENDENTE\";\n } else if (evento.tipo == \"2\") {\n return \"RECEBENDO ORÇAMENTOS\";\n } else if (evento.tipo == \"3\") {\n return \"ORÇAMENTO APROVADO\";\n } else if (evento.tipo == \"4\") {\n return \"RECUSADA\";\n } else if (evento.tipo == \"5\") {\n return \"CONCLUÍDA\";\n } else if (evento.tipo == \"6\") {\n return \"AVALIADO\";\n } else {\n return \"STATUS INDEFINIDO\";\n }\n } catch (err) {\n return \"\";\n }\n}\n\nexport function getNomeUltimoEvento(ultimoEvento) {\n try {\n if (ultimoEvento == \"1\") {\n return \"PENDENTE\";\n } else if (ultimoEvento == \"2\") {\n return \"RECEBENDO ORÇAMENTOS\";\n } else if (ultimoEvento == \"3\") {\n return \"ORÇAMENTO APROVADO\";\n } else if (ultimoEvento == \"4\") {\n return \"RECUSADA\";\n } else if (ultimoEvento == \"5\") {\n return \"CONCLUÍDA\";\n } else if (ultimoEvento == \"6\") {\n return \"AVALIADO\";\n } else {\n return \"STATUS INDEFINIDO\";\n }\n } catch (err) {\n return \"\";\n }\n}\n\nexport function getCor(ultimoEvento) {\n try {\n if (ultimoEvento == \"1\") {\n return \"#9E9E9E\";\n } else if (ultimoEvento == \"2\") {\n return \"#673AB7\";\n } else if (ultimoEvento == \"3\") {\n return \"#2196F3\";\n } else if (ultimoEvento == \"4\") {\n return \"#FF5722\";\n } else if (ultimoEvento == \"5\") {\n return \"#4CAF50\";\n } else if (ultimoEvento == \"6\") {\n return \"#FF9800\";\n } else {\n return \"STATUS INDEFINIDO\";\n }\n } catch (err) {\n return \"\";\n }\n}\n","import { toast } from 'react-toastify'\n\nexport default function ErrorsUploadImage(erros) {\n if (erros.acceptType === true) {\n toast.error(`Opss! Tipo de arquivo inválido! 😥`)\n } else if (erros.maxFileSize === true) {\n toast.error(`Opss! A imagem é muito grande! 😥`)\n } else if (erros.maxNumber === true) {\n toast.error(`Opss! Quantidade de imagens excedida! 😥`)\n } else if (erros.resolution === true) {\n toast.error(`Opss! A resolução da imagem é incorreta! 😥`)\n }\n}\n","import React from 'react'\n\nexport const useDidMountEffect = (effect, dependencies) => {\n const mounted = React.useRef(false)\n React.useEffect(() => {\n if (mounted.current) {\n const unmount = effect()\n return () => unmount && unmount()\n } else {\n mounted.current = true\n }\n }, dependencies)\n\n React.useEffect(() => {\n return () => (mounted.current = false)\n }, [])\n}\n\n// hook usado para renderizar o componente somente quando state sofre alguma mudança,\n// não dispara na criação do componente como o useEffect() padrão\n","export const stringUtils = {\n serialize,\n toInputUppercase,\n toInputLowerCase\n};\n\nfunction serialize(obj) {\n let str = '?' + Object.keys(obj).reduce(function (a, k) {\n a.push(k + '=' + encodeURIComponent(obj[k]));\n return a;\n }, []).join('&');\n return str;\n}\n\nfunction toInputUppercase(e) {\n var start = e.target.selectionStart;\n var end = e.target.selectionEnd;\n e.target.value = e.target.value.toUpperCase();\n e.target.setSelectionRange(start, end);\n};\n\nfunction toInputLowerCase(e) {\n var start = e.target.selectionStart;\n var end = e.target.selectionEnd;\n e.target.value = e.target.value.toLowerCase();\n e.target.setSelectionRange(start, end);\n};\n","import { toast } from 'react-toastify'\nimport { history } from '../utils'\n\nexport function errorHandler(error) {\n if (error.response.status === 400) {\n if (error.response.data != null) {\n toast.error(error.response.data, {\n autoClose: 6600\n })\n }\n else\n {\n toast.error(`Opss! Algo deu errado 😥`, {\n autoClose: 6600\n })\n }\n\n return Promise.reject(error.response || error.message)\n }\n if (error.response.status === 403) {\n toast.error(`Sem permissão para realizar essa operação! 🔐`)\n return Promise.reject(error.response || error.message)\n }\n if (error.response.status === 401) {\n localStorage.removeItem('token')\n localStorage.removeItem('user')\n localStorage.removeItem('expires')\n history.push('/login')\n return Promise.reject(error)\n }\n if (error.response.status === 404) {\n toast.error(`Opss! ${error.response.data} 😥`)\n return Promise.reject(error.response || error.message)\n }\n return Promise.reject(error.response || error.message)\n}\n","import axios from 'axios'\nimport config from '../config/config'\nimport { errorHandler } from './errorHandler'\nimport { toast } from 'react-toastify'\n\nexport const authServices = {\n post,\n logout\n}\n\nfunction post(apiEndpoint, payload) {\n return axios\n .post(config.baseUrl + apiEndpoint, payload)\n .then((response) => {\n localStorage.setItem('user', JSON.stringify(response.data.usuario))\n localStorage.setItem('token', response.data.token)\n localStorage.setItem('expires', response.data.expires)\n return response\n })\n .catch((error) => {\n if (error.response.data === '') {\n toast.error('Opss! Problema ao autenticar usuário! 😥')\n } else {\n return errorHandler(error)\n }\n })\n}\n\nfunction logout() {\n // remove user from local storage to log user out\n localStorage.removeItem('token')\n localStorage.removeItem('user')\n localStorage.removeItem('expires')\n}\n","import axios from 'axios'\nimport config from '../config/config'\nimport { toast } from 'react-toastify'\nimport { errorHandler } from './errorHandler'\n\nexport const crudService = {\n get,\n post,\n postWithToken,\n put,\n deleteDetail\n}\n\nfunction get(apiEndpoint) {\n return axios\n .get(config.baseUrl + apiEndpoint, getOptions())\n .then((response) => {\n return response\n })\n .catch((error) => {\n return errorHandler(error)\n })\n}\n\nfunction post(apiEndpoint, payload) {\n return axios\n .post(config.baseUrl + apiEndpoint, payload, getOptions())\n .then((response) => {\n return response\n })\n .catch((error) => {\n return errorHandler(error)\n })\n}\n\nfunction postWithToken(apiEndpoint, payload, token) {\n let options = {}\n if (token) {\n options.headers = { 'Authorization': 'Bearer ' + token, 'Cache-Control': 'no-cache' };\n } else {\n options.headers = { 'Cache-Control': 'no-cache' };\n }\n\n return axios\n .post(config.baseUrl + apiEndpoint, payload, options)\n .then((response) => {\n return response\n })\n .catch((error) => {\n return errorHandler(error)\n })\n}\n\nfunction put(apiEndpoint, payload) {\n return axios\n .put(config.baseUrl + apiEndpoint, payload, getOptions())\n .then((response) => {\n toast.success('Feito! Dados alterados com sucesso! 😎')\n return response\n })\n .catch((error) => {\n return errorHandler(error)\n })\n}\n\nfunction deleteDetail(apiEndpoint) {\n return axios\n .delete(config.baseUrl + apiEndpoint, getOptions())\n .then((response) => {\n toast.success('Feito! Registro excluído com sucesso! 😎')\n return response\n })\n .catch((error) => {\n return errorHandler(error)\n })\n}\n\nfunction getOptions() {\n let options = {}\n if (localStorage.getItem('token')) {\n options.headers = { 'Authorization': 'Bearer ' + localStorage.getItem('token'), 'Cache-Control': 'no-cache' };\n } else {\n options.headers = { 'Cache-Control': 'no-cache' };\n }\n return options\n}\n","import axios from 'axios'\nimport { errorHandler } from './errorHandler'\nimport config from '../config/config'\nimport Resizer from \"react-image-file-resizer\";\n\nexport async function uploadImage(payload) {\n const data = new FormData()\n var compress_image = await resizeFile(payload.file)\n data.append('file', compress_image, payload.name)\n\n return axios\n .post(config.baseUrl + 'uploads/S3', data, getOptions())\n .then((response) => {\n return response.data.url\n })\n .catch((error) => {\n console.log('error', error)\n return errorHandler(error)\n })\n}\n\n\n const resizeFile = (file) =>\n new Promise((resolve) => {\n Resizer.imageFileResizer(\n file,\n 1000,\n 1000,\n \"JPEG\",\n 97,\n 0,\n (uri) => {\n resolve(uri);\n },\n \"blob\"\n );\n }); \n\n//export function getUrl(key) {\n// if (key != null && key.includes('/')) {\n// key = key.substr(key.lastIndexOf('/') + 1, key.length - key.lastIndexOf('/'));\n// console.log('key', key)\n// }\n// return axios\n// .get(config.baseUrl + 'uploads/S3/url/' + key, getOptions())\n// .then((response) => {\n// console.log('response', response)\n// return response.data\n// })\n// .catch((error) => {\n// console.log('error', error)\n// return errorHandler(error)\n// })\n//}\n\nfunction getOptions() {\n let options = {}\n if (localStorage.getItem('token')) {\n options.headers = {\n Authorization: 'Bearer ' + localStorage.getItem('token')\n }\n }\n return options\n}\n","import { authServices, crudService } from '../_services/'\nimport { history } from '../utils'\nimport { toast } from 'react-toastify'\n\nexport const authActions = {\n login,\n isGestor,\n isPrefeitura,\n isEmpresa,\n isMotorista,\n isFiscal,\n refresh,\n logout\n}\n\nfunction login(username, password) {\n return (dispatch) => {\n dispatch(request({ username }))\n let apiEndpoint = 'authentication/login'\n let payload = {\n login: username,\n senha: password,\n admin: true\n }\n authServices\n .post(apiEndpoint, payload) \n .then((response) => {\n dispatch(success(response.data))\n history.push('/dashboard')\n })\n .catch((err) => {\n dispatch(failure(err))\n })\n }\n\n function request(user) {\n return { type: 'LOGIN_REQUEST', user }\n }\n\n function success(user) {\n return {\n type: 'LOGIN_SUCCESS',\n token: user.token,\n expires: user.expires,\n user: user.usuario\n }\n }\n\n function failure(error) {\n return { type: 'LOGIN_FAILURE', error }\n }\n}\n\nfunction refresh() {\n return (dispatch) => {\n const token = localStorage.getItem('token')\n if (token !== null && token !== undefined) {\n dispatch(request(token))\n let apiEndpoint = 'authentication/refresh?admin=true'\n crudService\n .post(apiEndpoint)\n .then((response) => {\n dispatch(success(response.data))\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(logout())\n })\n }\n }\n\n function request(token) {\n return { type: 'AUTHENTICATION_REFRESH_REQUEST', token }\n }\n\n function success(user) {\n return {\n type: 'AUTHENTICATION_REFRESH_SUCCESS',\n user: user.usuario\n }\n }\n\n function failure(error) {\n return { type: 'AUTHENTICATION_REFRESH_FAILURE', error }\n }\n}\n\nfunction isGestor() {\n const isGestor = (JSON.parse(localStorage.getItem('user'))[\"idTipoUsuario\"] == 1 ? true : false);\n return isGestor;\n}\n\nfunction isMotorista() {\n const isMotorista = (JSON.parse(localStorage.getItem('user'))[\"idTipoUsuario\"] == 4 ? true : false);\n return isMotorista;\n}\n\nfunction isPrefeitura() {\n const isPrefeitura = (JSON.parse(localStorage.getItem('user'))[\"idTipoUsuario\"] == 2 ? true : false);\n return isPrefeitura;\n}\n\nfunction isFiscal() {\n const isFiscal = (JSON.parse(localStorage.getItem('user'))[\"idTipoUsuario\"] == 5 ? true : false);\n return isFiscal;\n}\n\nfunction isEmpresa() {\n const isEmpresa = (JSON.parse(localStorage.getItem('user'))[\"idTipoUsuario\"] == 3 ? true : false);\n return isEmpresa;\n}\n\nfunction logout() {\n return (dispatch) => {\n authServices.logout()\n dispatch(logoutUser())\n history.push('/login')\n }\n}\nexport function setUserDetails(user) {\n return {\n type: 'LOGIN_SUCCESS',\n auth: user.auth,\n token: user.token,\n expires: user.expires,\n user: user.usuario\n }\n}\nexport function logoutUser() {\n return {\n type: 'LOGOUT_SUCCESS'\n }\n}\n","import { crudService } from '../_services/'\n\nexport const cidadeAction = {\n getCidade,\n getCidadesSelect,\n getCidadeByUf,\n getCidadeByIdEstado,\n addCidade,\n getCidadeById,\n onChangeProps,\n changeDetailsCidade,\n editCidadeInfo,\n editCidadesDetails,\n createCidade,\n deleteCidadeById,\n clear,\n clearAll\n}\n\nfunction getCidade() {\n return (dispatch) => {\n let apiEndpoint = 'cidades'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeCidadesList(response.data))\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getCidadesSelect() {\n return (dispatch) => {\n let apiEndpoint = 'cidades/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeCidadesList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getCidadeByUf(uf) {\n return (dispatch) => {\n let apiEndpoint = 'cidades/select/uf/' + uf\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n dispatch(changeCidadesList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getCidadeByIdEstado(idEstado) {\n //console.log(\"entrei aqui\", idEstado)\n return (dispatch) => {\n let apiEndpoint = 'cidades/select/estado/' + idEstado\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n dispatch(changeCidadesList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction createCidade(payload) {\n return (dispatch) => {\n let apiEndpoint = 'cidades/'\n crudService.post(apiEndpoint, payload).then(() => {\n dispatch(createCidadeInfo())\n dispatch(clear())\n })\n }\n}\n\nfunction getCidadeById(id) {\n return (dispatch) => {\n let apiEndpoint = 'cidades/' + id\n crudService.get(apiEndpoint).then((response) => {\n dispatch(editCidadesDetails(response.data))\n })\n }\n}\n\nfunction changeDetailsCidade(cidade) {\n return (dispatch) => {\n if (cidade) {\n dispatch(onChangeDetailsCidade(cidade))\n } else {\n clear()\n }\n }\n}\n\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n}\n\nfunction editCidadeInfo(id, payload) {\n return (dispatch) => {\n let apiEndpoint = 'cidades/' + id\n crudService.put(apiEndpoint, payload).then(() => {\n dispatch(updatedCidadeInfo())\n dispatch(clear())\n })\n }\n}\n\nfunction deleteCidadeById(id) {\n return (dispatch) => {\n let apiEndpoint = 'cidades/' + id\n crudService.deleteDetail(apiEndpoint).then(() => {\n dispatch(deleteCidadesDetails())\n dispatch(getCidade())\n })\n }\n}\n\nexport function addCidade(payload) {\n return [{ type: 'ADD_CIDADE', cidade: payload }, clear()]\n}\n\nexport function changeCidadesList(cidade) {\n return {\n type: 'FETCHED_ALL_CIDADE',\n cidade: cidade\n }\n}\n\nexport function clear() {\n return {\n type: 'CIDADE_CLEAR'\n }\n}\n\nexport function clearAll() {\n return {\n type: 'CIDADE_CLEAR_ALL'\n }\n}\n\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'CIDADE_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\n\nexport function editCidadesDetails(cidade) {\n return {\n type: 'CIDADE_DETAIL',\n id: cidade.id,\n nome: cidade.nome,\n idEstado: cidade.idEstado,\n ibge: cidade.ibge,\n estado: cidade.estado\n }\n}\n\nexport function updatedCidadeInfo() {\n return {\n type: 'CIDADE_UPDATED'\n }\n}\n\nexport function createCidadeInfo() {\n return {\n type: 'CIDADE_CREATED_SUCCESSFULLY'\n }\n}\n\nexport function deleteCidadesDetails() {\n return {\n type: 'DELETED_CIDADE_DETAILS'\n }\n}\n\nexport function onChangeDetailsCidade(cidade) {\n return [\n {\n type: 'CHANGE_DETAILS_CIDADE',\n id: cidade.id,\n nome: cidade.nome,\n idEstado: cidade.idEstado,\n ibge: cidade.ibge\n }\n ]\n}\n","import { crudService } from '../_services/'\n\nexport const tipoUsuarioAction = {\n getTiposUsuarioSelect\n}\n\nfunction getTiposUsuarioSelect() {\n return (dispatch) => {\n let apiEndpoint = 'tiposUsuarios/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n dispatch(changeTiposUsuariosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nexport function changeTiposUsuariosList(tipoUsuario) {\n return {\n type: 'FETCHED_ALL_TIPO_USUARIO',\n tipoUsuario: tipoUsuario\n }\n}\n\n","import { crudService } from '../_services'\n\nexport const dashboardAction = {\n getDashboard,\n getDashboardGraficoOrdensServico,\n clear\n}\n\nfunction getDashboard() {\n return (dispatch) => {\n dispatch(request())\n let apiEndpoint = 'dashboard'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(success(response.data))\n })\n .catch((error) => {\n dispatch(failure(error))\n })\n }\n\n function request() {\n return {\n type: 'FETCHED_DASHBOARD_REQUEST'\n }\n }\n\n function success(dashboardResponse) {\n return {\n type: 'FETCHED_DASHBOARD_SUCCESS',\n dashboard: dashboardResponse\n }\n }\n\n function failure(error) {\n return { type: 'FETCHED_DASHBOARD_FAILURE', error }\n }\n}\n\nfunction getDashboardGraficoOrdensServico() {\n return (dispatch) => {\n dispatch(request())\n let apiEndpoint = 'dashboard/graficoOrdensServico';\n crudService\n .get(apiEndpoint)\n .then((response) => {\n //console.log(\"response\", response)\n dispatch(success(response.data.items, response.data.totalRows))\n })\n .catch((error) => {\n dispatch(failure(error))\n })\n }\n function request() {\n return {\n type: 'FETCHED_DASHBOARD_GRAFICO_ORDENS_SERVICO_REQUEST'\n }\n }\n\n function success(ordensServico, totalOrdensServico) {\n return {\n type: 'FETCHED_DASHBOARD_GRAFICO_ORDENS_SERVICO_SUCCESS',\n ordensServico: ordensServico,\n totalOrdensServico: totalOrdensServico\n }\n }\n\n function failure(error) {\n return { type: 'FETCHED_DASHBOARD_GRAFICO_ORDENS_SERVICO_FAILURE', error }\n }\n\n}\n\nexport function clear() {\n return {\n type: 'DASHBOARD_CLEAR'\n }\n}\n","import { crudService } from '../_services/'\nimport { stringUtils } from 'utils'\nimport { history } from '../utils'\nimport { toast } from 'react-toastify'\n\nexport const empresaAction = {\n getEmpresa,\n getEmpresaSelect,\n addEmpresa,\n getEmpresaById,\n onChangeProps,\n editEmpresaInfo,\n editAprovaCadastroEmpresa,\n editRecusaCadastroEmpresa,\n editEmpresasDetails,\n createEmpresa,\n changeDetailsEmpresa,\n deleteEmpresaById,\n clear,\n clearAll,\n clearUsuariosEmpresas\n}\n\nlet filterModel = {\n Page: 0,\n Limit: 10,\n Term: ''\n};\n\nfunction getEmpresa(filterModel, showWaiting) {\n return (dispatch) => {\n let apiEndpoint = 'empresas' + stringUtils.serialize(filterModel);\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeEmpresasList(response.data.items, response.data.totalRows))\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getEmpresaSelect() {\n return (dispatch) => {\n let apiEndpoint = 'empresas/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeEmpresasList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction createEmpresa(payload) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'empresas/'\n crudService\n .post(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n dispatch(createEmpresaInfo())\n // toast.success('Empresa criada com sucesso! 😎')\n dispatch(clear())\n dispatch(notIsLoading())\n history.push('/empresas')\n }\n })\n .catch((err) => {\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao cadastrar usuário! 😥')\n })\n }\n}\n\nfunction editAprovaCadastroEmpresa(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'empresas/aprova/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/empresas')\n } else {\n // toast.error('Oops! Erro ao alterar empresa! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar empresa! 😥')\n })\n }\n\n function failure(error) {\n return { type: 'EDIT_ORGAO_FAILURE', error }\n }\n}\n\nfunction editRecusaCadastroEmpresa(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'empresas/recusa/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/empresas')\n } else {\n // toast.error('Oops! Erro ao alterar empresa! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar empresa! 😥')\n })\n }\n}\n\nfunction getEmpresaById(id) {\n return (dispatch) => {\n let apiEndpoint = 'empresas/' + id\n crudService.get(apiEndpoint).then((response) => {\n dispatch(editEmpresasDetails(response.data))\n })\n }\n}\n\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n if (event.target.type === 'checkbox') {\n dispatch(handleOnChangeProps(props, event.target.checked))\n } else {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n }\n}\nfunction changeDetailsEmpresa(empresa) {\n return (dispatch) => {\n if (empresa) {\n dispatch(onChangeDetailsEmpresa(empresa))\n } else {\n clear()\n }\n }\n}\n\nexport function onChangeDetailsEmpresa(empresa) {\n return [\n {\n type: 'CHANGE_DETAILS_EMPRESA',\n id: empresa.id,\n nome: empresa.nome\n }\n ]\n}\n\nfunction editEmpresaInfo(id, payload) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'empresas/' + id\n crudService\n .put(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n dispatch(clear())\n dispatch(notIsLoading())\n history.push('/empresas')\n } else {\n // toast.err('Oops! Erro ao cadastrar empresa! 😥')\n }\n })\n }\n}\n\nfunction deleteEmpresaById(id) {\n return (dispatch) => {\n let apiEndpoint = 'empresas/' + id\n crudService.deleteDetail(apiEndpoint).then(() => {\n dispatch(deleteEmpresasDetails())\n dispatch(getEmpresa(filterModel))\n history.push('/empresas')\n })\n }\n}\n\nexport function addEmpresa(payload) {\n return [{ type: 'ADD_EMPRESA', empresa: payload }, clear()]\n}\n\nexport function changeEmpresasList(empresa, totalRows) {\n return {\n type: 'FETCHED_ALL_EMPRESA',\n empresa: empresa,\n totalRegistros: totalRows\n }\n}\n\nexport function clear() {\n return {\n type: 'EMPRESA_CLEAR'\n }\n}\n\nexport function clearAll() {\n return {\n type: 'EMPRESA_CLEAR_ALL'\n }\n}\n\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'EMPRESA_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\n\nexport function editEmpresasDetails(empresa) {\n return {\n type: 'EMPRESA_DETAIL',\n id: empresa.id,\n razaoSocial: empresa.razaoSocial,\n nomeFantasia: empresa.nomeFantasia,\n cnpj: empresa.cnpj,\n telefone: empresa.telefone,\n celular: empresa.celular,\n email: empresa.email,\n endereco: empresa.endereco,\n inscricaoEstadual: empresa.inscricaoEstadual,\n idCidade: empresa.idCidade,\n idEstado: empresa.idEstado,\n usuariosEmpresas: empresa.usuariosEmpresas,\n empresasOrgaos: empresa.empresasOrgaos,\n fornecedor: empresa.fornecedor,\n prestadorServico: empresa.prestadorServico,\n cadastroLiberado: empresa.cadastroLiberado\n }\n}\n\nexport function updatedEmpresaInfo() {\n return {\n type: 'EMPRESA_UPDATED'\n }\n}\n\nfunction failure(error) {\n return { type: 'EDIT_EMPRESA_FAILURE', error }\n}\n\nexport function createEmpresaInfo() {\n return {\n type: 'EMPRESA_CREATED_SUCCESSFULLY'\n }\n}\n\nexport function deleteEmpresasDetails() {\n return {\n type: 'DELETED_EMPRESA_DETAILS'\n }\n}\nexport function isLoading() {\n return {\n type: 'EMPRESA_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'EMPRESA_NOTISLOADING'\n }\n}\n\nexport function clearUsuariosEmpresas() {\n return {\n type: 'EMPRESA_CLEAR_USUARIOS_EMPRESAS'\n }\n}\n","import { crudService } from '../_services/'\n\nexport const estadoAction = {\n getEstadoSelect\n}\nfunction getEstadoSelect() {\n return (dispatch) => {\n let apiEndpoint = 'estados/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeEstadosList(response.data))\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\nexport function changeEstadosList(estado) {\n return {\n type: 'FETCHED_ALL_ESTADO',\n estado: estado\n }\n}\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\n","import { history } from 'utils'\nimport { crudService } from '../_services'\nimport { stringUtils } from 'utils'\nimport { toast } from 'react-toastify'\n\nexport const marcaAction = {\n getMarca,\n addMarca,\n getMarcaSelect,\n getMarcaById,\n onChangeProps,\n editMarcaInfo,\n editMarcasDetails,\n createMarca,\n deleteMarcaById,\n clear,\n clearAll\n}\n\nlet filterModel = {\n Page: 1,\n Limit: 10,\n Term: ''\n};\n\nfunction getMarca(filterModel, showWaiting) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'marcas' + stringUtils.serialize(filterModel);\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeMarcasList(response.data.items, response.data.totalRows))\n dispatch(notIsLoading())\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getMarcaSelect() {\n return (dispatch) => {\n let apiEndpoint = 'marcas/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n // response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeMarcasList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction createMarca(payload) {\n return (dispatch) => {\n dispatch(isLoading())\n // console.log('entrou na action');\n let apiEndpoint = 'marcas/'\n crudService.post(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n var ret = JSON.parse(response.request.responseText);\n dispatch(createMarcaInfo())\n toast.success('Feito! Cadastro realizado com sucesso! 😎')\n dispatch(clear())\n dispatch(notIsLoading())\n history.push('/marcas')\n } else {\n toast.err('Oops! Erro ao cadastrar marca! 😥')\n }\n }).catch((err) => {\n // console.log(err.response);\n dispatch(notIsLoading())\n toast.error('Oops! Erro ao cadastrar marca! 😥')\n return err.response;\n })\n }\n}\n\nfunction getMarcaById(id) {\n return (dispatch) => {\n let apiEndpoint = 'marcas/' + id\n crudService.get(apiEndpoint).then((response) => {\n // console.log('response.data', response.data)\n dispatch(editMarcasDetails(response.data))\n })\n }\n}\n\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n if (event.target.type === 'checkbox') {\n dispatch(handleOnChangeProps(props, event.target.checked))\n } else {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n }\n}\n\nfunction editMarcaInfo(id, payload, redirect) {\n return (dispatch) => {\n if (redirect) {\n dispatch(isLoading())\n }\n let apiEndpoint = 'marcas/' + id\n crudService.put(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n var ret = JSON.parse(response.request.responseText);\n dispatch(updatedMarcaInfo())\n if (redirect) {\n dispatch(clear())\n dispatch(notIsLoading())\n history.push('/marcas')\n }\n }\n }).catch((err) => {\n dispatch(notIsLoading())\n toast.error('Oops! Erro ao atualizar marca! 😥')\n // console.log(err.response);\n return err.response;\n }\n )\n }\n}\n\nfunction deleteMarcaById(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'marcas/' + id\n crudService.deleteDetail(apiEndpoint).then(() => {\n dispatch(deleteMarcasDetails())\n dispatch(getMarca(filterModel))\n dispatch(notIsLoading())\n })\n }\n}\n\nexport function addMarca(payload) {\n return [{ type: 'ADD_MARCA', marca: payload }, clear()]\n}\n\nexport function changeMarcasList(marca, totalRows) {\n return {\n type: 'FETCHED_ALL_MARCA',\n marca: marca,\n totalRegistros: totalRows\n }\n}\n\nexport function clear() {\n return {\n type: 'MARCA_CLEAR'\n }\n}\n\nexport function clearAll() {\n return {\n type: 'MARCA_CLEAR_ALL'\n }\n}\n\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'MARCA_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\n\nexport function editMarcasDetails(marca) {\n return [\n { type: 'MARCA_DETAIL', marca },\n ]\n}\n\nexport function updatedMarcaInfo() {\n return {\n type: 'MARCA_UPDATED'\n }\n}\n\nexport function createMarcaInfo() {\n return {\n type: 'MARCA_CREATED_SUCCESSFULLY'\n }\n}\n\nexport function deleteMarcasDetails() {\n return {\n type: 'DELETED_MARCA_DETAILS'\n }\n}\nexport function isLoading() {\n return {\n type: 'MARCA_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'MARCA_NOTISLOADING'\n }\n}\n","import { crudService } from '../_services/'\nimport { history } from '../utils'\nimport { toast } from 'react-toastify'\nimport { stringUtils } from 'utils'\n\nexport const ordemServicoAction = {\n getOrdemServico,\n getOrdemServicoSelect,\n getOrdemServicoById,\n onChangeProps,\n editOrdemServicoInfo,\n editOrdemServicoAprova,\n editOrdemServicoAprovaOrcamento,\n editOrdemServicoRecusa,\n editOrdemServicoRecusaOrcamento,\n createOrdemServico,\n deleteOrdemServicoById,\n clear,\n notIsLoading,\n isLoading\n}\n\nlet filterModel = {\n Page: 0,\n Limit: 10,\n Term: ''\n};\n\nfunction getOrdemServico(filterModel, showWaiting) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'ordensServico' + stringUtils.serialize(filterModel);\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeOrdemServicosList(response.data.items, response.data.totalRows))\n dispatch(notIsLoading())\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getOrdemServicoSelect() {\n return (dispatch) => {\n let apiEndpoint = 'ordensServico/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n // response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeOrdemServicosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction createOrdemServico(payload, user) {\n return (dispatch) => {\n dispatch(isLoading())\n dispatch(request(payload))\n let apiEndpoint = 'ordensServico'\n crudService\n .post(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n toast.success('Feito! Cadastro realizado com sucesso! 😎')\n dispatch(clear())\n dispatch(notIsLoading())\n history.push('/ordensServico')\n } else {\n // toast.error('Oops! Erro ao cadastrar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n // console.log('err', err)\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao cadastrar ordem de serviço! 😥')\n })\n }\n\n function request(payload) {\n return { type: 'CREATE_ORDEMSERVICO_REQUEST', payload }\n }\n\n function failure(error) {\n return { type: 'CREATE_ORDEMSERVICO_FAILURE', error }\n }\n}\n\nexport function clear() {\n return {\n type: 'ORDEMSERVICO_CLEAR'\n }\n}\n\nfunction editOrdemServicoInfo(id, payload, redirect) {\n return (dispatch) => {\n dispatch(isLoading())\n dispatch(request(payload))\n let apiEndpoint = 'ordensServico/' + id\n crudService\n .put(apiEndpoint, payload)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n } else {\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n //console.log('err', err)\n dispatch(failure(err))\n dispatch(notIsLoading())\n toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n })\n }\n\n function failure(error) {\n return { type: 'EDIT_ORDEMSERVICO_FAILURE', error }\n }\n}\n\nfunction editOrdemServicoAprova(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'ordensServico/aprova/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/ordensServico')\n } else {\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n })\n }\n\n function failure(error) {\n return { type: 'EDIT_ORDEMSERVICO_FAILURE', error }\n }\n}\n\nfunction editOrdemServicoRecusa(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'ordensServico/recusa/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/ordensServico')\n } else {\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n })\n }\n}\n\nfunction editOrdemServicoAprovaOrcamento(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'ordensServico/aprova/orcamento/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/ordensServico')\n } else {\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n })\n }\n\n function failure(error) {\n return { type: 'EDIT_ORDEMSERVICO_FAILURE', error }\n }\n}\n\nfunction editOrdemServicoRecusaOrcamento(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'ordensServico/recusa/orcamento/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/ordensServico')\n } else {\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n })\n }\n\n function failure(error) {\n return { type: 'EDIT_ORDEMSERVICO_FAILURE', error }\n }\n}\n\nfunction request(payload) {\n return { type: 'EDIT_ORDEMSERVICO_REQUEST', payload }\n}\n\nfunction success(user) {\n return {\n type: 'EDIT_ORDEMSERVICO_SUCCESS',\n user: user\n }\n}\n\nfunction failure(error) {\n return { type: 'EDIT_ORDEMSERVICO_FAILURE', error }\n}\n\n\nfunction getOrdemServicoById(id) {\n return (dispatch) => {\n let apiEndpoint = 'ordensServico/' + id\n crudService.get(apiEndpoint).then((response) => {\n dispatch(editOrdemServicosDetails(response.data))\n })\n }\n}\n\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n if (props === 'imagem') {\n dispatch(handleOnChangeProps(props, event))\n } else {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n }\n}\n\nfunction deleteOrdemServicoById(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'ordensServico/' + id\n crudService.deleteDetail(apiEndpoint).then((response) => {\n dispatch(deleteOrdemServicosDetails())\n dispatch(notIsLoading())\n history.push('/ordensServico')\n dispatch(getOrdemServico(filterModel))\n })\n }\n}\nexport function changeOrdemServicosList(ordemServico, totalRows) {\n return {\n type: 'FETCHED_ALL_ORDEMSERVICO',\n ordemServico: ordemServico,\n totalRegistros: totalRows\n }\n}\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'ORDEMSERVICO_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\nexport function editOrdemServicosDetails(ordemServico) {\n return {\n type: 'ORDEMSERVICO_DETAIL',\n id: ordemServico.id,\n idTipoServico: ordemServico.idTipoServico,\n idVeiculo: ordemServico.idVeiculo,\n descritivo: ordemServico.descritivo,\n titulo: ordemServico.titulo,\n idUsuario: ordemServico.idUsuario,\n data: ordemServico.data,\n avaliacao: ordemServico.avaliacao,\n descritivoAvaliacao: ordemServico.descritivoAvaliacao,\n idUsuarioAvaliacao: ordemServico.idUsuarioAvaliacao,\n idOrgao: ordemServico.idOrgao,\n idEmpresa: ordemServico.idEmpresa,\n ultimoEvento: ordemServico.ultimoEvento,\n empresa: ordemServico.empresa,\n eventos: ordemServico.eventos,\n ordensServicosFotos: ordemServico.ordensServicosFotos,\n ordensServicosOrcamentos: ordemServico.ordensServicosOrcamentos\n }\n}\nexport function createUserInfo() {\n return {\n type: 'ORDEMSERVICO_CREATED_SUCCESSFULLY'\n }\n}\nexport function deleteOrdemServicosDetails() {\n return {\n type: 'DELETED_ORDEMSERVICO_DETAILS'\n }\n}\nexport function isLoading() {\n return {\n type: 'ORDEMSERVICO_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'ORDEMSERVICO_NOTISLOADING'\n }\n}\n","import { crudService } from '../_services/'\nimport { history } from '../utils'\nimport { toast } from 'react-toastify'\nimport { stringUtils } from 'utils'\n\nexport const orgaoAction = {\n getOrgao,\n getOrgaoSelect,\n getOrgaoById,\n onChangeProps,\n editOrgaoInfo,\n editAprovaCadastroOrgao,\n editRecusaCadastroOrgao,\n changeDetailsOrgao,\n createOrgao,\n deleteOrgaoById,\n clear\n}\n\nlet filterModel = {\n Page: 0,\n Limit: 10,\n Term: ''\n};\n\nfunction getOrgao(filterModel, showWaiting) {\n return (dispatch) => {\n let apiEndpoint = 'orgaos' + stringUtils.serialize(filterModel);\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeOrgaosList(response.data.items, response.data.totalRows))\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getOrgaoSelect() {\n return (dispatch) => {\n let apiEndpoint = 'orgaos/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n // response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeOrgaosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction createOrgao(payload, user) {\n return (dispatch) => {\n dispatch(isLoading())\n dispatch(request(payload))\n let apiEndpoint = 'orgaos'\n crudService\n .post(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n toast.success('Feito! Cadastro realizado com sucesso! 😎')\n dispatch(clear())\n dispatch(notIsLoading())\n history.push('/orgaos')\n } else {\n // toast.err('Oops! Erro ao cadastrar órgão! 😥')\n }\n })\n .catch((err) => {\n // console.log('err', err)\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.err('Oops! Erro ao cadastrar órgão! 😥')\n })\n }\n\n function request(payload) {\n return { type: 'CREATE_ORGAO_REQUEST', payload }\n }\n\n function failure(error) {\n return { type: 'CREATE_ORGAO_FAILURE', error }\n }\n}\n\nfunction failure(error) {\n return { type: 'EDIT_ORGAO_FAILURE', error }\n}\n\nexport function clear() {\n return {\n type: 'ORGAO_CLEAR'\n }\n}\n\nfunction editAprovaCadastroOrgao(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'orgaos/aprova/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/orgaos')\n } else {\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n })\n }\n\n function failure(error) {\n return { type: 'EDIT_ORGAO_FAILURE', error }\n }\n}\n\nfunction editRecusaCadastroOrgao(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'orgaos/recusa/' + id\n crudService\n .put(apiEndpoint)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/orgaos')\n } else {\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar ordem de serviço! 😥')\n })\n }\n}\n\nfunction editOrgaoInfo(id, payload, redirect) {\n return (dispatch) => {\n dispatch(isLoading())\n dispatch(request(payload))\n let apiEndpoint = 'orgaos/' + id\n crudService\n .put(apiEndpoint, payload)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/orgaos')\n } else {\n // toast.error('Oops! Erro ao alterar órgão! 😥')\n }\n })\n .catch((err) => {\n //console.log('err', err)\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.error('Oops! Erro ao alterar órgão! 😥')\n })\n }\n\n function request(payload) {\n return { type: 'EDIT_ORGAO_REQUEST', payload }\n }\n\n function success(user) {\n return {\n type: 'EDIT_ORGAO_SUCCESS',\n user: user\n }\n }\n\n function failure(error) {\n return { type: 'EDIT_ORGAO_FAILURE', error }\n }\n}\n\nfunction getOrgaoById(id) {\n return (dispatch) => {\n let apiEndpoint = 'orgaos/' + id\n crudService.get(apiEndpoint).then((response) => {\n dispatch(editOrgaosDetails(response.data))\n })\n }\n}\n\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n if (props === 'imagem') {\n dispatch(handleOnChangeProps(props, event))\n } else {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n }\n}\nfunction changeDetailsOrgao(orgao) {\n return (dispatch) => {\n if (orgao) {\n dispatch(onChangeDetailsOrgao(orgao))\n } else {\n clear()\n }\n }\n}\n\nexport function onChangeDetailsOrgao(orgao) {\n return [\n {\n type: 'CHANGE_DETAILS_ORGAO',\n id: orgao.id,\n nome: orgao.nome\n }\n ]\n}\n\nfunction deleteOrgaoById(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'orgaos/' + id\n crudService.deleteDetail(apiEndpoint).then((response) => {\n dispatch(deleteOrgaosDetails())\n history.push('/orgaos')\n getOrgao(filterModel, true)\n dispatch(notIsLoading())\n })\n }\n}\nexport function changeOrgaosList(orgao, totalRows) {\n return {\n type: 'FETCHED_ALL_ORGAO',\n orgao: orgao,\n totalRegistros: totalRows\n }\n}\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'ORGAO_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\nexport function editOrgaosDetails(orgao) {\n return {\n type: 'ORGAO_DETAIL',\n id: orgao.id,\n isLoading: orgao.isLoading,\n nome: orgao.nome,\n celular: orgao.celular,\n cnpj: orgao.cnpj,\n email: orgao.email,\n endereco: orgao.endereco,\n telefone: orgao.telefone,\n idCidade: orgao.idCidade,\n idEstado: orgao.idEstado,\n excluido: orgao.excluido,\n cadastroLiberado: orgao.cadastroLiberado,\n usuariosOrgaos: orgao.usuariosOrgaos\n }\n}\nexport function createUserInfo() {\n return {\n type: 'ORGAO_CREATED_SUCCESSFULLY'\n }\n}\nexport function deleteOrgaosDetails() {\n return {\n type: 'DELETED_ORGAO_DETAILS'\n }\n}\nexport function isLoading() {\n return {\n type: 'ORGAO_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'ORGAO_NOTISLOADING'\n }\n}\n\n\n","import { history } from 'utils'\nimport { crudService } from '../_services'\nimport { stringUtils } from 'utils'\nimport { toast } from 'react-toastify'\n\nexport const parametroAction = {\n getParametro,\n addParametro,\n getParametroById,\n onChangeProps,\n onChangePropsHtml,\n editParametroInfo,\n editParametrosDetails,\n createParametro,\n deleteParametroById,\n clear,\n clearAll\n}\n\nlet filterModel = {\n Page: 1,\n Limit: 10,\n Term: ''\n};\n\nfunction getParametro(filterModel, showWaiting) {\n return (dispatch) => {\n let apiEndpoint = 'parametros' + stringUtils.serialize(filterModel);\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeParametrosList(response.data.items, response.data.totalRows))\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction createParametro(payload) {\n return (dispatch) => {\n let apiEndpoint = 'parametros/'\n crudService.post(apiEndpoint, payload).then(() => {\n dispatch(createParametroInfo())\n dispatch(clear())\n history.push('/parametros')\n })\n }\n}\n\nfunction getParametroById(id) {\n return (dispatch) => {\n let apiEndpoint = 'parametros/' + id\n crudService.get(apiEndpoint).then((response) => {\n // console.log('response.data', response.data)\n dispatch(editParametrosDetails(response.data))\n })\n }\n}\n\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n if (event.target.type === 'checkbox') {\n dispatch(handleOnChangeProps(props, event.target.checked))\n } else {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n }\n}\n\nfunction onChangePropsHtml(props, event) {\n return (dispatch) => {\n dispatch(handleOnChangeProps(props, event))\n }\n}\n\nfunction editParametroInfo(id, payload, redirect) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'parametros/' + id\n crudService.put(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n var ret = JSON.parse(response.request.responseText);\n dispatch(updatedParametroInfo())\n dispatch(clear())\n if (redirect) {\n dispatch(notIsLoading())\n history.push('/parametros')\n }\n } else {\n toast.err('Oops! Erro ao editar parâmetro! 😥')\n }\n }).catch((err) => {\n // console.log(err.response);\n dispatch(notIsLoading())\n toast.error('Oops! Erro ao editar parâmetro! 😥')\n return err.response;\n })\n }\n}\n\nfunction deleteParametroById(id) {\n return (dispatch) => {\n let apiEndpoint = 'parametros/' + id\n crudService.deleteDetail(apiEndpoint).then(() => {\n dispatch(deleteParametrosDetails())\n dispatch(getParametro(filterModel))\n })\n }\n}\n\nexport function addParametro(payload) {\n return [{ type: 'ADD_PARAMETRO', parametro: payload }, clear()]\n}\n\nexport function changeParametrosList(parametro, totalRows) {\n return {\n type: 'FETCHED_ALL_PARAMETRO',\n parametro: parametro,\n totalRegistros: totalRows\n }\n}\n\nexport function clear() {\n return {\n type: 'PARAMETRO_CLEAR'\n }\n}\n\nexport function clearAll() {\n return {\n type: 'PARAMETRO_CLEAR_ALL'\n }\n}\n\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'PARAMETRO_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\n\nexport function editParametrosDetails(parametro) {\n return [\n { type: 'PARAMETRO_DETAIL', parametro },\n ]\n}\n\nexport function updatedParametroInfo() {\n return {\n type: 'PARAMETRO_UPDATED'\n }\n}\n\nexport function createParametroInfo() {\n return {\n type: 'PARAMETRO_CREATED_SUCCESSFULLY'\n }\n}\n\nexport function deleteParametrosDetails() {\n return {\n type: 'DELETED_PARAMETRO_DETAILS'\n }\n}\n\nexport function isLoading() {\n return {\n type: 'PARAMETRO_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'PARAMETRO_NOTISLOADING'\n }\n}\n","import { crudService } from '../_services/'\n\nexport const tipoFotoAction = {\n getTiposFotoSelect\n}\n\nfunction getTiposFotoSelect() {\n return (dispatch) => {\n let apiEndpoint = 'tiposFotos/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n dispatch(changeTiposFotosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nexport function changeTiposFotosList(tipoFoto) {\n return {\n type: 'FETCHED_ALL_TIPO_FOTO',\n tipoFoto: tipoFoto\n }\n}\n\n","import { crudService } from '../_services/'\n\nexport const tipoServicoAction = {\n getTiposServicoSelect\n}\n\nfunction getTiposServicoSelect() {\n return (dispatch) => {\n let apiEndpoint = 'tiposServico/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n dispatch(changeTiposServicosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nexport function changeTiposServicosList(tipoServico) {\n return {\n type: 'FETCHED_ALL_TIPO_SERVICO',\n tipoServico: tipoServico\n }\n}\n\n","import { crudService } from '../_services/'\nimport { history } from '../utils'\nimport { toast } from 'react-toastify'\nimport { stringUtils } from 'utils'\n\nexport const usuarioAction = {\n getUsuario,\n getUsuarioSelect,\n getUsuarioSemOrgaoAindaSelect,\n getUsuarioMotoristaByOrgaoSelect,\n getUsuarioById,\n changeDetailsUsuario,\n onChangeProps,\n editUsuarioInfo,\n createUsuario,\n deleteUsuarioById,\n emailVerification,\n requestEmailVerification,\n requestPasswordReset,\n passwordReset,\n openModalRequestPasswordReset,\n setIdUsuarioOrgao,\n verifyUsuarioEmail,\n clear\n}\n\nlet filterModel = {\n Page: 0,\n Limit: 10,\n Term: ''\n};\n\nfunction getUsuario(filterModel, showWaiting) {\n return (dispatch) => {\n let apiEndpoint = 'usuarios' + stringUtils.serialize(filterModel);\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeUsuariosList(response.data.items, response.data.totalRows))\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getUsuarioSelect() {\n return (dispatch) => {\n let apiEndpoint = 'usuarios/select'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n // response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeUsuariosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getUsuarioSemOrgaoAindaSelect() {\n return (dispatch) => {\n let apiEndpoint = 'usuarios/select/orgao'\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n // response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeUsuariosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction getUsuarioMotoristaByOrgaoSelect(idOrgao) {\n return (dispatch) => {\n let apiEndpoint = 'usuarios/select/orgao/motoristas/' + idOrgao\n crudService\n .get(apiEndpoint)\n .then((response) => {\n if (response.data) {\n // response.data.unshift({ value: '', text: ' SELECIONE ...' })\n dispatch(changeUsuariosList(response.data))\n }\n })\n .catch((err) => {\n console.log(err)\n })\n }\n}\n\nfunction requestEmailVerification(email) {\n let payload = {\n email: email\n }\n return (dispatch) => {\n dispatch(request(payload))\n let apiEndpoint = 'usuarios/request-email-verification'\n crudService\n .post(apiEndpoint, payload)\n .then(() => {\n dispatch(success())\n })\n .catch((err) => {\n dispatch(failure(err))\n })\n }\n\n function request(payload) {\n return { type: 'REQUEST_EMAIL_VERIFICATION_REQUEST', payload }\n }\n\n function success() {\n return {\n type: 'REQUEST_EMAIL_VERIFICATION_SUCCESS'\n }\n }\n\n function failure(error) {\n return { type: 'REQUEST_EMAIL_VERIFICATION_FAILURE', error }\n }\n}\n\nfunction createUsuario(payload, isUsuarioOrgao) {\n return (dispatch) => {\n dispatch(isLoading())\n if (isUsuarioOrgao == true) {\n for (var i = 0; i <= payload.length - 1; i++) {\n payload.map(n => {\n var dadosCadastro = payload[i].usuario;\n dispatch(request(dadosCadastro))\n let apiEndpoint = 'usuarios'\n crudService\n .post(apiEndpoint, dadosCadastro)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n toast.success('Feito! Cadastro realizado com sucesso! 😎')\n var ret = JSON.parse(response.request.responseText);\n dispatch(clear())\n dispatch(notIsLoading())\n dispatch(setIdUsuarioOrgao(ret.key))\n } else {\n // toast.err('Oops! Erro ao cadastrar usuário! 😥')\n }\n })\n .catch((err) => {\n // console.log('err', err)\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.err('Oops! Erro ao cadastrar usuário! 😥')\n })\n })\n }\n } else {\n dispatch(request(payload))\n let apiEndpoint = 'usuarios'\n crudService\n .post(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n toast.success('Feito! Cadastro realizado com sucesso! 😎')\n var ret = JSON.parse(response.request.responseText);\n dispatch(clear())\n dispatch(notIsLoading())\n dispatch(setIdUsuarioOrgao(ret.key))\n history.push('/usuarios')\n } else {\n // toast.err('Oops! Erro ao cadastrar usuário! 😥')\n }\n })\n .catch((err) => {\n // console.log('err', err)\n dispatch(failure(err))\n dispatch(notIsLoading())\n // toast.err('Oops! Erro ao cadastrar usuário! 😥')\n })\n }\n }\n\n function request(payload) {\n return { type: 'CREATE_USER_REQUEST', payload }\n }\n\n function failure(error) {\n return { type: 'CREATE_USER_FAILURE', error }\n }\n}\n\nfunction verifyUsuarioEmail(id) {\n return (dispatch) => {\n dispatch(request(id))\n let apiEndpoint = 'usuarios/verificarEmail/admin/' + id\n crudService\n .post(apiEndpoint)\n .then(() => {\n toast.success('Feito! E-mail verificado com sucesso! 😎')\n })\n .catch((err) => {\n dispatch(failure(err))\n })\n }\n}\n\nfunction request(id) {\n return { type: 'EDIT_USUARIO_REQUEST', id }\n}\n\nfunction failure(error) {\n return { type: 'EDIT_USUARIO_FAILURE', error }\n}\n\nexport function clear() {\n return {\n type: 'USER_CLEAR'\n }\n}\n\nfunction changeDetailsUsuario(usuario) {\n return (dispatch) => {\n if (usuario) {\n dispatch(onChangeDetailsUsuario(usuario))\n } else {\n clear()\n }\n }\n}\n\nexport function onChangeDetailsUsuario(usuario) {\n return [\n {\n type: 'CHANGE_DETAILS_USUARIO',\n id: usuario.id,\n nome: usuario.nome\n }\n ]\n}\n\nfunction requestPasswordReset(email) {\n let payload = {\n email: email\n }\n return (dispatch) => {\n dispatch(isLoading())\n dispatch(request(email))\n let apiEndpoint = 'usuarios/request-reset-password'\n crudService\n .post(apiEndpoint, payload)\n .then((response) => {\n dispatch(success(response.data))\n dispatch(notIsLoading())\n if (response && response.request.status === 200) {\n toast.success('E-mail de recuperação enviado! 😎')\n } else if (response && response.request.status === 404) {\n toast.warn('Não existe nenhum usuário com este e-mail')\n } else {\n // toast.error('Erro ao recuperar senha do usuário')\n }\n })\n .catch((err) => {\n dispatch(notIsLoading())\n console.log('err', err)\n dispatch(failure(err))\n // toast.error('Erro ao recuperar senha do usuário')\n })\n }\n function request(payload) {\n return { type: 'REQUEST_RESET_PASSWORD_REQUEST', payload }\n }\n\n function success() {\n return {\n type: 'REQUEST_RESET_PASSWORD_SUCCESS'\n }\n }\n\n function failure(error) {\n return { type: 'REQUEST_RESET_PASSWORD_FAILURE', error }\n }\n}\n\nfunction setIdUsuarioOrgao(id) {\n return {\n type: 'USUARIO_ORGAO_SET_ID',\n idUsuarioOrgao: id\n }\n}\n\nfunction passwordReset(payload, token) {\n return (dispatch) => {\n dispatch(request(payload))\n let apiEndpoint = 'usuarios/reset-password'\n crudService\n .postWithToken(apiEndpoint, payload, token)\n .then((response) => {\n if (response && response.request.status === 200) {\n dispatch(success(response.data))\n toast.success('Senha redefinida com sucesso! 😎')\n history.push('/password-reset-success')\n } else if (response && response.request.status === 404) {\n // toast.success('Não existe nenhum usuário com o e-mail informado!')\n } else {\n // toast.error('Erro ao recuperar senha do usuário')\n }\n })\n .catch((err) => {\n dispatch(failure(err))\n })\n }\n function request(payload) {\n return { type: 'RESET_PASSWORD_REQUEST', payload }\n }\n\n function success() {\n return {\n type: 'RESET_PASSWORD_SUCCESS'\n }\n }\n\n function failure(error) {\n return { type: 'RESET_PASSWORD_FAILURE', error }\n }\n}\n\nfunction emailVerification(payload, token) {\n return (dispatch) => {\n let apiEndpoint = 'usuarios/email-verification'\n crudService\n .postWithToken(apiEndpoint, payload, token)\n .then((response) => {\n if (response && response.request.status === 200) {\n toast.success('E-mail verificado com sucesso! 😎')\n history.push('/')\n dispatch(success())\n } else if (response && response.request.status === 404) {\n toast.success('Não existe nenhum usuário com o e-mail informado!')\n } else {\n // toast.error('Erro ao verificar e-mail do usuário')\n }\n })\n .catch(() => {\n // toast.error('Erro ao verificar e-mail do usuário')\n })\n }\n\n function success() {\n return {\n type: 'VERIFICATION_USER_SUCCESS'\n }\n }\n}\n\nfunction editUsuarioInfo(id, payload, redirect) {\n return (dispatch) => {\n dispatch(isLoading())\n dispatch(request(payload))\n let apiEndpoint = 'usuarios/' + id\n crudService\n .put(apiEndpoint, payload)\n .then((response) => {\n if (response && response.request.status === 200) {\n //dispatch(success(payload))\n dispatch(notIsLoading())\n history.push('/usuarios')\n } else {\n // toast.error('Oops! Erro ao alterar usuário! 😥')\n }\n })\n .catch((err) => {\n //console.log('err', err)\n dispatch(failure(err))\n dispatch(notIsLoading())\n toast.error('Oops! Erro ao alterar usuário! 😥')\n })\n }\n\n function request(payload) {\n return { type: 'EDIT_USER_REQUEST', payload }\n }\n\n function success(user) {\n return {\n type: 'EDIT_USER_SUCCESS',\n user: user\n }\n }\n\n function failure(error) {\n return { type: 'EDIT_USER_FAILURE', error }\n }\n}\n\nfunction getUsuarioById(id) {\n return (dispatch) => {\n let apiEndpoint = 'usuarios/' + id\n crudService.get(apiEndpoint).then((response) => {\n dispatch(editUsuariosDetails(response.data))\n })\n }\n}\n\nexport function openModalRequestPasswordReset(open) {\n return {\n type: 'OPEN_MODAL_REQUEST_PASSWORD_RESET',\n open: open\n }\n}\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n if (props === 'imagem') {\n dispatch(handleOnChangeProps(props, event))\n } else {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n }\n}\n\nfunction deleteUsuarioById(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'usuarios/' + id\n crudService.deleteDetail(apiEndpoint).then((response) => {\n dispatch(deleteUsuariosDetails())\n dispatch(notIsLoading())\n history.push('/usuarios')\n dispatch(getUsuario(filterModel))\n })\n }\n}\nexport function changeUsuariosList(usuario, totalRows) {\n return {\n type: 'FETCHED_ALL_USUARIO',\n usuario: usuario,\n totalRegistros: totalRows\n }\n}\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'USUARIO_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\nexport function editUsuariosDetails(usuario) {\n return {\n type: 'USUARIO_DETAIL',\n id: usuario.id,\n isLoading: usuario.isLoading,\n email: usuario.email,\n nome: usuario.nome,\n senha: usuario.senha,\n sobrenome: usuario.sobrenome,\n idTipoUsuario: usuario.idTipoUsuario,\n dataHoraUltimoAcesso: usuario.dataHoraUltimoAcesso,\n caminhoCnh: usuario.caminhoCnh,\n celular: usuario.celular,\n cnh: usuario.cnh,\n matricula: usuario.matricula,\n telefone: usuario.telefone,\n idUsuarioOrgao: usuario.idUsuarioOrgao,\n emailVerificado: usuario.emailVerificado\n }\n}\nexport function createUserInfo() {\n return {\n type: 'USUARIO_CREATED_SUCCESSFULLY'\n }\n}\nexport function deleteUsuariosDetails() {\n return {\n type: 'DELETED_USUARIO_DETAILS'\n }\n}\nexport function isLoading() {\n return {\n type: 'USUARIO_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'USUARIO_NOTISLOADING'\n }\n}\n","import { crudService } from '../_services/'\nimport { orgaoAction } from '_actions'\nimport { toast } from 'react-toastify'\n\nexport const usuarioOrgaoAction = {\n changeDetailsUsuarioOrgao,\n getUsuarioOrgao,\n getUsuarioOrgaos,\n addUsuarioByEmail,\n editUsuarioOrgaosDetails,\n deleteUsuarioById,\n clearSelected,\n clear,\n clearAll\n}\n\nfunction addUsuarioByEmail(payload) {\n return (dispatch) => {\n dispatch(request({ payload }))\n let apiEndpoint = 'usuariosOrgaos/email'\n crudService\n .post(apiEndpoint, payload)\n .then((response) => {\n dispatch(success(response.data))\n toast.success('Usuário adicionado com sucesso! 😎')\n })\n .catch((err) => {\n dispatch(failure(err))\n })\n }\n\n function request(data) {\n return { type: 'USUARIO_ORGAO_ADD_REQUEST', data }\n }\n\n function success(data) {\n return {\n type: 'USUARIO_ORGAO_ADD_SUCCESS',\n data: data\n }\n }\n\n function failure(error) {\n return { type: 'USUARIO_ORGAO_ADD_FAILURE', error }\n }\n}\n\nfunction deleteUsuarioById(id) {\n return (dispatch) => {\n dispatch(request(id))\n let apiEndpoint = 'usuariosEstabelecimentos/' + id\n crudService\n .deleteDetail(apiEndpoint)\n .then((response) => {\n dispatch(success(response.data))\n })\n .catch((err) => {\n dispatch(failure(err))\n })\n }\n\n function request(id) {\n return { type: 'USUARIO_ORGAO_DELETE_REQUEST', id }\n }\n\n function success(data) {\n return {\n type: 'USUARIO_ORGAO_DELETE_SUCCESS',\n data: data\n }\n }\n\n function failure(error) {\n return { type: 'USUARIO_ORGAO_DELETE_FAILURE', error }\n }\n}\n\nfunction changeDetailsUsuarioOrgao(usuarioOrgao) {\n return (dispatch) => {\n if (usuarioOrgao) {\n dispatch(onChangeDetailsUsuarioOrgao(usuarioOrgao))\n } else {\n clear()\n }\n }\n}\n\nfunction getUsuarioOrgaos(usuarioOrgao) {\n return (dispatch) => {\n dispatch(changeUsuarioOrgaosList(usuarioOrgao))\n if (\n undefined !== usuarioOrgao &&\n usuarioOrgao.length === 1\n ) {\n dispatch(editUsuarioOrgaosDetails(usuarioOrgao[0]))\n }\n }\n}\n\nfunction getUsuarioOrgao(usuarioOrgao) {\n return (dispatch) => {\n dispatch(editUsuarioOrgaosDetails(usuarioOrgao))\n }\n}\n\nexport function addUsuarioOrgao(payload) {\n return [\n { type: 'ADD_USUARIO_ORGAO', usuarioOrgao: payload },\n clear()\n ]\n}\n\nexport function changeUsuarioOrgaosList(usuarioOrgao) {\n return {\n type: 'FETCHED_ALL_USUARIO_ORGAO',\n usuarioOrgao: usuarioOrgao\n }\n}\n\nexport function clear() {\n return {\n type: 'USUARIO_ORGAO_CLEAR'\n }\n}\n\nexport function clearAll() {\n return {\n type: 'USUARIO_ORGAO_CLEAR_ALL'\n }\n}\n\nexport function clearSelected() {\n return {\n type: 'USUARIO_ORGAO_CLEAR_SELECTED'\n }\n}\n\n\nexport function onChangeDetailsUsuarioOrgao(usuarioOrgao) {\n return [\n {\n type: 'CHANGE_DETAILS_USUARIO_ORGAO',\n id: usuarioOrgao.id,\n idUsuario: usuarioOrgao.idUsuario,\n idOrgao: usuarioOrgao.idOrgao,\n excluido: usuarioOrgao.excluido,\n orgao: usuarioOrgao.orgao\n },\n orgaoAction.getOrgaoById(\n usuarioOrgao.idOrgao\n )\n ]\n}\n\nexport function editUsuarioOrgaosDetails(usuarioOrgao) {\n return {\n type: 'USUARIO_ORGAO_DETAIL',\n id: usuarioOrgao.id,\n idUsuario: usuarioOrgao.idUsuario,\n idOrgao: usuarioOrgao.idOrgao,\n excluido: usuarioOrgao.excluido,\n orgao: usuarioOrgao.orgao\n }\n}\n\nexport function updatedUsuarioOrgaoInfo() {\n return {\n type: 'USUARIO_ORGAO_UPDATED'\n }\n}\n\nexport function createUsuarioOrgaoInfo() {\n return {\n type: 'USUARIO_ORGAO_CREATED_SUCCESSFULLY'\n }\n}\n\nexport function isLoading() {\n return {\n type: 'USUARIO_ORGAO_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'USUARIO_ORGAO_NOTISLOADING'\n }\n}\n","import { history } from 'utils'\nimport { crudService } from '../_services'\nimport { stringUtils } from 'utils'\nimport { toast } from 'react-toastify'\nimport { authActions } from '../_actions/'\n\nexport const veiculoAction = {\n getVeiculo,\n getVeiculoSelect,\n addVeiculo,\n getVeiculoById,\n onChangeProps,\n editVeiculoInfo,\n editVeiculosDetails,\n createVeiculo,\n deleteVeiculoById,\n clear,\n clearAll,\n clearUsuariosVeiculos\n}\n\nlet filterModel = {\n Page: 0,\n Limit: 10,\n Term: ''\n};\n\nfunction getVeiculo(filterModel, showWaiting) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'veiculos' + stringUtils.serialize(filterModel);\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeVeiculosList(response.data.items, response.data.totalRows))\n dispatch(notIsLoading())\n })\n .catch((err) => {\n console.log(err.response);\n return err.response;\n })\n }\n}\n\nfunction getVeiculoSelect() {\n return (dispatch) => {\n let apiEndpoint = 'veiculos/select';\n crudService\n .get(apiEndpoint)\n .then((response) => {\n dispatch(changeVeiculosList(response.data, 0))\n })\n .catch((err) => {\n console.log(err.response);\n return err.response;\n })\n }\n}\n\nfunction createVeiculo(payload, props) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'veiculos/'\n crudService.post(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n var ret = JSON.parse(response.request.responseText);\n dispatch(createVeiculoInfo())\n toast.success('Feito! Cadastro realizado com sucesso! 😎')\n dispatch(clear())\n dispatch(notIsLoading())\n history.push('/veiculos') // retorna para a lista e atualiza\n } else {\n toast.error('Oops! Erro ao cadastrar veículo! 😥')\n }\n }).catch((err) => {\n // console.log(err.response);\n dispatch(notIsLoading())\n toast.error('Oops! Erro ao cadastrar veículo! 😥')\n return err.response;\n })\n }\n}\n\n\nfunction getVeiculoById(id) {\n return (dispatch) => {\n let apiEndpoint = 'veiculos/' + id\n crudService.get(apiEndpoint).then((response) => {\n dispatch(editVeiculosDetails(response.data))\n })\n }\n}\n\nfunction onChangeProps(props, event) {\n return (dispatch) => {\n if (event.target.type === 'checkbox') {\n dispatch(handleOnChangeProps(props, event.target.checked))\n } else {\n dispatch(handleOnChangeProps(props, event.target.value))\n }\n }\n}\n\nfunction editVeiculoInfo(id, payload, redirect) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'veiculos/' + id\n crudService.put(apiEndpoint, payload)\n .then((response) => {\n if (response.request != undefined && response.request.status === 200) {\n var ret = JSON.parse(response.request.responseText);\n dispatch(updatedVeiculoInfo())\n dispatch(clear())\n dispatch(notIsLoading())\n // history.push('/veiculos')\n }// retorna para a lista e atualiza }\n }).catch((err) => {\n // console.log(err.response);\n dispatch(notIsLoading())\n toast.error('Oops! Erro ao atualizar veiculo! 😥')\n return err.response;\n })\n }\n}\n\nfunction deleteVeiculoById(id) {\n return (dispatch) => {\n dispatch(isLoading())\n let apiEndpoint = 'veiculos/' + id\n crudService.deleteDetail(apiEndpoint).then(() => {\n dispatch(deleteVeiculosDetails())\n dispatch(authActions.refresh())\n dispatch(getVeiculo(filterModel))\n dispatch(notIsLoading())\n })\n }\n}\n\nexport function addVeiculo(payload, props) {\n return [{ type: 'ADD_VEICULO', veiculo: payload },\n clear()\n ]\n}\n\nexport function changeVeiculosList(veiculo, totalRows) {\n return {\n type: 'FETCHED_ALL_VEICULO',\n veiculo: veiculo,\n totalRegistros: totalRows\n }\n}\n\nexport function clear() {\n return {\n type: 'VEICULO_CLEAR'\n }\n}\n\nexport function clearAll() {\n return {\n type: 'VEICULO_CLEAR_ALL'\n }\n}\n\nexport function clearUsuariosVeiculos() {\n return {\n type: 'VEICULO_CLEAR_USUARIOS_VEICULOS'\n }\n}\n\nexport function handleOnChangeProps(props, value) {\n return {\n type: 'VEICULO_HANDLE_ON_CHANGE',\n props: props,\n value: value\n }\n}\n\nexport function editVeiculosDetails(veiculo) {\n return {\n type: 'VEICULO_DETAIL',\n id: veiculo.id,\n ano: veiculo.ano,\n placa: veiculo.placa,\n renavam: veiculo.renavam,\n hodometro: veiculo.hodometro,\n numeroChassis: veiculo.numeroChassis,\n idOrgao: veiculo.idOrgao,\n idMarca: veiculo.idMarca,\n modelo: veiculo.modelo,\n caminhoFoto: veiculo.caminhoFoto,\n usuariosVeiculos: veiculo.usuariosVeiculos,\n excluido: veiculo.excluido\n }\n}\n\nexport function updatedVeiculoInfo() {\n return {\n type: 'VEICULO_UPDATED'\n }\n}\n\nexport function createVeiculoInfo() {\n return {\n type: 'VEICULO_CREATED_SUCCESSFULLY'\n }\n}\n\nexport function deleteVeiculosDetails() {\n return {\n type: 'DELETED_VEICULO_DETAILS'\n }\n}\n\nexport function isLoading() {\n return {\n type: 'VEICULO_ISLOADING'\n }\n}\n\nexport function notIsLoading() {\n return {\n type: 'VEICULO_NOTISLOADING'\n }\n}\n","import React from 'react'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@mui/styles'\nimport { Typography } from '@mui/material'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n minHeight: 'fit-content',\n paddingTop: 10,\n paddingBottom: 30\n },\n name: {\n marginTop: theme.spacing(1)\n }\n}))\n\nconst Profile = (props) => {\n const { user, className, ...rest } = props\n\n const classes = useStyles()\n\n return (\n \n \n {user.nome}\n \n \n {user.email}\n \n {user.tipoUsuario.descricao}\n
\n )\n}\n\nProfile.propTypes = {\n className: PropTypes.string\n}\n\nexport default Profile\n","import { connect } from 'react-redux'\nimport PropTypes from 'prop-types'\n\nconst check = (rule, permissaoTipoUsuario, permissaoUsuario) => {\n var todasPermissoes = permissaoTipoUsuario.concat(permissaoUsuario)\n const allowed = todasPermissoes.some(\n (item) => item.permissao.nome === rule && item.permitido\n )\n return allowed\n}\n\nconst AccessControl = (props) =>\n check(props.rule, props.permissaoTipoUsuario, props.permissaoUsuario)\n ? props.yes()\n : props.no()\n\nAccessControl.defaultProps = {\n yes: () => null,\n no: () => null\n}\n\nAccessControl.propTypes = {\n rule: PropTypes.string.isRequired\n}\n\nconst mapStateToProps = (state, index) => {\n return {\n key:\"access\" + index,\n permissaoTipoUsuario:\n state.authentication.user.tipoUsuario !== undefined &&\n state.authentication.user.tipoUsuario.permissoesTiposUsuarios,\n permissaoUsuario:\n state.authentication.user.permissoesUsuarios !== undefined &&\n state.authentication.user.permissoesUsuarios\n }\n}\nconst connectedAccessControlPage = connect(mapStateToProps)(AccessControl)\nexport { connectedAccessControlPage as AccessControl }\n","import React, { forwardRef } from 'react'\nimport { NavLink as RouterLink } from 'react-router-dom'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@mui/styles'\nimport {\n List,\n ListItem,\n Button,\n Tooltip,\n Divider\n} from '@mui/material'\nimport { AccessControl } from '../../../../../../components/Utils/AccessControl'\nimport { history } from 'utils'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n },\n item: {\n display: 'flex',\n paddingTop: 0,\n paddingBottom: 0,\n color: '#37474f',\n },\n button: {\n color: '#37474f',\n padding: '8px 5px',\n justifyContent: 'flex-start',\n textTransform: 'none',\n letterSpacing: 0,\n width: '100%',\n fontWeight: theme.typography.fontWeightMedium\n },\n icon: { \n color: '#37474f',\n width: 24,\n height: 24,\n display: 'flex',\n alignItems: 'center',\n marginRight: theme.spacing(2)\n }, \n active: {\n color: theme.palette.primary.main,\n fontWeight: theme.typography.fontWeightMedium,\n '& $icon': {\n color: theme.palette.primary.main\n }\n },\n tooltipText: {\n textAlign: 'center'\n },\n divider: {\n margin: theme.spacing(1, 0)\n }\n}))\n\nconst CustomRouterLink = forwardRef((props, ref) => (\n \n \n
\n))\n\nconst SidebarNav = (props) => {\n const { pages, className, ...rest } = props\n const classes = useStyles()\n\n return (\n \n {pages.map((page, index) => (\n \n {page.rule !== undefined ? (\n (\n \n Função bloqueada 🤔
\n Clique para completar seu cadastro!
\n \n }\n arrow\n onClick={() =>\n page.disabled &&\n history.push(`/estabelecimento/`)\n }\n disableFocusListener={!page.disabled}\n disableHoverListener={!page.disabled}\n disableTouchListener={!page.disabled}\n >\n { page.clicked == true ? (\n \n \n \n ) : (\n \n {page.clickedSub == true ?\n \n :\n \n }\n \n ) }\n \n )} \n />\n ) : (\n \n Função bloqueada 🤔
\n Clique para completar seu cadastro!
\n \n }\n arrow\n onClick={() =>\n page.disabled &&\n history.push(`/estabelecimento/`)\n }\n disableFocusListener={!page.disabled}\n disableHoverListener={!page.disabled}\n disableTouchListener={!page.disabled}\n >\n \n \n \n \n )}\n {page.divider && }\n \n ))}\n
\n )\n}\n\nSidebarNav.propTypes = {\n className: PropTypes.string,\n pages: PropTypes.array.isRequired\n}\n\nexport default SidebarNav\n","import React, { useState, useEffect } from 'react'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport PerfectScrollbar from 'react-perfect-scrollbar'\nimport 'react-perfect-scrollbar/dist/css/styles.css'\nimport { Divider, Drawer } from '@mui/material'\nimport { withStyles } from '@mui/styles'\nimport ExitToAppTwoToneIcon from '@mui/icons-material/ExitToAppTwoTone'\nimport HomeTwoToneIcon from '@mui/icons-material/HomeTwoTone';\nimport PeopleOutlineTwoToneIcon from '@mui/icons-material/PeopleOutlineTwoTone';\n\nimport { authActions } from '../../../../_actions'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport { withRouter } from 'react-router-dom'\nimport { Profile, SidebarNav } from './components'\n\nconst styles = (theme) => ({\n drawer: {\n width: 240,\n [theme.breakpoints.up('lg')]: {\n marginTop: 64,\n height: 'calc(100% - 64px)'\n }\n },\n root: {\n backgroundColor: theme.palette.white,\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n padding: theme.spacing(2)\n },\n sidebarNav: {\n paddingTop: 0,\n alignContent: 'right',\n justifyContent: 'end'\n },\n divider: {\n margin: theme.spacing(1, 0)\n },\n nav: {\n marginBottom: theme.spacing(1)\n }\n})\n\nconst Sidebar = ({ staticContext, ...props }) => {\n\n const { open, variant, onClose, className, ...rest } = props\n const dispatch = useDispatch()\n const { user } = props\n const [isClickedOptionSubmenu, setIsClickedOptionSubMenu] = useState(false);\n\n const logout = () => {\n dispatch(authActions.logout())\n }\n const { classes } = props\n\n const isDisabled = useSelector((state) => {\n return false\n })\n\n const pages = [\n {\n title: 'Home',\n href: '/dashboard',\n icon: \n },\n {\n disabled: isDisabled,\n clickedSub: isClickedOptionSubmenu,\n title: 'Usuários',\n href: '/usuarios',\n rule: 'usuarios.list',\n onClick: () => {\n setIsClickedOptionSubMenu(true)\n },\n icon: \n }\n ]\n\n const pagesSair = [\n {\n title: 'Sair',\n href: '/login',\n icon: ,\n onClick: () => {\n logout()\n }\n }\n ]\n\n return (\n \n \n \n \n \n )\n}\n\n\nSidebar.propTypes = {\n className: PropTypes.string,\n onClose: PropTypes.func,\n open: PropTypes.bool.isRequired,\n variant: PropTypes.string.isRequired\n}\n\nconst mapStateToProps = (state) => {\n return {\n user: state.authentication.user\n }\n}\nconst connectedSidebarPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Sidebar))\n)\nexport { connectedSidebarPage as Sidebar }\n","/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useEffect } from 'react'\nimport {\n Button,\n Dialog,\n Hidden,\n DialogActions,\n DialogContent,\n DialogTitle,\n Typography,\n IconButton,\n Tooltip,\n TextField\n} from '@mui/material'\nimport { makeStyles } from '@mui/styles'\nimport Autocomplete from '@mui/material/Autocomplete';\nimport PropTypes from 'prop-types'\nimport ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { usuarioOrgaoAction, authActions } from '_actions'\n\nconst useStyles = makeStyles((theme) => ({\n container: {\n display: 'flex',\n flexWrap: 'wrap'\n },\n formControl: {\n margin: theme.spacing(1),\n minWidth: 250\n },\n showPrefeitura: {\n justifyContent: 'center',\n alignItems: 'center'\n }\n}))\n\nconst SelectOrgao = (props) => {\n const classes = useStyles()\n const [open, setOpen] = React.useState(false)\n const [disabled, setDisabled] = React.useState(false)\n const { usuarioOrgao, orgao, idOrgao } = useSelector(\n (state) => state.usuarioOrgao\n )\n\n const options = usuarioOrgao.map(u => ({ id: u.orgao.id, nome: u.orgao.nome }));\n\n const [value, setValue] = React.useState(null);\n const [inputValue, setInputValue] = React.useState('');\n\n const hasOrgaoSelected = useSelector((state) => {\n if (\n state.usuarioOrgao.idOrgao === '' ||\n state.usuarioOrgao.idOrgao === undefined\n ) {\n return false\n }\n return true\n })\n\n const dispatch = useDispatch()\n\n useEffect(() => {\n setInitialUsuarioOrgao()\n }, [usuarioOrgao])\n\n useEffect(() => {\n // console.log('idOrgao', idOrgao);\n }, [idOrgao])\n\n useEffect(() => {\n setValue(idOrgao)\n // console.log(\"usuarioOrgao\", usuarioOrgao)\n }, [])\n\n useEffect(() => {\n if (value) {\n handleChangeAutoComplete(value)\n }\n }, [value])\n\n const handleChangeAutoComplete = (obj) => {\n // console.log(\"obj\", obj)\n if (obj != null && obj.id > 0) {\n let selectedUsuarioOrgao = usuarioOrgao.filter(\n (item) => item.idOrgao === obj.id\n )\n // console.log('selectedUsuarioOrgao', selectedUsuarioOrgao)\n dispatch(\n usuarioOrgaoAction.changeDetailsUsuarioOrgao(\n selectedUsuarioOrgao[0]\n )\n )\n } else {\n //dispatch(\n // usuarioOrgaoAction.clearSelected()\n //)\n }\n setOpen(false)\n }\n\n const handleClickOpen = () => {\n setOpen(true)\n //if (undefined !== usuarioOrgao && usuarioOrgao.length) {\n // setDisabled(false)\n //} else {\n // setDisabled(true)\n //}\n setDisabled(false)\n }\n\n const setInitialUsuarioOrgao = () => {\n if (\n usuarioOrgao.length === 0 ||\n usuarioOrgao === undefined\n ) {\n return null\n } else if (\n undefined !== usuarioOrgao &&\n usuarioOrgao.length === 1\n ) {\n dispatch(\n usuarioOrgaoAction.changeDetailsUsuarioOrgao(\n usuarioOrgao[0]\n )\n )\n } else if (!hasOrgaoSelected) {\n //setOpen(true)\n //setDisabled(true)\n }\n }\n\n const handleClose = () => {\n setOpen(false)\n setDisabled(false)\n }\n\n const handleClear = () => {\n dispatch(\n usuarioOrgaoAction.clearSelected()\n )\n setOpen(false)\n setDisabled(false)\n }\n\n const returnContent = () => {\n return (\n \n {authActions.isPrefeitura() || authActions.isMotorista() || authActions.isFiscal() ?\n <>\n
\n \n Órgão vinculado:\n \n {' '}\n {usuarioOrgao.length > 0 && usuarioOrgao[0] != null ? usuarioOrgao[0].orgao.nome : ''}\n \n \n \n >\n : authActions.isGestor() ?\n <>\n
\n \n Órgão selecionado:\n \n {' '}\n {(hasOrgaoSelected ? orgao.nome : 'TODOS')}\n \n \n \n
\n \n \n \n \n
\n >\n : authActions.isEmpresa() &&\n null\n }\n
\n )\n }\n\n return (\n \n {returnContent()}\n
\n )\n}\n\nSelectOrgao.propTypes = {\n className: PropTypes.string\n}\nexport default SelectOrgao\n","import React from 'react'\nimport { useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport { connect, useDispatch } from 'react-redux'\nimport AccountCircleIcon from '@mui/icons-material/AccountCircle';\nimport AddCircleIcon from '@mui/icons-material/AddCircle';\nimport ArticleIcon from '@mui/icons-material/Article';\nimport BrandingWatermarkIcon from '@mui/icons-material/BrandingWatermark';\nimport SettingsIcon from '@mui/icons-material/Settings';\nimport HomeIcon from '@mui/icons-material/Home';\nimport CorporateFareIcon from '@mui/icons-material/CorporateFare';\nimport DirectionsCarIcon from '@mui/icons-material/DirectionsCar';\nimport PeopleIcon from '@mui/icons-material/People';\nimport BusinessIcon from '@mui/icons-material/Business';\n\nimport PropTypes from 'prop-types'\nimport {\n AppBar,\n Chip,\n Menu,\n Grid,\n MenuItem,\n Button,\n Toolbar,\n Hidden,\n IconButton,\n Tooltip,\n Typography\n} from '@mui/material'\nimport { withStyles } from '@mui/styles'\nimport MenuIcon from '@mui/icons-material/Menu';\nimport { authActions } from '../../../../_actions'\nimport LogoutIcon from '@mui/icons-material/Logout';\nimport { withRouter } from 'react-router-dom'\nimport { history } from '../../../../utils'\nimport logo from '../../../../img/rotorWhite.png'\nimport { SelectOrgao } from './components'\n\nconst styles = (theme) => ({\n root: {\n boxShadow: 'none'\n },\n link: {\n color: \"#FFF\",\n font: theme.palette.body1,\n marginLeft: theme.spacing(2)\n },\n topBar: {\n color: 'inherit',\n textDecoration: 'inherit',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center'\n }\n})\n\nconst Topbar = ({ staticContext, theme, ...props }) => {\n const { className, onSidebarOpen, ...rest } = props\n const { classes } = props\n\n const [anchorEl, setAnchorEl] = React.useState(null);\n const open = Boolean(anchorEl);\n\n const [anchorElUser, setAnchorElUser] = React.useState(null);\n const openUser = Boolean(anchorElUser);\n\n const dispatch = useDispatch()\n\n const user = useSelector((state) => state.authentication.user)\n\n const logout = () => {\n dispatch(authActions.logout())\n }\n\n const handleClick = (event) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const handleClickUser = (event) => {\n setAnchorElUser(event.currentTarget);\n };\n\n const handleCloseUser = () => {\n setAnchorElUser(null);\n };\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n {user ? user.nome.toUpperCase() : ''}\n \n \n }\n variant=\"outlined\"\n sx={{ marginLeft: 5, marginRight: 2, color: '#FFF', alignItems: 'center' }} />\n \n \n \n
\n \n \n \n \n \n \n \n \n
\n \n
\n
\n \n \n \n \n
\n \n Toolbar>\n \n )\n}\n\nTopbar.propTypes = {\n onSidebarOpen: PropTypes.func,\n className: PropTypes.string\n}\n\nconst mapStateToProps = (state) => {\n return state\n}\nconst TopbarPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Topbar))\n)\nexport default TopbarPage\n","import React, { useState } from 'react'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles, useTheme } from '@mui/styles'\nimport { useMediaQuery } from '@mui/material'\n\nimport { Topbar, Footer } from './components'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n paddingTop: 56,\n height: '100%',\n [theme.breakpoints.up('sm')]: {\n paddingTop: 64\n }\n },\n content: {\n height: '100%'\n }\n}))\n\nconst Main = (props) => {\n const { children } = props\n\n const classes = useStyles()\n const theme = useTheme()\n const isDesktop = useMediaQuery(theme.breakpoints.up('lg'), {\n defaultMatches: true\n })\n\n const [openSidebar, setOpenSidebar] = useState(false)\n\n const handleSidebarOpen = () => {\n setOpenSidebar(true)\n }\n\n const handleSidebarClose = () => {\n setOpenSidebar(false)\n }\n\n const shouldOpenSidebar = isDesktop ? true : openSidebar\n\n return (\n \n \n {/**/}\n \n {children}\n \n \n
\n )\n}\n\nMain.propTypes = {\n children: PropTypes.node\n}\n\nexport default Main\n","import React from 'react'\nimport { Link as RouterLink } from 'react-router-dom'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@mui/styles'\nimport { AppBar, Toolbar } from '@mui/material'\n\nconst useStyles = makeStyles(() => ({\n root: {\n boxShadow: 'none'\n }\n}))\n\nconst Topbar = (props) => {\n const { className, ...rest } = props\n\n const classes = useStyles()\n\n return (\n \n \n \n
\n \n \n \n )\n}\n\nTopbar.propTypes = {\n className: PropTypes.string\n}\n\nexport default Topbar\n","import React from 'react'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@mui/styles'\n\nimport { Topbar } from './components'\n\nconst useStyles = makeStyles(() => ({\n root: {\n paddingTop: 64,\n height: '100%'\n },\n content: {\n height: '100%'\n }\n}))\n\nconst Minimal = (props) => {\n const { children } = props\n\n const classes = useStyles()\n\n return (\n \n \n {children}\n
\n )\n}\n\nMinimal.propTypes = {\n children: PropTypes.node,\n className: PropTypes.string\n}\n\nexport default Minimal\n","import React from 'react'\nimport { Link as RouterLink } from 'react-router-dom'\nimport { makeStyles } from '@mui/styles'\nimport { Typography, Button, useTheme, useMediaQuery } from '@mui/material'\n\nimport { Page } from 'components'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n padding: theme.spacing(3),\n paddingTop: '10vh',\n display: 'flex',\n flexDirection: 'column',\n alignContent: 'center'\n },\n imageContainer: {\n marginTop: theme.spacing(6),\n display: 'flex',\n justifyContent: 'center'\n },\n image: {\n maxWidth: '100%',\n width: 560,\n maxHeight: 300,\n height: 'auto'\n },\n buttonContainer: {\n marginTop: theme.spacing(6),\n display: 'flex',\n justifyContent: 'center'\n }\n}))\n\nconst Error404 = () => {\n const classes = useStyles()\n const theme = useTheme()\n const mobileDevice = useMediaQuery(theme.breakpoints.down('sm'))\n\n return (\n \n \n 404: A página que você está procurando não está aqui\n \n \n Você tentou alguma rota sombria ou veio aqui por engano. Seja qual for,\n tente usar a navegação\n \n \n {/*\n

\n */}\n
\n \n \n
\n \n )\n}\n\nexport default Error404\n","export default () => {\n var today = new Date()\n var curHr = today.getHours()\n\n if (curHr < 12) {\n return 'Bom dia 🌞'\n } else if (curHr < 18) {\n return 'Boa tarde ✌'\n } else {\n return 'Boa noite 🌜'\n }\n}\n","import React from 'react'\nimport { useSelector } from 'react-redux'\nimport PropTypes from 'prop-types'\nimport clsx from 'clsx'\nimport { makeStyles } from '@mui/styles'\nimport { Typography, Grid, Button, Hidden } from '@mui/material'\nimport BarChartIcon from '@mui/icons-material/BarChart'\nimport messageTime from 'utils/stringTimeHello'\nimport { history } from 'utils'\nimport Lottie from 'react-lottie';\nimport animationData from './rocket.json';\n\nconst defaultOptions = {\n loop: true,\n autoplay: true,\n animationData: animationData,\n rendererSettings: {\n preserveAspectRatio: \"xMidYMid slice\"\n }\n};\n\nconst useStyles = makeStyles((theme) => ({\n root: {},\n summaryButton: {\n backgroundColor: theme.palette.white\n },\n barChartIcon: {\n marginRight: theme.spacing(1)\n }\n}))\n\nconst Header = (props) => {\n const { className, ...rest } = props\n const user = useSelector((state) => state.authentication.user)\n const isDisabled = useSelector((state) => {\n //if (\n // state.usuarioLoja.usuarioLoja.length <= 0\n //) {\n // return true\n //}\n return false\n })\n const classes = useStyles()\n\n return (\n \n \n \n \n Página inicial\n \n \n {messageTime()}, {user.nome.split(' ').slice(0, -1).join(' ')}\n \n \n Confira a performance da loja nos últimos dias\n \n \n \n \n \n {/**/}\n \n \n \n \n
\n )\n}\n\nHeader.propTypes = {\n className: PropTypes.string\n}\n\nexport default Header\n","import React, { useEffect } from 'react'\nimport { makeStyles } from '@mui/styles'\nimport { Page } from 'components'\nimport { Typography } from '@mui/material'\nimport {\n Header\n} from './components'\nimport { useDispatch } from 'react-redux'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n width: theme.breakpoints.values.lg,\n maxWidth: '100%',\n margin: '0 auto',\n padding: theme.spacing(3),\n [theme.breakpoints.up('lg')]: {\n paddingTop: theme.spacing(0)\n }\n },\n statistics: {\n [theme.breakpoints.down('md')]: {\n marginTop: theme.spacing(3)\n }\n },\n notifications: {\n marginTop: theme.spacing(3),\n [theme.breakpoints.down('md')]: {\n marginTop: theme.spacing(0),\n marginBottom: theme.spacing(3)\n }\n },\n summary: {\n marginTop: theme.spacing(3)\n },\n titleCard: {\n fontWeight: 500,\n flex: 1,\n fontSize: 16,\n marginTop: 30,\n marginLeft: 10\n }\n}))\n\nconst Home = () => {\n const classes = useStyles()\n const dispatch = useDispatch()\n \n return (\n \n \n \n FIDELIDADE\n \n \n PEDIDOS DE COMPRA\n \n \n )\n}\n\nexport default Home\n","import React from 'react'\n// import { makeStyles } from '@mui/styles';\nimport { Grid, Typography, Button } from '@mui/material'\nimport PropTypes from 'prop-types'\nimport { makeStyles } from '@mui/styles'\nimport { history } from '../utils'\nimport clsx from 'clsx'\nimport { AccessControl } from '../components/Utils/AccessControl'\n\nconst useStyles = makeStyles(() => ({\n root: {}\n}))\n\nconst TitleContent = (props) => {\n const { className, ...rest } = props\n const classes = useStyles()\n return (\n \n
\n \n \n {props.subTitle}\n \n \n {props.title}\n \n \n (\n \n \n \n \n \n )}\n />\n \n
\n {props.length !== undefined && props.length !== 0 ? (\n
\n \n Total de dados encontrados: {props.length}\n \n \n ) : (\n
\n {'Nenhum dado encontrado.'}\n \n )}\n
\n )\n}\n\nTitleContent.propTypes = {\n title: PropTypes.string.isRequired,\n subTitle: PropTypes.string,\n rule: PropTypes.string\n}\nexport default TitleContent\n","import React from 'react'\nimport { Link as RouterLink } from 'react-router-dom'\nimport { makeStyles } from '@mui/styles'\nimport { Typography, Button, useTheme, useMediaQuery } from '@mui/material'\nimport BlockIcon from '@mui/icons-material/Block';\nimport { Page } from 'components'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n padding: theme.spacing(3),\n paddingTop: '10vh',\n display: 'flex',\n flexDirection: 'column',\n alignContent: 'center'\n },\n imageContainer: {\n marginTop: theme.spacing(6),\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n alignContent: 'center',\n Content: 'center'\n },\n image: {\n maxWidth: '100%',\n width: 560,\n maxHeight: 300,\n height: 'auto'\n },\n buttonContainer: {\n marginTop: theme.spacing(6),\n display: 'flex',\n justifyContent: 'center',\n }\n}))\n\nconst AccessDenied = () => {\n const classes = useStyles()\n const theme = useTheme()\n const mobileDevice = useMediaQuery(theme.breakpoints.down('sm'))\n\n return (\n \n \n 403: O acesso a essa página foi negado.\n \n \n Você não tem autorização para acessar essa página\n \n \n \n
\n \n \n
\n \n )\n}\n\nexport default AccessDenied\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch } from 'react-redux'\nimport { empresaAction } from '../../_actions'\nimport PropTypes from 'prop-types'\nimport {\n Table,\n TableContainer,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Paper,\n IconButton,\n Tooltip,\n Input,\n Grid,\n TablePagination\n} from '@mui/material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport EditIcon from '@mui/icons-material/Edit'\nimport { withStyles } from '@mui/styles'\nimport { withRouter } from 'react-router-dom'\nimport { history, stringUtils } from '../../utils'\nimport TitleContent from '../TitleContent'\nimport { useConfirm } from 'material-ui-confirm'\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport AccessDenied from '../Errors/AccessDenied'\nimport { Page } from 'components'\nimport { useDebounce } from 'use-debounce';\n\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(6, 6, 6, 6)\n }\n})\n\nconst Empresa = (props) => {\n\n const confirm = useConfirm()\n const dispatch = useDispatch()\n const { classes } = props\n const { empresa } = props.empresa\n const { totalRegistros } = props.empresa\n\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('razaosocial');\n const [direction] = useState('asc');\n const [ready, setReady] = React.useState(false);\n\n useEffect(() => {\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction\n };\n\n dispatch(empresaAction.getEmpresa(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n\n }, [page, limit, debounceTerm, order, direction]);\n\n useEffect(() => {\n\n }, [totalRegistros]);\n\n useEffect(() => {\n\n }, [ready, props.empresa.isLoading])\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeLimit = (event) => {\n setLimit(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleClick = (id) => {\n confirm({\n title: 'Você deseja excluir esta Empresa?',\n description: 'Essa operação é irreversível',\n disabled: props.empresa.isLoading,\n confirmationText: props.empresa.isLoading ? 'Excluindo empresa...' : 'Sim, excluir!',\n }).then(() => {\n dispatch(empresaAction.deleteEmpresaById(id))\n })\n }\n\n const handleChange = prop => event => {\n setTerm(event.target.value);\n };\n\n return (\n \n (\n \n {undefined !== empresa && empresa.length > 0 ? (\n
\n ) : (\n
\n )}\n
\n \n \n
\n
\n \n \n \n Razão Social\n Status\n Ações\n \n \n \n {undefined !== empresa && empresa.length\n ? empresa.map((n) => {\n return (\n \n \n {n.razaoSocial ? n.razaoSocial.toUpperCase() : ''}\n \n \n {n.cadastroLiberado == true ? 'CADASTRO LIBERADO' :\n n.cadastroLiberado == false ? 'CADASTRO RECUSADO' :\n n.cadastroLiberado == null && 'PENDENTE'}\n \n \n (\n \n history.push(`/empresa/${n.id}`)\n }\n size=\"small\"\n >\n \n \n \n \n \n \n )}\n />\n (\n handleClick(n.id)}\n size=\"small\"\n >\n \n \n \n \n )}\n />\n \n \n )\n })\n : null}\n \n
\n \n
\n
\n )}\n no={() => }\n />\n \n )\n}\nEmpresa.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return {\n empresa: state.empresa\n }\n}\nconst connectedEmpresaPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Empresa))\n)\nexport { connectedEmpresaPage as Empresa }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { toast } from 'react-toastify'\nimport { withStyles } from '@mui/styles'\nimport Swal from 'sweetalert2';\nimport Typography from '@mui/material/Typography'\nimport { useConfirm } from 'material-ui-confirm'\nimport { styled } from '@mui/material/styles';\nimport DoneIcon from '@mui/icons-material/Done';\nimport CloseIcon from '@mui/icons-material/Close';\nimport {\n Autocomplete,\n Badge,\n Card,\n CardHeader,\n CardContent,\n CardActions,\n CircularProgress,\n Divider,\n Button,\n FormControlLabel,\n Switch,\n Grid,\n MenuItem,\n TextField\n} from '@mui/material'\nimport {\n ValidatorForm,\n TextValidator,\n SelectValidator\n} from 'react-material-ui-form-validator'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faPlus, faTrashAlt } from '@fortawesome/free-solid-svg-icons'\nimport {\n authActions,\n empresaAction,\n usuarioAction,\n orgaoAction,\n cidadeAction,\n estadoAction\n} from '../../_actions'\nimport { withRouter } from 'react-router-dom'\nimport { history, cnpjMask, stringUtils, phoneMask } from '../../utils'\nimport { Page } from 'components'\nimport { isEmpty } from 'lodash'\nimport SaveIcon from '@mui/icons-material/Save';\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2)\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n textAlgin: 'center'\n },\n nome: {\n marginTop: theme.spacing(1)\n },\n uploadButton: {\n marginRight: theme.spacing(2),\n justifyContent: 'space-between'\n },\n avatar: {\n height: 200,\n width: 200,\n borderRadius: '10px',\n webkitBorderRadius: '10px',\n mozBorderRadius: '10px',\n cursor: 'pointer'\n },\n backdrop: {\n zIndex: theme.zIndex.drawer + 1,\n color: '#fff'\n }\n})\n\nconst ButtonAdd = styled(Button)({\n backgroundColor: '#F2D647',\n marginLeft: 7,\n marginRight: 7,\n marginBottom: 3,\n '&:hover': {\n backgroundColor: '#F2D647',\n borderColor: '#F2D647',\n },\n})\n\nconst BadgeShowNames = styled(Badge)({\n fontSize: 15,\n paddingLeft: 7,\n paddingRight: 7,\n color: '#000'\n})\n\nconst EmpresaEdit = (props) => {\n\n const dispatch = useDispatch()\n const { classes, empresa, className, ...rest } = props\n const { match: { params } } = props;\n const formRef = React.createRef(null);\n const confirm = useConfirm()\n\n const [idUsuario, setIdUsuario] = useState(0);\n const [textUsuario, setTextUsuario] = useState('');\n\n const [idOrgao, setIdOrgao] = useState(0);\n const [textOrgao, setTextOrgao] = useState('');\n\n const [value, setValue] = React.useState(null);\n const [inputValue, setInputValue] = React.useState('');\n const [open, setOpen] = React.useState(false)\n\n const [valueOrgao, setValueOrgao] = React.useState(null);\n const [inputValueOrgao, setInputValueOrgao] = React.useState('');\n const [openOrgao, setOpenOrgao] = React.useState(false)\n\n const usuarios = useSelector((state) => state.usuario.usuario)\n\n const orgaos = useSelector((state) => state.orgao.orgao)\n\n const { cidade } = useSelector(\n (state) => state.cidade\n )\n\n const estados = useSelector((state) => state.estado.estado)\n\n const options = cidade.map(u => ({ id: u.value, nome: u.text }));\n\n const optionsOrgaos = orgaos.map(u => ({ id: u.value, nome: u.text }));\n\n const [, forceUpdate] = React.useState(0);\n const [ready, setReady] = React.useState(false);\n\n useEffect(() => {\n\n dispatch(empresaAction.clearUsuariosEmpresas())\n dispatch(usuarioAction.getUsuarioSelect())\n dispatch(orgaoAction.getOrgaoSelect())\n dispatch(estadoAction.getEstadoSelect())\n if (params.id) {\n dispatch(empresaAction.getEmpresaById(params.id))\n } else {\n dispatch(empresaAction.clear())\n dispatch(empresaAction.clearUsuariosEmpresas())\n }\n\n\n if (props.empresa.idEstado != undefined && props.empresa.idEstado !== 0 && props.empresa.idEstado !== '') {\n dispatch(cidadeAction.getCidadeByIdEstado(props.empresa.idEstado))\n }\n\n const interval = setInterval(() => {\n setReady(true)\n }, 1500);\n return () => clearInterval(interval);\n\n }, []);\n\n useEffect(() => {\n if (props.empresa.idEstado) {\n dispatch(cidadeAction.getCidadeByIdEstado(props.empresa.idEstado))\n }\n }, [props.empresa.idEstado])\n\n const handleAddOrgaoOnList = () => {\n if (props.empresa.empresasOrgaos.filter(ts => ts.idOrgao == parseInt(idOrgao)).length > 0) {\n toast.error('Erro ao adicionar! Este órgao já existe!')\n }\n else {\n props.empresa.empresasOrgaos.push({\n 'idOrgao': idOrgao,\n 'idEmpresa': props.empresa.id,\n 'orgao': {\n 'nome': textOrgao\n }\n });\n forceUpdate(n => !n);\n setIdOrgao(0);\n setValueOrgao(null);\n }\n }\n\n const handleRemoveOrgaoOnList = idOrgao => {\n props.empresa.empresasOrgaos = props.empresa.empresasOrgaos.filter(ts => ts.idOrgao != parseInt(idOrgao));\n forceUpdate(n => !n);\n };\n\n useEffect(() => {\n if (value) {\n handleChangeAutoComplete(value)\n }\n }, [value])\n\n const handleChangeAutoComplete = (obj) => {\n if (obj != null) {\n let selected = cidade.filter(\n (item) => item.value == obj.id\n )\n\n dispatch(\n cidadeAction.changeDetailsCidade(\n selected[0]\n )\n )\n } else {\n\n }\n setOpen(false)\n }\n\n const handleChangeAutoCompleteOrgao = (obj) => {\n if (obj != null) {\n setIdOrgao(obj.id);\n setTextOrgao(obj.nome);\n }\n setOpenOrgao(false)\n }\n\n\n useEffect(() => {\n if (valueOrgao) {\n handleChangeAutoCompleteOrgao(valueOrgao)\n }\n }, [valueOrgao])\n\n useEffect(() => {\n forceUpdate(n => !n);\n }, [props.empresa.empresasOrgaos])\n\n useEffect(() => {\n forceUpdate(n => !n);\n }, [props.empresa.usuariosEmpresas])\n\n useEffect(() => {\n\n }, [ready, props.empresa.isLoading])\n\n const handleSelectChangeState = (prop) => (event) => {\n setIdUsuario(event.target.value);\n setTextUsuario(event.nativeEvent.target.innerText);\n };\n\n const handleChange = (prop) => (event) => {\n dispatch(empresaAction.onChangeProps(prop, event))\n }\n\n const handleSubmit = (event) => {\n\n let payload = {\n id: params.id,\n razaoSocial: props.empresa.razaoSocial,\n nomeFantasia: props.empresa.nomeFantasia,\n cnpj: props.empresa.cnpj ? props.empresa.cnpj.split('.').join('').replace(/[-/.]/g, '') : '',\n celular: props.empresa.celular ? props.empresa.celular.split('-').join('').replace('(', '').replace(')', '').replace(' ', '') : '',\n email: props.empresa.email,\n telefone: props.empresa.telefone ? props.empresa.telefone.split('-').join('').replace('(', '').replace(')', '').replace(' ', '') : '',\n endereco: props.empresa.endereco,\n inscricaoEstadual: props.empresa.inscricaoEstadual,\n idCidade: value ? value.id : props.empresa.idCidade,\n idEstado: props.empresa.idEstado,\n usuariosEmpresas: props.empresa.usuariosEmpresas,\n empresasOrgaos: props.empresa.empresasOrgaos,\n fornecedor: props.empresa.fornecedor,\n prestadorServico: props.empresa.prestadorServico\n }\n\n if (params.id) {\n dispatch(empresaAction.editEmpresaInfo(params.id, payload, true))\n } else {\n dispatch(empresaAction.createEmpresa(payload))\n }\n\n };\n\n const handleAprovaCadastroEmpresa = () => {\n confirm({\n title: 'Você deseja liberar o acesso ao sistema para esta Empresa?',\n description: 'Essa operação é irreversível',\n disabled: props.empresa.isLoading,\n confirmationText: props.empresa.isLoading ? 'Aprovando...' : 'Sim, aprovar!',\n }).then(() => {\n dispatch(empresaAction.editAprovaCadastroEmpresa(params.id))\n })\n }\n\n const handleRecusaCadastroEmpresa = () => {\n confirm({\n title: 'Você deseja recusar o acesso ao sistema para esta Empresa?',\n description: 'Essa operação é irreversível',\n disabled: props.empresa.isLoading,\n confirmationText: props.empresa.isLoading ? 'Recusando...' : 'Sim, recusar!',\n }).then(() => {\n dispatch(empresaAction.editRecusaCadastroEmpresa(params.id))\n })\n }\n\n const handleAddOnList = e => {\n\n if (props.empresa.usuariosEmpresas.filter(ts => ts.idUsuario == parseInt(idUsuario)).length > 0) {\n toast.error('Erro ao adicionar! Este usuário já existe!')\n }\n else {\n\n if (idUsuario != '' && idUsuario != '0') {\n props.empresa.usuariosEmpresas.push({ 'idUsuario': idUsuario, 'idEmpresa': props.empresa.id, 'usuario': { 'nome': textUsuario } });\n forceUpdate(n => !n);\n setIdUsuario(0);\n\n } else {\n Swal.fire({\n icon: 'warning',\n title: 'Erro ao salvar',\n showCloseButton: true,\n showConfirmButton: true,\n html: 'Informe ao menos um usuário!
'\n });\n }\n }\n };\n\n const handleRemoveOnList = id => {\n props.empresa.usuariosEmpresas = props.empresa.usuariosEmpresas.filter(ts => ts.idUsuario != parseInt(id));\n forceUpdate(n => !n);\n };\n\n function excludeFilter(obj) {\n if (props.empresa.usuariosEmpresas && props.empresa.usuariosEmpresas.length > 0) {\n if (props.empresa.usuariosEmpresas.filter(fl => fl.idUsuario == parseInt(obj.value)).length > 0) {\n return false;\n } else {\n return true;\n }\n\n } else {\n return true;\n }\n }\n\n function InsertText() {\n return (\n \n {'Nova Empresa'}\n \n )\n }\n\n function EditText() {\n return (\n \n {'Editar Empresa'}\n \n )\n }\n function SegHeader() {\n if (params.id) {\n return \n }\n return \n }\n return (\n \n \n \n \n \n handleSubmit(event)}\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 \n \n \n \n \n {!isEmpty(estados) &&\n undefined !== estados &&\n estados.length &&\n estados.map((row, index) => (\n \n ))}\n \n \n \n {\n setValue(newValue);\n }}\n inputValue={inputValue}\n onInputChange={(event, newInputValue) => {\n setInputValue(newInputValue);\n }}\n id=\"controllable-states-demo\"\n options={options}\n margin=\"normal\"\n variant=\"outlined\"\n defaultValue={null}\n getOptionLabel={option => option.nome || ''}\n renderInput={(params) => }\n fullWidth\n />\n \n \n \n \n \n \n \n }\n label=\"Fornecedor\"\n />\n \n }\n label=\"Prestador de Serviço\"\n />\n \n \n \n \n \n \n \n \n \n \n Usuários vinculados a empresa\n \n \n \n \n \n {!isEmpty(usuarios) &&\n undefined !== usuarios &&\n usuarios.length &&\n usuarios.filter(excludeFilter).map((row, index) => (\n \n ))}\n \n \n \n \n \n \n \n \n {\n (props.empresa.usuariosEmpresas != null && props.empresa.usuariosEmpresas.length > 0 ?\n props.empresa.usuariosEmpresas.map(n => {\n return (\n (n.id !== '' ?\n handleRemoveOnList(n.idUsuario)} key={'button' + n.id}>\n \n {(n.usuario ? n.usuario.nome : n.idUsuario)}\n \n \n \n : null)\n );\n })\n : null)\n }\n \n
\n \n \n \n \n \n \n \n \n Cidades de Interesse\n \n \n \n {\n setValueOrgao(newValueOrgao);\n }}\n inputValue={inputValueOrgao}\n onInputChange={(event, newInputValueOrgao) => {\n setInputValueOrgao(newInputValueOrgao);\n }}\n id=\"controllable-states-demo\"\n options={optionsOrgaos}\n defaultValue={null}\n getOptionLabel={option => option.nome}\n renderInput={(params) => }\n />\n \n \n \n \n \n \n \n {\n (props.empresa.empresasOrgaos != null && props.empresa.empresasOrgaos.length > 0 ?\n props.empresa.empresasOrgaos.map(n => {\n return (\n (n.id !== '' ?\n handleRemoveOrgaoOnList(n.idOrgao)} key={'button' + n.id}>\n \n {(n.orgao ? n.orgao.nome : n.idOrgao)}\n \n \n \n : null)\n );\n })\n : null)\n }\n \n
\n \n \n \n \n \n * Campos obrigatórios\n \n \n \n \n {empresa.id && (authActions.isPrefeitura() || authActions.isGestor()) ?\n <>\n }\n endIcon={props.empresa.isLoading && }\n >\n {props.empresa.cadastroLiberado == false ? 'Acesso recusado' : props.empresa.isLoading ? 'Recusando acesso...' : 'Recusar acesso'}\n \n }\n endIcon={props.empresa.isLoading && }\n >\n {props.empresa.cadastroLiberado == true ? 'Acesso liberado' : props.empresa.isLoading ? 'Liberando acesso...' : 'Liberar acesso'}\n \n >\n : null}\n }\n endIcon={props.empresa.isLoading && }\n >\n {params.id ? (props.empresa.isLoading ? 'Atualizando empresa...' : 'Atualizar') : (props.empresa.isLoading ? 'Salvando empresa...' : 'Salvar')}\n \n \n \n \n \n \n \n \n \n )\n}\n\nEmpresaEdit.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return state\n}\n\nconst connectedEmpresaEditPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(EmpresaEdit))\n)\nexport { connectedEmpresaEditPage as EmpresaEdit }\n","import React, { useState, useEffect } from 'react'\nimport {\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n Grid,\n TextField,\n Typography\n} from '@mui/material'\nimport { usuarioAction } from '_actions'\nimport { useDispatch, useSelector } from 'react-redux'\n\nconst ModalRequestPasswordReset = (props) => {\n\n const [email, setEmail] = useState()\n const dispatch = useDispatch()\n const [finishedTimeout, setFinishedTimeout] = useState(false);\n const { openModalRequestPasswordReset, isLoading } = useSelector(\n (state) => state.usuario\n )\n\n useEffect(() => {\n const id = setTimeout(() => {\n setFinishedTimeout(true);\n }, 5000);\n\n return () => clearTimeout(id);\n }, []);\n\n useEffect(() => {\n if (props.currentEmail != undefined) {\n setEmail(props.currentEmail)\n }\n }, [props])\n\n const handleChange = (event) => {\n setEmail(event.target.value.toLowerCase())\n }\n const handleClose = () => {\n dispatch(usuarioAction.openModalRequestPasswordReset(false))\n }\n const handleSubmit = (event) => {\n event.preventDefault()\n dispatch(usuarioAction.requestPasswordReset(email))\n { finishedTimeout && setEmail('') }\n }\n return (\n \n )\n}\n\nexport default ModalRequestPasswordReset\n","import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport {\n CircularProgress,\n Avatar,\n FormControlLabel,\n Paper,\n Grid,\n Button,\n Box,\n Typography,\n CssBaseline,\n Checkbox,\n Link\n} from '@mui/material'\nimport { connect } from 'react-redux'\nimport LockOutlinedIcon from '@mui/icons-material/LockOutlined'\nimport { authActions, usuarioAction } from '../../_actions'\nimport { history } from '../../utils'\nimport { withStyles } from '@mui/styles'\nimport { withRouter } from 'react-router-dom'\nimport { ValidatorForm, TextValidator } from 'react-material-ui-form-validator'\nimport LockOpenIcon from '@mui/icons-material/LockOpen'\nimport ModalRequestPasswordReset from './ModalRequestPasswordReset'\nimport background from \"../../img/login.png\";\n//import logo from \"../../img/rotorSemFundo.png\";\n\nconst styles = (theme) => ({\n root: {\n height: '100vh',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundImage: `url(${background})`,\n backgroundSize: 'cover',\n backgroundRepeat: 'no-repeat'\n },\n image: {\n backgroundImage: `url(/images/logo_quiero_cafe.svg)`,\n backgroundRepeat: 'no-repeat',\n backgroundColor:\n theme.palette.type === 'dark'\n ? theme.palette.secondary.dark\n : theme.palette.secondary.light,\n backgroundSize: '40rem',\n backgroundPosition: 'center'\n },\n paper: {\n margin: theme.spacing(8, 4),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n avatar: {\n margin: theme.spacing(1),\n backgroundColor: theme.palette.secondary.main\n },\n form: {\n width: '100%', // Fix IE 11 issue.\n marginTop: theme.spacing(1)\n },\n submit: {\n margin: theme.spacing(3, 0, 2)\n },\n backButtom: {}\n})\n\nfunction Copyright() {\n return (\n \n {'Desenvolvido por © '}\n \n FortalezaTec\n {' '}\n {new Date().getFullYear()}\n {'.'}\n \n )\n}\n\nclass Login extends Component {\n constructor(props) {\n super(props)\n this.state = {\n email: '',\n senha: '',\n showPassword: false,\n submitted: false\n }\n }\n\n componentDidMount() {\n if (localStorage.getItem('auth')) {\n history.push('/dashboard')\n }\n }\n handleChange = (prop) => (event) => {\n if (prop === 'email') {\n this.setState({ [prop]: event.target.value.toLowerCase() })\n } else {\n this.setState({ [prop]: event.target.value })\n }\n }\n\n handleChangeBox = (name) => (event) => {\n this.setState({ ...this.state, [name]: event.target.checked })\n }\n\n handleSubmit = (event) => {\n event.preventDefault()\n const { email, senha } = this.state\n const { dispatch } = this.props\n\n if (email && senha) {\n dispatch(authActions.login(email, senha))\n }\n }\n\n handleClickopenModalRequestPasswordReset = () => {\n const { dispatch } = this.props\n dispatch(usuarioAction.openModalRequestPasswordReset(true))\n }\n render() {\n const { loggingIn } = this.props\n const { classes } = this.props\n return (\n \n \n \n \n {/*

*/}\n
\n API SINAPI/SICRO\n \n
\n Efetuar Login\n \n
\n \n \n \n \n }\n label=\"Mostrar senha\"\n />\n \n }\n endIcon={loggingIn && }\n >\n {loggingIn ? 'Validando informações... ' : 'Entrar'}\n \n \n
\n \n \n {'Esqueceu a senha?'}\n \n \n \n
\n \n \n
\n \n \n )\n }\n}\nLogin.propTypes = {\n classes: PropTypes.object.isRequired\n}\n\nconst mapStateToProps = (state) => {\n const { loggingIn } = state.authentication\n return {\n loggingIn\n }\n}\nconst connectedLoginPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Login))\n)\nexport { connectedLoginPage as Login }\n","import React, { useEffect } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { usuarioAction } from '../../_actions'\n\nconst EmailVerification = (props) => {\n const dispatch = useDispatch()\n const refreshed = useSelector((state) => state.authentication.refreshed)\n const loggedIn = useSelector((state) => state.authentication.loggedIn)\n\n const verificaEmail = () => {\n const query = new URLSearchParams(props.location.search)\n var email = query.toString().substr(6, query.toString().indexOf('&', 0) - 6)\n email = decodeURIComponent(email)\n var token = query\n .toString()\n .substr(\n query.toString().indexOf('token=', 0) + 6,\n query.toString().length - query.toString().indexOf('token=', 0) - 6\n )\n\n let payload = {\n login: decodeURIComponent(email),\n senha: 'senha'\n }\n dispatch(usuarioAction.emailVerification(payload, token))\n }\n\n useEffect(() => {\n //console.log('loggedIn', loggedIn)\n if (loggedIn) {\n if (refreshed) {\n verificaEmail()\n }\n }\n }, [refreshed])\n\n useEffect(() => {\n if (!loggedIn) {\n verificaEmail()\n }\n }, [])\n\n return <>>\n}\nexport default EmailVerification\n","import React, { Component } from 'react'\nimport Button from '@mui/material/Button'\nimport CssBaseline from '@mui/material/CssBaseline'\nimport PropTypes from 'prop-types'\nimport { withRouter } from 'react-router-dom'\nimport { connect } from 'react-redux'\nimport Paper from '@mui/material/Paper'\nimport Grid from '@mui/material/Grid'\nimport Typography from '@mui/material/Typography'\nimport Container from '@mui/material/Container'\nimport IconButton from '@mui/material/IconButton'\nimport KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace'\nimport { withStyles } from '@mui/styles'\nimport { usuarioAction } from '../../_actions'\nimport { ValidatorForm, TextValidator } from 'react-material-ui-form-validator'\nimport { history } from 'utils'\nimport { CircularProgress } from '@mui/material'\n\nconst styles = (theme) => ({\n paper: {\n marginTop: theme.spacing(5),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n avatar: {\n margin: theme.spacing(1),\n backgroundColor: theme.palette.secondary.main,\n width: theme.spacing(9),\n height: theme.spacing(9)\n },\n form: {\n width: '100%', // Fix IE 11 issue.\n marginTop: theme.spacing(3)\n },\n submit: {\n margin: theme.spacing(3, 0, 2),\n color: '#ffffff'\n },\n backButton: {\n marginTop: theme.spacing(1)\n }\n})\n\nclass PasswordReset extends Component {\n state = {\n email: '',\n token: '',\n password: '',\n repeatPassword: ''\n }\n\n componentDidMount() {\n const query = new URLSearchParams(this.props.location.search)\n var email = query.toString().substr(6, query.toString().indexOf('&', 0) - 6)\n this.setState({ email: decodeURIComponent(email) })\n\n var token = query\n .toString()\n .substr(\n query.toString().indexOf('token=', 0) + 6,\n query.toString().length - query.toString().indexOf('token=', 0) - 6\n )\n this.setState({ token: token })\n\n ValidatorForm.addValidationRule('isPasswordMatch', (value) => {\n if (value !== this.state.password) {\n return false\n }\n return true\n })\n }\n\n handleChangePassword = (prop) => (event) => {\n this.setState({ [prop]: event.target.value })\n }\n\n handleChangeRepeatPassword = (prop) => (event) => {\n this.setState({ [prop]: event.target.value })\n }\n\n handleSubmit = (event) => {\n event.preventDefault()\n const { dispatch } = this.props\n let payload = {\n login: this.state.email,\n senha: this.state.password\n }\n dispatch(usuarioAction.passwordReset(payload, this.state.token))\n }\n\n render() {\n const { loading } = this.props.usuario\n const { classes } = this.props\n\n return (\n \n \n \n \n history.goBack()}\n aria-label=\"Voltar\"\n color=\"primary\"\n >\n \n \n \n \n Informe e confirme a nova senha.\n \n \n \n \n \n \n \n \n \n \n }\n >\n {loading ? 'Enviando informações...' : 'Alterar'}\n \n \n
\n \n )\n }\n}\nPasswordReset.propTypes = {\n classes: PropTypes.object.isRequired\n}\n\nfunction mapStateToProps(state) {\n return state\n}\nconst connectedPasswordResetPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(PasswordReset))\n)\nexport { connectedPasswordResetPage as PasswordReset }\n","import React, { Component } from 'react'\nimport Button from '@mui/material/Button'\nimport CssBaseline from '@mui/material/CssBaseline'\nimport PropTypes from 'prop-types'\nimport { withRouter } from 'react-router-dom'\nimport { connect } from 'react-redux'\nimport Paper from '@mui/material/Paper'\nimport Grid from '@mui/material/Grid'\nimport Typography from '@mui/material/Typography'\nimport Container from '@mui/material/Container'\nimport { withStyles } from '@mui/styles'\nimport { history } from 'utils'\nimport { CircularProgress } from '@mui/material'\n\nconst styles = (theme) => ({\n paper: {\n marginTop: theme.spacing(5),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n avatar: {\n margin: theme.spacing(1),\n backgroundColor: theme.palette.secondary.main,\n width: theme.spacing(9),\n height: theme.spacing(9)\n },\n form: {\n width: '100%', // Fix IE 11 issue.\n marginTop: theme.spacing(3)\n },\n submit: {\n color: '#ffffff'\n },\n backButton: {\n marginTop: theme.spacing(1)\n }\n})\n\nclass PasswordResetSuccess extends Component {\n\n handleOpenWeb = () => {\n history.push('/');\n }\n\n render() {\n const { loading } = this.props.usuario\n const { classes } = this.props\n\n return (\n \n \n \n \n Senha redefinida com sucesso. Escolha a forma de login.\n \n \n \n }\n onClick={this.handleOpenWeb}\n >\n {loading ? 'Carregando...' : 'Login Administrador (Web)'}\n \n \n \n
\n \n )\n }\n}\nPasswordResetSuccess.propTypes = {\n classes: PropTypes.object.isRequired\n}\n\nfunction mapStateToProps(state) {\n return state\n}\nconst connectedPasswordResetSuccessPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(PasswordResetSuccess))\n)\nexport { connectedPasswordResetSuccessPage as PasswordResetSuccess }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch } from 'react-redux'\nimport { marcaAction } from '../../_actions'\nimport PropTypes from 'prop-types'\nimport { withStyles } from '@mui/styles'\nimport {\n Table,\n TableContainer,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n TablePagination,\n Paper,\n IconButton,\n Tooltip,\n Input,\n Grid\n} from '@mui/material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport EditIcon from '@mui/icons-material/Edit'\nimport { withRouter } from 'react-router-dom'\nimport { history } from '../../utils'\nimport TitleContent from '../TitleContent'\nimport { useConfirm } from 'material-ui-confirm'\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport AccessDenied from '../Errors/AccessDenied'\nimport { Page } from 'components'\nimport { useDebounce } from 'use-debounce';\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(6, 6, 6, 6)\n }\n})\n\nconst Marca = (props) => {\n\n const confirm = useConfirm()\n const dispatch = useDispatch()\n const { classes } = props\n const { marca } = props.marca\n const { totalRegistros } = props.marca\n\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('nome');\n const [direction] = useState('asc');\n const [ready, setReady] = React.useState(false);\n\n useEffect(() => {\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction\n };\n\n dispatch(marcaAction.getMarca(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n\n }, [page, limit, debounceTerm, order, direction]);\n\n useEffect(() => {\n\n }, [totalRegistros]);\n\n useEffect(() => {\n\n }, [ready, props.marca.isLoading])\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeLimit = (event) => {\n setLimit(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleClick = (id) => {\n confirm({\n title: 'Você deseja excluir esta Marca?',\n description: 'Essa operação é irreversível',\n confirmationText: 'Sim, excluir!',\n disabled: props.marca.isLoading,\n confirmationText: props.marca.isLoading ? 'Excluindo marca...' : 'Sim, excluir!',\n cancellationText: 'Não!'\n }).then(() => {\n dispatch(marcaAction.deleteMarcaById(id))\n })\n }\n\n const handleChange = prop => event => {\n setTerm(event.target.value);\n };\n\n return (\n \n (\n \n {undefined !== marca && marca.length > 0 ? (\n
\n ) : (\n
\n )}\n
\n \n \n
\n
\n \n \n \n Nome\n Ações\n \n \n \n {undefined !== marca && marca.length\n ? marca.map((n) => {\n return (\n \n \n {n.nome ? n.nome.toUpperCase() : ''}\n \n \n (\n \n history.push(`/marca/${n.id}`)\n }\n size=\"small\"\n >\n \n \n \n \n \n \n )}\n />\n (\n handleClick(n.id)}\n size=\"small\"\n >\n \n \n \n \n )}\n />\n \n \n )\n })\n : null}\n \n
\n \n
\n
\n )}\n no={() => }\n />\n \n )\n}\nMarca.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return {\n marca: state.marca\n }\n}\nconst connectedMarcaPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Marca))\n)\nexport { connectedMarcaPage as Marca }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { withStyles } from '@mui/styles'\nimport Typography from '@mui/material/Typography'\nimport {\n Button,\n Card,\n CardHeader,\n CardContent,\n CardActions,\n CircularProgress,\n Divider,\n Grid,\n} from '@mui/material'\nimport {\n ValidatorForm,\n TextValidator\n} from 'react-material-ui-form-validator'\nimport { marcaAction } from '../../_actions'\nimport { withRouter } from 'react-router-dom'\nimport { history, stringUtils } from '../../utils'\nimport SaveIcon from '@mui/icons-material/Save';\nimport { Page } from 'components'\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2)\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n textAlgin: 'center'\n },\n nome: {\n marginTop: theme.spacing(1)\n },\n uploadButton: {\n marginRight: theme.spacing(2),\n justifyContent: 'space-between'\n },\n avatar: {\n height: 200,\n width: 200,\n borderRadius: '10px',\n webkitBorderRadius: '10px',\n mozBorderRadius: '10px',\n cursor: 'pointer'\n },\n backdrop: {\n zIndex: theme.zIndex.drawer + 1,\n color: '#fff'\n }\n})\n\nconst MarcaEdit = (props) => {\n\n const dispatch = useDispatch()\n const { classes, marca, className, ...rest } = props\n const { match: { params } } = props;\n const formRef = React.createRef(null);\n\n const [, forceUpdate] = React.useState(0);\n const [ready, setReady] = React.useState(false);\n\n useEffect(() => {\n\n if (params.id) {\n dispatch(marcaAction.getMarcaById(params.id))\n } else {\n dispatch(marcaAction.clear())\n }\n\n }, []);\n\n useEffect(() => {\n\n }, [ready, props.marca.isLoading])\n\n const handleChange = (prop) => (event) => {\n dispatch(marcaAction.onChangeProps(prop, event))\n }\n\n const handleSubmit = (event) => {\n\n let payload = {\n id: params.id,\n nome: props.marca.nome\n }\n\n if (params.id) {\n dispatch(marcaAction.editMarcaInfo(params.id, payload, true))\n } else {\n dispatch(marcaAction.createMarca(payload))\n }\n\n };\n\n function InsertText() {\n return (\n \n {'Nova Marca'}\n \n )\n }\n\n function EditText() {\n return (\n \n {'Editar Marca'}\n \n )\n }\n function SegHeader() {\n if (params.id) {\n return \n }\n return \n }\n return (\n \n \n \n \n \n handleSubmit(event)}\n >\n }\n />\n \n \n \n \n \n \n \n \n \n \n \n \n * Campos obrigatórios\n \n\n \n \n \n }\n endIcon={props.marca.isLoading && }\n >\n {params.id ? (props.marca.isLoading ? 'Atualizando marca...' : 'Atualizar') : (props.marca.isLoading ? 'Salvando marca...' : 'Salvar')}\n \n \n \n \n \n \n \n \n \n )\n}\n\nMarcaEdit.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return state\n}\n\nconst connectedMarcaEditPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(MarcaEdit))\n)\nexport { connectedMarcaEditPage as MarcaEdit }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport { orgaoAction } from '../../_actions'\nimport PropTypes from 'prop-types'\nimport {\n Box,\n Button,\n ButtonGroup,\n FormControl,\n FormLabel,\n Typography,\n Table,\n TableContainer,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Paper,\n IconButton,\n Tooltip,\n Input,\n Grid,\n TablePagination\n} from '@mui/material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport EditIcon from '@mui/icons-material/Edit'\nimport { withStyles } from '@mui/styles'\nimport { withRouter } from 'react-router-dom'\nimport { history } from '../../utils'\nimport TitleContent from '../TitleContent'\nimport { useConfirm } from 'material-ui-confirm'\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport AccessDenied from '../Errors/AccessDenied'\nimport { Page } from 'components'\nimport { useDebounce } from 'use-debounce';\n\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(6, 6, 6, 6)\n }\n})\n\nconst Orgao = (props) => {\n\n const confirm = useConfirm()\n const dispatch = useDispatch()\n const { classes } = props\n const { orgao } = props.orgao\n const { totalRegistros } = props.orgao\n\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('nome');\n const [direction] = useState('asc');\n const [status, setStatus] = useState('');\n\n const [ready, setReady] = React.useState(false);\n\n const { idOrgao } = useSelector(\n (state) => state.usuarioOrgao\n )\n\n const buttons = [\n ,\n ,\n ,\n \n ];\n\n useEffect(() => {\n setStatus('')\n }, [])\n\n useEffect(() => {\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction,\n IdOrgao: (idOrgao && idOrgao != '' && idOrgao),\n Status: status\n };\n\n dispatch(orgaoAction.getOrgao(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n }, [page, limit, debounceTerm, order, direction, idOrgao]);\n\n useEffect(() => {\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction,\n IdOrgao: (idOrgao && idOrgao != '' && idOrgao),\n Status: status\n };\n dispatch(orgaoAction.getOrgao(filterModel, true));\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n\n }, [status])\n\n useEffect(() => {\n\n }, [totalRegistros]);\n\n useEffect(() => {\n\n }, [ready, props.orgao.isLoading])\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeLimit = (event) => {\n setLimit(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleClick = (id) => {\n confirm({\n title: 'Você deseja excluir este órgão?',\n description: 'Essa operação é irreversível',\n disabled: props.orgao.isLoading,\n confirmationText: props.orgao.isLoading ? 'Excluindo órgão...' : 'Sim, excluir!',\n }).then(() => {\n dispatch(orgaoAction.deleteOrgaoById(id))\n })\n }\n\n const handleChange = prop => event => {\n setTerm(event.target.value);\n };\n\n return (\n \n (\n \n {undefined !== orgao && orgao.length > 0 ? (\n
\n ) : (\n
\n )}\n
\n \n \n \n \n \n \n Filtrar por Status \n \n *': {\n m: 1,\n },\n }}\n >\n \n {buttons}\n \n \n \n \n \n
\n
\n \n \n \n Nome\n Status\n Ações\n \n \n \n {undefined !== orgao && orgao.length\n ? orgao.map((n) => {\n return (\n \n \n {n.nome ? n.nome.toUpperCase() : ''}\n \n \n {n.cadastroLiberado == true ? 'CADASTRO LIBERADO' :\n n.cadastroLiberado == false ? 'CADASTRO RECUSADO' :\n n.cadastroLiberado == null && 'PENDENTE'}\n \n \n (\n \n history.push(`/orgao/${n.id}`)\n }\n size=\"small\"\n >\n \n \n \n \n \n \n )}\n />\n (\n handleClick(n.id)}\n size=\"small\"\n >\n \n \n \n \n )}\n />\n \n \n )\n })\n : null}\n \n
\n \n
\n
\n )\n }\n no={() => }\n />\n \n )\n}\nOrgao.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return {\n orgao: state.orgao\n }\n}\nconst connectedOrgaoPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Orgao))\n)\nexport { connectedOrgaoPage as Orgao }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch } from 'react-redux'\nimport { usuarioAction } from '../../_actions'\nimport PropTypes from 'prop-types'\nimport {\n Table,\n TableContainer,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Paper,\n IconButton,\n Tooltip,\n Input,\n Grid,\n TablePagination\n} from '@mui/material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport EditIcon from '@mui/icons-material/Edit'\nimport InfoIcon from '@mui/icons-material/Info';\nimport { withStyles } from '@mui/styles'\nimport { withRouter } from 'react-router-dom'\nimport { history } from '../../utils'\nimport TitleContent from '../TitleContent'\nimport SendIcon from '@mui/icons-material/Send';\nimport DoneIcon from '@mui/icons-material/Done';\nimport { useConfirm } from 'material-ui-confirm'\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport AccessDenied from '../Errors/AccessDenied'\nimport { Page } from 'components'\nimport { useDebounce } from 'use-debounce';\n\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(6, 6, 6, 6)\n }\n})\n\nconst Usuario = (props) => {\n\n const confirm = useConfirm()\n const dispatch = useDispatch()\n const { classes } = props\n const { usuario } = props.usuario\n const { totalRegistros } = props.usuario\n\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('nome');\n const [direction] = useState('asc');\n const [ready, setReady] = React.useState(false);\n\n useEffect(() => {\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction\n };\n\n dispatch(usuarioAction.getUsuario(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n //console.log(\"usuarios\", usuario)\n }, [page, limit, debounceTerm, order, direction]);\n\n useEffect(() => {\n\n }, [props.usuario.usuario]);\n\n useEffect(() => {\n\n }, [totalRegistros]);\n\n const handleVerificaEmailUsuario = (n) => {\n confirm({\n title: 'Você deseja verificar este e-mail?',\n description: 'O status verificado será alterado para \"SIM\"',\n confirmationText: 'Sim, verificar!',\n disabled: props.usuario.isLoading,\n confirmationText: props.usuario.isLoading ? 'Verificando e-mail...' : 'Sim, verificar!',\n cancellationText: 'Não!'\n }).then(() => {\n dispatch(usuarioAction.verifyUsuarioEmail(n))\n })\n }\n\n const handleRequestPasswordReset = (email) => {\n dispatch(usuarioAction.requestPasswordReset(email))\n }\n\n useEffect(() => {\n\n }, [ready, props.usuario.isLoading])\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeLimit = (event) => {\n setLimit(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleClick = (id) => {\n confirm({\n title: 'Você deseja excluir este Usuário?',\n description: 'Essa operação é irreversível',\n disabled: props.usuario.isLoading,\n confirmationText: props.usuario.isLoading ? 'Excluindo usuário...' : 'Sim, excluir!',\n }).then(() => {\n dispatch(usuarioAction.deleteUsuarioById(id))\n })\n }\n\n const handleChange = prop => event => {\n setTerm(event.target.value);\n };\n\n return (\n \n (\n \n {undefined !== usuario && usuario.length > 0 ? (\n
\n ) : (\n
\n )}\n
\n \n \n
\n
\n \n \n \n Nome\n E-mail\n Tipo\n Cadastro Ativo\n \n \n \n \n Ações\n \n \n \n {undefined !== usuario && usuario.length\n ? usuario.map((n) => {\n return (\n \n \n {n.nome ? n.nome.toUpperCase() : ''} {n.sobrenome ? n.sobrenome.toUpperCase() : ''}\n \n \n {n.email ? n.email.toLowerCase() : ''}\n \n \n {n.tipoUsuario ? n.tipoUsuario.nome.toUpperCase() : ''}\n \n \n {(n.senha != null && n.senha != '') ? 'SIM' : 'NÃO'}\n \n \n (\n \n history.push(`/usuario/${n.id}`)\n }\n size=\"small\"\n >\n \n \n \n \n \n \n )}\n />\n (\n handleClick(n.id)}\n size=\"small\"\n >\n \n \n \n \n )}\n />\n {/*{n.emailVerificado != true &&*/}\n {/* (*/}\n {/* handleVerificaEmailUsuario(n.id)}*/}\n {/* >*/}\n {/* */}\n {/* */}\n {/* */}\n {/* */}\n {/* )}*/}\n {/* />*/}\n {/*}*/}\n {n.senha == null || n.senha == '' &&\n (\n handleRequestPasswordReset(n.email)}\n >\n \n \n \n \n )}\n />\n }\n \n \n )\n })\n : null}\n \n
\n \n
\n
\n )}\n no={() => }\n />\n \n )\n}\nUsuario.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return {\n usuario: state.usuario\n }\n}\nconst connectedUsuarioPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Usuario))\n)\nexport { connectedUsuarioPage as Usuario }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport moment from 'moment'\nimport { withStyles } from '@mui/styles'\nimport Typography from '@mui/material/Typography'\nimport { toast } from 'react-toastify'\nimport Swal from 'sweetalert2';\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n CircularProgress,\n Divider,\n Button,\n Grid,\n MenuItem\n} from '@mui/material'\nimport {\n ValidatorForm,\n TextValidator,\n SelectValidator\n} from 'react-material-ui-form-validator'\nimport { usuarioAction, tipoUsuarioAction } from '../../_actions'\nimport { withRouter } from 'react-router-dom'\nimport { phoneMask, history, stringUtils } from '../../utils'\nimport { Page } from 'components'\nimport { isEmpty } from 'lodash'\nimport SaveIcon from '@mui/icons-material/Save';\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2)\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n textAlgin: 'center'\n },\n nome: {\n marginTop: theme.spacing(1)\n },\n uploadButton: {\n marginRight: theme.spacing(2),\n justifyContent: 'space-between'\n },\n avatar: {\n height: 200,\n width: 200,\n borderRadius: '10px',\n webkitBorderRadius: '10px',\n mozBorderRadius: '10px',\n cursor: 'pointer'\n },\n backdrop: {\n zIndex: theme.zIndex.drawer + 1,\n color: '#fff'\n }\n})\n\nconst UsuarioEdit = (props) => {\n\n const dispatch = useDispatch()\n const { classes, className, idorgao, isorgao, toggle, ...rest } = props\n const { match: { params } } = props;\n const formRef = React.createRef(null);\n const tipoUsuario = useSelector((state) => state.tipoUsuario.tipoUsuario)\n\n const [, forceUpdate] = React.useState(0);\n const [ready, setReady] = React.useState(false);\n\n useEffect(() => {\n dispatch(tipoUsuarioAction.getTiposUsuarioSelect())\n\n if (params.id && (idorgao == undefined || idorgao == null)) {\n dispatch(usuarioAction.getUsuarioById(params.id))\n } else {\n dispatch(usuarioAction.clear())\n }\n\n }, []);\n\n const { idUsuario } = useSelector(\n (state) => state.usuario\n )\n\n useEffect(() => {\n\n }, [ready, props.usuario.isLoading])\n\n const handleChange = (prop) => (event) => {\n dispatch(usuarioAction.onChangeProps(prop, event))\n }\n\n const handleSubmit = (event) => {\n\n let payload = {\n id: params.id,\n nome: props.usuario.nome,\n senha: props.usuario.senha,\n sobrenome: props.usuario.sobrenome,\n email: props.usuario.email.toLowerCase(),\n idTipoUsuario: props.usuario.idTipoUsuario,\n caminhoCnh: props.usuario.caminhoCnh,\n celular: props.usuario.celular.split('-').join('').replace('(', '').replace(')', '').replace(' ', ''), \n cnh: props.usuario.cnh,\n matricula: props.usuario.matricula,\n telefone: props.usuario.telefone.split('-').join('').replace('(', '').replace(')', '').replace(' ', '')\n }\n if (isorgao != true) {\n if (params.id) {\n dispatch(usuarioAction.editUsuarioInfo(params.id, payload, true))\n } else {\n dispatch(usuarioAction.createUsuario(payload))\n }\n } else {\n handleAddOnList()\n }\n };\n\n const handleAddOnList = () => {\n if (props.orgao.usuariosOrgaos.filter(ts => ts.idUsuario == parseInt(idUsuario)).length > 0) {\n toast.error('Erro ao adicionar! Este usuário já existe!')\n }\n else {\n props.orgao.usuariosOrgaos.push({\n 'idUsuario': params.id != 0 ? params.id : props.usuario.idUsuarioOrgao,\n 'idOrgao': idorgao ? idorgao : 0,\n 'usuario': {\n 'nome': props.usuario.nome,\n 'sobrenome': props.usuario.sobrenome,\n 'email': props.usuario.email.toLowerCase(),\n 'idTipoUsuario': props.usuario.idTipoUsuario,\n 'caminhoCnh': props.usuario.caminhoCnh,\n 'celular': props.usuario.celular.split('-').join('').replace('(', '').replace(')', '').replace(' ', ''), \n 'cnh': props.usuario.cnh,\n 'matricula': props.usuario.matricula,\n 'telefone': props.usuario.telefone.split('-').join('').replace('(', '').replace(')', '').replace(' ', '')\n }\n });\n\n forceUpdate(n => !n);\n toggle();\n }\n }\n\n const handleActions = () => {\n if (isorgao == true) {\n history.push('/orgao/' + idorgao);\n } else {\n history.push('/orgao/');\n }\n\n toggle();\n }\n\n function InsertText() {\n return (\n \n {'Novo Usuário'}\n \n )\n }\n\n function EditText() {\n return (\n \n {'Editar Usuário'}\n \n )\n }\n function SegHeader() {\n if (params.id && isorgao == false) {\n return \n }\n return \n }\n return (\n \n \n \n \n \n handleSubmit(event)}\n >\n }\n />\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {!isEmpty(tipoUsuario) &&\n undefined !== tipoUsuario &&\n tipoUsuario.length &&\n tipoUsuario.map((row) => (\n \n ))}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {(props.usuario && props.usuario.dataHoraUltimoAcesso ?\n \n \n \n :\n null\n )}\n \n \n \n \n \n \n * Campos obrigatórios\n \n \n \n {(idorgao) ?\n \n :\n \n }\n }\n endIcon={props.usuario.isLoading && }\n >\n {params.id && isorgao != true ? (props.usuario.isLoading ? 'Atualizando usuário...' : 'Atualizar') : (props.usuario.isLoading ? 'Salvando usuário...' : 'Salvar')}\n \n \n \n \n \n \n \n \n \n )\n}\n\nUsuarioEdit.propTypes = {\n classes: PropTypes.object.isRequired,\n idorgao: PropTypes.string,\n toggle: PropTypes.object,\n idUsuario: PropTypes.object,\n isorgao: PropTypes.bool\n}\nconst mapStateToProps = (state) => {\n return state\n}\n\nconst connectedUsuarioEditPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(UsuarioEdit))\n)\nexport { connectedUsuarioEditPage as UsuarioEdit }\n","import React, { useEffect, useState } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { UsuarioEdit } from '../../views/Usuarios'\nimport {\n Grid,\n Button,\n Typography\n} from '@mui/material'\nimport Dialog from '@mui/material/Dialog';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogContent from '@mui/material/DialogContent';\nimport CloseIcon from '@mui/icons-material/Close';\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport { useConfirm } from 'material-ui-confirm'\n\nconst styles = {\n bgcolor: 'background.paper',\n border: '2px solid #000',\n boxShadow: 24,\n p: 4\n};\n\nexport const UsuarioEditModal = ({ modal, toggle, props, idorgao, isorgao }) => {\n\n const confirm = useConfirm()\n const dispatch = useDispatch()\n const { classes, orgao, className, ...rest } = props\n const { match: { params } } = props;\n\n const { idUsuario } = useSelector(\n (state) => state.usuario\n )\n\n const isLoading = useSelector(\n (state) => state.usuarioOrgao.isLoading\n )\n\n useEffect(() => {\n }, [props.orgao.isLoading, isLoading])\n\n const handleClose = () => {\n toggle();\n }\n\n return (\n \n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { withStyles } from '@mui/styles'\nimport Autocomplete from '@mui/material/Autocomplete';\nimport Typography from '@mui/material/Typography';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faPlus, faTrashAlt, faUserPlus } from '@fortawesome/free-solid-svg-icons'\nimport { isEmpty } from 'lodash'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n CircularProgress,\n Divider,\n Button,\n Badge,\n Grid,\n TextField,\n MenuItem\n} from '@mui/material'\nimport {\n ValidatorForm,\n TextValidator,\n SelectValidator\n} from 'react-material-ui-form-validator'\nimport DoneIcon from '@mui/icons-material/Done';\nimport CloseIcon from '@mui/icons-material/Close';\nimport {\n authActions,\n orgaoAction,\n cidadeAction,\n estadoAction,\n usuarioAction\n} from '../../_actions'\nimport { withRouter } from 'react-router-dom'\nimport { useConfirm } from 'material-ui-confirm'\nimport { toast } from 'react-toastify'\nimport { history, cnpjMask, stringUtils, phoneMask } from '../../utils'\nimport { Page } from 'components'\nimport SaveIcon from '@mui/icons-material/Save';\nimport { UsuarioEditModal } from './usuarioEditModal.component';\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2)\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n textAlgin: 'center'\n },\n nome: {\n marginTop: theme.spacing(1)\n },\n uploadButton: {\n marginRight: theme.spacing(2),\n justifyContent: 'space-between'\n },\n avatar: {\n height: 200,\n width: 200,\n borderRadius: '10px',\n webkitBorderRadius: '10px',\n mozBorderRadius: '10px',\n cursor: 'pointer'\n },\n backdrop: {\n zIndex: theme.zIndex.drawer + 1,\n color: '#fff'\n }\n})\n\nconst OrgaoEdit = (props) => {\n\n const dispatch = useDispatch()\n const { classes, orgao, className, ...rest } = props\n const { match: { params } } = props;\n const formRef = React.createRef(null);\n const confirm = useConfirm()\n\n const [, forceUpdate] = React.useState(0);\n const [ready, setReady] = React.useState(false);\n\n const [idUsuario, setIdUsuario] = useState(0);\n const [textUsuario, setTextUsuario] = useState('');\n\n const [value, setValue] = React.useState(null);\n const [inputValue, setInputValue] = React.useState('');\n const [open, setOpen] = React.useState(false)\n\n const [valueUsuario, setValueUsuario] = React.useState(null);\n const [inputValueUsuario, setInputValueUsuario] = React.useState('');\n const [openUsuario, setOpenUsuario] = React.useState(false)\n\n const [usuarioByOrgao, setUsuarioByOrgao] = React.useState(false);\n\n const [modalUsuario, setModalUsuario] = useState(false);\n const toggleUsuario = () => setModalUsuario(!modalUsuario);\n\n const { cidade } = useSelector(\n (state) => state.cidade\n )\n\n const { usuario } = useSelector(\n (state) => state.usuario\n )\n\n const estados = useSelector((state) => state.estado.estado)\n\n const options = cidade.map(u => ({ id: u.value, nome: u.text }));\n\n const optionsUsuarios = usuario.map(u => ({ id: u.value, nome: u.text }));\n\n useEffect(() => {\n\n dispatch(estadoAction.getEstadoSelect())\n dispatch(usuarioAction.getUsuarioSemOrgaoAindaSelect())\n\n if (params.id) {\n dispatch(orgaoAction.getOrgaoById(params.id))\n } else {\n dispatch(orgaoAction.clear())\n }\n \n }, []);\n\n const handleAprovaCadastroOrgao = () => {\n confirm({\n title: 'Você deseja liberar o acesso ao sistema para este Órgão?',\n description: 'Essa operação é irreversível',\n disabled: props.orgao.isLoading,\n confirmationText: props.orgao.isLoading ? 'Aprovando...' : 'Sim, aprovar!',\n }).then(() => {\n dispatch(orgaoAction.editAprovaCadastroOrgao(params.id))\n })\n }\n\n const handleRecusaCadastroOrgao = () => {\n confirm({\n title: 'Você deseja recusar o acesso ao sistema para este óÓrgão?',\n description: 'Essa operação é irreversível',\n disabled: props.orgao.isLoading,\n confirmationText: props.orgao.isLoading ? 'Recusando...' : 'Sim, recusar!',\n }).then(() => {\n dispatch(orgaoAction.editRecusaCadastroOrgao(params.id))\n })\n }\n\n const handleRemoveOnList = id => {\n props.orgao.usuariosOrgaos = props.orgao.usuariosOrgaos.filter(ts => ts.idUsuario != parseInt(id));\n forceUpdate(n => !n);\n };\n\n const handleOpenModal = () => {\n toggleUsuario();\n setUsuarioByOrgao(true);\n }\n\n useEffect(() => {\n }, [idUsuario])\n\n useEffect(() => {\n if (props.orgao.idEstado) {\n dispatch(cidadeAction.getCidadeByIdEstado(props.orgao.idEstado))\n }\n }, [props.orgao.idEstado])\n\n useEffect(() => {\n if (value) {\n handleChangeAutoComplete(value)\n }\n }, [value])\n\n useEffect(() => {\n if (valueUsuario) {\n handleChangeAutoCompleteUsuario(valueUsuario)\n }\n }, [valueUsuario])\n\n const handleChangeAutoComplete = (obj) => {\n\n if (obj != null) {\n let selectedCidade = cidade.filter(\n (item) => item.value == obj.id\n )\n\n dispatch(\n cidadeAction.changeDetailsCidade(\n selectedCidade[0]\n )\n )\n } else {\n\n }\n setOpen(false)\n }\n\n const handleChangeAutoCompleteUsuario = (obj) => {\n if (obj != null) {\n setIdUsuario(obj.id);\n setTextUsuario(obj.nome);\n }\n setOpenUsuario(false)\n }\n\n useEffect(() => {\n\n }, [ready, props.orgao.isLoading])\n\n const handleChange = (prop) => (event) => {\n dispatch(orgaoAction.onChangeProps(prop, event))\n }\n\n useEffect(() => {\n forceUpdate(n => !n);\n }, [props.orgao.usuariosOrgaos])\n\n const handleSubmit = (event) => {\n\n let payload = {\n id: params.id,\n nome: props.orgao.nome,\n idCidade: value ? value.id : 0,\n idEstado: props.orgao.idEstado,\n celular: props.orgao.celular && props.orgao.celular.split('-').join('').replace('(', '').replace(')', '').replace(' ', ''),\n cnpj: props.orgao.cnpj && props.orgao.cnpj.split('.').join('').replace(/[-/.]/g, ''),\n email: props.orgao.email,\n endereco: props.orgao.endereco,\n telefone: props.orgao.telefone && props.orgao.telefone.split('-').join('').replace('(', '').replace(')', '').replace(' ', ''),\n usuariosOrgaos: props.orgao.usuariosOrgaos\n }\n\n if (params.id) {\n dispatch(orgaoAction.editOrgaoInfo(params.id, payload, true))\n dispatch(usuarioAction.getUsuarioSelect())\n } else {\n dispatch(orgaoAction.createOrgao(payload))\n dispatch(usuarioAction.createUsuario(payload.usuariosOrgaos, true))\n dispatch(usuarioAction.getUsuarioSelect())\n }\n };\n\n const handleAddOnList = () => {\n if (props.orgao.usuariosOrgaos.filter(ts => ts.idUsuario == parseInt(idUsuario)).length > 0) {\n toast.error('Erro ao adicionar! Este usuário já existe!')\n }\n else {\n props.orgao.usuariosOrgaos.push({\n 'idUsuario': idUsuario,\n 'idOrgao': params.id ? params.id : 0,\n 'usuario': {\n 'nome': textUsuario ? textUsuario : ''\n }\n });\n\n forceUpdate(n => !n);\n setIdUsuario(0);\n setValueUsuario(null);\n }\n }\n\n function InsertText() {\n return (\n \n {'Novo Órgão'}\n \n )\n }\n\n function EditText() {\n return (\n \n {'Editar Órgão'}\n \n )\n }\n function SegHeader() {\n if (params.id) {\n return \n }\n return \n }\n return (\n \n \n \n \n \n handleSubmit(event)}\n >\n }\n />\n \n \n \n \n \n \n \n \n \n {!isEmpty(estados) &&\n undefined !== estados &&\n estados.length &&\n estados.map((row, index) => (\n \n ))}\n \n \n \n {\n setValue(newValue);\n }}\n inputValue={inputValue}\n onInputChange={(event, newInputValue) => {\n setInputValue(newInputValue);\n }}\n id=\"controllable-states-demo\"\n options={options}\n margin=\"normal\"\n variant=\"outlined\"\n defaultValue={null}\n getOptionLabel={option => option.nome}\n renderInput={(params) => }\n fullWidth\n />\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Dados de contato\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Usuários vinculados ao órgão\n \n \n \n \n {\n (props.orgao.usuariosOrgaos != null && props.orgao.usuariosOrgaos.length > 0 ?\n props.orgao.usuariosOrgaos.map(n => {\n return (\n (n.id !== '' ?\n \n : null)\n );\n })\n : null)\n }\n
\n \n \n {\n setValueUsuario(newValueUsuario);\n }}\n inputValue={inputValueUsuario}\n onInputChange={(event, newInputValueUsuario) => {\n setInputValueUsuario(newInputValueUsuario);\n }}\n id=\"controllable-states-demo\"\n options={optionsUsuarios}\n defaultValue={null}\n getOptionLabel={option => option.nome}\n renderInput={(params) => }\n style={{ width: \"312px\" }}\n fullWidth\n />\n \n \n \n \n \n \n \n \n \n \n \n \n \n * Campos obrigatórios\n \n \n \n \n {orgao.id && (authActions.isPrefeitura() || authActions.isGestor()) ?\n <>\n }\n endIcon={props.orgao.isLoading && }\n >\n {props.orgao.cadastroLiberado == false ? 'Acesso recusado' : props.orgao.isLoading ? 'Recusando acesso...' : 'Recusar acesso'}\n \n }\n endIcon={props.orgao.isLoading && }\n >\n {props.orgao.cadastroLiberado == true ? 'Acesso liberado' : props.orgao.isLoading ? 'Liberando acesso...' : 'Liberar acesso'}\n \n >\n : null}\n }\n endIcon={props.orgao.isLoading && }\n >\n {params.id ? (props.orgao.isLoading ? 'Atualizando órgão...' : 'Atualizar') : (props.orgao.isLoading ? 'Salvando órgão...' : 'Salvar')}\n \n \n \n \n \n \n \n \n\n {\n (modalUsuario ?\n \n :\n null\n )\n }\n \n )\n}\n\nOrgaoEdit.propTypes = {\n classes: PropTypes.object.isRequired,\n idUsuario: PropTypes.object\n}\nconst mapStateToProps = (state) => {\n return state\n}\n\nconst connectedOrgaoEditPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(OrgaoEdit))\n)\nexport { connectedOrgaoEditPage as OrgaoEdit }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport { ordemServicoAction } from '../../_actions'\nimport PropTypes from 'prop-types'\nimport moment from 'moment'\nimport {\n Chip,\n Grid,\n FormControl,\n FormControlLabel,\n FormLabel,\n IconButton,\n Input,\n Paper,\n Radio,\n RadioGroup,\n Tooltip,\n Skeleton,\n TablePagination,\n Table,\n TableContainer,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Typography,\n} from '@mui/material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport EditIcon from '@mui/icons-material/Edit'\nimport { withStyles } from '@mui/styles'\nimport { withRouter } from 'react-router-dom'\nimport { history, getNomeUltimoEvento, getCor } from '../../utils'\nimport TitleContent from '../TitleContent'\nimport { useConfirm } from 'material-ui-confirm'\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport AccessDenied from '../Errors/AccessDenied'\nimport { Page } from 'components'\nimport { useDebounce } from 'use-debounce';\n\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(6, 6, 6, 6)\n },\n textField: {\n fontSize: 8\n }\n})\n\nconst OrdemServico = (props) => {\n\n const confirm = useConfirm()\n const dispatch = useDispatch()\n const { classes, className } = props\n const { ordemServico } = props.ordemServico\n const { totalRegistros } = props.ordemServico\n const { isLoading } = props.ordemServico\n\n const [status, setStatus] = useState('');\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('data');\n const [direction] = useState('desc');\n const [ready, setReady] = React.useState(false);\n\n const { idOrgao } = useSelector(\n (state) => state.usuarioOrgao\n )\n\n useEffect(() => {\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction,\n IdOrgao: (idOrgao && idOrgao != '' && idOrgao),\n Status: status\n };\n\n dispatch(ordemServicoAction.getOrdemServico(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n\n }, [page, limit, debounceTerm, order, direction, idOrgao]);\n\n useEffect(() => {\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction,\n IdOrgao: (idOrgao && idOrgao != '' && idOrgao),\n Status: status\n };\n dispatch(ordemServicoAction.getOrdemServico(filterModel, true));\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n\n }, [status])\n\n useEffect(() => {\n\n }, [totalRegistros, isLoading]);\n\n useEffect(() => {\n }, [ready, props.ordemServico.isLoading])\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeLimit = (event) => {\n setLimit(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleClick = (id) => {\n confirm({\n title: 'Você deseja excluir esta Ordem de Serviço?',\n description: 'Essa operação é irreversível',\n disabled: props.ordemServico.isLoading,\n confirmationText: props.ordemServico.isLoading ? 'Excluindo Ordem de Serviço...' : 'Sim, excluir!',\n }).then(() => {\n dispatch(ordemServicoAction.deleteOrdemServicoById(id))\n })\n }\n\n const handleChange = prop => event => {\n setTerm(event.target.value);\n };\n\n const handleChangeRadio = prop => event => {\n setStatus(event.target.value);\n };\n\n return (\n \n (\n \n {undefined !== ordemServico && ordemServico.length > 0 ? (\n
\n ) : (\n
\n )}\n
\n \n \n \n \n \n \n Filtrar por Status \n \n \n } label={Pendente} />\n\n } label={Recebendo orçamentos} />\n\n } label={Orçamento aprovado} />\n\n } label={Recusada} />\n\n } label={Concluída} />\n\n } label={Avaliada} />\n\n } label={Todas} />\n \n \n \n \n
\n
\n \n \n \n Data\n Tipo de Serviço\n Título\n Órgão\n Status\n Ações\n \n \n \n {undefined !== ordemServico && ordemServico.length\n ? ordemServico.map((n) => {\n return (\n \n \n {n.data ? moment(n.data).format(\"DD/MM/YYYY\") : ''}\n \n \n {n.tipoServico ? n.tipoServico.nome.toUpperCase() : ''}\n \n \n {n.titulo ? n.titulo.toUpperCase() : ''}\n \n \n {n.orgao ? n.orgao.nome.toUpperCase() : ''}\n \n \n \n \n \n (\n \n history.push(`/ordemServico/${n.id}`)\n }\n size=\"small\"\n >\n \n \n \n \n \n \n )}\n />\n (\n handleClick(n.id)}\n size=\"small\"\n >\n \n \n \n \n )}\n />\n \n \n )\n })\n :\n (\n !isLoading ?\n \n Nenhum registro encontrado\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
\n \n
\n
\n )\n }\n no={() => }\n />\n \n )\n}\nOrdemServico.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return {\n ordemServico: state.ordemServico\n }\n}\nconst connectedOrdemServicoPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(OrdemServico))\n)\nexport { connectedOrdemServicoPage as OrdemServico }\n","import React, { useEffect, useState } from 'react'\nimport moment from 'moment'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport { styled } from '@mui/material/styles';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { toast } from 'react-toastify'\nimport DoneIcon from '@mui/icons-material/Done';\nimport CloseIcon from '@mui/icons-material/Close';\nimport { useConfirm } from 'material-ui-confirm'\nimport { faPlus } from '@fortawesome/free-solid-svg-icons'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport PropTypes from 'prop-types'\nimport { withStyles } from '@mui/styles'\nimport Autocomplete from '@mui/lab/Autocomplete';\nimport Typography from '@mui/material/Typography'\nimport Stepper from '@mui/material/Stepper';\nimport Step from '@mui/material/Step';\nimport StepLabel from '@mui/material/StepLabel';\nimport EventAvailableIcon from '@mui/icons-material/EventAvailable';\nimport StarOutlineIcon from '@mui/icons-material/StarOutline';\nimport CheckBoxIcon from '@mui/icons-material/CheckBox';\nimport PendingActionsRoundedIcon from '@mui/icons-material/PendingActionsRounded';\nimport GradingIcon from '@mui/icons-material/Grading';\nimport Rating from '@mui/material/Rating';\nimport Box from '@mui/material/Box';\nimport StepConnector, { stepConnectorClasses } from '@mui/material/StepConnector';\nimport HighlightOffIcon from '@mui/icons-material/HighlightOff';\nimport {\n Avatar,\n Backdrop,\n Card,\n Chip,\n CardHeader,\n CardContent,\n CardActions,\n CircularProgress,\n Divider,\n Button,\n Grid,\n IconButton,\n MenuItem,\n Paper,\n Skeleton,\n TableContainer,\n TableBody,\n TableHead,\n TableRow,\n TableCell,\n Table,\n TextField,\n Tooltip\n} from '@mui/material'\nimport {\n ValidatorForm,\n TextValidator,\n SelectValidator\n} from 'react-material-ui-form-validator'\nimport {\n authActions,\n ordemServicoAction,\n veiculoAction,\n tipoServicoAction,\n tipoFotoAction,\n usuarioAction,\n orgaoAction\n} from '../../_actions'\nimport { withRouter, Link } from 'react-router-dom'\nimport Swal from 'sweetalert2';\nimport { uploadImage } from '_services'\nimport ImageUploading from 'react-images-uploading'\nimport { errorsUploadImage, getNomeEvento, getNomeUltimoEvento } from 'utils'\nimport { history, stringUtils } from '../../utils'\nimport { Page } from 'components'\nimport { isEmpty } from 'lodash'\nimport SaveIcon from '@mui/icons-material/Save';\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2)\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n textAlgin: 'center'\n },\n nome: {\n marginTop: theme.spacing(1)\n },\n uploadButton: {\n marginRight: theme.spacing(2),\n justifyContent: 'center'\n },\n avatar: {\n height: 200,\n width: 200,\n borderRadius: '10px',\n webkitBorderRadius: '10px',\n mozBorderRadius: '10px',\n cursor: 'pointer'\n },\n backdrop: {\n zIndex: theme.zIndex.drawer + 1,\n color: '#fff'\n }\n})\n\nconst ColorlibConnector = styled(StepConnector)(({ theme }) => ({\n [`&.${stepConnectorClasses.alternativeLabel}`]: {\n top: 22,\n },\n [`&.${stepConnectorClasses.active}`]: {\n [`& .${stepConnectorClasses.line}`]: {\n backgroundImage:\n 'linear-gradient( 95deg,rgb(242, 214, 71) 30%,rgb(0, 0, 0) 70%)',\n },\n },\n [`&.${stepConnectorClasses.completed}`]: {\n [`& .${stepConnectorClasses.line}`]: {\n backgroundImage:\n 'linear-gradient( 95deg,rgb(242, 214, 71) 30%,rgb(0, 0, 0) 70%)',\n },\n },\n [`& .${stepConnectorClasses.line}`]: {\n height: 3,\n border: 0,\n backgroundColor:\n theme.palette.mode === 'dark' ? theme.palette.grey[800] : '#eaeaf0',\n borderRadius: 1,\n },\n}));\n\nconst ColorlibStepIconRoot = styled('div')(({ theme, ownerState }) => ({\n backgroundColor: theme.palette.mode === 'dark' ? theme.palette.grey[700] : '#ccc',\n zIndex: 1,\n color: '#fff',\n width: 50,\n height: 50,\n display: 'flex',\n borderRadius: '50%',\n justifyContent: 'center',\n alignItems: 'center',\n ...(ownerState.active && {\n backgroundImage:\n 'linear-gradient( 136deg, rgb(242, 214, 71) 30%, rgb(0, 0, 0) 70%)',\n boxShadow: '0 4px 10px 0 rgba(0,0,0,.25)',\n }),\n ...(ownerState.completed && {\n backgroundImage:\n 'linear-gradient( 136deg, rgb(242, 214, 71) 30%, rgb(0, 0, 0) 70%)',\n }),\n}));\n\nfunction ColorlibStepIcon(props) {\n const { active, completed, className } = props;\n\n const icons = {\n 1: ,\n 2: ,\n 3: ,\n 4: ,\n 5: \n };\n\n return (\n \n {icons[String(props.icon)]}\n \n );\n}\n\nfunction ColorlibStepIconOsRecusada(props) {\n const { active, completed, className } = props;\n\n const icons = {\n 1: ,\n 2: \n };\n\n return (\n \n {icons[String(props.icon)]}\n \n );\n}\n\nfunction isEditable(e) {\n if (e == '2' || e == '3' || e == '4' || e == '5' || e == '6') {\n return false\n }\n else return true\n}\n\nColorlibStepIcon.propTypes = {\n /**\n * Whether this step is active.\n * @default false\n */\n active: PropTypes.bool,\n className: PropTypes.string,\n /**\n * Mark the step as completed. Is passed to child components.\n * @default false\n */\n completed: PropTypes.bool,\n /**\n * The label displayed in the step icon.\n */\n icon: PropTypes.node,\n};\n\nconst steps = ['PENDENTE',\n 'RECEBENDO ORÇAMENTOS',\n 'ORÇAMENTO APROVADO',\n 'CONCLUÍDA',\n 'AVALIADA'];\n\nconst OrdemServicoEdit = (props) => {\n\n const dispatch = useDispatch()\n const confirm = useConfirm()\n\n const { classes, ordemServico, className, ...rest } = props\n const { match: { params } } = props;\n const formRef = React.createRef(null);\n const [value, setValue] = useState(null);\n const [inputValue, setInputValue] = useState('');\n const [open, setOpen] = useState(false)\n\n const [id, setId] = useState(0);\n const [idTipoFoto, setIdTipoFoto] = useState(0);\n\n const [images, setImages] = useState([])\n const [imagem, setImagem] = useState('')\n const [rate, setRate] = useState(0);\n const [hover, setHover] = useState(-1);\n\n const tiposFoto = useSelector((state) => state.tipoFoto.tipoFoto)\n const tiposServico = useSelector((state) => state.tipoServico.tipoServico)\n const veiculos = useSelector((state) => state.veiculo.veiculo)\n\n const { usuario } = useSelector(\n (state) => state.usuario)\n\n const { orgao } = useSelector(\n (state) => state.orgao)\n\n const options = usuario.map(u => ({ id: u.value, nome: u.text }));\n\n const [, forceUpdate] = useState(0);\n const [ready, setReady] = useState(false);\n\n const { idOrgao } = useSelector(\n (state) => state.usuarioOrgao\n )\n\n const labels = {\n 1: 'Péssimo',\n 2: 'Ruim',\n 3: 'Médio',\n 4: 'Bom',\n 5: 'Excelente',\n };\n\n useEffect(() => {\n\n dispatch(tipoFotoAction.getTiposFotoSelect())\n dispatch(tipoServicoAction.getTiposServicoSelect())\n dispatch(veiculoAction.getVeiculoSelect())\n dispatch(orgaoAction.getOrgaoSelect())\n dispatch(usuarioAction.getUsuarioSelect())\n\n if (params.id) {\n dispatch(ordemServicoAction.getOrdemServicoById(params.id))\n } else {\n dispatch(ordemServicoAction.clear())\n }\n // console.log(\"ordemServico\", ordemServico)\n // console.log(\"idOrgao\", idOrgao)\n\n }, []);\n\n useEffect(() => {\n if (value) {\n handleChangeAutoComplete(value)\n }\n }, [value])\n\n const handleAddOnList = e => {\n if (props.ordemServico.ordensServicosFotos.filter(ts => ts.id == parseInt(id)).length > 0) {\n toast.error('Erro ao adicionar! Esta foto já existe!')\n }\n else {\n if (idTipoFoto != 0) {\n props.ordemServico.ordensServicosFotos.push({\n 'idTipoFoto': idTipoFoto,\n 'caminhoFoto': imagem,\n 'idOrdemServico': params.id\n });\n } else {\n toast.error('Selecione um tipo de foto para prosseguir')\n }\n forceUpdate(n => !n);\n setId(0);\n setIdTipoFoto(0);\n setImagem(imagem)\n }\n }\n\n const onChangeImage = (imageList) => {\n // console.log(\"imageList\", imageList)\n // data for submit\n setOpen(true)\n setImages(imageList)\n uploadImage(imageList[0])\n .then((response) => {\n setImagem(response)\n setOpen(false)\n })\n .catch((err) => {\n console.log(err)\n setOpen(false)\n })\n }\n\n const handleChangeAutoComplete = (obj) => {\n if (obj != null) {\n let selectedUsuario = usuario.filter(\n (item) => item.value == obj.id\n )\n\n dispatch(\n usuarioAction.changeDetailsUsuario(\n selectedUsuario[0]\n )\n )\n } else {\n\n }\n setOpen(false)\n }\n\n const handleRemoveOnList = id => {\n props.ordemServico.ordensServicosFotos = props.ordemServico.ordensServicosFotos.filter(ts => ts.id != parseInt(id));\n forceUpdate(n => !n);\n };\n\n useEffect(() => {\n // forceUpdate(n => !n);\n }, [open, imagem]);\n\n useEffect(() => {\n\n }, [ready, props.ordemServico.isLoading])\n\n const handleChange = (prop) => (event) => {\n dispatch(ordemServicoAction.onChangeProps(prop, event))\n }\n\n const handleSubmit = (event) => {\n\n let payload = {\n id: params.id,\n idTipoServico: props.ordemServico.idTipoServico,\n idVeiculo: props.ordemServico.idVeiculo,\n idUsuario: value ? value.id : props.ordemServico.idUsuario,\n data: props.ordemServico.data,\n idOrgao: props.ordemServico.idOrgao,\n descritivo: props.ordemServico.descritivo,\n titulo: props.ordemServico.titulo,\n ultimoEvento: props.ordemServico.ultimoEvento,\n avaliacao: rate,\n descritivoAvaliacao: props.ordemServico.descritivoAvaliacao,\n idUsuarioAvaliacao: props.authentication.user.id,\n ordensServicosFotos: props.ordemServico.ordensServicosFotos\n }\n\n\n if (params.id) {\n // console.log(\"payload\", payload)\n dispatch(ordemServicoAction.editOrdemServicoInfo(params.id, payload, true))\n } else {\n // console.log(\"payload\", payload)\n dispatch(ordemServicoAction.createOrdemServico(payload))\n }\n\n };\n\n const handleAprovaOrdemServico = () => {\n confirm({\n title: 'Você deseja aprovar esta Ordem de Serviço?',\n description: 'Essa operação é irreversível',\n disabled: props.ordemServico.isLoading,\n confirmationText: props.ordemServico.isLoading ? 'Aprovando Ordem de Serviço...' : 'Sim, aprovar!',\n }).then(() => {\n dispatch(ordemServicoAction.editOrdemServicoAprova(params.id))\n })\n }\n\n const handleAprovaOrcamento = (id) => {\n confirm({\n title: 'Você deseja realmente aprovar este Orçamento?',\n description: 'Essa operação é irreversível',\n disabled: props.ordemServico.isLoading,\n confirmationText: props.ordemServico.isLoading ? 'Aprovando Orçamento...' : 'Sim, aprovar!',\n }).then(() => {\n dispatch(ordemServicoAction.editOrdemServicoAprovaOrcamento(id))\n })\n }\n\n const handleRecusaOrcamento = (id) => {\n confirm({\n title: 'Você deseja realmente recusar este Orçamento?',\n description: 'Essa operação é irreversível',\n disabled: props.ordemServico.isLoading,\n confirmationText: props.ordemServico.isLoading ? 'Recusando Orçamento...' : 'Sim, recusar!',\n }).then(() => {\n dispatch(ordemServicoAction.editOrdemServicoAprovaOrcamento(id))\n })\n }\n\n const handleRecusaOrdemServico = () => {\n confirm({\n title: 'Você deseja recusar esta Ordem de Serviço?',\n description: 'Essa operação é irreversível',\n disabled: props.ordemServico.isLoading,\n confirmationText: props.ordemServico.isLoading ? 'Recusando Ordem de Serviço...' : 'Sim, recusar!',\n }).then(() => {\n dispatch(ordemServicoAction.editOrdemServicoRecusa(params.id))\n })\n }\n\n function InsertText() {\n return (\n \n {'Nova Ordem de Serviço'}\n \n )\n }\n\n function EditText() {\n return (\n \n {'Editar Ordem de Serviço'}\n \n )\n }\n function SegHeader() {\n if (params.id) {\n return \n }\n return \n }\n return (\n \n \n \n \n \n handleSubmit(event)}\n >\n }\n />\n \n \n \n \n \n \n \n \n \n {!isEmpty(tiposServico) &&\n undefined !== tiposServico &&\n tiposServico.length &&\n tiposServico.map((row, index) => (\n \n ))}\n \n \n \n \n \n \n \n \n {!isEmpty(veiculos) &&\n undefined !== veiculos &&\n veiculos.length &&\n veiculos.map((row, index) => (\n \n ))}\n \n \n \n {\n setValue(newValue);\n }}\n disabled={isEditable(ordemServico.ultimoEvento) == false}\n inputValue={inputValue}\n onInputChange={(event, newInputValue) => {\n setInputValue(newInputValue);\n }}\n id=\"controllable-states-demo\"\n options={options}\n margin=\"normal\"\n variant=\"outlined\"\n defaultValue={null}\n getOptionLabel={(option) => (option ? option.nome : \"\")}\n renderInput={(params) => }\n fullWidth\n />\n \n \n \n \n \n \n \n {!isEmpty(orgao) &&\n undefined !== orgao &&\n orgao.length &&\n orgao.map((row) => (\n \n ))}\n \n \n {params.id &&\n \n \n \n }\n \n \n \n \n \n {'Etapas da Ordem de Serviço'}\n }>\n \n \n \n {params.id && ordemServico.eventos && ordemServico.eventos.length > 0 ?\n //se a O.S foi recusada, vai exibir somente os dois eventos\n (ordemServico.ultimoEvento == '4' ?\n }>\n {ordemServico.eventos.map((e) => (\n \n {getNomeEvento(e)}
{moment(e.data).format(\"DD/MM/YYYY HH:mm\")}\n \n ))\n }\n \n : (ordemServico.ultimoEvento != null && ordemServico.ultimoEvento != '4') ?\n }>\n {ordemServico.eventos.map((e) => (\n \n {getNomeEvento(e)}
{moment(e.data).format(\"DD/MM/YYYY HH:mm\")}\n \n ))\n }\n \n : (ordemServico.ultimoEvento > '5') &&\n }>\n {ordemServico.eventos.map((e) => (\n \n {getNomeEvento(e)}
{moment(e.data).format(\"DD/MM/YYYY HH:mm\")}\n \n ))\n }\n \n )\n :\n }>\n {steps.map((label) => (\n \n {label}\n \n ))}\n \n }\n \n \n \n {ordemServico.id && ordemServico.ultimoEvento == '2' && (authActions.isPrefeitura() || authActions.isGestor()) ?\n \n \n \n \n \n \n \n \n {'Orçamentos para aprovação'}\n \n \n \n \n Data\n Prazo\n Valor\n Empresa\n Ações\n \n \n \n {undefined !== ordemServico.ordensServicosOrcamentos && ordemServico.ordensServicosOrcamentos.length\n ? ordemServico.ordensServicosOrcamentos.map((n) => {\n return (\n \n \n {n.data ? moment(n.data).format(\"DD/MM/YYYY\") : ''}\n \n \n {n.prazo ? moment(n.prazo).format(\"DD/MM/YYYY\") : ''}\n \n \n {n.valor ? 'R$' + n.valor.toLocaleString('pt-br', { minimumFractionDigits: 2 }) : ''}\n \n \n {n.empresa ? n.empresa.razaoSocial.toUpperCase() : ''}\n \n \n handleAprovaOrcamento(n.id)}\n size=\"small\"\n >\n \n \n \n \n \n \n handleRecusaOrcamento(n.id)}\n size=\"small\"\n >\n \n \n \n \n \n \n )\n })\n :\n \n Nenhum orçamento recebido até o momento\n \n }\n \n
\n \n \n : ordemServico.id && ordemServico.ultimoEvento == '3' && (authActions.isPrefeitura() || authActions.isGestor()) ?\n \n \n \n \n \n \n \n {'Orçamento aprovado para a Ordem de Serviço'}\n \n \n \n \n Data\n Prazo\n Valor\n Empresa\n \n \n \n {undefined !== ordemServico.ordensServicosOrcamentos && ordemServico.ordensServicosOrcamentos.length\n ? ordemServico.ordensServicosOrcamentos.map((n) => {\n return (\n (n.statusOrcamento == '1' ?\n \n \n {n.data ? moment(n.data).format(\"DD/MM/YYYY\") : ''}\n \n \n {n.prazo ? moment(n.prazo).format(\"DD/MM/YYYY\") : ''}\n \n \n {n.valor ? 'R$' + n.valor.toLocaleString('pt-br', { minimumFractionDigits: 2 }) : ''}\n \n \n {n.empresa ? n.empresa.razaoSocial.toUpperCase() : ''}\n \n \n : null\n )\n )\n })\n :\n null\n }\n \n
\n \n : null\n }\n \n \n \n {'Fotos'}\n }>\n \n \n \n {isEditable(ordemServico.ultimoEvento) == true ?\n \n \n \n \n \n \n \n \n \n Enviando foto...\n \n \n \n \n errorsUploadImage(errors)}\n value={images}\n acceptType={['jpeg', 'jpg']}\n onChange={onChangeImage}\n resolutionWidth={1100}\n resolutionHeight={1100}\n resolutionType={\"less\"}\n dataURLKey=\"data_url\"\n >\n {({ onImageUpload }) => (\n \n \n \n )}\n \n \n \n setIdTipoFoto(e.target.value)}\n InputLabelProps={{\n shrink: true\n }}\n fullWidth\n displayEmpty\n labelId=\"idTipoFoto\"\n >\n \n {!isEmpty(tiposFoto) &&\n undefined !== tiposFoto &&\n tiposFoto.length &&\n tiposFoto.map((row) => (\n \n ))}\n \n \n \n \n \n \n : null\n }\n \n {props.ordemServico.ordensServicosFotos && props.ordemServico.ordensServicosFotos.length > 0 ?\n props.ordemServico.ordensServicosFotos.map(o => {\n return (\n \n \n \n {isEditable(ordemServico.ultimoEvento) == true ?\n \n : null}\n \n \n )\n }) :\n isEditable(ordemServico.ultimoEvento) == false ?\n \n \n Nenhuma foto carregada\n \n
\n : null\n }\n \n \n \n \n \n * Campos obrigatórios\n \n \n \n \n {ordemServico.id && ordemServico.ultimoEvento == '1' && (authActions.isPrefeitura() || authActions.isGestor()) ?\n <>\n }\n endIcon={props.ordemServico.isLoading && }\n >\n {props.ordemServico.isLoading ? 'Recusando ordem de serviço...' : 'Recusar'}\n \n }\n endIcon={props.ordemServico.isLoading && }\n >\n {props.ordemServico.isLoading ? 'Aprovando ordem de serviço...' : 'Aprovar'}\n \n >\n : null}\n }\n endIcon={props.ordemServico.isLoading && }\n >\n {params.id ? (props.ordemServico.isLoading ? 'Atualizando ordem de serviço...' : 'Atualizar') : (props.ordemServico.isLoading ? 'Salvando ordem de serviço...' : 'Salvar')}\n \n \n \n \n \n \n {ordemServico &&\n ordemServico.eventos &&\n ordemServico.eventos.length > 0 &&\n ordemServico.eventos[0].tipo == '5' &&\n <>\n \n \n \n {'Avaliação'}\n }>\n \n \n \n \n \n \n \n Avalie, com uma nota\n {\n setRate(newRate);\n }}\n onChangeActive={(event, newHover) => {\n setHover(newHover);\n }}\n />\n {rate !== null && (\n {labels[hover !== -1 ? hover : rate]}\n )}\n \n \n \n \n >\n }\n \n \n \n \n )\n}\n\nOrdemServicoEdit.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return state\n}\n\nconst connectedOrdemServicoEditPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(OrdemServicoEdit))\n)\nexport { connectedOrdemServicoEditPage as OrdemServicoEdit }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport { parametroAction } from '../../_actions'\nimport PropTypes from 'prop-types'\nimport {\n Table,\n TableContainer,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Paper,\n IconButton,\n Tooltip,\n Typography,\n Input,\n Grid,\n TablePagination\n} from '@mui/material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport EditIcon from '@mui/icons-material/Edit'\nimport { withStyles } from '@mui/styles'\nimport { withRouter } from 'react-router-dom'\nimport { history } from '../../utils'\nimport TitleContent from '../TitleContent'\nimport { useConfirm } from 'material-ui-confirm'\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport AccessDenied from '../Errors/AccessDenied'\nimport { Page } from 'components'\nimport { useDebounce } from 'use-debounce';\n\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(6, 6, 6, 6)\n }\n})\n\nconst Parametro = (props) => {\n\n const dispatch = useDispatch()\n const { classes } = props\n const { parametro } = props.parametro // é o mesmo que props.parametro.parametro se estiver entre as chaves\n const { totalRegistros } = props.parametro\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('descricao');\n const [direction] = useState('asc');\n\n useEffect(() => {\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction\n };\n\n dispatch(parametroAction.getParametro(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n\n }, [page, limit, debounceTerm, order, direction]);\n\n useEffect(() => {\n\n }, [totalRegistros]);\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeLimit = (event) => {\n setLimit(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleChange = prop => event => {\n setTerm(event.target.value);\n };\n\n return (\n \n (\n \n
\n \n \n Gerência de Parâmetro\n \n \n Lista de parâmetros\n \n \n \n
\n \n \n
\n
\n \n \n \n Descrição\n Ações\n \n \n \n {undefined !== parametro && parametro.length\n ? parametro.map((n) => {\n return (\n \n \n {n.descricao}\n \n \n (\n \n history.push(`/parametro/${n.id}`)\n }\n size=\"small\"\n >\n \n \n \n \n \n \n )}\n />\n\n \n \n )\n })\n : null}\n \n
\n \n
\n
\n )}\n no={() => }\n />\n \n )\n}\nParametro.propTypes = {\n classes: PropTypes.object.isRequired\n}\n\nconst mapStateToProps = (state) => {\n return {\n parametro: state.parametro\n }\n}\nconst connectedParametroPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Parametro))\n)\nexport { connectedParametroPage as Parametro }\n","import React, { useEffect, useState, useRef } from 'react'\nimport { connect, useDispatch } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { withStyles } from '@mui/styles'\nimport JoditEditor from \"jodit-react\";\nimport Typography from '@mui/material/Typography';\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n CircularProgress,\n Divider,\n Button,\n Input,\n Grid,\n MenuItem\n} from '@mui/material'\nimport {\n ValidatorForm,\n TextValidator,\n SelectValidator\n} from 'react-material-ui-form-validator'\nimport { parametroAction } from '../../_actions'\nimport { withRouter } from 'react-router-dom'\nimport { history, stringUtils } from '../../utils'\nimport { Page } from 'components'\nimport SaveIcon from '@mui/icons-material/Save';\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2)\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n textAlgin: 'center'\n },\n nome: {\n marginTop: theme.spacing(1)\n },\n uploadButton: {\n marginRight: theme.spacing(2),\n justifyContent: 'space-between'\n },\n avatar: {\n height: 200,\n width: 200,\n borderRadius: '10px',\n webkitBorderRadius: '10px',\n mozBorderRadius: '10px',\n cursor: 'pointer'\n },\n backdrop: {\n zIndex: theme.zIndex.drawer + 1,\n color: '#fff'\n }\n})\n\nconst ParametroEdit = (props) => {\n\n const dispatch = useDispatch()\n const { classes, parametro, className, ...rest } = props\n const editor = useRef(null)\n const { match: { params } } = props;\n const formRef = React.createRef(null);\n const [content, setContent] = useState('');\n const [ready, setReady] = React.useState(false);\n\n const config = {\n readonly: false\n }\n\n useEffect(() => {\n\n if (params.id) {\n dispatch(parametroAction.getParametroById(params.id))\n } else {\n dispatch(parametroAction.clear())\n }\n }, []);\n\n useEffect(() => {\n dispatch(parametroAction.onChangePropsHtml('valor', content))\n }, [content]);\n\n const handleChange = (prop) => (event) => {\n dispatch(parametroAction.onChangeProps(prop, event))\n }\n\n useEffect(() => {\n\n }, [ready, props.parametro.isLoading])\n\n const handleSubmit = (event) => {\n\n let payload = {\n id: params.id,\n descricao: props.parametro.descricao,\n chave: props.parametro.chave,\n valor: props.parametro.valor,\n tipo: props.parametro.tipo\n }\n\n if (params.id) {\n dispatch(parametroAction.editParametroInfo(params.id, payload, true))\n } else {\n dispatch(parametroAction.createParametro(payload))\n }\n\n };\n\n const handleSelectChange = prop => event => {\n\n var event2 = {\n type: 'selectValidator',\n target: {\n value: event.value\n }\n };\n\n dispatch(parametroAction.onChangeProps(prop, event2));\n\n };\n\n function EditText() {\n return (\n \n {'Editar Parâmetro'}\n \n )\n }\n function SegHeader() {\n if (params.id) {\n return \n }\n }\n return (\n \n \n\n \n \n \n handleSubmit(event)}\n >\n }\n />\n \n \n \n \n \n \n \n {(props.parametro.id > 0 ?\n \n :\n \n )}\n\n \n \n }\n margin=\"normal\"\n variant=\"outlined\"\n id=\"tipo\"\n >\n \n \n \n \n \n \n\n {(props.parametro.tipo === 'H' ?\n setContent(newContent)} // preferred to use only this option to update the content for performance reasons\n />\n :\n \n )}\n\n \n\n \n \n \n \n \n }\n endIcon={props.parametro.isLoading && }\n >\n {params.id ? (props.parametro.isLoading ? 'Atualizando parâmetro...' : 'Atualizar') : (props.parametro.isLoading ? 'Salvando parâmetro...' : 'Salvar')}\n \n \n \n \n \n \n \n \n )\n}\n\n\nParametroEdit.propTypes = {\n classes: PropTypes.object.isRequired,\n}\nconst mapStateToProps = (state) => {\n return state\n}\n\nconst connectedParametroEditPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(ParametroEdit))\n)\nexport { connectedParametroEditPage as ParametroEdit }\n","import React, { useEffect } from 'react';\nimport clsx from 'clsx'\nimport Card from '@mui/material/Card';\nimport PeopleIcon from '@mui/icons-material/People';\nimport AccessTimeIcon from '@mui/icons-material/AccessTime';\nimport { Avatar, Typography, CardContent, Grid } from '@mui/material'\nimport PropTypes from 'prop-types'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { dashboardAction } from '_actions'\nimport { makeStyles } from '@mui/styles'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n marginLeft: 10,\n marginRight: 10,\n minHeight: 120,\n minWidth: 300\n },\n title: {\n fontWeight: 500,\n color: theme.palette.primary.main\n }\n}));\n\nconst CardHorasRecebimentoOrcamentos = (props) => {\n const { className, ...rest } = props\n const classes = useStyles();\n const dispatch = useDispatch();\n\n const horasRecebimentoOrcamentos = useSelector((state) => (state.dashboard ? state.dashboard.dashboard.horasRecebimentoOrcamentos : undefined))\n\n useEffect(() => {\n dispatch(dashboardAction.getDashboard());\n\n console.log(\"horasRecebimentoOrcamentos\", horasRecebimentoOrcamentos)\n }, [])\n\n return (\n \n \n \n \n \n \n {horasRecebimentoOrcamentos ? horasRecebimentoOrcamentos : ''}\n \n \n \n \n Horas para receber orçamentos\n \n \n \n \n \n \n \n \n \n \n \n );\n}\n\nCardHorasRecebimentoOrcamentos.propTypes = {\n className: PropTypes.string,\n subtitle: PropTypes.string\n}\n\nexport default CardHorasRecebimentoOrcamentos\n","import React, { useEffect, useState } from 'react';\nimport clsx from 'clsx'\nimport Card from '@mui/material/Card';\nimport MiscellaneousServicesIcon from '@mui/icons-material/MiscellaneousServices';\nimport { Avatar, Button, Typography, CardContent, Grid } from '@mui/material'\nimport PropTypes from 'prop-types'\nimport { history } from '../../../../utils'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { dashboardAction, ordemServicoAction } from '_actions'\nimport { makeStyles } from '@mui/styles'\nimport { useDebounce } from 'use-debounce';\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n marginLeft: 10,\n marginRight: 10,\n minHeight: 120,\n minWidth: 300\n },\n title: {\n fontWeight: 500,\n color: theme.palette.primary.main\n }\n}));\n\nconst CardOrdemServico = (props) => {\n const { className, ...rest } = props\n const classes = useStyles();\n const dispatch = useDispatch();\n\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('data');\n const [direction] = useState('desc');\n\n const ordensServicoPendentes = useSelector((state) => (state.dashboard ? state.dashboard.dashboard.ordensServicoPendentes : undefined))\n\n useEffect(() => {\n dispatch(dashboardAction.getDashboard());\n }, [])\n\n const { idOrgao } = useSelector(\n (state) => state.usuarioOrgao\n )\n\n const handleVisualizarOrdensServicoPendentes = () => {\n\n history.push('/ordensServico');\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction,\n IdOrgao: (idOrgao && idOrgao != '' && idOrgao),\n Status: \"1\"\n };\n\n dispatch(ordemServicoAction.getOrdemServico(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n }\n\n return (\n \n \n \n \n \n \n {ordensServicoPendentes ? ordensServicoPendentes : 0}\n \n \n \n \n Ordens de serviço pendentes\n \n {/**/}\n {/* */}\n {/**/}\n \n \n \n \n \n \n \n \n \n \n );\n}\n\nCardOrdemServico.propTypes = {\n className: PropTypes.string,\n subtitle: PropTypes.string\n}\n\nexport default CardOrdemServico\n","import React, { useEffect } from 'react';\nimport clsx from 'clsx'\nimport Card from '@mui/material/Card';\nimport PeopleIcon from '@mui/icons-material/People';\nimport { Avatar, Typography, CardContent, Grid } from '@mui/material'\nimport PropTypes from 'prop-types'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { dashboardAction } from '_actions'\nimport { makeStyles } from '@mui/styles'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n marginLeft: 10,\n marginRight: 10,\n minHeight: 120,\n minWidth: 300\n },\n title: {\n fontWeight: 500,\n color: theme.palette.primary.main\n }\n}));\n\nconst CardUsuarios = (props) => {\n const { className, ...rest } = props\n const classes = useStyles();\n const dispatch = useDispatch();\n\n const totalUsuarios = useSelector((state) => (state.dashboard ? state.dashboard.dashboard.totalUsuarios : undefined))\n\n useEffect(() => {\n dispatch(dashboardAction.getDashboard());\n }, [])\n\n return (\n \n \n \n \n \n \n {totalUsuarios ? totalUsuarios : 0}\n \n \n \n \n Total de usuários cadastrados\n \n \n \n \n \n \n \n \n \n \n \n );\n}\n\nCardUsuarios.propTypes = {\n className: PropTypes.string,\n subtitle: PropTypes.string\n}\n\nexport default CardUsuarios\n","import React, { useEffect } from 'react';\nimport clsx from 'clsx'\nimport Card from '@mui/material/Card';\nimport BusinessIcon from '@mui/icons-material/Business';\nimport { Avatar, Typography, CardContent, Grid } from '@mui/material'\nimport PropTypes from 'prop-types'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { dashboardAction } from '_actions'\nimport { makeStyles } from '@mui/styles'\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n marginLeft: 10,\n marginRight: 10,\n minHeight: 120,\n minWidth: 300\n },\n title: {\n fontWeight: 500,\n color: theme.palette.primary.main\n }\n}));\n\nconst CardEmpresas = (props) => {\n const { className, ...rest } = props\n const classes = useStyles();\n const dispatch = useDispatch();\n\n const totalEmpresas = useSelector((state) => (state.dashboard ? state.dashboard.dashboard.totalEmpresas : undefined))\n\n useEffect(() => {\n dispatch(dashboardAction.getDashboard());\n }, [])\n\n return (\n \n \n \n \n \n \n {totalEmpresas ? totalEmpresas : 0}\n \n \n \n \n Total de empresas cadastradas\n \n \n \n \n \n \n \n \n \n \n \n );\n}\n\nCardEmpresas.propTypes = {\n className: PropTypes.string,\n subtitle: PropTypes.string\n}\n\nexport default CardEmpresas\n","export const options = {\n interaction: {\n mode: 'dataset'\n },\n responsive: true,\n tooltips: {\n callbacks: {\n label: function (tooltipItem, data) {\n var dataset = data.datasets[tooltipItem.datasetIndex];\n var meta = dataset._meta[Object.keys(dataset._meta)[0]];\n var total = meta.total;\n var currentValue = dataset.data[tooltipItem.index];\n var percentage = parseFloat((currentValue/total*100).toFixed(2));\n return data.labels[tooltipItem.index] + ' ' + percentage + ' %';\n },\n }\n }\n}\n","import React, { useEffect } from 'react'\nimport { useDispatch } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { Pie } from 'react-chartjs-2'\nimport { makeStyles } from '@mui/styles'\nimport {\n Card,\n CardHeader,\n CardContent,\n Divider,\n Typography\n} from '@mui/material'\nimport { options } from './options'\nimport palette from 'theme/palette'\nimport { useSelector } from 'react-redux'\nimport { dashboardAction } from '../../../../_actions'\n\nconst useStyles = makeStyles(() => ({\n root: {},\n chartContainer: {\n height: 400,\n position: 'relative'\n },\n actions: {\n justifyContent: 'flex-end'\n }\n}))\n\nconst GraficoOrdensServicoStatusChartCard = (props) => {\n\n const dispatch = useDispatch()\n\n const { className, ...rest } = props\n const graficoOrdensServico = useSelector((state) => state.dashboard ? state.dashboard.dashboard.graficoOrdensServico : undefined)\n const { isLoading } = useSelector((state) => state.dashboard)\n const classes = useStyles()\n\n useEffect(() => {\n dispatch(dashboardAction.getDashboardGraficoOrdensServico());\n\n //console.log(\"graficoOrdensServico\", graficoOrdensServico)\n // console.log(\"props.graficoOrdensServico\", props.graficoOrdensServico)\n }, []);\n\n const generateData = () => {\n if (graficoOrdensServico) {\n const data = {\n labels: graficoOrdensServico.options, //labels\n datasets: [\n {\n label: 'Ordens de serviço criadas',\n data: graficoOrdensServico.series[0], //dados\n backgroundColor: [\n '#9E9E9E',\n '#673AB7',\n '#2196F3',\n '#FF5722',\n '#4CAF50',\n '#FF9800'\n ],\n borderColor: [\n '#9E9E9E',\n '#673AB7',\n '#2196F3',\n '#FF5722',\n '#4CAF50',\n '#FF9800'\n ],\n borderWidth: 2\n },\n ],\n }\n return data\n } else {\n return []\n }\n }\n\n\n return (\n \n \n Ordens de Serviço Por Status\n }\n />\n \n \n \n \n \n \n )\n}\n\nGraficoOrdensServicoStatusChartCard.propTypes = {\n className: PropTypes.string\n}\n\nexport default GraficoOrdensServicoStatusChartCard\n","import palette from 'theme/palette'\n\nexport const options = {\n responsive: true,\n maintainAspectRatio: false,\n animation: false,\n legend: { display: false },\n cornerRadius: 5,\n tooltips: {\n enabled: true,\n mode: 'index',\n intersect: false,\n borderWidth: 1,\n borderColor: palette.divider,\n backgroundColor: palette.white,\n titleFontColor: palette.text.primary,\n bodyFontColor: palette.text.secondary,\n footerFontColor: palette.text.secondary,\n callbacks: {\n label: function (tooltipItems, data) {\n var dataset = data.datasets[tooltipItems.datasetIndex]\n if (dataset.yAxisID === 'A') {\n return `${dataset.label}: R$ ${tooltipItems.yLabel}`\n } else {\n return `${dataset.label}: ${tooltipItems.yLabel}`\n }\n }\n }\n },\n layout: { padding: 0 },\n scales: {\n xAxes: [\n {\n barThickness: 35, //largura das barras\n maxBarThickness: 37,\n barPercentage: 0.5,\n categoryPercentage: 0.5,\n ticks: {\n fontColor: palette.text.secondary\n },\n gridLines: {\n display: false,\n drawBorder: false\n }\n }\n ],\n yAxes: [\n {\n id: 'A',\n ticks: {\n fontColor: palette.text.secondary,\n beginAtZero: true,\n min: 0,\n stepSize: 1\n },\n gridLines: {\n borderDash: [2],\n borderDashOffset: [2],\n color: palette.divider,\n drawBorder: false,\n zeroLineBorderDash: [2],\n zeroLineBorderDashOffset: [2],\n zeroLineColor: palette.divider\n }\n },\n {\n id: 'B',\n ticks: {\n fontColor: palette.text.secondary,\n beginAtZero: true,\n min: 0,\n stepSize: 1\n },\n gridLines: {\n borderDash: [2],\n borderDashOffset: [2],\n color: palette.divider,\n drawBorder: false,\n zeroLineBorderDash: [2],\n zeroLineBorderDashOffset: [2],\n zeroLineColor: palette.divider\n }\n } \n ]\n }\n}\n","import React, { useEffect } from 'react'\nimport { useDispatch } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { Bar } from 'react-chartjs-2'\nimport { makeStyles } from '@mui/styles'\nimport {\n Card,\n CardHeader,\n CardContent,\n Divider,\n Typography\n} from '@mui/material'\nimport { options } from './options'\nimport palette from 'theme/palette'\nimport { useSelector } from 'react-redux'\nimport { dashboardAction } from '../../../../_actions'\n\nconst useStyles = makeStyles(() => ({\n root: {},\n chartContainer: {\n height: 400,\n position: 'relative'\n },\n actions: {\n justifyContent: 'flex-end'\n }\n}))\n\nconst GraficoOrdensServicoPorMesChartCard = (props) => {\n\n const dispatch = useDispatch()\n\n const { className, ...rest } = props\n const graficoOrdensServicoPorMes = useSelector((state) => state.dashboard ? state.dashboard.dashboard.graficoOrdensServicoPorMes : undefined)\n const { isLoading } = useSelector((state) => state.dashboard)\n const classes = useStyles()\n\n useEffect(() => {\n dispatch(dashboardAction.getDashboardGraficoOrdensServico());\n\n //console.log(\"graficoOrdensServico\", graficoOrdensServico)\n console.log(\"graficoOrdensServicoPorMes\", graficoOrdensServicoPorMes)\n }, []);\n\n const generateData = () => {\n if (graficoOrdensServicoPorMes) {\n const data = {\n labels: graficoOrdensServicoPorMes.options,\n datasets: [\n {\n label: 'Valor total',\n yAxisID: 'A',\n backgroundColor: '#000',\n data: graficoOrdensServicoPorMes.series[0]\n },\n {\n label: 'Quantidade',\n yAxisID: 'B',\n backgroundColor: '#FFC107',\n data: graficoOrdensServicoPorMes.series[1]\n } \n ]\n }\n return data\n } else {\n return []\n }\n }\n\n\n return (\n \n \n Ordens de Serviço Por Mês\n }\n />\n \n \n \n \n \n \n )\n}\n\nGraficoOrdensServicoPorMesChartCard.propTypes = {\n className: PropTypes.string\n}\n\nexport default GraficoOrdensServicoPorMesChartCard\n","import React, { useLayoutEffect, useEffect } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport {\n Typography,\n Grid\n} from '@mui/material'\nimport { withStyles } from '@mui/styles'\nimport messageTime from 'utils/stringTimeHello'\nimport { Page } from 'components'\nimport { withRouter } from 'react-router-dom'\nimport { authActions, dashboardAction } from '../../_actions'\nimport CardHorasRecebimentoOrcamentos from '../Dashboard/components/CardHorasRecebimentoOrcamentos'\nimport CardOrdemServico from '../Dashboard/components/CardOrdemServico'\nimport CardUsuarios from '../Dashboard/components/CardUsuarios'\nimport CardEmpresas from '../Dashboard/components/CardEmpresas'\nimport GraficoOrdensServicoStatusChartCard from '../Dashboard/components/GraficoOrdensServicoStatusChartCard'\nimport GraficoOrdensServicoPorMesChartCard from '../Dashboard/components/GraficoOrdensServicoPorMesChartCard'\nimport background from \"../../img/background.png\";\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2),\n backgroundImage: `url(${background})`,\n backgroundSize: 'cover',\n backgroundRepeat: 'no-repeat'\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'row',\n textAlign: 'center'\n },\n gridCards: {\n //alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'row',\n padding: theme.spacing(2),\n [theme.breakpoints.down('md')]: {\n padding: theme.spacing(1)\n }\n }\n});\n\nconst Dashboard = (props) => {\n\n const { className, classes, ...rest } = props\n const { match: { params } } = props;\n const dispatch = useDispatch();\n\n const user = useSelector((state) => state.authentication.user)\n\n useLayoutEffect(() => {\n dispatch(authActions.refresh())\n\n }, [])\n\n useEffect(() => {\n dispatch(dashboardAction.getDashboard())\n }, [])\n\n return (\n \n \n \n \n \n {messageTime()}, {user ? user.nome : ''}\n \n
\n \n {'Seja bem vindo'}\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 )\n}\nDashboard.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return state\n}\nconst connectedDashboardPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Dashboard))\n)\nexport { connectedDashboardPage as Dashboard }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport { veiculoAction } from '../../_actions'\nimport PropTypes from 'prop-types'\nimport {\n Table,\n TableContainer,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Paper,\n IconButton,\n Tooltip,\n Input,\n Grid,\n TablePagination\n} from '@mui/material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport EditIcon from '@mui/icons-material/Edit'\nimport { withStyles } from '@mui/styles'\nimport { withRouter } from 'react-router-dom'\nimport { history } from '../../utils'\nimport TitleContent from '../TitleContent'\nimport { useConfirm } from 'material-ui-confirm'\nimport { AccessControl } from '../../components/Utils/AccessControl'\nimport AccessDenied from '../Errors/AccessDenied'\nimport { Page } from 'components'\nimport { useDebounce } from 'use-debounce';\n\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(6, 6, 6, 6)\n }\n})\n\nconst Veiculo = (props) => {\n\n const confirm = useConfirm()\n const dispatch = useDispatch()\n const { classes } = props\n const { veiculo } = props.veiculo\n const { totalRegistros } = props.veiculo\n\n const [page, setPage] = useState(0);\n const [limit, setLimit] = useState(10);\n const [term, setTerm] = useState('');\n const [debounceTerm] = useDebounce(term, 1000);\n const [order] = useState('placa');\n const [direction] = useState('asc');\n const [ready, setReady] = React.useState(false);\n\n const { idOrgao } = useSelector(\n (state) => state.usuarioOrgao\n )\n\n useEffect(() => {\n\n const fetchData = (page, limit, term) => {\n\n let filterModel = {\n Page: page,\n Limit: limit,\n Term: term,\n Order: order,\n Direction: direction,\n IdOrgao: (idOrgao && idOrgao != '' && idOrgao)\n };\n\n dispatch(veiculoAction.getVeiculo(filterModel, true));\n\n };\n\n fetchData(page, limit, debounceTerm, order, direction);\n\n }, [page, limit, debounceTerm, order, direction, idOrgao]);\n\n useEffect(() => {\n\n }, [totalRegistros]);\n\n useEffect(() => {\n\n }, [ready, props.veiculo.isLoading])\n\n const handleChangePage = (event, newPage) => {\n setPage(newPage);\n };\n\n const handleChangeLimit = (event) => {\n setLimit(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n const handleClick = (id) => {\n confirm({\n title: 'Você deseja excluir este Veículo?',\n description: 'Essa operação é irreversível',\n disabled: props.veiculo.isLoading,\n confirmationText: props.veiculo.isLoading ? 'Excluindo veículo...' : 'Sim, excluir!',\n }).then(() => {\n dispatch(veiculoAction.deleteVeiculoById(id))\n })\n }\n\n const handleChange = prop => event => {\n setTerm(event.target.value);\n };\n\n return (\n \n (\n \n {undefined !== veiculo && veiculo.length > 0 ? (\n
\n ) : (\n
\n )}\n
\n \n \n
\n
\n \n \n \n Placa\n Ações\n \n \n \n {undefined !== veiculo && veiculo.length\n ? veiculo.map((n) => {\n return (\n \n \n {n.placa ? n.placa.toUpperCase() : ''}\n \n \n (\n \n history.push(`/veiculo/${n.id}`)\n }\n size=\"small\"\n >\n \n \n \n \n \n \n )}\n />\n (\n handleClick(n.id)}\n size=\"small\"\n >\n \n \n \n \n )}\n />\n \n \n )\n })\n : null}\n \n
\n \n
\n
\n )}\n no={() => }\n />\n \n )\n}\nVeiculo.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return {\n veiculo: state.veiculo\n }\n}\nconst connectedVeiculoPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(Veiculo))\n)\nexport { connectedVeiculoPage as Veiculo }\n","import React, { useEffect, useState } from 'react'\nimport { connect, useDispatch, useSelector } from 'react-redux'\nimport clsx from 'clsx'\nimport PropTypes from 'prop-types'\nimport { toast } from 'react-toastify'\nimport { withStyles } from '@mui/styles'\nimport Swal from 'sweetalert2';\nimport Typography from '@mui/material/Typography'\nimport {\n Avatar,\n Backdrop,\n Badge,\n Card,\n CardHeader,\n CardContent,\n CardActions,\n CircularProgress,\n Divider,\n Button,\n Grid,\n MenuItem,\n Tooltip\n} from '@mui/material'\nimport {\n ValidatorForm,\n TextValidator,\n SelectValidator\n} from 'react-material-ui-form-validator'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faPlus, faTrashAlt } from '@fortawesome/free-solid-svg-icons'\nimport {\n veiculoAction,\n usuarioAction,\n orgaoAction,\n authActions,\n marcaAction\n} from '../../_actions'\nimport { withRouter } from 'react-router-dom'\nimport { uploadImage } from '_services'\nimport { useConfirm } from 'material-ui-confirm'\nimport ImageUploading from 'react-images-uploading'\nimport { errorsUploadImage } from 'utils'\nimport CloudUploadIcon from '@mui/icons-material/CloudUpload';\nimport { history, stringUtils } from '../../utils'\nimport { Page } from 'components'\nimport { isEmpty } from 'lodash'\nimport SaveIcon from '@mui/icons-material/Save';\nimport getInitials from 'utils/getInitials'\n\nconst styles = (theme) => ({\n root: {\n padding: theme.spacing(2)\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n textAlgin: 'center'\n },\n nome: {\n marginTop: theme.spacing(1)\n },\n uploadButton: {\n marginRight: theme.spacing(1),\n justifyContent: 'space-between'\n },\n avatar: {\n borderRadius: '10px',\n webkitBorderRadius: '10px',\n mozBorderRadius: '10px',\n cursor: 'pointer',\n objectFit: 'cover'\n },\n backdrop: {\n zIndex: theme.zIndex.drawer + 1,\n color: '#fff'\n }\n})\n\nconst VeiculoEdit = (props) => {\n\n const dispatch = useDispatch()\n const { classes, veiculo, className, ...rest } = props\n const { match: { params } } = props;\n const formRef = React.createRef(null);\n\n const [idUsuario, setIdUsuario] = useState(0);\n\n const confirm = useConfirm()\n const [images, setImages] = useState([])\n const [imagem, setImagem] = useState('')\n const [open, setOpen] = useState(false)\n\n const [textUsuario, setTextUsuario] = useState('');\n\n const usuarios = useSelector((state) => state.usuario.usuario)\n const orgaos = useSelector((state) => state.orgao.orgao)\n const marcas = useSelector((state) => state.marca.marca)\n\n const [, forceUpdate] = React.useState(0);\n const [ready, setReady] = React.useState(false);\n\n const { idOrgao } = useSelector(\n (state) => state.usuarioOrgao\n )\n\n const removeImage = () => {\n confirm({\n title: 'Deseja remover a imagem?',\n description: '',\n confirmationText: 'Sim, quero remover!',\n cancellationText: 'Não'\n }).then(() => {\n let payload = {\n ...veiculo,\n caminhoFoto: null\n }\n dispatch(\n veiculoAction.editVeiculoInfo(veiculo.id, payload, false)\n )\n var event2 = {\n type: 'select',\n target: {\n value: null\n }\n };\n dispatch(veiculoAction.onChangeProps('caminhoFoto', event2))\n setImagem(null)\n })\n }\n\n const onChangeImage = (imageList) => {\n //console.log(\"imageList\", imageList)\n // data for submit\n setOpen(true)\n setImages(imageList)\n uploadImage(imageList[0])\n .then((response) => {\n\n let payload = {\n ...veiculo,\n caminhoFoto: response.toString()\n }\n\n if (veiculo.id !== 0) {\n dispatch(\n veiculoAction.editVeiculoInfo(veiculo.id, payload, false)\n )\n }\n\n setTimeout(function () {\n\n var event2 = {\n type: 'select',\n target: {\n value: response.toString()\n }\n };\n dispatch(veiculoAction.onChangeProps('caminhoFoto', event2))\n\n setImagem(response)\n setOpen(false)\n\n }, 1000);\n\n })\n .catch((err) => {\n console.log(err)\n setOpen(false)\n })\n }\n\n useEffect(() => {\n setImagem(veiculo.caminhoFoto)\n }, [veiculo.caminhoFoto, open]);\n\n useEffect(() => {\n // forceUpdate(n => !n);\n }, [open, imagem]);\n\n useEffect(() => {\n\n dispatch(marcaAction.getMarcaSelect())\n dispatch(orgaoAction.getOrgaoSelect())\n\n if (params.id) {\n dispatch(veiculoAction.getVeiculoById(params.id))\n } else {\n dispatch(veiculoAction.clear())\n }\n\n }, []);\n\n useEffect(() => {\n if (idOrgao != 0) {\n dispatch(usuarioAction.getUsuarioMotoristaByOrgaoSelect(idOrgao))\n } else {\n toast.error('Selecione um órgão');\n }\n }, [idOrgao]);\n\n useEffect(() => {\n }, [ready, props.veiculo.isLoading])\n\n const handleSelectChangeState = (prop) => (event) => {\n setIdUsuario(event.target.value);\n setTextUsuario(event.nativeEvent.target.innerText);\n };\n\n const handleChange = (prop) => (event) => {\n dispatch(veiculoAction.onChangeProps(prop, event))\n }\n\n const handleSubmit = (event) => {\n\n let payload = {\n id: params.id,\n ano: props.veiculo.ano,\n placa: props.veiculo.placa,\n renavam: props.veiculo.renavam,\n hodometro: props.veiculo.hodometro,\n numeroChassis: props.veiculo.numeroChassis,\n idMarca: props.veiculo.idMarca,\n modelo: props.veiculo.modelo,\n caminhoFoto: props.veiculo.caminhoFoto,\n idOrgao: idOrgao != 0 ? idOrgao : props.veiculo.idOrgao,\n usuariosVeiculos: props.veiculo.usuariosVeiculos\n }\n\n if (params.id) {\n dispatch(veiculoAction.editVeiculoInfo(params.id, payload, true))\n } else {\n dispatch(veiculoAction.createVeiculo(payload))\n }\n\n };\n\n const handleAddOnList = e => {\n\n if (props.veiculo.usuariosVeiculos.filter(ts => ts.idUsuario == parseInt(idUsuario)).length > 0) {\n toast.error('Erro ao adicionar! Este usuário já existe!')\n }\n else {\n\n if (idUsuario != '' && idUsuario != '0') {\n props.veiculo.usuariosVeiculos.push({ 'idUsuario': idUsuario, 'idVeiculo': props.veiculo.id, 'usuario': { 'nome': textUsuario } });\n forceUpdate(n => !n);\n setIdUsuario(0);\n\n } else {\n Swal.fire({\n icon: 'warning',\n title: 'Erro ao salvar',\n showCloseButton: true,\n showConfirmButton: true,\n html: 'Informe ao menos um usuário!
'\n });\n }\n }\n };\n\n const handleRemoveOnList = id => {\n props.veiculo.usuariosVeiculos = props.veiculo.usuariosVeiculos.filter(ts => ts.idUsuario != parseInt(id));\n forceUpdate(n => !n);\n };\n\n function excludeFilter(obj) {\n if (props.veiculo.usuariosVeiculos && props.veiculo.usuariosVeiculos.length > 0) {\n if (props.veiculo.usuariosVeiculos.filter(fl => fl.idUsuario == parseInt(obj.value)).length > 0) {\n return false;\n } else {\n return true;\n }\n\n } else {\n return true;\n }\n }\n\n function InsertText() {\n return (\n \n {'Novo Veículo'}\n \n )\n }\n\n function EditText() {\n return (\n \n {'Editar Veículo'}\n \n )\n }\n function SegHeader() {\n if (params.id) {\n return \n }\n return \n }\n return (\n \n \n \n \n \n \n \n \n \n \n \n Enviando foto...\n \n \n \n \n errorsUploadImage(errors)}\n value={images}\n acceptType={['jpeg', 'jpg']}\n onChange={onChangeImage}\n resolutionWidth={1100}\n resolutionHeight={1100}\n resolutionType={\"less\"}\n dataURLKey=\"data_url\"\n >\n {({ onImageUpload, isDragging, dragProps }) => (\n \n \n {isDragging ? (\n <>\n \n \n Solte a imagem aqui!\n \n >\n ) : (\n <>\n \n \n {veiculo.placa}\n \n \n \n\n \n >\n )}\n \n \n \n \n {veiculo != null &&\n imagem != null &&\n imagem != '' && (\n \n )}\n \n \n )}\n \n \n \n \n \n \n handleSubmit(event)}\n >\n }\n />\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {!isEmpty(marcas) &&\n undefined !== marcas &&\n marcas.length &&\n marcas.map((row, index) => (\n \n ))}\n \n \n \n \n \n \n \n \n \n \n \n {idOrgao != null && idOrgao != 0 ?\n \n \n \n {!isEmpty(orgaos) &&\n undefined !== orgaos &&\n orgaos.length &&\n orgaos.map((row, index) => (\n \n ))}\n \n \n :\n \n \n \n {!isEmpty(orgaos) &&\n undefined !== orgaos &&\n orgaos.length &&\n orgaos.map((row, index) => (\n \n ))}\n \n \n }\n \n \n \n \n \n \n \n Motoristas vinculados ao veículo\n \n \n \n \n \n \n {!isEmpty(usuarios) &&\n undefined !== usuarios &&\n usuarios.length &&\n usuarios.filter(excludeFilter).map((row, index) => (\n \n ))}\n \n \n \n \n \n \n \n \n {\n (props.veiculo.usuariosVeiculos != null && props.veiculo.usuariosVeiculos.length > 0 ?\n props.veiculo.usuariosVeiculos.map(n => {\n return (\n (n.id !== '' ?\n \n : null)\n );\n })\n : null)\n }\n \n
\n \n \n \n \n \n \n \n * Campos obrigatórios\n \n \n \n \n }\n endIcon={props.veiculo.isLoading && }\n >\n {params.id ? (props.veiculo.isLoading ? 'Atualizando veículo...' : 'Atualizar') : (props.veiculo.isLoading ? 'Salvando veículo...' : 'Salvar')}\n \n \n \n \n \n \n \n \n \n )\n}\n\nVeiculoEdit.propTypes = {\n classes: PropTypes.object.isRequired\n}\nconst mapStateToProps = (state) => {\n return state\n}\n\nconst connectedVeiculoEditPage = withRouter(\n connect(mapStateToProps, null, null, {\n pure: false\n })(withStyles(styles)(VeiculoEdit))\n)\nexport { connectedVeiculoEditPage as VeiculoEdit }\n","import React from 'react'\nimport { Route, Switch, Redirect } from 'react-router-dom'\nimport { RouteWithLayout } from './components'\nimport { PrivateRouteWithLayout } from './components'\nimport {\n Main as MainLayout,\n Minimal as MinimalLayout,\n} from './layouts'\n\nimport {\n Error404 as Error404View,\n EmailVerification as EmailVerificationView,\n Empresa as EmpresaView,\n EmpresaEdit as EmpresaEditView,\n Home as HomeView,\n Login as LoginView,\n Marca as MarcaView,\n MarcaEdit as MarcaEditView,\n OrdemServico as OrdemServicoView,\n OrdemServicoEdit as OrdemServicoEditView,\n Orgao as OrgaoView,\n OrgaoEdit as OrgaoEditView,\n Parametro as ParametroView,\n ParametroEdit as ParametroEditView,\n PasswordReset as PasswordResetView,\n PasswordResetSuccess as PasswordResetSuccessView,\n Dashboard as DashboardView,\n Usuario as UsuarioView,\n UsuarioEdit as UsuarioEditView,\n Veiculo as VeiculoView,\n VeiculoEdit as VeiculoEditView\n} from './views'\n\nconst Routes = () => {\n return (\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 \n \n \n \n \n \n )\n}\n\nexport default Routes\n","import React, { useLayoutEffect } from 'react';\nimport { Router } from 'react-router-dom';\nimport { ThemeProvider } from '@mui/styles';\nimport { LocalizationProvider } from '@mui/x-date-pickers';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'\nimport { ConfirmProvider } from 'material-ui-confirm';\nimport './App.css';\nimport theme from './theme';\nimport Routes from './Routes';\nimport Mensagens from './components/Utils';\nimport { authActions } from './_actions';\nimport { useDispatch } from 'react-redux';\nimport { history } from './utils';\n\nconst App = () => {\n const dispatch = useDispatch()\n\n useLayoutEffect(() => {\n dispatch(authActions.refresh())\n }, [])\n\n return (\n \n \n \n \n \n
\n \n \n \n \n \n \n )\n}\nexport default App\n","let token = localStorage.getItem('token')\nlet expires = localStorage.getItem('expires')\nlet user = JSON.parse(localStorage.getItem('user'))\n\nconst initialState = user\n ? { refreshed: false, loggedIn: true, token, expires, user }\n : {}\n\nexport function authentication(state = initialState, action) {\n switch (action.type) {\n case 'LOGIN_REQUEST':\n return {\n ...state,\n loggingIn: true,\n user: action.user\n }\n case 'LOGIN_SUCCESS':\n return {\n ...state,\n loggedIn: true,\n loggingIn: false,\n user: action.user,\n token: action.token,\n expires: action.expires\n }\n case 'LOGIN_FAILURE':\n return {}\n case 'AUTHENTICATION_REFRESH_REQUEST':\n return {\n ...state,\n refreshed: false,\n token: action.token\n }\n case 'AUTHENTICATION_REFRESH_SUCCESS':\n return {\n ...state,\n loggedIn: true,\n refreshed: true,\n loggingIn: false,\n user: action.user\n }\n case 'AUTHENTICATION_REFRESH_FAILURE':\n return {\n ...state,\n refreshed: true,\n loggedIn: false,\n user: null,\n token: null,\n expires: null\n }\n case 'VERIFICATION_USER_SUCCESS':\n return {\n ...state,\n user: { ...state.user }\n }\n case 'EDIT_USER_SUCCESS':\n return {\n ...state,\n user: {\n ...state.user,\n ...action.user\n }\n }\n case 'UPDATE_USER_DETAILS':\n return {\n ...state,\n user: action.user\n }\n default:\n return state\n }\n}\n","const initialState = {\n anchor: 'left',\n cidade: [],\n open: false,\n id: 0,\n nome: '',\n idEstado: 0,\n ibge: '',\n estado: null\n}\n\nexport function cidade(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_CIDADE':\n return {\n ...state,\n cidade: action.cidade\n }\n case 'CIDADE_DETAIL':\n return {\n ...state,\n id: action.id,\n nome: action.nome,\n idEstado: action.idEstado,\n ibge: action.ibge,\n estado: action.estado\n }\n case 'CIDADE_UPDATED':\n return state\n case 'CIDADE_CLEAR':\n return initialState\n case 'CIDADE_CLEAR_ALL':\n return {\n ...state,\n cidade: []\n }\n case 'CIDADE_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n default:\n return state\n }\n}\n","const initialState = {\n dashboard: {\n ordensServicoPendentes: 0,\n ordensServicoRecebendoOrcamento: 0,\n ordensServicoAprovadaEmAndamento: 0,\n ordensServicoRecusadas: 0,\n ordensServicoConcluidas: 0,\n totalOrdens: 0,\n totalUsuarios: 0,\n totalEmpresas: 0,\n graficoOrdensServico: { options: [], series: [] },\n graficoOrdensServicoPorMes: { options: [], series: [] },\n horasRecebimentoOrcamentos: ''\n },\n ordensServico: [],\n totalOrdensServico: 0,\n isLoading: false,\n isLoadingOrdensServicoEmAberto: false,\n isLoadingGraficoOrdensServico: false\n}\n\nexport function dashboard(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_DASHBOARD_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'FETCHED_DASHBOARD_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'FETCHED_DASHBOARD_SUCCESS':\n return {\n ...state,\n dashboard: action.dashboard,\n isLoading: false\n }\n case 'FETCHED_DASHBOARD_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'FETCHED_DASHBOARD_GRAFICO_ORDENS_SERVICO_REQUEST':\n return {\n ...state,\n isLoadingGraficoOrdensServico: true\n }\n case 'FETCHED_DASHBOARD_GRAFICO_ORDENS_SERVICO_SUCCESS':\n return {\n ...state,\n isLoadingGraficoOrdensServico: false,\n ordensServico: action.ordensServico,\n totalOrdensServico: action.totalOrdensServico\n }\n case 'FETCHED_DASHBOARD_GRAFICO_ORDENS_SERVICO_FAILURE':\n return {\n ...state,\n isLoadingGraficoOrdensServico: false,\n error: action.error\n }\n case 'DASHBOARD_CLEAR':\n return initialState\n default:\n return state\n }\n}\n","const initialState = {\n anchor: 'left',\n estado: [],\n open: false,\n id: '',\n nome: '',\n uf: '',\n ibge: '',\n}\n\nexport function estado(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_ESTADO':\n return {\n ...state,\n estado: action.estado\n }\n case 'ESTADO_DETAIL':\n return {\n ...state,\n id: action.id,\n nome: action.nome,\n uf: action.uf,\n ibge: action.ibge,\n }\n case 'ESTADO_UPDATED':\n return state\n case 'HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n default:\n return state\n }\n}\n","const initialState = {\n anchor: 'left',\n empresa: [],\n open: false,\n id: 0,\n razaoSocial: '',\n nomeFantasia: '',\n cnpj: '',\n telefone: '',\n celular: '',\n email: '',\n endereco: '',\n idCidade: 0,\n idEstado: 0,\n inscricaoEstadual: '',\n usuariosEmpresas: [],\n empresasOrgaos: [],\n totalRegistros: 0,\n fornecedor: false,\n prestadorServico: false,\n cadastroLiberado: false\n}\n\nexport function empresa(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_EMPRESA':\n return {\n ...state,\n empresa: action.empresa\n }\n case 'EMPRESA_DETAIL':\n return {\n ...state,\n id: action.id,\n razaoSocial: action.razaoSocial,\n nomeFantasia: action.nomeFantasia,\n cnpj: action.cnpj,\n telefone: action.telefone,\n celular: action.celular,\n email: action.email,\n endereco: action.endereco,\n idCidade: action.idCidade,\n idEstado: action.idEstado,\n inscricaoEstadual: action.inscricaoEstadual,\n usuariosEmpresas: action.usuariosEmpresas,\n empresasOrgaos: action.empresasOrgaos,\n fornecedor: action.fornecedor,\n prestadorServico: action.prestadorServico,\n cadastroLiberado: action.cadastroLiberado\n }\n case 'EMPRESA_UPDATED':\n return state\n case 'EMPRESA_CLEAR':\n return initialState\n case 'EMPRESA_CLEAR_ALL':\n return {\n ...state,\n empresa: []\n }\n case 'EMPRESA_CLEAR_USUARIOS_EMPRESAS':\n return {\n ...state,\n usuariosEmpresas: []\n }\n case 'FETCHED_ALL_EMPRESA':\n return {\n ...state,\n empresa: action.empresa,\n totalRegistros: action.totalRegistros\n }\n case 'EMPRESA_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n default:\n return state\n }\n}\n","const initialState = {\n empresaOrgao: [],\n id: '',\n isLoading: false,\n idOrgao: '',\n idEmpresa: '',\n excluido: null,\n empresa: {}\n}\n\nexport function empresaOrgao(state = initialState, action) {\n switch (action.type) {\n case 'CREATE_EMPRESA_ORGAO_SUCCESS':\n return {\n ...state,\n idEmpresa: '',\n empresaOrgao: [\n ...state.empresaOrgao,\n action.empresaOrgao\n ]\n }\n case 'FETCHED_ALL_EMPRESA_ORGAO':\n return {\n ...state,\n empresaOrgao: action.empresaOrgao\n }\n case 'EMPRESA_ORGAO_DETAIL':\n return {\n ...state,\n id: action.id,\n idOrgao: action.idOrgao,\n idEmpresa: action.idEmpresa,\n excluido: action.excluido,\n empresa: action.empresa\n }\n case 'EMPRESA_ORGAO_UPDATED':\n return state\n case 'EMPRESA_ORGAO_ADD_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'EMPRESA_ORGAO_ADD_SUCCESS':\n return {\n ...state,\n isLoading: false\n }\n case 'EMPRESA_ORGAO_ADD_FAILURE':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_SUCCESS':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_FAILURE':\n return {\n ...state,\n isLoading: false\n }\n case 'EMPRESA_ORGAO_CLEAR':\n return initialState\n case 'EMPRESA_ORGAO_CLEAR_ALL':\n return {\n ...state,\n empresaOrgao: []\n }\n case 'EMPRESA_ORGAO_CLEAR_SELECTED':\n return {\n ...state,\n id: '',\n isLoading: false,\n idOrgao: '',\n idEmpresa: '',\n excluido: null,\n empresa: {}\n }\n case 'CHANGE_DETAILS_EMPRESA_ORGAO':\n return {\n ...state,\n id: action.id,\n idOrgao: action.idOrgao,\n idEmpresa: action.idEmpresa,\n excluido: action.excluido,\n empresa: action.empresa\n }\n case 'AUTHENTICATION_REFRESH_SUCCESS':\n return {\n ...state,\n empresaOrgao: action.user.usuariosEmpresas\n }\n case 'LOGIN_SUCCESS':\n return {\n ...state,\n empresaOrgao: action.user.usuariosEmpresas\n }\n default:\n return state\n }\n}\n","const initialState = {\n isLoading: false,\n totalRegistros: 0,\n marca: [],\n open: false,\n id: 0,\n nome: '',\n excluido: false,\n}\n\nexport function marca(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_MARCA':\n return {\n ...state,\n marca: action.marca,\n totalRegistros: action.totalRegistros\n }\n case 'MARCA_DETAIL':\n return action.marca\n case 'MARCA_UPDATED':\n return state\n case 'MARCA_CLEAR':\n return initialState\n case 'MARCA_CLEAR_ALL':\n return {\n ...state,\n marca: []\n }\n case 'MARCA_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'MARCA_ISLOADING':\n return {\n ...state,\n isLoading: true\n }\n case 'MARCA_NOTISLOADING':\n return {\n ...state,\n isLoading: false\n }\n default:\n return state\n }\n}\n","const initialState = {\n totalRegistros: 0,\n isLoading: false,\n orgao: [],\n id: '',\n nome: '',\n idCidade: 0,\n idEstado: '',\n excluido: '',\n celular: '',\n cnpj: '',\n email: '',\n endereco: '',\n telefone: '',\n cadastroLiberado: false,\n usuariosOrgaos: []\n}\n\nexport function orgao(state = initialState, action) {\n switch (action.type) {\n case 'CREATE_ORGAO_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'CREATE_ORGAO_SUCCESS':\n return {\n ...state,\n id: action.orgao.id,\n isLoading: false,\n nome: action.orgao.nome,\n celular: action.orgao.celular,\n cnpj: action.orgao.cnpj,\n email: action.orgao.email,\n endereco: action.orgao.endereco,\n telefone: action.orgao.telefone,\n idCidade: action.orgao.idCidade,\n idEstado: action.orgao.idEstado,\n cadastroLiberado: action.orgao.cadastroLiberado,\n usuariosOrgaos: action.usuariosOrgaos\n }\n case 'CREATE_ORGAO_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'EDIT_ORGAO_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'EDIT_ORGAO_SUCCESS':\n return {\n ...state,\n id: action.orgao.id,\n isLoading: false,\n nome: action.orgao.nome,\n celular: action.orgao.celular,\n cnpj: action.orgao.cnpj,\n email: action.orgao.email,\n endereco: action.orgao.endereco,\n telefone: action.orgao.telefone,\n idCidade: action.orgao.idCidade,\n idEstado: action.orgao.idEstado,\n cadastroLiberado: action.orgao.cadastroLiberado,\n usuariosOrgaos: action.orgao.usuariosOrgaos\n }\n case 'EDIT_ORGAO_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'FETCHED_ALL_ORGAO':\n return {\n ...state,\n orgao: action.orgao,\n totalRegistros: action.totalRegistros\n }\n case 'ORGAO_DETAIL':\n return {\n ...state,\n id: action.id,\n isLoading: false,\n nome: action.nome,\n celular: action.celular,\n cnpj: action.cnpj,\n email: action.email,\n endereco: action.endereco,\n telefone: action.telefone,\n idCidade: action.idCidade,\n idEstado: action.idEstado,\n cadastroLiberado: action.cadastroLiberado,\n usuariosOrgaos: action.usuariosOrgaos\n }\n case 'ORGAO_CLEAR':\n return initialState\n case 'ORGAO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'ORGAO_ISLOADING':\n return {\n ...state,\n isLoading: true\n }\n case 'ORGAO_NOTISLOADING':\n return {\n ...state,\n isLoading: false\n }\n default:\n return state\n }\n}\n","const initialState = {\n totalRegistros: 0,\n isLoading: false,\n ordemServico: [],\n open: false,\n id: '',\n descritivo: '',\n titulo: '',\n idTipoServico: 0,\n idVeiculo: 0,\n idUsuario: 0,\n data: '',\n avaliacao: 0,\n descritivoAvaliacao: '',\n idUsuarioAvaliacao: 0,\n idOrgao: 0,\n idEmpresa: 0,\n ultimoEvento: '',\n orgao: [],\n empresa: [],\n eventos: [],\n ordensServicosFotos: [],\n ordensServicosOrcamentos: []\n}\n\nexport function ordemServico(state = initialState, action) {\n switch (action.type) {\n case 'CREATE_ORDEMSERVICO_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'CREATE_ORDEMSERVICO_SUCCESS':\n return {\n ...state,\n id: action.ordemServico.id,\n isLoading: false,\n idTipoServico: action.ordemServico.idTipoServico,\n descritivo: action.ordemServico.descritivo,\n titulo: action.ordemServico.titulo,\n idVeiculo: action.ordemServico.idVeiculo,\n idUsuario: action.ordemServico.idUsuario,\n data: action.ordemServico.data,\n avaliacao: action.ordemServico.avaliacao,\n descritivoAvaliacao: action.ordemServico.descritivoAvaliacao,\n idUsuarioAvaliacao: action.ordemServico.idUsuarioAvaliacao,\n idOrgao: action.ordemServico.idOrgao,\n idEmpresa: action.ordemServico.idEmpresa,\n ultimoEvento: action.ordemServico.ultimoEvento,\n orgao: action.ordemServico.orgao,\n empresa: action.ordemServico.empresa,\n eventos: action.ordemServico.eventos,\n ordensServicosFotos: action.ordemServico.ordensServicosFotos,\n ordensServicosOrcamentos: action.ordemServico.ordensServicosOrcamentos\n }\n case 'CREATE_ORDEMSERVICO_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'EDIT_ORDEMSERVICO_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'EDIT_ORDEMSERVICO_SUCCESS':\n return {\n ...state,\n id: action.ordemServico.id,\n isLoading: false,\n idTipoServico: action.ordemServico.idTipoServico,\n descritivo: action.ordemServico.descritivo,\n titulo: action.ordemServico.titulo,\n idVeiculo: action.ordemServico.idVeiculo,\n idUsuario: action.ordemServico.idUsuario,\n data: action.ordemServico.data,\n avaliacao: action.ordemServico.avaliacao,\n descritivoAvaliacao: action.ordemServico.descritivoAvaliacao,\n idUsuarioAvaliacao: action.ordemServico.idUsuarioAvaliacao,\n idOrgao: action.ordemServico.idOrgao,\n idEmpresa: action.ordemServico.idEmpresa,\n ultimoEvento: action.ordemServico.ultimoEvento,\n orgao: action.ordemServico.orgao,\n empresa: action.ordemServico.empresa,\n eventos: action.ordemServico.eventos,\n ordensServicosFotos: action.ordemServico.ordensServicosFotos,\n ordensServicosOrcamentos: action.ordemServico.ordensServicosOrcamentos\n }\n case 'EDIT_ORDEMSERVICO_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'FETCHED_ALL_ORDEMSERVICO':\n return {\n ...state,\n ordemServico: action.ordemServico,\n totalRegistros: action.totalRegistros\n }\n case 'ORDEMSERVICO_DETAIL':\n return {\n ...state,\n id: action.id,\n isLoading: false,\n idTipoServico: action.idTipoServico,\n descritivo: action.descritivo,\n titulo: action.titulo,\n idVeiculo: action.idVeiculo,\n idUsuario: action.idUsuario,\n data: action.data,\n avaliacao: action.avaliacao,\n descritivoAvaliacao: action.descritivoAvaliacao,\n idUsuarioAvaliacao: action.idUsuarioAvaliacao,\n idOrgao: action.idOrgao,\n idEmpresa: action.idEmpresa,\n ultimoEvento: action.ultimoEvento,\n orgao: action.orgao,\n empresa: action.empresa,\n eventos: action.eventos,\n ordensServicosFotos: action.ordensServicosFotos,\n ordensServicosOrcamentos: action.ordensServicosOrcamentos\n }\n case 'ORDEMSERVICO_CLEAR':\n return initialState\n case 'ORDEMSERVICO_ESTABELECIMENTO_ADD_SUCCESS':\n return {\n ...state,\n ordemServico: [...state.ordemServico, action.data.ordemServico]\n }\n case 'ORDEMSERVICO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'ORDEMSERVICO_ISLOADING':\n return {\n ...state,\n isLoading: true\n }\n case 'ORDEMSERVICO_NOTISLOADING':\n return {\n ...state,\n isLoading: false\n }\n default:\n return state\n }\n}\n","const initialState = {\n totalRegistros: 0,\n isLoading: false,\n ordemServicoFoto: [],\n open: false,\n id: '',\n idTipoFoto: 0,\n caminhoFoto: '',\n idOrdemServico: 0,\n excluido: false\n}\n\nexport function ordemServicoFoto(state = initialState, action) {\n switch (action.type) {\n case 'CREATE_ORDEMSERVICO_FOTO_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'CREATE_ORDEMSERVICO_FOTO_SUCCESS':\n return {\n ...state,\n id: action.ordemServicoFoto.id,\n isLoading: false,\n idTipoFoto: action.ordemServicoFoto.idTipoFoto,\n caminhoFoto: action.ordemServicoFoto.caminhoFoto,\n idOrdemServico: action.ordemServicoFoto.idOrdemServico,\n excluido: action.ordemServicoFoto.excluido,\n ordemServicoFoto: action.ordemServicoFoto.ordemServicoFoto\n }\n case 'CREATE_ORDEMSERVICO_FOTO_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'EDIT_ORDEMSERVICO_FOTO_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'EDIT_ORDEMSERVICO_FOTO_SUCCESS':\n return {\n ...state,\n id: action.ordemServicoFoto.id,\n isLoading: false,\n idTipoFoto: action.ordemServicoFoto.idTipoFoto,\n caminhoFoto: action.ordemServicoFoto.caminhoFoto,\n idOrdemServico: action.ordemServicoFoto.idOrdemServico,\n excluido: action.ordemServicoFoto.excluido,\n ordemServicoFoto: action.ordemServicoFoto.ordemServicoFoto\n }\n case 'EDIT_ORDEMSERVICO_FOTO_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'FETCHED_ALL_ORDEMSERVICO_FOTO':\n return {\n ...state,\n ordemServicoFoto: action.ordemServicoFoto,\n totalRegistros: action.totalRegistros\n }\n case 'ORDEMSERVICO_FOTO_DETAIL':\n return {\n ...state,\n id: action.id,\n isLoading: false,\n idTipoFoto: action.idTipoFoto,\n caminhoFoto: action.caminhoFoto,\n idOrdemServico: action.idOrdemServico,\n excluido: action.excluido,\n ordemServicoFoto: action.ordemServicoFoto\n }\n case 'ORDEMSERVICO_FOTO_CLEAR':\n return initialState\n case 'ORDEMSERVICO_FOTO_ESTABELECIMENTO_ADD_SUCCESS':\n return {\n ...state,\n ordemServicoFoto: [...state.ordemServicoFoto, action.data.ordemServicoFoto]\n }\n case 'ORDEMSERVICO_FOTO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'ORDEMSERVICO_FOTO_ISLOADING':\n return {\n ...state,\n isLoading: true\n }\n case 'ORDEMSERVICO_FOTO_NOTISLOADING':\n return {\n ...state,\n isLoading: false\n }\n default:\n return state\n }\n}\n","const initialState = {\n isLoading: false,\n parametro: [],\n id: '',\n descricao: '',\n chave: '',\n valor: '',\n tipo: '',\n totalRegistros: 0,\n};\n\nexport function parametro(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_PARAMETRO':\n return {\n ...state,\n parametro: action.parametro,\n totalRegistros: action.totalRegistros\n }\n case 'PARAMETRO_DETAIL':\n return action.parametro\n case 'PARAMETRO_UPDATED':\n return state\n case 'PARAMETRO_CLEAR':\n return initialState\n case 'PARAMETRO_CLEAR_ALL':\n return {\n ...state,\n parametro: []\n }\n case 'PARAMETRO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'PARAMETRO_ISLOADING':\n return {\n ...state,\n isLoading: true\n }\n case 'PARAMETRO_NOTISLOADING':\n return {\n ...state,\n isLoading: false\n }\n default:\n return state\n }\n}\n","const initialState = {\n anchor: 'left',\n permissao: [],\n open: false,\n id: 0,\n nome: '',\n descricao: '',\n excluido: false\n}\n\nexport function permissao(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_PERMISSAO':\n return {\n ...state,\n permissao: action.permissao\n }\n case 'PERMISSAO_DETAIL':\n return {\n ...state,\n id: action.id,\n nome: action.nome,\n descricao: action.descricao,\n excluido: action.excluido\n }\n case 'PERMISSAO_UPDATED':\n return state\n case 'PERMISSAO_CLEAR':\n return initialState\n case 'PERMISSAO_CLEAR_ALL':\n return {\n ...state,\n permissao: []\n }\n case 'PERMISSAO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n default:\n return state\n }\n}\n","const initialState = {\n anchor: 'left',\n permissaoTipoUsuario: [],\n open: false,\n id: 0,\n permissaoId: 0,\n idTipoUsuario: 0,\n permitido: false,\n checkedAll: false,\n isLoading: false\n}\n\nexport function permissaoTipoUsuario(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_PERMISSAO_TIPO_USUARIO':\n return {\n ...state,\n permissaoTipoUsuario: action.permissaoTipoUsuario,\n idTipoUsuario: action.idTipoUsuario\n }\n case 'PERMISSAO_TIPO_USUARIO_DETAIL':\n return {\n ...state,\n id: action.id,\n permissaoId: action.permissaoId,\n idTipoUsuario: action.idTipoUsuario,\n permitido: action.permitido\n }\n case 'PERMISSAO_TIPO_USUARIO_CLEAR':\n return initialState\n case 'PERMISSAO_TIPO_USUARIO_CLEAR_ALL':\n return {\n ...state,\n permissaoTipoUsuario: []\n }\n case 'PERMISSAO_TIPO_USUARIO_CREATE_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'PERMISSAO_TIPO_USUARIO_CREATE_SUCCESS':\n return {\n ...state,\n isLoading: false,\n idTipoUsuario: 0,\n checkedAll: false,\n permissaoTipoUsuario: []\n }\n case 'PERMISSAO_TIPO_USUARIO_CREATE_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'PERMISSAO_TIPO_USUARIO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'HANDLE_CHANGE_CHECK_ALL_PERMISSAO_TIPO_USUARIO':\n return {\n ...state,\n checkedAll: !state.checkedAll\n }\n case 'HANDLE_CHECKED_PERMITIDO_PERMISSAO_TIPO_USUARIO':\n return {\n ...state,\n permissaoTipoUsuario: state.permissaoTipoUsuario.map(\n (permissaoTipoUsuario) =>\n permissaoTipoUsuario.id === action.id\n ? {\n ...permissaoTipoUsuario,\n permitido: !permissaoTipoUsuario.permitido\n }\n : permissaoTipoUsuario\n )\n }\n case 'HANDLE_CHECK_ALL_PERMISSAO_TIPO_USUARIO':\n return {\n ...state,\n permissaoTipoUsuario: state.permissaoTipoUsuario.map(\n (permissaoTipoUsuario) => ({\n ...permissaoTipoUsuario,\n permitido: action.checked\n })\n )\n }\n default:\n return state\n }\n}\n","const initialState = {\n anchor: 'left',\n permissaoUsuario: [],\n open: false,\n id: 0,\n permissaoId: 0,\n usuarioId: 0,\n permitido: false,\n checkedAll: false,\n isLoading: false\n}\n\nexport function permissaoUsuario(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_PERMISSAO_USUARIO':\n return {\n ...state,\n permissaoUsuario: action.permissaoUsuario,\n usuarioId: action.usuarioId\n }\n case 'PERMISSAO_USUARIO_DETAIL':\n return {\n ...state,\n id: action.id,\n permissaoId: action.permissaoId,\n usuarioId: action.usuarioId,\n permitido: action.permitido\n }\n case 'PERMISSAO_USUARIO_CLEAR':\n return initialState\n case 'PERMISSAO_USUARIO_CLEAR_ALL':\n return {\n ...state,\n permissaoUsuario: []\n }\n case 'PERMISSAO_USUARIO_CREATE_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'PERMISSAO_USUARIO_CREATE_SUCCESS':\n return {\n ...state,\n isLoading: false,\n usuarioId: 0,\n checkedAll: false,\n permissaoUsuario: []\n }\n case 'PERMISSAO_USUARIO_CREATE_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'PERMISSAO_USUARIO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'HANDLE_CHANGE_CHECK_ALL_PERMISSAO_USUARIO':\n return {\n ...state,\n checkedAll: !state.checkedAll\n }\n case 'HANDLE_CHECKED_PERMITIDO_PERMISSAO_USUARIO':\n return {\n ...state,\n permissaoUsuario: state.permissaoUsuario.map((permissaoUsuario) =>\n permissaoUsuario.id === action.id\n ? {\n ...permissaoUsuario,\n permitido: !permissaoUsuario.permitido\n }\n : permissaoUsuario\n )\n }\n case 'HANDLE_CHECK_ALL_PERMISSAO_USUARIO':\n return {\n ...state,\n permissaoUsuario: state.permissaoUsuario.map((permissaoUsuario) => ({\n ...permissaoUsuario,\n permitido: action.checked\n }))\n }\n default:\n return state\n }\n}\n","const initialState = {\n loading: false,\n foto: [],\n open: false,\n id: '',\n nome: '',\n excluido: false,\n}\n\nexport function tipoFoto(state = initialState, action) {\n switch (action.type) { \n case 'FETCHED_ALL_TIPO_FOTO':\n return {\n ...state,\n tipoFoto: action.tipoFoto\n } \n default:\n return state\n }\n}\n","const initialState = {\n loading: false,\n usuario: [],\n open: false,\n id: '',\n nome: '',\n idTipoUsuario: '',\n}\n\nexport function tipoUsuario(state = initialState, action) {\n switch (action.type) { \n case 'FETCHED_ALL_TIPO_USUARIO':\n return {\n ...state,\n tipoUsuario: action.tipoUsuario\n } \n default:\n return state\n }\n}\n","const initialState = {\n loading: false,\n usuario: [],\n open: false,\n id: '',\n nome: ''\n}\n\nexport function tipoServico(state = initialState, action) {\n switch (action.type) { \n case 'FETCHED_ALL_TIPO_SERVICO':\n return {\n ...state,\n tipoServico: action.tipoServico\n } \n default:\n return state\n }\n}\n","const initialState = {\n totalRegistros: 0,\n isLoading: false,\n usuario: [],\n open: false,\n id: '',\n email: '',\n nome: '',\n senha: '',\n sobrenome: '',\n idTipoUsuario: '',\n dataHoraUltimoAcesso: '',\n openModalRequestPasswordReset: false,\n caminhoCnh: '',\n celular: '',\n cnh: '',\n matricula: '',\n telefone: '',\n idUsuarioOrgao: 0,\n emailVerificado: false\n}\n\nexport function usuario(state = initialState, action) {\n switch (action.type) {\n case 'CREATE_USER_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'CREATE_USER_SUCCESS':\n return {\n ...state,\n id: action.user.id,\n isLoading: false,\n email: action.user.email,\n nome: action.user.nome,\n senha: action.user.senha,\n sobrenome: action.user.sobrenome,\n idTipoUsuario: action.user.idTipoUsuario,\n dataHoraUltimoAcesso: action.user.dataHoraUltimoAcesso,\n caminhoCnh: action.user.caminhoCnh,\n celular: action.user.celular,\n cnh: action.user.cnh,\n matricula: action.user.matricula,\n telefone: action.user.telefone,\n idUsuarioOrgao: action.user.idUsuarioOrgao,\n emailVerificado: action.user.emailVerificado\n }\n case 'CREATE_USER_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'EDIT_USER_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'EDIT_USER_SUCCESS':\n return {\n ...state,\n id: action.user.id,\n isLoading: false,\n email: action.user.email,\n nome: action.user.nome,\n senha: action.user.senha,\n sobrenome: action.user.sobrenome,\n idTipoUsuario: action.user.idTipoUsuario,\n dataHoraUltimoAcesso: action.user.dataHoraUltimoAcesso,\n caminhoCnh: action.user.caminhoCnh,\n celular: action.user.celular,\n cnh: action.user.cnh,\n matricula: action.user.matricula,\n telefone: action.user.telefone,\n idUsuarioOrgao: action.idUsuarioOrgao,\n emailVerificado: action.emailVerificado\n }\n case 'EDIT_USER_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'REQUEST_RESET_PASSWORD_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'REQUEST_RESET_PASSWORD_SUCCESS':\n return {\n ...state,\n isLoading: false,\n openModalRequestPasswordReset: false\n }\n case 'REQUEST_RESET_PASSWORD_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'RESET_PASSWORD_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'RESET_PASSWORD_SUCCESS':\n return {\n ...state,\n isLoading: false\n }\n case 'RESET_PASSWORD_FAILURE':\n return {\n ...state,\n isLoading: false,\n error: action.error\n }\n case 'FETCHED_ALL_USUARIO':\n return {\n ...state,\n usuario: action.usuario,\n totalRegistros: action.totalRegistros\n }\n case 'USUARIO_DETAIL':\n return {\n ...state,\n id: action.id,\n isLoading: false,\n email: action.email,\n nome: action.nome,\n senha: action.senha,\n sobrenome: action.sobrenome,\n idTipoUsuario: action.idTipoUsuario,\n dataHoraUltimoAcesso: action.dataHoraUltimoAcesso,\n caminhoCnh: action.caminhoCnh,\n celular: action.celular,\n cnh: action.cnh,\n matricula: action.matricula,\n telefone: action.telefone,\n idUsuarioOrgao: action.idUsuarioOrgao,\n emailVerificado: action.emailVerificado\n }\n case 'USER_CLEAR':\n return initialState\n case 'USUARIO_ESTABELECIMENTO_ADD_SUCCESS':\n return {\n ...state,\n usuario: [...state.usuario, action.data.usuario]\n }\n case 'USUARIO_ORGAO_SET_ID':\n return {\n idUsuarioOrgao: action.idUsuarioOrgao\n }\n case 'USUARIO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'OPEN_MODAL_REQUEST_PASSWORD_RESET':\n return {\n ...state,\n openModalRequestPasswordReset: action.open\n }\n case 'USUARIO_ISLOADING':\n return {\n ...state,\n isLoading: true\n }\n case 'USUARIO_NOTISLOADING':\n return {\n ...state,\n isLoading: false\n }\n default:\n return state\n }\n}\n","const initialState = {\n usuarioOrgao: [],\n id: '',\n isLoading: false,\n idUsuario: '',\n idOrgao: '',\n excluido: null,\n orgao: {}\n}\n\nexport function usuarioOrgao(state = initialState, action) {\n switch (action.type) {\n case 'CREATE_USUARIO_ORGAO_SUCCESS':\n return {\n ...state,\n idOrgao: '',\n usuarioOrgao: [\n ...state.usuarioOrgao,\n action.usuarioOrgao\n ]\n }\n case 'FETCHED_ALL_USUARIO_ORGAO':\n return {\n ...state,\n usuarioOrgao: action.usuarioOrgao\n }\n case 'USUARIO_ORGAO_DETAIL':\n return {\n ...state,\n id: action.id,\n idUsuario: action.idUsuario,\n idOrgao: action.idOrgao,\n excluido: action.excluido,\n orgao: action.orgao\n }\n case 'USUARIO_ORGAO_UPDATED':\n return state\n case 'USUARIO_ORGAO_ADD_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'USUARIO_ORGAO_ADD_SUCCESS':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ORGAO_ADD_FAILURE':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_SUCCESS':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_FAILURE':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ORGAO_CLEAR':\n return initialState\n case 'USUARIO_ORGAO_CLEAR_ALL':\n return {\n ...state,\n usuarioOrgao: []\n }\n case 'USUARIO_ORGAO_CLEAR_SELECTED':\n return {\n ...state,\n id: '',\n isLoading: false,\n idUsuario: '',\n idOrgao: '',\n excluido: null,\n orgao: {}\n }\n case 'CHANGE_DETAILS_USUARIO_ORGAO':\n return {\n ...state,\n id: action.id,\n idUsuario: action.idUsuario,\n idOrgao: action.idOrgao,\n excluido: action.excluido,\n orgao: action.orgao\n }\n case 'AUTHENTICATION_REFRESH_SUCCESS':\n return {\n ...state,\n usuarioOrgao: action.user.usuariosOrgaos\n }\n case 'LOGIN_SUCCESS':\n return {\n ...state,\n usuarioOrgao: action.user.usuariosOrgaos\n }\n default:\n return state\n }\n}\n","const initialState = {\n usuarioEmpresa: [],\n id: '',\n isLoading: false,\n idUsuario: '',\n idEmpresa: '',\n excluido: null,\n empresa: {}\n}\n\nexport function usuarioEmpresa(state = initialState, action) {\n switch (action.type) {\n case 'CREATE_USUARIO_EMPRESA_SUCCESS':\n return {\n ...state,\n idEmpresa: '',\n usuarioEmpresa: [\n ...state.usuarioEmpresa,\n action.usuarioEmpresa\n ]\n }\n case 'FETCHED_ALL_USUARIO_EMPRESA':\n return {\n ...state,\n usuarioEmpresa: action.usuarioEmpresa\n }\n case 'USUARIO_EMPRESA_DETAIL':\n return {\n ...state,\n id: action.id,\n idUsuario: action.idUsuario,\n idEmpresa: action.idEmpresa,\n excluido: action.excluido,\n empresa: action.empresa\n }\n case 'USUARIO_EMPRESA_UPDATED':\n return state\n case 'USUARIO_EMPRESA_ADD_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'USUARIO_EMPRESA_ADD_SUCCESS':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_EMPRESA_ADD_FAILURE':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_REQUEST':\n return {\n ...state,\n isLoading: true\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_SUCCESS':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_ESTABELECIMENTO_DELETE_FAILURE':\n return {\n ...state,\n isLoading: false\n }\n case 'USUARIO_EMPRESA_CLEAR':\n return initialState\n case 'USUARIO_EMPRESA_CLEAR_ALL':\n return {\n ...state,\n usuarioEmpresa: []\n }\n case 'USUARIO_EMPRESA_CLEAR_SELECTED':\n return {\n ...state,\n id: '',\n isLoading: false,\n idUsuario: '',\n idEmpresa: '',\n excluido: null,\n empresa: {},\n categoriaId: 0\n }\n case 'CHANGE_DETAILS_USUARIO_EMPRESA':\n return {\n ...state,\n id: action.id,\n idUsuario: action.idUsuario,\n idEmpresa: action.idEmpresa,\n excluido: action.excluido,\n empresa: action.empresa\n }\n case 'AUTHENTICATION_REFRESH_SUCCESS':\n return {\n ...state,\n usuarioEmpresa: action.user.usuariosEmpresas\n }\n case 'LOGIN_SUCCESS':\n return {\n ...state,\n usuarioEmpresa: action.user.usuariosEmpresas\n }\n default:\n return state\n }\n}\n","const initialState = {\n isLoading: false,\n totalRegistros: 0,\n veiculo: [],\n open: false,\n id: 0,\n ano: '',\n placa: '',\n renavam: '',\n numeroChassis: '',\n hodometro: '',\n idOrgao: 0,\n idMarca: 0,\n modelo: '',\n caminhoFoto: '',\n usuariosVeiculos: [],\n excluido: false,\n}\n\nexport function veiculo(state = initialState, action) {\n switch (action.type) {\n case 'FETCHED_ALL_VEICULO':\n return {\n ...state,\n veiculo: action.veiculo,\n totalRegistros: action.totalRegistros\n }\n case 'VEICULO_DETAIL':\n return {\n ...state,\n isLoading: false,\n id: action.id,\n ano: action.ano,\n placa: action.placa,\n renavam: action.renavam,\n hodometro: action.hodometro,\n numeroChassis: action.numeroChassis,\n idOrgao: action.idOrgao,\n idMarca: action.idMarca,\n modelo: action.modelo,\n caminhoFoto: action.caminhoFoto,\n usuariosVeiculos: action.usuariosVeiculos,\n excluido: action.excluido\n }\n case 'VEICULO_UPDATED':\n return state \n case 'VEICULO_CLEAR':\n return initialState\n case 'VEICULO_CLEAR_ALL':\n return {\n ...state,\n veiculo: []\n }\n case 'VEICULO_CLEAR_USUARIOS_VEICULOS':\n return {\n ...state,\n usuariosVeiculos: []\n }\n case 'VEICULO_HANDLE_ON_CHANGE':\n return {\n ...state,\n [action.props]: action.value\n }\n case 'VEICULO_ISLOADING':\n return {\n ...state,\n isLoading: true\n }\n case 'VEICULO_NOTISLOADING':\n return {\n ...state,\n isLoading: false\n }\n default:\n return state\n }\n}\n","import { authentication } from './auth.reducer'\nimport { cidade } from './cidade.reducer'\nimport { dashboard } from './dashboard.reducer'\nimport { estado } from './estado.reducer'\nimport { empresa } from './empresa.reducer'\nimport { empresaOrgao } from './empresaOrgao.reducer'\nimport { marca } from './marca.reducer'\nimport { orgao } from './orgao.reducer'\nimport { ordemServico } from './ordemServico.reducer'\nimport { ordemServicoFoto } from './ordemServicoFoto.reducer'\nimport { parametro } from './parametro.reducer'\nimport { permissao } from './permissao.reducer'\nimport { permissaoTipoUsuario } from './permissaoTipoUsuario.reducer'\nimport { permissaoUsuario } from './permissaoUsuario.reducer'\nimport { tipoFoto } from './tipoFoto.reducer'\nimport { tipoUsuario } from './tipoUsuario.reducer'\nimport { tipoServico } from './tipoServico.reducer'\nimport { usuario } from './usuario.reducer'\nimport { usuarioOrgao } from './usuarioOrgao.reducer'\nimport { usuarioEmpresa } from './usuarioEmpresa.reducer'\nimport { veiculo } from './veiculo.reducer'\n\nimport { combineReducers } from 'redux'\n\nimport { reducer as formReducer } from 'redux-form'\n\nconst appReducer = combineReducers({\n authentication,\n cidade,\n dashboard,\n estado,\n empresa,\n empresaOrgao,\n marca,\n ordemServico,\n ordemServicoFoto,\n orgao,\n parametro,\n permissao,\n permissaoTipoUsuario,\n permissaoUsuario,\n tipoServico,\n tipoUsuario,\n tipoFoto,\n usuario,\n usuarioOrgao,\n usuarioEmpresa,\n veiculo,\n form: formReducer\n})\n\nconst rootReducer = (state, action) => {\n if (action.type === 'LOGOUT_SUCCESS') {\n const { routing } = state\n state = { routing }\n }\n return appReducer(state, action)\n}\nexport default rootReducer\n","// In production, we register a service worker to serve assets from local cache.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on the \"N+1\" visit to a page, since previously\n// cached resources are updated in the background.\n\n// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.\n// This link also includes instructions on opting out of this behavior.\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport default function register() {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Lets check if a service worker still exists or not.\n checkValidServiceWorker(swUrl);\n } else {\n // Is not local host. Just register service worker\n registerValidSW(swUrl);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the old content will have been purged and\n // the fresh content will have been added to the cache.\n // It's the perfect time to display a \"New content is\n // available; please refresh.\" message in your web app.\n console.log('New content is available; please refresh.');\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n if (\n response.status === 404 ||\n response.headers.get('content-type').indexOf('javascript') === -1\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react'\nimport ReactDOM from 'react-dom'\nimport App from './App'\nimport { createStore, applyMiddleware } from 'redux'\nimport { Provider } from 'react-redux'\nimport thunk from 'redux-thunk'\nimport './index.css';\nimport multi from 'redux-multi'\nimport reducer from './_reducers'\nimport { unregister as unregisterServiceWorker } from './registerServiceWorker'\nimport { persistStore, persistReducer } from 'redux-persist'\nimport storage from 'redux-persist/lib/storage'\nimport { PersistGate } from 'redux-persist/integration/react'\n\nconst persistConfig = {\n key: 'rotor-admin-root',\n storage,\n blacklist: ['authentication']\n}\nconst persistedReducer = persistReducer(persistConfig, reducer)\nconst devTools =\n window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()\n//Define a store do redux (agrupa todos reducers da aplicação, atravez do arquivo reducer from './_reducers';)\nconst store = applyMiddleware(thunk, multi)(createStore)(\n persistedReducer,\n devTools\n)\nconst persistor = persistStore(store)\n\nReactDOM.render(\n \n \n \n \n ,\n document.getElementById('root')\n)\nunregisterServiceWorker()\n"],"sourceRoot":""}