Commit 7d8cd57e authored by EKSAD's avatar EKSAD

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

parents 0082810f f5ce2a3a
......@@ -94,6 +94,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const createPerusahaan = (body) => api.post('/company/create_company', body)
const updatePerusahaan = (body) => api.post('/company/update_company', body)
const getPerusahaanHierarki = () => api.get('company/get_company_hierarki')
const saveVisualisasiPerusahaan = (body) => api.post('company/save_visualization', body)
// APPROVAL MATRIX
const getAM = () => api.get('approval_matrix/get_all_approval_matrix')
......@@ -125,7 +126,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const updateReportItems = (body) => api.post('/item_report/update_item_report', body)
const checkUploadReportItems = (body) => api.post('/item_report/check_import', body)
const uploadReportItems = (body) => api.post('/item_report/import_item_report', body)
const getItemReportHierarki = () => api.get('item_report/get_item_report_hierarki')
const getItemReportHierarki = (body) => api.post('item_report/get_item_report_hierarki', body)
const saveVisualisasiReport = (body) => api.post('item_report/save_visualization', body)
//PARAMETER
......@@ -214,7 +215,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
uploadParameter,
getItemReportHierarki,
getMenuByRole,
saveVisualisasiReport
saveVisualisasiReport,
saveVisualisasiPerusahaan
}
}
......
......@@ -174,7 +174,7 @@ export default class VisualisasiAM extends Component {
</div>
<ReactDragListView {...dragProps}>
<ol style={{paddingLeft: 15}}>
{this.state.listApproval.map((item, index) => (
{this.state.listApproval.sort((a,b) => a.orderId - b.orderId).map((item, index) => (
<li key={index} style={{color: '#4b4b4b', fontSize: 14}}>
<a href='#' style={{ color: '#4b4b4b', fontSize: '14px', cursor: 'auto', outline: 'none' }}>
<div className="grid grid-3x grid-mobile-none gap-20px margin-bottom-20px" style={{width: '75%'}}>
......
......@@ -9,20 +9,96 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import TreeItem from '@material-ui/lab/TreeItem';
import Nestable from 'react-nestable/dist/Nestable';
import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove';
import api from '../../../api';
export default class VisualPerusahaan extends Component {
constructor(props) {
super(props)
this.state = {
items: [
{ id: 0, GG: 'Accumulated Depreciation (negative value)', collapse: false,
children: [
{ id: 3, GG: 'Beginning Balance', collapse: false },
{ id: 4, GG: 'Depreciation expense MTD (please fill in, if any)', collapse: false },
{ id: 5, GG: 'Depreciation expense MTD (please fill in, if any)', collapse: false }
]
},{
id: 1, GG: 'Control Gain/(Loss) on Fixed Assets', collapse: false
},{
id: 2, GG: 'Gain/(Loss) on Fixed Assets', collapse: false,
children: [
{ id: 6, GG: 'NBV', collapse: false,
children : [
{ id: 8, GG: 'Cost', collapse: false },
{ id: 9, GG: 'Accm. Depreciation', collapse: false },
]
},
{ id: 7, GG: 'Proceed from sale or disposal of Fixed Assets (please fill in, if any)', collapse: false },
]
},
],
arrayCollapse: [],
defaultCollapsed: false
}
}
componentDidMount() {
console.log(this.props.height)
this.getPerusahaan()
}
getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => {
if (response.data.status == 'success') {
this.setState({ items: response.data.data })
console.log(response.data.data)
}
})
}
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');
}
};
handleSave() {
let payload = {
"company": this.state.items
}
api.create().saveVisualisasiPerusahaan(payload).then((response) => {
// if (response.data.status == 'ucces') {
this.props.onClickClose()
// } else {
// alert(response.data.message)
// }
})
}
renderItem = ({ item, collapseIcon }) => {
return (
<div>
<button type="button" onClick={() => this.collapse(item.id)}>
{collapseIcon ? (this.state.arrayCollapse.includes(item.id)? <AddIcon/> : <RemoveIcon/>) : null}
</button>
<label style={{marginLeft: collapseIcon ? 10 : 0}}>{item.company_name}</label>
</div>
)
};
render() {
return (
......@@ -88,7 +164,7 @@ export default class VisualPerusahaan extends Component {
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}>
<span style={{ color: '#354960', fontSize: 11 }} >Batal</span>
</div>
<div style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}>
<div onClick={() => this.handleSave()} style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div>
</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