diff --git a/src/index.js b/src/index.js index be505a6..a7c5b0c 100644 --- a/src/index.js +++ b/src/index.js @@ -5,13 +5,26 @@ import './index.css'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; -const baseUrl = 'http://localhost:8080/dhis'; -// const baseUrl = 'https://idsr-afi.pheoc.go.ug/dhis'; +// const baseUrl = 'http://localhost:8080/dhis'; +// const baseUrl = 'https://cbs-academy.dhis2.org/demo'; + +let baseUrl = ''; +if (process.env.NODE_ENV === 'development') { + baseUrl = 'http://localhost:8080/dhis/api/29'; +} else { + let urlArray = window.location.pathname.split('/'); + let apiIndex = urlArray.indexOf('api'); + if (apiIndex > 1) { + baseUrl = '/' + urlArray[apiIndex - 1] + '/api/29'; + } else { + baseUrl = '/api/29'; + } +} init({ - baseUrl: baseUrl + '/api/29' + baseUrl }).then(d2 => { ReactDOM.render( - , document.getElementById('root')); + , document.getElementById('root')); registerServiceWorker(); }).catch(e => console.error); diff --git a/src/programs/program.js b/src/programs/program.js index 7346972..85bf419 100644 --- a/src/programs/program.js +++ b/src/programs/program.js @@ -16,11 +16,7 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import ExportTable from './exportTable'; import PropTypes from 'prop-types'; - - // import Table from '@dhis2/d2-ui-table'; - - const styles = theme => ({ root: { flexGrow: 1, @@ -102,18 +98,97 @@ class Program extends React.Component { } render() { - const {classes, d2} = this.props; + const {classes} = this.props; let progress = ''; + let selection = ''; + if (this.integrationStore.loading) { progress = ; } + + if (this.integrationStore.program !== null) { + let current = ''; + if (this.integrationStore.selectedStage !== null) { + current =
+ this.integrationStore.dataElementFilterChange(value)} + /> + + +
; + } + selection = + + this.integrationStore.filterChange(value)} + /> + + + +
+ - - - this.integrationStore.filterChange(value)} - /> - - - -
-