Commit e9fcb03f authored by Edu Trevisan's avatar Edu Trevisan

Merge branch 'development' into small_changes

parents bcb1bca2 9c2e2706
......@@ -70,6 +70,7 @@ class Eixo1 extends Component {
clickedInMap: null,
autocompleteTagId: null,
modalOpen: false,
data: {},
clickedRow: {},
};
this.getMapClick = this.getMapClick.bind(this);
......@@ -77,9 +78,10 @@ class Eixo1 extends Component {
this.getDataFromAutocomplete = this.getDataFromAutocomplete.bind(this);
this.openModal = this.openModal.bind(this);
this.closeModal = this.closeModal.bind(this);
this.fixData = this.fixData.bind(this);
}
fixData() {
fixData(clickedInMap) {
var original = data.gete1p4()
var final = []
Object.keys(original).forEach((key) => {
......@@ -92,14 +94,22 @@ class Eixo1 extends Component {
tempObj['Status INCRA'] = original[key][i]['STATUS_INCRA']
tempObj['Etapa FCP'] = original[key][i]['ETAPA_FCP']
tempObj['UF'] = key
if(clickedInMap != null){
if(tempObj['UF'] === getStateExtendedName(clickedInMap).currentState) final.push(tempObj);
} else {
final.push(tempObj)
}
}
})
return final
}
componentWillMount(){
this.setState({data: this.fixData(null)});
}
componentDidMount() {
this.clearMap()
this.clearMap();
}
shapeMap() {
......@@ -120,6 +130,7 @@ class Eixo1 extends Component {
}
openModal(e, where) {
if(where === undefined) return;
Promise.all([findFileById(where.original['ID'])]).then(([json_file]) => {
this.setState({
clickedRow: json_file ? json_file['comunidades'][0] : null,
......@@ -243,7 +254,7 @@ class Eixo1 extends Component {
<p>Clique na comunidade para ter acesso ao mapa com informações detalhadas sobre ela</p>
<PageTable columns={['ID', 'Comunidade', 'Território', 'Status INCRA', 'Etapa FCP', 'UF']}
data={this.fixData(data.gete1p4())} pageSize={15} defaultSorted={[{ id: "ID", desc: false }]}
data={this.state.data} pageSize={15} defaultSorted={[{ id: "ID", desc: false }]}
mode='normal'
onClick={this.openModal}
/>
......@@ -271,11 +282,17 @@ class Eixo1 extends Component {
}
getMapClick(clicked) {
this.setState({ clickedInMap: clicked });
this.setState({
data: this.fixData(clicked),
clickedInMap: clicked
});
}
clearMap() {
this.setState({ clickedInMap: null });
this.setState({
data: this.fixData(null),
clickedInMap: null
});
}
jsonToArray(jsonData) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment