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/') => ...@@ -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 createPerusahaan = (body) => api.post('/company/create_company', body)
const updatePerusahaan = (body) => api.post('/company/update_company', body) const updatePerusahaan = (body) => api.post('/company/update_company', body)
const getPerusahaanHierarki = () => api.get('company/get_company_hierarki') const getPerusahaanHierarki = () => api.get('company/get_company_hierarki')
const saveVisualisasiPerusahaan = (body) => api.post('company/save_visualization', body)
// APPROVAL MATRIX // APPROVAL MATRIX
const getAM = () => api.get('approval_matrix/get_all_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/') => ...@@ -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 updateReportItems = (body) => api.post('/item_report/update_item_report', body)
const checkUploadReportItems = (body) => api.post('/item_report/check_import', body) const checkUploadReportItems = (body) => api.post('/item_report/check_import', body)
const uploadReportItems = (body) => api.post('/item_report/import_item_report', 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) const saveVisualisasiReport = (body) => api.post('item_report/save_visualization', body)
//PARAMETER //PARAMETER
...@@ -214,7 +215,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -214,7 +215,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
uploadParameter, uploadParameter,
getItemReportHierarki, getItemReportHierarki,
getMenuByRole, getMenuByRole,
saveVisualisasiReport saveVisualisasiReport,
saveVisualisasiPerusahaan
} }
} }
......
...@@ -174,7 +174,7 @@ export default class VisualisasiAM extends Component { ...@@ -174,7 +174,7 @@ export default class VisualisasiAM extends Component {
</div> </div>
<ReactDragListView {...dragProps}> <ReactDragListView {...dragProps}>
<ol style={{paddingLeft: 15}}> <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}}> <li key={index} style={{color: '#4b4b4b', fontSize: 14}}>
<a href='#' style={{ color: '#4b4b4b', fontSize: '14px', cursor: 'auto', outline: 'none' }}> <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%'}}> <div className="grid grid-3x grid-mobile-none gap-20px margin-bottom-20px" style={{width: '75%'}}>
......
...@@ -9,19 +9,95 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; ...@@ -9,19 +9,95 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import TreeItem from '@material-ui/lab/TreeItem'; import TreeItem from '@material-ui/lab/TreeItem';
import Nestable from 'react-nestable/dist/Nestable'; 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 { export default class VisualPerusahaan extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { 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() { 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() { render() {
...@@ -88,7 +164,7 @@ export default class VisualPerusahaan extends Component { ...@@ -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" }}> <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> <span style={{ color: '#354960', fontSize: 11 }} >Batal</span>
</div> </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> <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div> </div>
</div> </div>
......
...@@ -6,6 +6,8 @@ import AddIcon from '@material-ui/icons/Add'; ...@@ -6,6 +6,8 @@ import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove'; import RemoveIcon from '@material-ui/icons/Remove';
import Nestable from 'react-nestable'; import Nestable from 'react-nestable';
import api from '../../../api'; import api from '../../../api';
import { titleCase } from '../../../library/Utils';
import Autocomplete from '@material-ui/lab/Autocomplete';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
...@@ -73,17 +75,72 @@ export default class VisualReportItems extends Component { ...@@ -73,17 +75,72 @@ export default class VisualReportItems extends Component {
}, },
], ],
arrayCollapse: [], arrayCollapse: [],
defaultCollapsed: false defaultCollapsed: false,
listReport: null,
report: null,
listCompany: null,
company: null
} }
} }
componentDidMount() { componentDidMount() {
console.log(this.props.height) console.log(this.props.height)
this.getReportType()
}
getReportType() {
api.create().getReportType().then((response) => {
this.getCompanyActive()
if (response.data.status === 'success') {
let data = response.data.data
let reportData = data.map((item) => {
return {
report_id: item.report_id,
report_name: item.report_name,
}
})
let defaultProps = {
options: reportData,
getOptionLabel: (option) => titleCase(option.report_name),
};
this.setState({ listReport: defaultProps, report: reportData[0] })
} else {
alert(response.data.message)
}
})
}
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
if (response.data.status === 'success') {
let data = response.data.data
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name,
}
})
let defaultProps = {
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
this.getItemHierarki() this.getItemHierarki()
})
} else {
alert(response.data.message)
}
})
} }
getItemHierarki() { getItemHierarki() {
api.create().getItemReportHierarki().then((response) => { let payload = {
"report_id": this.state.report.report_id,
"company_id": this.state.company.company_id
}
api.create().getItemReportHierarki(payload).then((response) => {
console.log(response.data)
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.setState({items : response.data.data}) this.setState({items : response.data.data})
} }
...@@ -136,18 +193,16 @@ export default class VisualReportItems extends Component { ...@@ -136,18 +193,16 @@ export default class VisualReportItems extends Component {
renderItem = ({ item, collapseIcon }) => { renderItem = ({ item, collapseIcon }) => {
return ( return (
<div> <div>
{collapseIcon ? (this.state.arrayCollapse.includes(item.id)? <AddIcon/> : <RemoveIcon/>) : null} <button type="button" onClick={() => this.collapse(item.id)}>{collapseIcon ? (this.state.arrayCollapse.includes(item.id)? <AddIcon/> : <RemoveIcon/>) : null}</button>
<button type="button" onClick={() => this.collapse(item.id)}>{item.report_name}</button> <label style={{marginLeft: collapseIcon? 10 : 0}}>{item.report_name}</label>
</div> </div>
) )
}; };
render() { render() {
return ( return (
<div>
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
<div style={{ height: 199, width: '100%' }} className={"main-color"} /> <div style={{ height: 150, width: '100%' }} className={"main-color"} />
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', width: '20%', fontSize: 16, paddingTop: 8 }}>Visualisasi Data</label> <label style={{ color: 'white', width: '20%', fontSize: 16, paddingTop: 8 }}>Visualisasi Data</label>
...@@ -156,74 +211,26 @@ export default class VisualReportItems extends Component { ...@@ -156,74 +211,26 @@ export default class VisualReportItems extends Component {
<div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4'}}> <div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4'}}>
<label style={{ color: '#4b4b4b', fontSize: '16px', fontWeight: 'bold' }}>Hirarki Item Laporan</label> <label style={{ color: '#4b4b4b', fontSize: '16px', fontWeight: 'bold' }}>Hirarki Item Laporan</label>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <Autocomplete
id="reportItems" {...this.state.listReport}
style={{ width: 250 }} id="report"
select onChange={(event, newInputValue) => this.setState({ report: newInputValue }, () => this.getItemHierarki())}
label="Item Laporan" debug
helperText=""
SelectProps={{ renderInput={(params) => <TextField {...params} label="Jenis Laporan" margin="normal" style={{ marginTop: 7 }} />}
native: true, value={this.state.report}
}} / >
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
paddingLeft: 10
}
}}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{type.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</TextField>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <Autocomplete
{...this.state.listCompany}
id="company" id="company"
style={{ width: 250 }} onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => this.getItemHierarki())}
select debug
label="Perusahaan"
helperText="" renderInput={(params) => <TextField {...params} label="Compan" margin="normal" style={{ marginTop: 7 }} />}
SelectProps={{ value={this.state.company}
native: true, / >
}}
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
paddingLeft: 10
}
}}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{companies.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</TextField>
</div> </div>
<div className="margin-top-30px"> <div className="margin-top-30px">
<Nestable <Nestable
...@@ -253,7 +260,6 @@ export default class VisualReportItems extends Component { ...@@ -253,7 +260,6 @@ export default class VisualReportItems extends Component {
</div> </div>
</div> </div>
</div> </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