From 78e4000917d608f914b77f34d22c6bd628f55069 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Picolo?= <jpp18@inf.ufpr.br>
Date: Wed, 17 Feb 2021 11:17:16 -0300
Subject: [PATCH] Changes default names and creates routes

---
 src/App.js                                    |  13 +-
 src/components/Charts/BarChartComponent.js    |   2 +-
 .../Charts/ChartSelectorComponent.js          |   1 +
 src/components/ExpandableGroupComponent.js    |   8 +-
 src/components/Pages/OfferPageComponent.js    | 311 ++++++++++++++++++
 ...eComponent.js => TrainingPageComponent.js} |   4 +-
 src/data/groups.js                            | 182 +++-------
 src/data/indicadores.js                       |  24 +-
 src/data/routes.js                            |   2 +-
 9 files changed, 383 insertions(+), 164 deletions(-)
 create mode 100644 src/components/Pages/OfferPageComponent.js
 rename src/components/Pages/{PageComponent.js => TrainingPageComponent.js} (99%)

diff --git a/src/App.js b/src/App.js
index faf20db..23a3043 100644
--- a/src/App.js
+++ b/src/App.js
@@ -21,7 +21,8 @@ along with mapfor. If not, see <https://www.gnu.org/licenses/>.
 import React, { useEffect }from 'react';
 import './App.scss';
 import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
-import PageComponent from './components/Pages/PageComponent';
+import TrainingPageComponent from './components/Pages/TrainingPageComponent';
+import OfferPageComponent from './components/Pages/OfferPageComponent';
 import SobreComponent from './components/Pages/SobreComponent';
 import TeamComponent from './components/Pages/TeamComponent';
 import ContatoComponent from './components/Pages/ContatoComponent';
