Commit 5eb76402 authored by EKSAD's avatar EKSAD

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents 2eb003db e4f23628
......@@ -69,6 +69,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
//Role
const getRole = () => api.get('role/get_all_role')
const getRoleActive = () => api.get('role/get_all_role_active')
const getDetailRole = (roleId) => api.get(`role/get_role_by_id/${roleId}`)
const searchRole = (body) => api.post('/role/search_role', body)
const addRole = (body) => api.post('role/create_role', body)
......@@ -120,6 +121,13 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const searchReportItems = (body) => api.post('/item_report/search_item_report', body)
const createReportItems = (body) => api.post('/item_report/create_item_report', body)
//PARAMETER
const getAllParameter = () => api.get('/setting/get_all_setting')
const getDetailParameter = (id) => api.get(`setting/get_setting_by_id/${id}`)
const getAllGroup = () => api.get('/setting_group/get_all_setting_group')
const getParameterByGroup = (groupID) => api.get(`/setting_type/get_all_setting_type_by_group/${groupID}`)
const createParameter = (body) => api.post('setting/create_setting', body)
const updateParameter = (body) => api.post('setting/update_setting', body)
//Template
const downloadTemplate = (fileName,fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -181,8 +189,15 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
createReportItems,
getInputType,
getReportType,
getPerusahaanActive
}
getAllParameter,
getAllGroup,
getParameterByGroup,
getDetailParameter,
updateParameter,
createParameter,
getPerusahaanActive,
getRoleActive
}
}
// let's return back our create method as the default.
......
......@@ -161,6 +161,47 @@
.btn-no-outline{
outline: 'none'
}
.form {
display: flex;
}
.form>div {
display: inline-block;
vertical-align: top;
}
#treeviewDriveC,
#treeviewDriveD {
margin-top: 10px;
}
.drive-header {
min-height: auto;
padding: 0px;
cursor: default;
}
.drive-header .dx-icon {
margin-top: -4px;
}
.drive-panel {
padding: 20px 30px;
font-size: 115%;
font-weight: bold;
border-right: 1px solid rgba(165, 165, 165, 0.4);
height: 100%;
}
.drive-panel:last-of-type {
border-right: none;
}
.dx-treeview-item {
position: relative;
left: -2px;
}
.color-white {
......@@ -78,10 +78,10 @@ export default class DashboardCAT extends Component {
<Tab label="KPIs" style={{ color: '#fff', fontSize: 11 }} />
</Tabs>
</AppBar>
{this.state.tab == 0 ?
{this.state.tab === 0 ?
<ExceutiveScoreboard height={this.props.height} />
:
this.state.tab == 1 ?
this.state.tab === 1 ?
<span>Testt</span>
:
<span>Test2</span>
......
......@@ -50,12 +50,14 @@ export default class UnitBisnis extends Component {
let isi = resp.rows.slice(3)
let payload = []
isi.map((item, index) => {
payload.push({
id: index + 1,
business_unit_name: item[0],
start_date: item[1],
end_date: item[2],
})
if (item.length > 0) {
payload.push({
id: index + 1,
business_unit_name: item[0],
start_date: item[1],
end_date: item[2],
})
}
})
let body = {
business_unit: payload
......@@ -170,8 +172,6 @@ export default class UnitBisnis extends Component {
})
// console.log(JSON.stringify(payload));
}
});
}
......@@ -185,7 +185,7 @@ export default class UnitBisnis extends Component {
console.log(response)
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
let listData = data.sort((a,b) => a.business_unit_id - b.business_unit_id).map((item, index) => {
return [index, item.business_unit_id, item.business_unit_name, item.status]
})
this.setState({ dataTable: listData, listData: response.data.data })
......@@ -287,7 +287,7 @@ export default class UnitBisnis extends Component {
this.setState({ visibleUnitBisnis: true })
})
}
render() {
const columns = [{
name: "Action",
......
......@@ -4,8 +4,6 @@ import { TextField, List, ListSubheader, Typography, Collapse } from '@material-
import MinimizeIcon from '@material-ui/icons/Minimize';
import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove';
import TreeView from '@material-ui/lab/TreeView';
import TreeItem from '@material-ui/lab/TreeItem';
import Nestable from 'react-nestable';
const useStyles = makeStyles((theme) => ({
......@@ -73,7 +71,8 @@ export default class VisualReportItems extends Component {
]
},
],
arrayCollapse: []
arrayCollapse: [],
defaultCollapsed: false
}
}
......@@ -94,32 +93,30 @@ export default class VisualReportItems extends Component {
}
}
renderItem = ({ item, index }) => {
return(item.text)
// if (item.children.length > 0) {
// return (
// <TreeView
// defaultCollapseIcon={<RemoveIcon />}
// defaultExpandIcon={< AddIcon/>}
// >
// {item.children.length > 0 &&
// <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}>
// {item.children.map((items,indexs) => {
// return (
// <TreeItem nodeId={items.id} style={{margin: 10}} label={items.text}/>
// )
// })}
// </TreeItem>
// // :
// // <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}/>
// }
// </TreeView>
// )
// } else {
// return (
// <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}/>
// )
// }
onDefaultCollapsed = () => this.setState({
defaultCollapsed: !this.state.defaultCollapsed
});
collapse = (collapseCase) => {
let arrayCollapse = this.state.arrayCollapse
let index = arrayCollapse.findIndex((val) => val.id === collapseCase)
if (arrayCollapse.includes(collapseCase)) {
arrayCollapse.splice(index, 1)
} else {
arrayCollapse.push(collapseCase)
}
if (this.refNestable) {
this.refNestable.collapse(arrayCollapse.length > 0? arrayCollapse : 'NONE');
}
};
renderItem = ({ item, collapseIcon }) => {
return (
<div>
{collapseIcon ? (this.state.arrayCollapse.includes(item.id)? <AddIcon/> : <RemoveIcon/>) : null}
<button type="button" onClick={() => this.collapse(item.id)}>{item.text}</button>
</div>
)
};
render() {
......@@ -141,7 +138,6 @@ export default class VisualReportItems extends Component {
style={{ width: 250 }}
select
label="Item Laporan"
// onChange={handleChange}
helperText=""
SelectProps={{
native: true,
......@@ -177,7 +173,6 @@ export default class VisualReportItems extends Component {
style={{ width: 250 }}
select
label="Perusahaan"
// onChange={handleChange}
helperText=""
SelectProps={{
native: true,
......@@ -210,7 +205,9 @@ export default class VisualReportItems extends Component {
<div className="margin-top-30px">
<Nestable
items={this.state.items}
collapsed={this.state.defaultCollapsed}
renderItem={this.renderItem}
ref={el => this.refNestable = el}
onChange={(e) => this.setState({items: e})}
/>
</div>
......
......@@ -78,7 +78,7 @@ export default class CreateUnitBisnis extends Component {
return (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Edit Data</span>
......
......@@ -47,7 +47,7 @@ export default class UserRole extends Component {
if (response.data.status === 'success') {
let data = response.data.data
let listData = data.sort((a,b) => a.user_id - b.user_id).map((item, index) => {
return [index, item.user_id, item.fullname === null? '-' : item.fullname, item.email, item.role_name, '-', item.status]
return [index, item.user_id, item.fullname === null? '-' : item.fullname, item.email, item.role_name, item.totalCompany, item.status]
})
this.setState({ listUser: listData })
} else {
......@@ -64,7 +64,7 @@ export default class UserRole extends Component {
if (response.data.status === 'success') {
let data = response.data.data
let listData = data.sort((a,b) => a.user_id - b.user_id).map((item, index) => {
return [index, item.user_id, item.fullname == null? '-' : item.fullname, item.email, item.role_name, '-', item.status]
return [index, item.user_id, item.fullname == null? '-' : item.fullname, item.email, item.role_name, item.totalCompany, item.status]
})
this.setState({ listUser: listData })
} else {
......@@ -271,7 +271,7 @@ export default class UserRole extends Component {
if (this.state.search.length > 0) {
this.searchUser()
} else {
this.getRole()
this.getUser()
}
}
}
......
......@@ -119,7 +119,7 @@ export default class AddUser extends Component {
}
getRole() {
api.create().getRole().then((response) => {
api.create().getRoleActive().then((response) => {
if(response.data.status === 'success') {
let data = response.data.data
let roleData = data.map((item) => {
......
......@@ -154,7 +154,7 @@ export default class EditUser extends Component {
}
getRole() {
api.create().getRole().then((response) => {
api.create().getRoleActive().then((response) => {
if(response.data.status === 'success') {
let data = response.data.data
let roleData = data.map((item) => {
......@@ -201,6 +201,29 @@ export default class EditUser extends Component {
this.setState({ company })
}
renderChild = (item, index) => {
console.log(item.child)
// item.child.map((items,indexs) => {
// return (
// // <Collapse in={true} timeout="auto" unmountOnExit>
// <div style={{ paddingLeft: 60, display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
// {/* {item.sub_menu.length > 0 && <span onClick={() => this.setState({ selectedIndex: index === this.state.selectedIndex ? 0 : index })} style={{ marginLeft: 7, marginRight: 2 }}>
// {index === this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
// </span>} */}
// {/* <RemoveIcon color={'action'} fontSize={'small'} /> */}
// <span>
// <CustomCheckbox
// checked={this.handleItemChecked(items)}
// onChange={() => this.handleItemClick(items)}
// />
// </span>
// <Typography style={{ fontSize: 12 }}>{titleCase(items.company_name)}</Typography>
// </div>
// // </Collapse>
// )
// })
}
render() {
return (
<div className="test app-popup-show">
......@@ -388,7 +411,7 @@ export default class EditUser extends Component {
return(
<div>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{item.childCompany.length > 0 && <span onClick={() => this.setState({ selectedIndex: index === this.state.selectedIndex ? 0 : index })} style={{ marginLeft: 7, marginRight: 2 }}>
{item.child.length > 0 && <span onClick={() => this.setState({ selectedIndex: index === this.state.selectedIndex ? 0 : index })} style={{ marginLeft: 7, marginRight: 2 }}>
{index === this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>}
<span>
......@@ -399,26 +422,7 @@ export default class EditUser extends Component {
</span>
<Typography style={{ fontSize: 12 }}>{titleCase(item.company_name)}</Typography>
</div>
{item.childCompany.length > 0 && item.childCompany.map((items,indexs) => {
return (
<Collapse in={index === this.state.selectedIndex} timeout="auto" unmountOnExit>
<div style={{ paddingLeft: 60, display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{/* {item.sub_menu.length > 0 && <span onClick={() => this.setState({ selectedIndex: index === this.state.selectedIndex ? 0 : index })} style={{ marginLeft: 7, marginRight: 2 }}>
{index === this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>} */}
{/* <RemoveIcon color={'action'} fontSize={'small'} /> */}
<span>
<CustomCheckbox
checked={this.handleItemChecked(items)}
onChange={() => this.handleItemClick(items)}
/>
</span>
<Typography style={{ fontSize: 12 }}>{titleCase(items.company_name)}</Typography>
</div>
</Collapse>
)
})}
{this.renderChild(item,index)}
</div>
)
})}
......
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