Commit 7579513c authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

bobo nyenyak

See merge request !488
parents ef94db22 7d662834
...@@ -108,6 +108,27 @@ export default class OperatingIndicator extends Component { ...@@ -108,6 +108,27 @@ export default class OperatingIndicator extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let compActive = []
let userCompActive = []
this.state.userCompany.map((item, index) => {
let indeks = data.findIndex((val) => val.company_id == item)
if (indeks !== -1 && String(data[indeks].status).toLocaleLowerCase() == 'active'){
userCompActive.push(item)
}
})
data.map(( item, index ) => {
if (String(item.status).toLocaleLowerCase() == 'active') {
compActive.push(item)
}
})
if (compActive.length == userCompActive.length){
this.setState({ superUser: false})
} else {
this.setState({ superUser: true})
}
let companyData = data.map((item) => { let companyData = data.map((item) => {
return { return {
company_id: item.company_id, company_id: item.company_id,
...@@ -501,7 +522,7 @@ export default class OperatingIndicator extends Component { ...@@ -501,7 +522,7 @@ export default class OperatingIndicator extends Component {
})} })}
getReport={() => this.getReport()} getReport={() => this.getReport()}
saveOperatingInd={this.saveOperatingInd.bind(this)} saveOperatingInd={this.saveOperatingInd.bind(this)}
superUser={this.state.superUser}
/> />
} }
......
...@@ -1244,7 +1244,7 @@ export default class BalanceSheet extends Component { ...@@ -1244,7 +1244,7 @@ export default class BalanceSheet extends Component {
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> {this.props.superUser && <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1256,9 +1256,9 @@ export default class BalanceSheet extends Component { ...@@ -1256,9 +1256,9 @@ export default class BalanceSheet extends Component {
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
</a> </a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload"> {this.props.superUser && <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1270,7 +1270,7 @@ export default class BalanceSheet extends Component { ...@@ -1270,7 +1270,7 @@ export default class BalanceSheet extends Component {
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
</a> </a>}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download"> <a data-tip={'Download'} data-for="download">
<button <button
...@@ -1323,7 +1323,7 @@ export default class BalanceSheet extends Component { ...@@ -1323,7 +1323,7 @@ export default class BalanceSheet extends Component {
</div> </div>
</button> </button>
</div> </div>
{!this.state.emptyData && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> {!this.state.emptyData && this.props.superUser && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
type="button" type="button"
onClick={() => onClick={() =>
......
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