@@ -49,11 +50,11 @@ function App() {
                     <Route exact path={routes.home} component={HomePageComponent} />
                     <Route exact path={routes.sobre} component={SobreComponent} />
                     <Route exact path={routes.equipe} component={TeamComponent} />
-                    <Route exact path={routes.adequacao_disciplina} render={props => <PageComponent { ...Object.assign({...props}) } />} />
-                    <Route exact path={routes.formacao_licenciatura} render={props => <PageComponent { ...Object.assign({...props}) } />} />
-                    <Route exact path={routes.formacao_pos_graduacao} render={props => <PageComponent { ...Object.assign({...props}) } />} />
-                    <Route exact path={routes.nivel_formacao_docente} render={props => <PageComponent { ...Object.assign({...props}) } />} />
-                    <Route exact path={routes.matriculas} render={props => <PageComponent {...props} />} />
+                    <Route exact path={routes.adequacao_disciplina} render={props => <TrainingPageComponent {...props} />} />
+                    <Route exact path={routes.formacao_licenciatura} render={props => <TrainingPageComponent {...props} />} />
+                    <Route exact path={routes.formacao_pos_graduacao} render={props => <TrainingPageComponent {...props} />} />
+                    <Route exact path={routes.nivel_formacao_docente} render={props => <TrainingPageComponent {...props} />} />
+                    <Route exact path={routes.situacao_matricula} render={props => <OfferPageComponent {...props} />} />
                     <Route exact path={routes.contato} component={ContatoComponent} />
                     <Route exact path={routes.acessibilidade} component={AccessibilityComponent} />
                     <Route exact path={routes.mapa_site} component={SiteMapComponent} />
diff --git a/src/components/Charts/BarChartComponent.js b/src/components/Charts/BarChartComponent.js
index 12c8824..50e76ee 100644
--- a/src/components/Charts/BarChartComponent.js
+++ b/src/components/Charts/BarChartComponent.js
@@ -38,7 +38,7 @@ function BarChartComponent(props) {
             background: props.contrastSet ? '#000000' : '#FFFFFF',
             height: 350,
             type: 'bar',
-            stacked: false,
+            stacked: props.stacked,
         },
         theme: {
             mode: props.contrastSet ? 'dark' : 'light'
diff --git a/src/components/Charts/ChartSelectorComponent.js b/src/components/Charts/ChartSelectorComponent.js
index 8b75ed7..0f693b8 100644
--- a/src/components/Charts/ChartSelectorComponent.js
+++ b/src/components/Charts/ChartSelectorComponent.js
@@ -78,6 +78,7 @@ function ChartSelectorComponent(props) {
                     filters={filtersLocation}
                     education={chartInfo.education}
                     disciplines={chartInfo.disciplines}
+                    stacked={chartInfo.stacked}
                     contrastSet={contrastSet}>
                 </BarChartComponent>
             </div>
diff --git a/src/components/ExpandableGroupComponent.js b/src/components/ExpandableGroupComponent.js
index 7469011..77f7ab7 100644
--- a/src/components/ExpandableGroupComponent.js
+++ b/src/components/ExpandableGroupComponent.js
@@ -26,13 +26,13 @@ import ChartSelectorComponent from './Charts/ChartSelectorComponent';
 function ExpandableGroupComponent(props) {
     const { groupInfo, hashFilters, sideChart, location, contrastSet } = props
 
-    let chartLength = groupInfo.charts.length
+    let chartLength = groupInfo.pieCharts.length
     return (
         <div className={`${contrastSet ? "high-contrast" : ""}`}>
             {sideChart ?
                 <ChartSelectorComponent
-                    chartInfo={groupInfo.charts[chartLength - 1]}
-                    filtersEducation={hashFilters.get[groupInfo.charts[chartLength - 1].education]}
+                    chartInfo={groupInfo.pieCharts[chartLength - 1]}
+                    filtersEducation={hashFilters.get[groupInfo.pieCharts[chartLength - 1].education]}
                     filtersLocation={hashFilters.get.location}
                     sideChart={sideChart}
                     location={location}
@@ -41,7 +41,7 @@ function ExpandableGroupComponent(props) {
                 </ChartSelectorComponent>
                 :
 
-                groupInfo.tables.map((chart, idx) => (
+                groupInfo.barCharts.map((chart, idx) => (
                     <Box borderRadius="10px" color="text.primary" boxShadow={3} className="charts-box table-container box-square second-box" key={idx}>
                             <Grid container direction="row">
                                 <Grid item md={3} sm={12} className="title-box">
diff --git a/src/components/Pages/OfferPageComponent.js b/src/components/Pages/OfferPageComponent.js
new file mode 100644
index 0000000..62c7536
--- /dev/null
+++ b/src/components/Pages/OfferPageComponent.js
@@ -0,0 +1,311 @@
+/*
+Copyright (C) 2020 Centro de Computacao Cientifica e Software Livre
+Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
+
+This file is part of mapfor.
+
+mapfor is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+mapfor is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with mapfor.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+import React, { useState, useEffect } from 'react';
+import { Grid } from '@material-ui/core';
+import { useSelector } from "react-redux";
+
+import { getFilters } from '../../data/filters';
+import { getIndicator } from '../../data/groups';
+import { getIndicatorsGroup } from '../../data/indicadores';
+
+import MapComponent from '../Map/MapComponent';
+import ExpandableGroupComponent from '../ExpandableGroupComponent';
+import IndicatorsComponent from '../Dropdown/IndicatorsComponent';
+import FiltersGroupComponent from '../Dropdown/FiltersGroupComponent';
+import FixedFiltersComponent from '../Dropdown/FixedFiltersComponent';
+
+import Consult from '../Consult';
+import '../../css/PageComponent.scss';
+
+let ConsultHandler = new Consult()
+
+function OfferPageComponent(props) {
+    const storeState = useSelector(state => state);
+    const contrastSet = storeState.highContrast.set;
+
+    const path = props.location.pathname.split('/');
+
+    const group = getIndicatorsGroup(path[2])
+    const [indicator, setIndicator] = useState(group[path[3]])
+    const [indicatorName, setIndicatorName] = useState(path[3])
+
+    const [route, setRoute] = useState()
+    const [routeDim, setRouteDim] = useState()
+
+    const [mapData, setmapData] = useState()
+    const [mapLoading, setMapLoading] = useState(true)
+
+    const [mapBorderDim, setMapBorderDim] = useState('mesoregion')
+    const [mapBorderDimLocked, setMapBorderDimLocked] = useState(false)
+
+    const [locationFilters, setLocationFilters] = useState()
+    const [basicEducationFilters, setBasicEducationFilters] = useState()
+    const [superiorEducationFilters, setSuperiorEducationFilters] = useState()
+    const hashFilters = {
+        get: {
+            location: locationFilters,
+            basic: basicEducationFilters,
+            superior: superiorEducationFilters
+        },
+        set: {
+            location: setLocationFilters,
+            basic: setBasicEducationFilters,
+            superior: setSuperiorEducationFilters
+        }
+    }
+    const [filtersLoading, setFiltersLoading] = useState()
+
+    //const [routeFilters, setRouteFilters] = useState([])
+
+    const [locationBuildingData, setLocationBuildingData] = useState([])
+    const [loadingLocationBuildingData, setLoadingLocationBuildingData] = useState(false)
+
+    //const [chartData, setChartData] = useState([])
+    const [chartLocation, setChartLocation] = useState("Paraná")
+    //const [chartLoading, setChartLoading] = useState(true)
+
+    // Alter route when indicator changes
+    useEffect(() => {
+        setRoute(indicator.route)
+        setRouteDim(indicator.routeDim)
+
+        // Reset map dim
+        setMapBorderDim("mesoregion")
+        setMapBorderDimLocked(false)
+    }, [indicator])
+
+    // Load indicator filters and base routes when route changes (indicator changed)
+    useEffect(() => {
+        if (filtersLoading === undefined) {
+            setFiltersLoading(true)
+
+            const filtersRoutes = getFilters()
+            let filtersGroupsToLoad = Object.keys(filtersRoutes).length + 1
+
+            const locationRoutes = ['city', 'microregion', 'mesoregion', 'university', 'location/campi', 'location/school']
+            ConsultHandler.getMultipleRoutes(locationRoutes, null, null, "object", [], 'state:41').then(response => {
+                Object.keys(response).forEach(l => {
+                    response[l] = {data: response[l], value: 0}
+                })
+                hashFilters.set.location(response)
+
+                filtersGroupsToLoad--;
+                if (filtersGroupsToLoad === 0)
+                    setFiltersLoading(false)
+            })
+
+            Object.keys(filtersRoutes).forEach(type => {
+                let groupRoutes = []
+                let groupKeys = []
+                Object.entries(filtersRoutes[type].filters).forEach(([k, v]) => {
+                    groupRoutes.push(v.route)
+                    groupKeys.push(k)
+                })
+
+                ConsultHandler.getMultipleRoutes(groupRoutes, null, null, "object", [], [], groupKeys).then(response => {
+                    Object.keys(response).forEach(l => {
+                        response[l] = {data: response[l], value: []}
+                    })
+                    hashFilters.set[type](response)
+
+                    filtersGroupsToLoad--;
+                    if (filtersGroupsToLoad === 0)
+                        setFiltersLoading(false)
+                })
+            })
+        }
+    }, [filtersLoading, hashFilters.set])
+
+    // Load mapData when filters/route changes
+    useEffect(() => {
+        if (filtersLoading === false) {
+            let mapLocationFilters = { ...hashFilters.get.location, city: {...hashFilters.get.location.city, value: 0} }
+            mapLocationFilters[indicator.locationBuilding] = {...mapLocationFilters[indicator.locationBuilding], value: 0}
+
+            ConsultHandler.fetchVar('mapData', setmapData, setMapLoading, route, [routeDim, mapBorderDim], [mapLocationFilters, hashFilters.get[indicator.education], indicator.fixedFilters])
+        }
+    }, [filtersLoading, route, routeDim, mapBorderDim, hashFilters.get[indicator.education], hashFilters.get.location])
+
+    // Load Location buildings
+    useEffect(() => {
+        if (filtersLoading === false) {
+            if (hashFilters.get.location.city.value > 0) {
+                let cityLocationBuildingFilters = Object.assign({}, hashFilters.get.location)
+                cityLocationBuildingFilters[indicator.locationBuilding] = {...cityLocationBuildingFilters[indicator.locationBuilding], value: 0}
+
+                ConsultHandler.fetchVar('locationBuildingData', setLocationBuildingData, setLoadingLocationBuildingData, route, [indicator.locationBuilding, routeDim], [cityLocationBuildingFilters, hashFilters.get[indicator.education], indicator.fixedFilters] )
+            } else if (locationBuildingData.length > 0) {
+                setLocationBuildingData([])
+            }
+        }
+
+        // eslint-disable-next-line react-hooks/exhaustive-deps
+    }, [filtersLoading, hashFilters.get[indicator.education], hashFilters.get.location])
+
+    function updateFilters(key, value, lockDim=false) {
+        // if key is not a location, simple update value
+        if (hashFilters.get.location[key] === undefined) {
+            let newFilters = {}
+            let type = ''
+
+            if (hashFilters.get.basic[key] !== undefined) {
+                newFilters = Object.assign({}, hashFilters.get.basic)
+                type = 'basic'
+            }
+            else {
+                newFilters = Object.assign({}, hashFilters.get.superior)
+                type = 'superior'
+            }
+
+            if (typeof key === 'string')
+                newFilters[key].value = value
+            else {
+                for (let i = 0; i < key.length; i++)
+                    newFilters[key[i]].value = value[i]
+            }
+
+            hashFilters.set[type](newFilters)
+        }
+        else {  // When it's a location, update all "lower" and "upper" dimensions
+            let newFilters = {...hashFilters.get.location}
+            newFilters[key].value = value
+
+            // Reset all "lower" locations filters, the missing break (fall through) is proposital
+            switch (key) {
+                case 'mesoregion':
+                    newFilters.microregion.value = 0;
+                case 'microregion':
+                    newFilters.city.value = 0;
+                case 'city':
+                    newFilters.school.value = 0;
+                    newFilters.campi.value = 0;
+            }
+
+            // Update all upper locations
+            if (value > 0) {
+                let currentObj = hashFilters.get.location[key].data.find(v => v.id === value)
+                setChartLocation(currentObj.name)
+                switch (key) {
+                    case 'campi':
+                    case 'school':
+                        newFilters.city.value = currentObj.city_id;
+                        // if (currentObj.ies_id) newFilters.university.value = currentObj.ies_id
+                    case 'city':
+                        newFilters.microregion.value = currentObj.microregion_id
+                    case 'microregion':
+                        newFilters.mesoregion.value = currentObj.mesoregion_id
+                }
+            }
+            if (!lockDim && ['city', 'microregion', 'mesoregion'].includes(key)) updateMapBorderDim(key)
+            else if (!lockDim && (key === 'campi' || key === 'school')) updateMapBorderDim('city')
+            hashFilters.set.location(newFilters)
+        }
+    }
+
+    function updateMapBorderDim(value) {
+        if (!mapBorderDimLocked) {
+            setMapBorderDim(value)
+        }
+    }
+
+    //const chartsDim = (indicator.chartsDim) ? indicator.chartsDim : routeDim
+    return (
+        <Grid container direction="column" className={`page-container ${contrastSet ? "high-contrast" : ""}`}>
+            {(filtersLoading === true || filtersLoading === undefined) ? null :
+                <Grid container direction="row">
+                    <Grid item xs={12} sm={12} md={3}>
+                        <div className="filter-spacing">
+                            <IndicatorsComponent
+                                indicator={indicator}
+                                indicatorName={indicatorName}
+                                setIndicator={setIndicator}
+                                setIndicatorName={setIndicatorName}
+                                path={path}
+                                contrastSet={contrastSet}>
+                            </IndicatorsComponent>
+                        </div>
+
+                        <FiltersGroupComponent
+                            hashFilters={hashFilters}
+                            filtersLoading={filtersLoading}
+                            updateFilters={updateFilters}
+                            contrastSet={contrastSet}>
+                        </FiltersGroupComponent>
+                    </Grid>
+                    <Grid item xs={12} sm={12} md={6}>
+                        <Grid container direction="row">
+                            <Grid item xs={12}>
+                                <FixedFiltersComponent
+                                    filters={hashFilters.get.location}
+                                    updateFilters={updateFilters}
+                                    currentindicador={indicator}
+                                    contrastSet={contrastSet}>
+                                </FixedFiltersComponent>
+                                {/* <SelectDimComponent setLocked={setMapBorderDimLocked} setDim={setMapBorderDim}></SelectDimComponent> */}
+                            </Grid>
+                            <Grid item xs={12} sm={12} md={12}>
+                                <MapComponent
+                                    filters={hashFilters.get.location}
+                                    updateFilters={updateFilters}
+                                    mapData={mapData}
+                                    mapLoading={mapLoading || loadingLocationBuildingData}
+                                    borderDim={mapBorderDim}
+                                    setBorderDim={updateMapBorderDim}
+                                    locationBuilding={indicator.locationBuilding}
+                                    locationBuildingData={locationBuildingData}
+                                    locked={mapBorderDimLocked}
+                                    indicador={indicator}
+                                    contrastSet={contrastSet}
+                                >
+                                </MapComponent>
+                            </Grid>
+                        </Grid>
+                    </Grid>
+                    <Grid item xs={12} sm={12} md={3}>
+                        <Grid item xs={12}>
+                            {filtersLoading !== false ? null :
+                                <ExpandableGroupComponent
+                                    groupInfo={getIndicator(path[2], indicatorName)}
+                                    hashFilters={hashFilters}
+                                    location={chartLocation}
+                                    sideChart={true}
+                                    contrastSet={contrastSet}
+                                >
+                                </ExpandableGroupComponent>
+                            }
+                        </Grid>
+                    </Grid>
+                </Grid>
+            }
+
+            {filtersLoading !== false ? null :
+                <ExpandableGroupComponent
+                    groupInfo={getIndicator(path[2], indicatorName)}
+                    hashFilters={hashFilters}
+                    contrastSet={contrastSet}
+                >
+                </ExpandableGroupComponent>
+            }
+        </Grid>
+    )
+}
+
+export default OfferPageComponent;
diff --git a/src/components/Pages/PageComponent.js b/src/components/Pages/TrainingPageComponent.js
similarity index 99%
rename from src/components/Pages/PageComponent.js
rename to src/components/Pages/TrainingPageComponent.js
index 626d36d..1af209f 100644
--- a/src/components/Pages/PageComponent.js
+++ b/src/components/Pages/TrainingPageComponent.js
@@ -41,7 +41,7 @@ import FiltersGroupComponent from '../Dropdown/FiltersGroupComponent'
 
 let ConsultHandler = new Consult()
 
-function PageComponent(props) {
+function TrainingPageComponent(props) {
     const storeState = useSelector(state => state);
     const contrastSet = storeState.highContrast.set;
 
@@ -395,4 +395,4 @@ function PageComponent(props) {
     )
 }
 
-export default PageComponent
+export default TrainingPageComponent;
diff --git a/src/data/groups.js b/src/data/groups.js
index 8d2c091..d75d8e3 100644
--- a/src/data/groups.js
+++ b/src/data/groups.js
@@ -5,7 +5,7 @@ const groups = {
             title: 'Nível de formação docente',
             routes: ['teacher'],
             dims: ['initial_training', 'year'],
-            tables: [
+            barCharts: [
                 {
                     title: 'NÚMERO DE DOCENTES SEGUNDO FORMAÇÃO INICIAL, LOCAL, 2012 – 2019',
                     route: ['teacher'],
@@ -17,7 +17,7 @@ const groups = {
                     extraFilters: {state: {value: 41}},   
                 }
             ],
-            charts: [
+            pieCharts: [
                 {
                     title: 'NÚMERO E PERCENTUAL DE DOCENTES SEGUNDO NÍVEL DE FORMAÇÃO',
                     route: 'teacher',
@@ -34,7 +34,7 @@ const groups = {
             title: 'FORMAÇÃO DOCENTE NA EDUCAÇÃO BÁSICA DE ACORDO COM PÓS-GRADUÇÃO',
             routes: ['disciplines'],
             dims: ['discipline', 'year'],
-            tables: [
+            barCharts: [
                 {
                     
                     title: 'PERCENTUAL DE ADEQUAÇÃO DA FORMAÇÃO DOCENTE SEGUNDO DISCIPLINA (AFD), 2012 – 2019',
@@ -58,7 +58,7 @@ const groups = {
                     extraFilters: {state: {value: 41}},
                 }
             ],
-            charts: [
+            pieCharts: [
                 {
                     title: 'PERCENTUAL DE ADEQUAÇÃO DA FORMAÇÃO DOCENTE',
                     route: 'disciplines',
@@ -75,7 +75,7 @@ const groups = {
             title: 'FORMAÇÃO DOCENTE NA EDUCAÇÃO BÁSICA DE ACORDO COM PÓS-GRADUÇÃO',
             routes: ['teacher'],
             dims: ['licentiate_degree', 'year'],
-            tables: [
+            barCharts: [
                 {
                     title: 'NÚMERO DE DOCENTES SEGUNDO FORMAÇÃO INICIAL, LOCAL, 2012 – 2019',
                     route: ['teacher'],
@@ -87,7 +87,7 @@ const groups = {
                     extraFilters: {state: {value: 41}},   
                 }
             ],
-            charts: [
+            pieCharts: [
                 {
                     title: 'NÚMERO E PERCENTUAL DE DOCENTES SEGUNDO NÍVEL DE FORMAÇÃO FORMAÇÃO',
                     route: 'teacher',
@@ -114,7 +114,7 @@ const groups = {
             title: 'FORMAÇÃO DOCENTE NA EDUCAÇÃO BÁSICA',
             routes: ['teacher'],
             dims: ['pos_training', 'year'],
-            tables: [
+            barCharts: [
                 {
                     title: 'NÚMERO DE DOCENTES SEGUNDO FORMAÇÃO INICIAL, LOCAL, 2012 – 2019',
                     route: ['teacher'],
@@ -126,7 +126,7 @@ const groups = {
                     extraFilters: {state: {value: 41}},   
                 }
             ],
-            charts: [
+            pieCharts: [
                 {
                     title: 'NÚMERO E PERCENTUAL DE DOCENTES SEGUNDO NÍVEL DE FORMAÇÃO FORMAÇÃO',
                     route: 'teacher',
@@ -140,147 +140,51 @@ const groups = {
             ],
         },
     },
-}
-
 
-    // {
-    //     title: 'ACESSO E OFERTA EDUCAÇÃO BÁSICA',
-    //     routes: ['school/count', 'enrollment'],
-    //     dims: ['adm_dependency_detailed', 'rural_location', 'education_level_mod'],
-    //     tables: [
-    //         {
-    //             title: 'NÚMERO DE ESCOLAS SEGUNDO DEPENDENCIA ADMINISTRATIVA E ÁREA DE LOCALIDADE',
-    //             years: [2019],
-    //             route: ['school/count'],
-    //             education: 'basic',
-    //             extraFilters: {},
-    //             dims: [['adm_dependency_detailed', 'rural_location']],
-    //             dimTitle: 'Dependência Administrativa',
-    //             notes: ["Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos microdados do Censo Escolar/INEP 2019"],
-    //         },
-    //         {
-    //             title: 'NÚMERO DE MATRÍCULAS SEGUNDO ETAPA DE ENSINO',
-    //             years: [2019],
-    //             route: ['enrollment'],
-    //             education: 'basic',
-    //             extraFilters: {},
-    //             dims: [['education_level_mod']],
-    //             dimTitle: 'Etapas e modalidades de ensino por segmento',
-    //             notes: ["Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos microdados do Censo Escolar/INEP 2019"],
-    //         },
-    //     ],
-    //     charts: []
-    // },
-    // {
-    //     title: 'ACESSO E OFERTA ENSINO SUPERIOR LICENCIATURA',
-    //     routes: ['course_count', 'university_enrollment'],
-    //     dims: ['localoffer', 'upper_adm_dependency', 'year'],
-    //     tables: [
-    //         {
-    //             title: 'NÚMERO DE CURSOS DE LICENCIATURA POR LOCAL DA OFERTA (CAMPI E/OU POLOS)',
-    //             years: [2018],
-    //             route: ['course_count'],
-    //             extraFilters: {academic_level: {value: 2}},
-    //             education: 'superior',
-    //             dims: [['localoffer']],
-    //             dimTitle: ['Local da oferta (Campi e/ou Polos)'],
-    //             extraDimCols: [{title: 'Instituição de Educação Superior', key: 'university'}],
-    //             notes: ["Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018"],
-    //         },
-    //         {
-    //             title: 'NÚMERO DE MATRÍCULAS (LICENCIATURA) SEGUNDO CATEGORIA ADMINISTRATIVA',
-    //             years: [2010, 2018],
-    //             route: ['university_enrollment'],
-    //             education: 'superior',
-    //             extraFilters: {academic_level: {value: 2}},
-    //             dims: [['upper_adm_dependency', 'year']],
-    //             dimTitle: ['Categoria Administrativa'],
-    //             notes: ["Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018"],
-    //         }
-    //     ],
-    //     charts: [
-    //         {
-    //             title: 'NÚMERO E PERCENTUAL DE MATRÍCULAS (LICENCIATURA) SEGUNDO CATEGORIA ADMINISTRATIVA',
-    //             route: 'university_enrollment',
-    //             dim: 'upper_adm_dependency',
-    //             education: 'superior',
-    //             type: 'bar',
-    //             years: [2018, 2018],
-    //             notes: ['Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018'],
-    //             extraFilters: {academic_level: {value: 2}},
-    //         }
-    //     ]
-    // },
-//     {
-//         title: 'FORMAÇÃO DOCENTE NA EDUCAÇÃO BÁSICA',
-//         routes: ['teacher'],
-//         dims: ['initial_training', 'year'],
-//         tables: [
-//             {
-//                 title: 'NÚMERO DE DOCENTES SEGUNDO FORMAÇÃO INICIAL, LOCAL, 2012 – 2019',
-//                 years: [2012, 2019],
-//                 route: ['teacher'],
-//                 education: 'basic',
-//                 dims: [['initial_training', 'year']],
-//                 dimTitle: ['Formação Inicial'],
-//                 notes: ["Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018."],
-//                 extraFilters: {state: {value: 41}},   
-//             }
-//         ],
-//         charts: [
-//             {
-//                 title: 'NÚMERO E PERCENTUAL DE DOCENTES SEGUNDO NÍVEL DE FORMAÇÃO FORMAÇÃO',
-//                 route: 'teacher',
-//                 dim: 'initial_training',
-//                 type: 'bar',
-//                 years: [2019, 2019],
-//                 notes: ['Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018.'],
-//                 education: 'basic',
-//                 extraFilters: {state: {value: 41}},
-//             }
-//         ],
-//     },
-//     {
-//         title: 'FORMAÇÃO DOCENTE NA EDUCAÇÃO BÁSICA DE ACORDO COM PÓS-GRADUÇÃO',
-//         routes: ['teacher'],
-//         dims: ['pos_training', 'year'],
-//         tables: [
-//             {
-//                 title: 'NÚMERO DE DOCENTES SEGUNDO FORMAÇÃO EM PÓS-GRADUAÇÃO, LOCAL, 2012 – 2019',
-//                 years: [2012, 2019],
-//                 route: ['teacher'],
-//                 education: 'basic',
-//                 dims: [['pos_training', 'year']],
-//                 dimTitle: ['Formação em Pós-graduação'],
-//                 notes: ["Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018."],
-//                 extraFilters: {state: {value: 41}},   
-//             }
-//         ],
-//         charts: [
-//             {
-//                 title: 'NÚMERO DE DOCENTES SEGUNDO FORMAÇÃO EM PÓS-GRADUAÇÃO, LOCAL, 2012 – 2019',
-//                 route: 'teacher',
-//                 dim: 'pos_training',
-//                 type: 'bar',
-//                 years: [2019, 2019],
-//                 notes: ['Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018.'],
-//                 education: 'basic',
-//                 extraFilters: {state: {value: 41}},
-//             }
-//         ],
-//     }
-// ]
+    oferta_formacao_docente: {
+        situacao_matriculas: {
+            title: 'FORMAÇÃO DOCENTE NA EDUCAÇÃO BÁSICA',
+            routes: ['teacher'],
+            dims: ['pos_training', 'year'],
+            barCharts: [
+                {
+                    title: 'NÚMERO DE DOCENTES SEGUNDO FORMAÇÃO INICIAL, LOCAL, 2012 – 2019',
+                    route: ['teacher'],
+                    dim: 'pos_training',
+                    type: 'bar',
+                    years: [2012, 2019],
+                    notes: ["Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018."],
+                    education: 'basic',
+                    stacked: true,
+                    extraFilters: {state: {value: 41}},   
+                }
+            ],
+            pieCharts: [
+                {
+                    title: 'NÚMERO E PERCENTUAL DE DOCENTES SEGUNDO NÍVEL DE FORMAÇÃO FORMAÇÃO',
+                    route: 'teacher',
+                    dim: 'pos_training',
+                    type: 'bar',
+                    years: [2019, 2019],
+                    notes: ['Fonte: Elaborado pelo Laboratório de Dados Educacionais a partir dos Microdados do Censo de Educação Superior/INEP 2018.'],
+                    education: 'basic',
+                    extraFilters: {state: {value: 41}},
+                }
+            ],
+        },
+    },
+}
 
 export function getGroups() {
     return groups;
 }
 
 export function getGroupIndicatorFirstChart(route, name) {
-    return groups[route][name].charts[0];
+    return groups[route][name].pieCharts[0];
 }
 
 export function getGroupsIndicatorCharts(indicator) {
-    return indicator.charts.slice(1, indicator.charts.length);
+    return indicator.pieCharts.slice(1, indicator.pieCharts.length);
 }
 
 export function getIndicator(route, name) {
diff --git a/src/data/indicadores.js b/src/data/indicadores.js
index 881cf13..7811bb5 100644
--- a/src/data/indicadores.js
+++ b/src/data/indicadores.js
@@ -54,18 +54,20 @@ const indicadores = {
             percentValues: [2, 3, 4],
         }
     },
+    
     oferta_formacao_docente: {
-        matriculas: {
-            route: 'university_enrollment',
-            routeDim: '',
-            locationBuilding: 'campi',
-            education: 'superior',
-            educationName: 'Ensino Superior',
-            group_title: 'Qual a oferta de formação docente?',
-            group_route: 'oferta_formacao_docente',
-            title: 'Número de Matrículas (LICENCIATURA) instiuições de ensino superior',
-            fixedFilters: { min_year: {value: 2017}, max_year: {value: 2017}, state: {value: 41}, academic_level:{value: 2} },
-            color: 'region',
+        situacao_matriculas: {
+            route: 'teacher',
+            routeDim: 'pos_training',
+            locationBuilding: 'school',
+            education: 'basic',
+            group_title: 'Qual a formação das(os) docentes na educação básica?',
+            group_route: 'formacao_docente',
+            title: 'Percentual de docentes com pós-graduação',
+            fixedFilters: { min_year: {value: 2019}, max_year: {value: 2019}, state: {value: 41} },
+            color: 'percent',
+            percentKey: 'pos_training_id',
+            percentValues: [2, 3, 4],
         },
     }
 }
diff --git a/src/data/routes.js b/src/data/routes.js
index 47a60df..e2a74b0 100644
--- a/src/data/routes.js
+++ b/src/data/routes.js
@@ -7,7 +7,7 @@ export const routes = {
     formacao_licenciatura: "/consultar/formacao_docente/formacao_em_licenciatura",
     formacao_pos_graduacao: "/consultar/formacao_docente/formacao_em_pos_graduacao",
     nivel_formacao_docente: "/consultar/formacao_docente/nivel_formacao_docente",
-    matriculas: "/consultar/oferta_formacao_docente/matriculas",
+    situacao_matriculas: "/consultar/oferta_formacao_docente/situacao_matriculas",
     contato: "/contato",
     acessibilidade: "/acessibilidade",
     mapa_site: "/mapa-site",
-- 
GitLab