= (props) => {\r\n\r\n const ids = useSelector((state: RootState) => state.progressIndicatorReducer.onFetchingData);\r\n\r\n const { children } = props;\r\n\r\n return (\r\n \r\n 0}>\r\n \r\n \r\n \r\n \r\n \r\n Por favor aguarde...\r\n \r\n \r\n \r\n \r\n \r\n {children}\r\n
\r\n )\r\n\r\n}\r\n\r\nexport default ProgressIndicator;","import React from 'react';\r\nimport MainRouter from './mainRouter';\r\nimport AppTheme from './shared/components/ApplicationTheme';\r\nimport ProgressIndicator from './shared/components/ProgressIndicator';\r\n\r\nconst App: React.FC = () => (\r\n \r\n \r\n \r\n \r\n \r\n);\r\n \r\nexport default App;\r\n","// This optional code is used to register a service worker.\r\n// register() is not called by default.\r\n\r\n// This lets the app load faster on subsequent visits in production, and gives\r\n// it offline capabilities. However, it also means that developers (and users)\r\n// will only see deployed updates on subsequent visits to a page, after all the\r\n// existing tabs open on the page have been closed, since previously cached\r\n// resources are updated in the background.\r\n\r\n// To learn more about the benefits of this model and instructions on how to\r\n// opt-in, read https://bit.ly/CRA-PWA\r\n\r\nconst isLocalhost = Boolean(\r\n window.location.hostname === 'localhost' ||\r\n // [::1] is the IPv6 localhost address.\r\n window.location.hostname === '[::1]' ||\r\n // 127.0.0.0/8 are considered localhost for IPv4.\r\n window.location.hostname.match(\r\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\r\n )\r\n);\r\n\r\ntype Config = {\r\n onSuccess?: (registration: ServiceWorkerRegistration) => void;\r\n onUpdate?: (registration: ServiceWorkerRegistration) => void;\r\n};\r\n\r\nexport function register(config?: Config) {\r\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\r\n // The URL constructor is available in all browsers that support SW.\r\n const publicUrl = new URL(\r\n process.env.PUBLIC_URL,\r\n window.location.href\r\n );\r\n if (publicUrl.origin !== window.location.origin) {\r\n // Our service worker won't work if PUBLIC_URL is on a different origin\r\n // from what our page is served on. This might happen if a CDN is used to\r\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\r\n return;\r\n }\r\n\r\n window.addEventListener('load', () => {\r\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\r\n\r\n if (isLocalhost) {\r\n // This is running on localhost. Let's check if a service worker still exists or not.\r\n checkValidServiceWorker(swUrl, config);\r\n\r\n // Add some additional logging to localhost, pointing developers to the\r\n // service worker/PWA documentation.\r\n navigator.serviceWorker.ready.then(() => {\r\n // console.log(\r\n // 'This web app is being served cache-first by a service ' +\r\n // 'worker. To learn more, visit https://bit.ly/CRA-PWA'\r\n // );\r\n });\r\n } else {\r\n // Is not localhost. Just register service worker\r\n registerValidSW(swUrl, config);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction registerValidSW(swUrl: string, config?: Config) {\r\n navigator.serviceWorker\r\n .register(swUrl)\r\n .then(registration => {\r\n registration.onupdatefound = () => {\r\n const installingWorker = registration.installing;\r\n if (installingWorker == null) {\r\n return;\r\n }\r\n installingWorker.onstatechange = () => {\r\n if (installingWorker.state === 'installed') {\r\n if (navigator.serviceWorker.controller) {\r\n // At this point, the updated precached content has been fetched,\r\n // but the previous service worker will still serve the older\r\n // content until all client tabs are closed.\r\n // console.log(\r\n // 'New content is available and will be used when all ' +\r\n // 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\r\n // );\r\n\r\n // Execute callback\r\n if (config && config.onUpdate) {\r\n config.onUpdate(registration);\r\n }\r\n } else {\r\n // At this point, everything has been precached.\r\n // It's the perfect time to display a\r\n // \"Content is cached for offline use.\" message.\r\n // console.log('Content is cached for offline use.');\r\n\r\n // Execute callback\r\n if (config && config.onSuccess) {\r\n config.onSuccess(registration);\r\n }\r\n }\r\n }\r\n };\r\n };\r\n })\r\n .catch(error => {\r\n console.error('Error during service worker registration:', error);\r\n });\r\n}\r\n\r\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\r\n // Check if the service worker can be found. If it can't reload the page.\r\n fetch(swUrl, {\r\n headers: { 'Service-Worker': 'script' }\r\n })\r\n .then(response => {\r\n // Ensure service worker exists, and that we really are getting a JS file.\r\n const contentType = response.headers.get('content-type');\r\n if (\r\n response.status === 404 ||\r\n (contentType != null && contentType.indexOf('javascript') === -1)\r\n ) {\r\n // No service worker found. Probably a different app. Reload the page.\r\n navigator.serviceWorker.ready.then(registration => {\r\n registration.unregister().then(() => {\r\n window.location.reload();\r\n });\r\n });\r\n } else {\r\n // Service worker found. Proceed as normal.\r\n registerValidSW(swUrl, config);\r\n }\r\n })\r\n .catch(() => {\r\n // console.log(\r\n // 'No internet connection found. App is running in offline mode.'\r\n // );\r\n });\r\n}\r\n\r\nexport function unregister() {\r\n if ('serviceWorker' in navigator) {\r\n navigator.serviceWorker.ready\r\n .then(registration => {\r\n registration.unregister();\r\n })\r\n .catch(error => {\r\n console.error(error.message);\r\n });\r\n }\r\n}\r\n","import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport App from './App';\r\nimport * as serviceWorker from './serviceWorker';\r\nimport { Provider } from 'react-redux';\r\nimport store from './redux/store';\r\n\r\nReactDOM.render(\r\n \r\n \r\n ,\r\n document.getElementById('root')\r\n);\r\n\r\n// If you want your app to work offline and load faster, you can change\r\n// unregister() to register() below. Note this comes with some pitfalls.\r\n// Learn more about service workers: https://bit.ly/CRA-PWA\r\nserviceWorker.unregister();\r\n","import { PaletteType } from '@material-ui/core';\r\nimport rootReducer from './reducers';\r\nimport store from './store';\r\n\r\nexport type AppDispatch = typeof store.dispatch;\r\nexport type RootState = ReturnType;\r\n\r\nexport interface GenericAction {\r\n type: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n payload?: any;\r\n}\r\n\r\nexport interface ProgressIndicatorState {\r\n onFetchingData: Array;\r\n}\r\n\r\nexport const PROGRESS_INDICATOR_ADD = 'PROGRESS_INDICATOR_ADD';\r\nexport const PROGRESS_INDICATOR_REMOVE = 'PROGRESS_INDICATOR_REMOVE';\r\n\r\nexport interface ThemeColors {\r\n primaryColor: string;\r\n secondaryColor: string;\r\n}\r\n\r\nexport interface ThemeState {\r\n colors: ThemeColors;\r\n type: PaletteType;\r\n}\r\n\r\nexport const THEME_CHANGE_COLORS = 'THEME_CHANGE_COLORS';\r\nexport const THEME_CHANGE_TYPE = 'THEME_CHANGE_DARK';\r\n\r\nexport interface AuthState {\r\n isAuthenticated: boolean;\r\n loading: boolean;\r\n user: UserInfo | null;\r\n}\r\n\r\nexport interface UserInfo {\r\n guid: string;\r\n name: string;\r\n email: string;\r\n cpf: string;\r\n cellphone: string;\r\n role: string;\r\n token: string;\r\n}\r\n\r\nexport const USER_SIGN_IN = 'USER_SIGN_IN';\r\nexport const USER_LOG_OFF = 'USER_LOG_OFF';\r\nexport const USER_LOADING = 'USER_LOADING';\r\n\r\nexport interface HeaderState {\r\n headerTitle: string;\r\n}\r\n\r\nexport const HEADER_CHANGE_TITLE = 'HEADER_CHANGE_TITLE';\r\n\r\nexport interface EnrollmentState {\r\n isSuccessful: boolean;\r\n successData: any[];\r\n sentEnrollmentsData: any[];\r\n isLoading: boolean;\r\n landingRead: boolean;\r\n}\r\n\r\nexport const ENROLLMENT_LANDING_READ = 'ENROLLMENT_LANDING_READ';\r\nexport const ENROLLMENT_SUCCESS = 'ENROLLMENT_SUCCESS';\r\nexport const ENROLLMENT_RESET = 'ENROLLMENT_RESET';\r\nexport const ENROLLMENTS_LOAD = 'ENROLLMENTS_LOAD';\r\n\r\nexport interface SchoolUnit {\r\n guid: string;\r\n id: SchoolUnit['guid'];\r\n name: string;\r\n position: string;\r\n countryside: number;\r\n totalVacancy: number;\r\n classrooms: Classroom[];\r\n}\r\n\r\ntype Classroom = {\r\n guid: string;\r\n name: string;\r\n vacancy: number;\r\n bornFrom: string;\r\n bornUntil: string;\r\n schoolUnitId: number;\r\n enrollments: any | null;\r\n id: number;\r\n createdDate: string;\r\n updatedDate: string;\r\n activeNumber: number;\r\n};\r\n\r\nexport interface SchoolUnitState {\r\n data: SchoolUnit[];\r\n selected: SchoolUnit['guid'];\r\n isEmpty: boolean;\r\n isLoaded: boolean;\r\n success: 'no' | 'create' | 'update';\r\n error: boolean;\r\n}\r\n\r\nexport const SCHOOLUNITS_LOAD = 'SCHOOLUNITS_LOAD';\r\nexport const SCHOOLUNIT_SELECT = 'SCHOOLUNIT_SELECT';\r\nexport const SCHOOLUNITS_TOGGLE_SUCCESS = 'SCHOOLUNITS_TOGGLE_SUCCESS';\r\nexport const SCHOOLUNITS_TOGGLE_ERROR = 'SCHOOLUNITS_TOGGLE_ERROR';\r\n\r\nexport interface ClassificationState {\r\n data: any[];\r\n selected: string | Object;\r\n selectedSchool: string | Object;\r\n previousSuccessfulSchool: Object;\r\n classrooms: any[];\r\n searchClassrooms: any[];\r\n emptyClassrooms: boolean;\r\n loadedClassrooms: boolean;\r\n selectedClassroom: Object;\r\n searchField: string;\r\n searchFilter: string;\r\n searchSchool: string;\r\n isEmpty: boolean;\r\n isLoaded: boolean;\r\n success: 'no' | 'update';\r\n error: boolean;\r\n stalemate: any[];\r\n}\r\n\r\nexport const CLASSIFICATION_LOAD = 'CLASSIFICATION_LOAD';\r\nexport const CLASSIFICATION_LOAD_CLASSROOMS = 'CLASSIFICATION_LOAD_CLASSROOMS';\r\nexport const CLASSIFICATION_LOAD_SEARCH_CLASSROOMS =\r\n 'CLASSIFICATION_LOAD_SEARCH_CLASSROOMS';\r\nexport const CLASSIFICATION_SELECT = 'CLASSIFICATION_SELECT';\r\nexport const CLASSIFICATION_PREP_CLASSROOMS_RELOAD =\r\n 'CLASSIFICATION_PREP_CLASSROOMS_RELOAD';\r\nexport const CLASSIFICATION_TOGGLE_SUCCESS = 'CLASSIFICATION_TOGGLE_SUCCESS';\r\nexport const CLASSIFICATION_TOGGLE_ERROR = 'CLASSIFICATION_TOGGLE_ERROR';\r\nexport const CLASSIFICATION_RESET = 'CLASSIFICATION_RESET';\r\nexport const CLASSIFICATION_CHANGE_SCHOOL = 'CLASSIFICATION_CHANGE_SCHOOL';\r\nexport const CLASSIFICATION_CHANGE_LAST_SCHOOL =\r\n 'CLASSIFICATION_CHANGE_LAST_SCHOOL';\r\nexport const CLASSIFICATION_CHANGE_CLASSROOM =\r\n 'CLASSIFICATION_CHANGE_CLASSROOM';\r\nexport const CLASSIFICATION_CHANGE_STATUS = 'CLASSIFICATION_CHANGE_STATUS';\r\nexport const CLASSIFICATION_CHANGE_FILTER = 'CLASSIFICATION_CHANGE_FILTER';\r\nexport const CLASSIFICATION_CHANGE_SEARCH = 'CLASSIFICATION_CHANGE_SEARCH';\r\nexport const CLASSIFICATION_CHANGE_SEARCH_SCHOOL =\r\n 'CLASSIFICATION_CHANGE_SEARCH_SCHOOL';\r\nexport const CLASSIFICATION_CHANGE_STALEMATE =\r\n 'CLASSIFICATION_CHANGE_STALEMATE';\r\nexport const CLASSIFICATION_CLEAR = 'CLASSIFICATION_CLEAR';\r\nexport const CLASSIFICATION_CLEAR_SELECTED_SCHOOL = 'CLASSIFICATION_CLEAR_SELECTED_SCHOOL';\r\n","import api from '../../../shared/services/api';\r\n\r\nimport {\r\n USER_SIGN_IN,\r\n USER_LOG_OFF,\r\n USER_LOADING,\r\n GenericAction,\r\n AuthState,\r\n} from '../../types';\r\n\r\nconst initialState: AuthState = {\r\n isAuthenticated: false,\r\n loading: false,\r\n user: null,\r\n};\r\n\r\nconst key = 'pikachu';\r\n\r\nexport default function (state = initialState, action: GenericAction) {\r\n switch (action.type) {\r\n case USER_SIGN_IN:\r\n sessionStorage.setItem(key, action.payload.token);\r\n\r\n return {\r\n ...state,\r\n isAuthenticated: true,\r\n user: action.payload,\r\n };\r\n case USER_LOADING:\r\n\r\n return {\r\n ...state,\r\n loading: action.payload.loading\r\n };\r\n case USER_LOG_OFF:\r\n sessionStorage.removeItem(key);\r\n\r\n return {\r\n ...initialState,\r\n };\r\n default:\r\n return state;\r\n }\r\n}\r\n\r\nexport const fetchUserInfo = () => async dispatch => {\r\n const token = sessionStorage.getItem(key);\r\n\r\n if (token !== null) {\r\n await api\r\n .get('/users/me', {\r\n headers: { Authorization: `Bearer ${token}` },\r\n })\r\n .then(response => {\r\n dispatch({\r\n type: 'USER_SIGN_IN',\r\n payload: { token, ...response.data },\r\n });\r\n });\r\n }\r\n};\r\n","const {\r\n REACT_APP_API_URL,\r\n REACT_APP_BASE_URL,\r\n REACT_APP_ENV,\r\n REACT_APP_API_KEY,\r\n REACT_APP_AUTH_DOMAIN,\r\n REACT_APP_DATABASE_URL,\r\n REACT_APP_PROJECT_ID,\r\n REACT_APP_STORAGE_BUCKET,\r\n REACT_APP_MESSAGING_SENDER_ID,\r\n REACT_APP_APP_ID,\r\n REACT_APP_MEASUREMENT_ID,\r\n REACT_APP_GOOGLE_API_KEY,\r\n} = process.env;\r\n\r\nconst isProduction = REACT_APP_ENV === 'production';\r\nconst isDevelopment = REACT_APP_ENV === 'development';\r\nconst isLocal = REACT_APP_ENV === 'local';\r\n\r\nexport const env = {\r\n REACT_APP_API_URL,\r\n REACT_APP_BASE_URL,\r\n REACT_APP_ENV,\r\n REACT_APP_API_KEY,\r\n REACT_APP_AUTH_DOMAIN,\r\n REACT_APP_DATABASE_URL,\r\n REACT_APP_PROJECT_ID,\r\n REACT_APP_STORAGE_BUCKET,\r\n REACT_APP_MESSAGING_SENDER_ID,\r\n REACT_APP_APP_ID,\r\n REACT_APP_MEASUREMENT_ID,\r\n REACT_APP_GOOGLE_API_KEY,\r\n isProduction,\r\n isDevelopment,\r\n isLocal\r\n}\r\n","import Swal from 'sweetalert2';\r\nimport api from '../../../shared/services/api';\r\nimport store from '../../store';\r\nimport {\r\n ClassificationState,\r\n GenericAction,\r\n CLASSIFICATION_TOGGLE_SUCCESS,\r\n CLASSIFICATION_TOGGLE_ERROR,\r\n CLASSIFICATION_SELECT,\r\n CLASSIFICATION_LOAD,\r\n CLASSIFICATION_RESET,\r\n CLASSIFICATION_CHANGE_CLASSROOM,\r\n CLASSIFICATION_CHANGE_SCHOOL,\r\n CLASSIFICATION_CLEAR,\r\n CLASSIFICATION_CHANGE_FILTER,\r\n CLASSIFICATION_CHANGE_SEARCH,\r\n CLASSIFICATION_LOAD_CLASSROOMS,\r\n CLASSIFICATION_CHANGE_STALEMATE,\r\n CLASSIFICATION_CHANGE_SEARCH_SCHOOL,\r\n CLASSIFICATION_LOAD_SEARCH_CLASSROOMS,\r\n CLASSIFICATION_CHANGE_LAST_SCHOOL,\r\n CLASSIFICATION_CLEAR_SELECTED_SCHOOL,\r\n} from '../../types';\r\n\r\nconst initialState: ClassificationState = {\r\n data: [],\r\n selected: '',\r\n selectedSchool: '',\r\n previousSuccessfulSchool: {},\r\n classrooms: [],\r\n emptyClassrooms: true,\r\n loadedClassrooms: false,\r\n selectedClassroom: {},\r\n searchClassrooms: [],\r\n searchField: '',\r\n searchFilter: 'ALL',\r\n searchSchool: '',\r\n isEmpty: true,\r\n isLoaded: false,\r\n success: 'no',\r\n error: false,\r\n stalemate: [],\r\n};\r\n\r\nexport default function (state = initialState, action: GenericAction) {\r\n switch (action.type) {\r\n case CLASSIFICATION_LOAD:\r\n const data = [...action.payload];\r\n\r\n let isEmpty = true;\r\n if (action.payload.length !== 0) {\r\n isEmpty = false;\r\n }\r\n\r\n return {\r\n ...state,\r\n data,\r\n isEmpty,\r\n isLoaded: true,\r\n };\r\n\r\n case CLASSIFICATION_LOAD_CLASSROOMS:\r\n const classrooms = [...action.payload];\r\n\r\n return {\r\n ...state,\r\n classrooms,\r\n loadedClassrooms: true,\r\n };\r\n\r\n case CLASSIFICATION_LOAD_SEARCH_CLASSROOMS:\r\n const searchClassrooms = [...action.payload];\r\n\r\n let emptyClassrooms = true;\r\n if (action.payload.length !== 0) {\r\n emptyClassrooms = false;\r\n }\r\n\r\n return {\r\n ...state,\r\n searchClassrooms,\r\n emptyClassrooms,\r\n loadedClassrooms: true,\r\n isLoaded: false,\r\n searchField: '',\r\n };\r\n\r\n case CLASSIFICATION_CLEAR:\r\n return {\r\n ...state,\r\n data: [],\r\n isEmpty: true,\r\n isLoaded: false,\r\n selected: '',\r\n selectedClassroom: {},\r\n };\r\n\r\n case CLASSIFICATION_TOGGLE_SUCCESS:\r\n return {\r\n ...state,\r\n success: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_TOGGLE_ERROR:\r\n return {\r\n ...state,\r\n error: !state.error,\r\n };\r\n\r\n case CLASSIFICATION_SELECT:\r\n return {\r\n ...state,\r\n selected: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_CHANGE_SCHOOL:\r\n return {\r\n ...state,\r\n selectedSchool: action.payload,\r\n selectedClassroom: {},\r\n isLoaded: false,\r\n loadedClassrooms: false,\r\n };\r\n\r\n case CLASSIFICATION_CHANGE_LAST_SCHOOL:\r\n return {\r\n ...state,\r\n previousSuccessfulSchool: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_CHANGE_CLASSROOM:\r\n return {\r\n ...state,\r\n selectedClassroom: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_CHANGE_FILTER:\r\n return {\r\n ...state,\r\n searchFilter: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_CHANGE_SEARCH:\r\n return {\r\n ...state,\r\n searchField: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_CHANGE_SEARCH_SCHOOL:\r\n return {\r\n ...state,\r\n searchSchool: action.payload,\r\n previousSuccessfulSchool: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_CHANGE_STALEMATE:\r\n return {\r\n ...state,\r\n stalemate: action.payload,\r\n };\r\n\r\n case CLASSIFICATION_RESET:\r\n return { ...initialState };\r\n \r\n case CLASSIFICATION_CLEAR_SELECTED_SCHOOL:\r\n return {\r\n ...state,\r\n selectedSchool: '',\r\n selectedClassroom: {},\r\n searchSchool: '',\r\n };\r\n\r\n default:\r\n return state;\r\n }\r\n}\r\n\r\nexport const changeSearchSchool = data => dispatch => {\r\n dispatch({ type: CLASSIFICATION_CHANGE_SEARCH_SCHOOL, payload: data });\r\n\r\n dispatch(fetchClassrooms(true));\r\n};\r\n\r\nexport const changeSelectedSchool = data => dispatch => {\r\n dispatch({ type: CLASSIFICATION_CHANGE_SCHOOL, payload: data });\r\n\r\n dispatch(fetchClassrooms(false));\r\n};\r\n\r\nexport const fetchClassrooms = (search: boolean) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n const guid = search\r\n ? store.getState().classificationReducer.searchSchool.guid\r\n : store.getState().classificationReducer.selectedSchool.guid;\r\n\r\n api.get(`/classifications/${guid}`, {\r\n headers: { Authorization: `Bearer ${token}` },\r\n }).then(response => {\r\n if (search) {\r\n dispatch({\r\n type: CLASSIFICATION_LOAD_SEARCH_CLASSROOMS,\r\n payload: response.data.classrooms,\r\n });\r\n } else {\r\n dispatch({\r\n type: CLASSIFICATION_LOAD_CLASSROOMS,\r\n payload: response.data.classrooms,\r\n });\r\n }\r\n });\r\n};\r\n\r\nexport const updateClassification = (data: any) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .put(\r\n `/enrollments/${data.guid}`,\r\n { ...data },\r\n { headers: { Authorization: `Bearer ${token}` } },\r\n )\r\n .then(response => {\r\n const currentSelectedClassification = store.getState()\r\n .classificationReducer.selected;\r\n const updatedSelectedClassification = {\r\n ...currentSelectedClassification,\r\n ...data,\r\n };\r\n\r\n\r\n if (currentSelectedClassification.guid === data.guid) {\r\n dispatch({\r\n type: CLASSIFICATION_SELECT,\r\n payload: updatedSelectedClassification,\r\n });\r\n }\r\n\r\n dispatch(fetchClassrooms(true));\r\n dispatch(fetchClassrooms(false));\r\n\r\n if (data.quitAfter) {\r\n dispatch({\r\n type: CLASSIFICATION_TOGGLE_SUCCESS,\r\n payload: 'updateAlt',\r\n });\r\n } else {\r\n dispatch({\r\n type: CLASSIFICATION_TOGGLE_SUCCESS,\r\n payload: 'update',\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n console.error(error);\r\n\r\n const fallbackClassroom = store\r\n .getState()\r\n .classificationReducer.selectedSchool.classrooms.find(\r\n x =>\r\n x.id ===\r\n store.getState().classificationReducer.selected\r\n .classroomId,\r\n );\r\n\r\n dispatch({\r\n type: CLASSIFICATION_CHANGE_CLASSROOM,\r\n payload: fallbackClassroom,\r\n });\r\n\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Erro ao atualizar dados',\r\n text: error.response?.data.message,\r\n });\r\n });\r\n};\r\n\r\nexport const updateStudentInfo = (data: any) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .put(\r\n `/students/${data.guid}`,\r\n { ...data },\r\n { headers: { Authorization: `Bearer ${token}` } },\r\n )\r\n .then(response => {\r\n const currentSelectedClassification = store.getState()\r\n .classificationReducer.selected;\r\n const updatedSelectedClassification = {\r\n ...currentSelectedClassification,\r\n ...data,\r\n };\r\n\r\n if (currentSelectedClassification.guid === data.guid) {\r\n dispatch({\r\n type: CLASSIFICATION_SELECT,\r\n payload: updatedSelectedClassification,\r\n });\r\n }\r\n\r\n dispatch(fetchClassrooms(true));\r\n dispatch(fetchClassrooms(false));\r\n\r\n if (data.quitAfter) {\r\n dispatch({\r\n type: CLASSIFICATION_TOGGLE_SUCCESS,\r\n payload: 'updateAlt',\r\n });\r\n } else {\r\n dispatch({\r\n type: CLASSIFICATION_TOGGLE_SUCCESS,\r\n payload: 'update',\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n console.error(error);\r\n\r\n const fallbackClassroom = store\r\n .getState()\r\n .classificationReducer.selectedSchool.classrooms.find(\r\n x =>\r\n x.id ===\r\n store.getState().classificationReducer.selected\r\n .classroomId,\r\n );\r\n\r\n dispatch({\r\n type: CLASSIFICATION_CHANGE_CLASSROOM,\r\n payload: fallbackClassroom,\r\n });\r\n\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Erro ao atualizar dados',\r\n text: error.response?.data.message,\r\n });\r\n });\r\n};\r\n\r\nexport const transferClassification = (data: any) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .put(\r\n `/enrollments/transfer/${data.guid}`,\r\n { ...data },\r\n { headers: { Authorization: `Bearer ${token}` } },\r\n )\r\n .then(response => {\r\n // console.log(response);\r\n\r\n dispatch(fetchClassrooms(true));\r\n dispatch(fetchClassrooms(false));\r\n\r\n dispatch({\r\n type: CLASSIFICATION_CHANGE_LAST_SCHOOL,\r\n payload: store.getState().classificationReducer.selectedSchool,\r\n });\r\n\r\n dispatch({\r\n type: CLASSIFICATION_TOGGLE_SUCCESS,\r\n payload: 'update',\r\n });\r\n })\r\n .catch(error => {\r\n console.error(error);\r\n\r\n dispatch(\r\n changeSelectedSchool(\r\n store.getState().classificationReducer\r\n .previousSuccessfulSchool,\r\n ),\r\n );\r\n\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'Erro na transferência',\r\n text: error.response?.data.message,\r\n });\r\n });\r\n};\r\n\r\nexport const solveStalemate = (data: any) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .get(`/enrollments/stalemate/${data}`, {\r\n headers: { Authorization: `Bearer ${token}` },\r\n })\r\n .then(response => {\r\n dispatch(fetchClassrooms(true));\r\n\r\n dispatch({ type: CLASSIFICATION_CHANGE_STALEMATE, payload: [] });\r\n\r\n dispatch({\r\n type: CLASSIFICATION_TOGGLE_SUCCESS,\r\n payload: 'stalemate',\r\n });\r\n })\r\n .catch(error => {\r\n console.error(error);\r\n\r\n dispatch({ type: CLASSIFICATION_CHANGE_STALEMATE, payload: [] });\r\n\r\n dispatch({\r\n type: CLASSIFICATION_TOGGLE_ERROR,\r\n });\r\n });\r\n};\r\n\r\nexport const clearSelectedSchool = () => dispatch => {\r\n dispatch({ type: CLASSIFICATION_CLEAR_SELECTED_SCHOOL });\r\n};","import {\r\n SchoolUnitState,\r\n SCHOOLUNITS_LOAD,\r\n GenericAction,\r\n SCHOOLUNITS_TOGGLE_SUCCESS,\r\n SCHOOLUNITS_TOGGLE_ERROR,\r\n SCHOOLUNIT_SELECT,\r\n SchoolUnit,\r\n} from '../../types';\r\n\r\nimport api from '../../../shared/services/api';\r\nimport store from '../../store';\r\nimport { SchoolUnitFormValues } from '../../../modules/public/pages/SchoolUnitsPage/types';\r\n\r\nconst initialState: SchoolUnitState = {\r\n data: [],\r\n selected: '',\r\n isEmpty: true,\r\n isLoaded: false,\r\n success: 'no',\r\n error: false,\r\n};\r\n\r\nexport default function (state = initialState, action: GenericAction) {\r\n switch (action.type) {\r\n case SCHOOLUNITS_LOAD:\r\n const data = [...action.payload];\r\n\r\n let isEmpty = true;\r\n if (action.payload.length !== 0) {\r\n isEmpty = false;\r\n }\r\n\r\n return {\r\n ...state,\r\n data,\r\n isEmpty,\r\n isLoaded: true,\r\n };\r\n\r\n case SCHOOLUNITS_TOGGLE_SUCCESS:\r\n return {\r\n ...state,\r\n success: action.payload,\r\n };\r\n\r\n case SCHOOLUNITS_TOGGLE_ERROR:\r\n return {\r\n ...state,\r\n error: !state.error,\r\n };\r\n\r\n case SCHOOLUNIT_SELECT:\r\n return {\r\n ...state,\r\n selected: action.payload,\r\n };\r\n\r\n default:\r\n return state;\r\n }\r\n}\r\n\r\nexport const fetchSchoolUnits = () => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .get(`/schoolunits`, {\r\n headers: { Authorization: `Bearer ${token}` },\r\n })\r\n .then(response => {\r\n let formattedResponse = response.data;\r\n\r\n for (let i = 0; i < formattedResponse.length; i++) {\r\n formattedResponse[i].totalVacancy = 0;\r\n\r\n for (\r\n let j = 0;\r\n j < formattedResponse[i].classrooms.length;\r\n j++\r\n ) {\r\n formattedResponse[i].totalVacancy +=\r\n formattedResponse[i].classrooms[j].vacancy;\r\n }\r\n\r\n formattedResponse[i].id = formattedResponse[i].guid;\r\n }\r\n\r\n dispatch({\r\n type: 'SCHOOLUNITS_LOAD',\r\n payload: formattedResponse,\r\n });\r\n });\r\n};\r\n\r\nexport const createSchoolUnit = (data: any) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .post(\r\n '/schoolunits',\r\n { ...data },\r\n { headers: { Authorization: `Bearer ${token}` } },\r\n )\r\n .then(response => {\r\n dispatch(fetchSchoolUnits());\r\n\r\n dispatch({\r\n type: 'SCHOOLUNITS_TOGGLE_SUCCESS',\r\n payload: 'create',\r\n });\r\n })\r\n .catch(error => {\r\n console.error(error);\r\n\r\n dispatch({\r\n type: 'SCHOOLUNITS_TOGGLE_ERROR',\r\n });\r\n });\r\n};\r\n\r\nexport const updateSchoolUnit = (data: SchoolUnitFormValues) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n const schools = store.getState().schoolUnitReducer as SchoolUnitState;\r\n\r\n const updatedSchools = schools.data.map((school: SchoolUnit) => {\r\n if (school.id === data.guid) {\r\n return {\r\n ...school,\r\n classrooms: school.classrooms.map(classroom => {\r\n const updatedClassroom = data.classrooms.find(c => c.id === classroom.id);\r\n if (updatedClassroom) {\r\n return {\r\n ...classroom,\r\n activeNumber: updatedClassroom.activeNumber\r\n };\r\n }\r\n return classroom;\r\n })\r\n };\r\n }\r\n return school;\r\n });\r\n\r\n await api\r\n .put(\r\n `/schoolunits/${data.guid}`,\r\n { ...data },\r\n { headers: { Authorization: `Bearer ${token}` } },\r\n )\r\n .then(response => {\r\n\r\n // Atualiza o estado localmente\r\n dispatch({\r\n type: SCHOOLUNITS_LOAD,\r\n payload: updatedSchools,\r\n });\r\n\r\n dispatch(fetchSchoolUnits())\r\n\r\n dispatch({\r\n type: 'SCHOOLUNITS_TOGGLE_SUCCESS',\r\n payload: 'update',\r\n });\r\n })\r\n .catch(error => {\r\n console.error(error);\r\n\r\n dispatch({\r\n type: 'SCHOOLUNITS_TOGGLE_ERROR',\r\n });\r\n });\r\n};","import { GenericAction, HeaderState, HEADER_CHANGE_TITLE } from '../../types';\r\n\r\nconst initialState: HeaderState = {\r\n headerTitle: 'Central de Vagas',\r\n};\r\n\r\nexport default function (state = initialState, action: GenericAction) {\r\n switch (action.type) {\r\n case HEADER_CHANGE_TITLE:\r\n return {\r\n ...state,\r\n headerTitle: action.payload,\r\n };\r\n default:\r\n return state;\r\n }\r\n}\r\n","import {\r\n GenericAction,\r\n PROGRESS_INDICATOR_ADD,\r\n PROGRESS_INDICATOR_REMOVE,\r\n ProgressIndicatorState\r\n} from \"../../types\";\r\n\r\n\r\nconst initialState: ProgressIndicatorState = {\r\n onFetchingData: []\r\n}\r\n\r\nconst progressIndicatorReducer = (state = initialState, action: GenericAction): ProgressIndicatorState => {\r\n\r\n switch (action.type) {\r\n case PROGRESS_INDICATOR_ADD:\r\n return {\r\n ...state,\r\n onFetchingData: [...state.onFetchingData, action.payload]\r\n }\r\n case PROGRESS_INDICATOR_REMOVE:\r\n return {\r\n ...state,\r\n onFetchingData: state.onFetchingData.filter(i => i !== action.payload)\r\n }\r\n default:\r\n return state;\r\n }\r\n}\r\n\r\n\r\nexport default progressIndicatorReducer;","import { PaletteType } from \"@material-ui/core\";\r\nimport { GenericAction, THEME_CHANGE_COLORS, THEME_CHANGE_TYPE, ThemeState } from \"../../types\";\r\n\r\nconst loadType = (): PaletteType => {\r\n const localStorageOpinion: any = localStorage.getItem('themeType');\r\n \r\n if (localStorageOpinion !== null) {\r\n return localStorageOpinion;\r\n }\r\n else {\r\n return 'light';\r\n }\r\n} \r\n\r\n\r\nconst initialState: ThemeState = {\r\n colors: {\r\n primaryColor: '#3B72A7',\r\n secondaryColor: '#4E8F48',\r\n },\r\n type: loadType()\r\n}\r\n\r\nconst themeReducer = (state = initialState, action: GenericAction): ThemeState => {\r\n\r\n switch (action.type) {\r\n case THEME_CHANGE_COLORS:\r\n return {\r\n ...state,\r\n colors: action.payload\r\n }\r\n case THEME_CHANGE_TYPE:\r\n const type = state.type === 'dark' ? 'light' : 'dark';\r\n localStorage.setItem('themeType', type);\r\n\r\n return {\r\n ...state,\r\n type\r\n }\r\n default:\r\n return state;\r\n }\r\n\r\n}\r\n\r\nexport default themeReducer;\r\n","import { combineReducers } from 'redux';\r\nimport authReducer from './auth/authReducer';\r\nimport classificationReducer from './classification/classificationReducer';\r\nimport enrollmentReducer from './enrollment/enrollmentReducer';\r\nimport headerReducer from './header/headerReducer';\r\nimport progressIndicatorReducer from './progressIndicator/progressIndicatorReducer';\r\nimport schoolUnitReducer from './schoolUnit/schoolUnitReducer';\r\nimport themeReducer from './theme/themeReducer';\r\n\r\nconst rootReducer = combineReducers({\r\n authReducer,\r\n classificationReducer,\r\n enrollmentReducer,\r\n headerReducer,\r\n progressIndicatorReducer,\r\n schoolUnitReducer,\r\n themeReducer,\r\n});\r\n\r\nexport default rootReducer;\r\n","import { createStore, applyMiddleware } from 'redux';\r\nimport thunk from 'redux-thunk';\r\nimport rootReducer from './reducers';\r\n\r\n\r\n\r\n// eslint-disable-next-line @typescript-eslint/ban-ts-ignore\r\n// @ts-ignore\r\n// eslint-disable-next-line no-underscore-dangle\r\nconst reduxDevtools = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__();\r\n\r\nconst composeStoreWithMiddleware = applyMiddleware(\r\n thunk\r\n)(createStore)\r\n\r\nexport default composeStoreWithMiddleware(rootReducer, reduxDevtools);","import api from '../../../shared/services/api';\r\nimport store from '../../store';\r\nimport {\r\n GenericAction,\r\n EnrollmentState,\r\n ENROLLMENT_SUCCESS,\r\n ENROLLMENT_RESET,\r\n ENROLLMENT_LANDING_READ,\r\n ENROLLMENTS_LOAD,\r\n} from '../../types';\r\n\r\nconst initialState: EnrollmentState = {\r\n isSuccessful: false,\r\n successData: [],\r\n sentEnrollmentsData: [],\r\n isLoading: true,\r\n landingRead: false,\r\n};\r\n\r\nexport default function (state = initialState, action: GenericAction) {\r\n switch (action.type) {\r\n case ENROLLMENT_SUCCESS:\r\n return {\r\n ...state,\r\n isSuccessful: true,\r\n successData: action.payload,\r\n };\r\n case ENROLLMENT_RESET:\r\n return {\r\n ...state,\r\n ...initialState,\r\n };\r\n case ENROLLMENT_LANDING_READ:\r\n return {\r\n ...state,\r\n landingRead: true,\r\n };\r\n case ENROLLMENTS_LOAD:\r\n return {\r\n ...state,\r\n sentEnrollmentsData: action.payload,\r\n isLoading: false,\r\n };\r\n default:\r\n return state;\r\n }\r\n}\r\n\r\nexport const fetchEnrollments = () => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .get(`/users/enrollments`, {\r\n headers: { Authorization: `Bearer ${token}` },\r\n })\r\n .then(response => {\r\n const minimumWage = 1045;\r\n let enrollmentsArr = [...response.data];\r\n enrollmentsArr.forEach((enrollment, index) => {\r\n switch (enrollment.cityResident) {\r\n case 0:\r\n enrollment.cityResident = 'Não';\r\n break;\r\n case 1:\r\n enrollment.cityResident = 'Sim';\r\n break;\r\n }\r\n\r\n switch (enrollment.responsibleForChild) {\r\n case 0:\r\n enrollment.responsibleForChild = 'Pais';\r\n break;\r\n case 1:\r\n enrollment.responsibleForChild =\r\n 'Crianças cuja a reponsabilidade é de terceiros';\r\n break;\r\n case 2:\r\n enrollment.responsibleForChild =\r\n 'Situação de vulnerabilidade social e/ou risco pessoal, encaminhadas pelos órgãos públicos';\r\n break;\r\n }\r\n\r\n switch (enrollment.familyIncome) {\r\n case 0:\r\n enrollment.familyIncome = `Renda de até R$ ${(\r\n minimumWage * 0.5\r\n ).toFixed(2)}`;\r\n break;\r\n case 1:\r\n enrollment.familyIncome = `Renda de R$ ${(\r\n minimumWage * 0.6\r\n ).toFixed(2)} até R$ ${minimumWage.toFixed(2)}`;\r\n break;\r\n case 2:\r\n enrollment.familyIncome = `Renda de R$ ${(\r\n minimumWage * 1.1\r\n ).toFixed(2)} até R$ ${(minimumWage * 1.3).toFixed(2)}`;\r\n break;\r\n case 3:\r\n enrollment.familyIncome = `Renda de R$ ${(\r\n minimumWage * 1.4\r\n ).toFixed(2)} até R$ ${(minimumWage * 1.3).toFixed(2)}`;\r\n break;\r\n case 4:\r\n enrollment.familyIncome = `Renda acima de R$ ${(\r\n minimumWage * 1.6\r\n ).toFixed(2)}`;\r\n break;\r\n }\r\n\r\n switch (enrollment.familyHousing) {\r\n case 0:\r\n enrollment.familyHousing = 'Família possui imóvel';\r\n break;\r\n case 1:\r\n enrollment.familyHousing =\r\n 'Família reside em casa cedida';\r\n break;\r\n case 2:\r\n enrollment.familyHousing =\r\n 'Família paga financiamento do imóvel';\r\n break;\r\n case 3:\r\n enrollment.familyHousing =\r\n 'Família reside em casa alugada';\r\n break;\r\n }\r\n\r\n switch (enrollment.socialProgram) {\r\n case 0:\r\n enrollment.socialProgram = 'Possui Bolsa Família';\r\n break;\r\n case 1:\r\n enrollment.socialProgram = 'Não possui Bolsa Família';\r\n break;\r\n }\r\n\r\n switch (enrollment.motherOccupation) {\r\n case 0:\r\n enrollment.motherOccupation =\r\n 'Mães que trabalham fora do lar';\r\n break;\r\n case 1:\r\n enrollment.motherOccupation =\r\n 'Mães que trabalham com faxina todos os dias da semana';\r\n break;\r\n case 2:\r\n enrollment.motherOccupation =\r\n 'Mães que trabalham com faxina alguns dias da semana';\r\n break;\r\n case 3:\r\n enrollment.motherOccupation =\r\n 'Mães que não trabalham fora do lar';\r\n break;\r\n }\r\n\r\n switch (enrollment.familyChildrenQty) {\r\n case 0:\r\n enrollment.familyChildrenQty = 'Até 2 filhos';\r\n break;\r\n case 1:\r\n enrollment.familyChildrenQty = 'Até 4 filhos';\r\n break;\r\n case 2:\r\n enrollment.familyChildrenQty = 'A partir de 5 filhos';\r\n break;\r\n }\r\n\r\n enrollment.cpf = enrollment.cpf.replace(\r\n /^(\\d{3})(\\d{3})(\\d{1,3})(\\d{1,2})$/g,\r\n '$1.$2.$3-$4',\r\n );\r\n\r\n enrollment.birthDate = enrollment.birthDate.split('T', 1);\r\n });\r\n\r\n dispatch({\r\n type: 'ENROLLMENTS_LOAD',\r\n payload: enrollmentsArr,\r\n });\r\n });\r\n};\r\n\r\nexport const cancelEnrollment = (guid: string) => async dispatch => {\r\n const token = store.getState().authReducer.user.token;\r\n\r\n await api\r\n .delete(`/enrollments/${guid}`, {\r\n headers: { Authorization: `Bearer ${token}` },\r\n })\r\n .then(response => {\r\n dispatch(fetchEnrollments());\r\n });\r\n};\r\n","import { makeStyles } from '@material-ui/core/styles';\r\nimport React from 'react';\r\nimport { CircularProgress } from '@material-ui/core';\r\n\r\n\r\nconst useStyle = makeStyles(theme => ({\r\n container: { \r\n display: 'flex',\r\n width: '100%',\r\n height: '100vh',\r\n justifyContent: 'center',\r\n alignItems: 'center'\r\n }\r\n}));\r\n\r\nconst RouteProgressIndicator: React.FC = () => {\r\n\r\n const classes = useStyle();\r\n\r\n return (\r\n \r\n \r\n
\r\n );\r\n}\r\n\r\nexport default RouteProgressIndicator;","import RouteProgressIndicator from './RouteProgressIndicator';\r\n\r\nexport default RouteProgressIndicator;"],"sourceRoot":""}