Commit cd9bb020 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'syadziy' into 'master'

Syadziy

See merge request !141
parents 3cef8616 4e4caec8
...@@ -287,47 +287,51 @@ export default class AddUser extends Component { ...@@ -287,47 +287,51 @@ export default class AddUser extends Component {
padding = 20 padding = 20
} }
return ( return (
<ul> <div>
{item.children.map((data, index) => { {item.children.length > 0 && (
return ( <ul>
// <li> {item.children.map((data, index) => {
<Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}> return (
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.children) ? (padding + 20) : padding }}> // <li>
{R.isNil(data.children) ? <Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}>
null <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.children) ? (padding + 20) : padding }}>
: {R.isNil(data.children) ?
data.children.length < 1 ? null
null :
: data.children.length < 1 ?
<span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}> null
{data.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />} :
<span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}>
{data.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>
}
<span>
{this.state.role ? this.state.role.role_id === 1 ?
<CustomCheckboxDisabled
disabled={true}
checked={true}
// onChange={() => this.handleItemClick(item)}
/> :
<CustomCheckbox
checked={this.handleItemChecked(data)}
onChange={() => this.handleItemClick(data)}
/> :
<CustomCheckbox
checked={this.handleItemChecked(data)}
onChange={() => this.handleItemClick(data)}
/>
}
</span> </span>
} <Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography>
<span> </div>
{this.state.role ? this.state.role.role_id === 1 ? {!R.isNil(data.children) && this.renderChildren(data, padding + 20)}
<CustomCheckboxDisabled </Collapse>
disabled={true} // </li>
checked={true} )
// onChange={() => this.handleItemClick(item)} })}
/> : </ul>
<CustomCheckbox )}
checked={this.handleItemChecked(data)} </div>
onChange={() => this.handleItemClick(data)}
/> :
<CustomCheckbox
checked={this.handleItemChecked(data)}
onChange={() => this.handleItemClick(data)}
/>
}
</span>
<Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography>
</div>
{!R.isNil(data.children) && this.renderChildren(data, padding + 20)}
</Collapse>
// </li>
)
})}
</ul>
) )
} }
......
...@@ -289,47 +289,51 @@ export default class EditUser extends Component { ...@@ -289,47 +289,51 @@ export default class EditUser extends Component {
padding = 20 padding = 20
} }
return ( return (
<ul> <div>
{item.children.map((data, index) => { {item.children.length > 0 && (
return ( <ul>
// <li> {item.children.map((data, index) => {
<Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}> return (
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.children) ? (padding + 20) : padding }}> // <li>
{R.isNil(data.children) ? <Collapse key={index} timeout="auto" unmountOnExit in={item.collapse}>
null <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', paddingLeft: R.isNil(data.children) ? (padding + 20) : padding }}>
: {R.isNil(data.children) ?
data.children.length < 1 ? null
null :
: data.children.length < 1 ?
<span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}> null
{data.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />} :
<span onClick={() => this.handleCollapse(data)} style={{ marginLeft: 7, marginRight: 2 }}>
{data.collapse ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>
}
<span>
{this.state.role ? this.state.role.role_id === 1 ?
<CustomCheckboxDisabled
disabled={true}
checked={true}
// onChange={() => this.handleItemClick(item)}
/> :
<CustomCheckbox
checked={this.handleItemChecked(data)}
onChange={() => this.handleItemClick(data)}
/> :
<CustomCheckbox
checked={this.handleItemChecked(data)}
onChange={() => this.handleItemClick(data)}
/>
}
</span> </span>
} <Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography>
<span> </div>
{this.state.role ? this.state.role.role_id === 1 ? {!R.isNil(data.children) && this.renderChildren(data, padding + 20)}
<CustomCheckboxDisabled </Collapse>
disabled={true} // </li>
checked={true} )
// onChange={() => this.handleItemClick(item)} })}
/> : </ul>
<CustomCheckbox )}
checked={this.handleItemChecked(data)} </div>
onChange={() => this.handleItemClick(data)}
/> :
<CustomCheckbox
checked={this.handleItemChecked(data)}
onChange={() => this.handleItemClick(data)}
/>
}
</span>
<Typography style={{ fontSize: 12 }}>{titleCase(data.company_name)}</Typography>
</div>
{!R.isNil(data.children) && this.renderChildren(data, padding + 20)}
</Collapse>
// </li>
)
})}
</ul>
) )
} }
......
This diff is collapsed.
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