Commit ce2d68d2 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into deni-dev(pc)

parents 29906780 8cd494ed
......@@ -4341,6 +4341,16 @@
"sha.js": "^2.4.8"
}
},
"create-react-class": {
"version": "15.6.3",
"resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.6.3.tgz",
"integrity": "sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg==",
"requires": {
"fbjs": "^0.8.9",
"loose-envify": "^1.3.1",
"object-assign": "^4.1.1"
}
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
......@@ -14990,6 +15000,24 @@
"prop-types": "^15.6.2"
}
},
"react-addons-shallow-compare": {
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/react-addons-shallow-compare/-/react-addons-shallow-compare-15.6.2.tgz",
"integrity": "sha1-GYoAuR/DdiPbZKKP0XtZa6NicC8=",
"requires": {
"fbjs": "^0.8.4",
"object-assign": "^4.1.0"
}
},
"react-addons-update": {
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/react-addons-update/-/react-addons-update-15.6.2.tgz",
"integrity": "sha1-5TdTxbNIh5dFEMiC1/sHWFHV5QQ=",
"requires": {
"fbjs": "^0.8.9",
"object-assign": "^4.1.0"
}
},
"react-app-polyfill": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz",
......@@ -15392,6 +15420,44 @@
"@babel/runtime": "^7.1.2"
}
},
"react-nestable": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/react-nestable/-/react-nestable-1.3.0.tgz",
"integrity": "sha512-M77eeVlChnxfM/zHQeX3+D+UvKtCG3+TjCphfQ8PHlvkwe14LwN4xtoxsD+y+y3jKqfq126pBI4R1nsoczOFtQ==",
"requires": {
"classnames": "^2.2.5",
"prop-types": "^15.6.0",
"react": "^15.3.2",
"react-addons-shallow-compare": "^15.3.1",
"react-addons-update": "^15.3.2",
"react-dom": "^15.3.2"
},
"dependencies": {
"react": {
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/react/-/react-15.6.2.tgz",
"integrity": "sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=",
"requires": {
"create-react-class": "^15.6.0",
"fbjs": "^0.8.9",
"loose-envify": "^1.1.0",
"object-assign": "^4.1.0",
"prop-types": "^15.5.10"
}
},
"react-dom": {
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.6.2.tgz",
"integrity": "sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=",
"requires": {
"fbjs": "^0.8.9",
"loose-envify": "^1.1.0",
"object-assign": "^4.1.0",
"prop-types": "^15.5.10"
}
}
}
},
"react-number-format": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/react-number-format/-/react-number-format-4.4.1.tgz",
......
......@@ -33,6 +33,7 @@
"react-dropzone": "^11.0.2",
"react-excel-renderer": "^1.1.0",
"react-linechart": "^1.1.12",
"react-nestable": "^1.3.0",
"react-number-format": "^4.4.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
......
......@@ -34,7 +34,10 @@ export default class CreateApprovalMatrix extends Component {
getUserData() {
api.create().getApprovedByAM().then((response) => {
if (response.data.status == 'success') {
if(response.status == null){
alert(response.problem)
}
else if (response.data.status == 'success') {
let data = response.data.data
let userData = data.map((item) => {
return {
......@@ -49,7 +52,7 @@ export default class CreateApprovalMatrix extends Component {
};
this.setState({ approvedBy: defaultProps, userData: response.data.data})
} else {
alert(response.data.message)
alert('Pemberi Persetujuan: ' +response.data.message)
}
})
}
......@@ -70,7 +73,7 @@ export default class CreateApprovalMatrix extends Component {
};
this.setState({ types: typeProps, typeData: response.data.data })
} else {
alert(response.data.message)
alert('Tipe Persetujuan: ' +response.data.message)
}
})
}
......@@ -92,7 +95,7 @@ export default class CreateApprovalMatrix extends Component {
};
this.setState({ operators: operatorProps, operatorData: response.data.data })
} else {
alert(response.data.message)
alert('Operator: ' +response.data.message)
}
})
}
......@@ -125,10 +128,10 @@ export default class CreateApprovalMatrix extends Component {
if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required.");
console.log('masuk');
let payload = {
"approval_type_id": this.state.typeId,
"approval_type_id": this.state.typeId.approval_type_id,
"orders": this.state.order,
"user_id": this.state.userId,
"operator_type_id": this.state.operatorId,
"user_id": this.state.userId.user_id,
"operator_type_id": this.state.operatorId.operator_type_id,
"start_date": this.state.startDate,
"end_date": this.state.endDate
}
......@@ -187,20 +190,28 @@ export default class CreateApprovalMatrix extends Component {
<Autocomplete
{...this.state.types}
id="tipe"
onChange={(event, newInputValue) => this.setState({typeId:newInputValue.approval_type_id})}
disableClearable
renderInput={(params) => <TextField {...params} label="Tipe Persetujuan" />}
onChange={(event, newInputValue) => this.setState({typeId:newInputValue})}
// disableClearable
debug
renderInput={(params) =>
<TextField
{...params}
label="Tipe Persetujuan"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>
}
value={this.state.typeId}
// inputProps={{
// style: {
// fontSize: 11
// }
// }}
// InputLabelProps={{
// style: {
// fontSize: 11,
// color: '#7e8085'
// }
// }}
/>
</div>
</div>
......@@ -232,24 +243,28 @@ export default class CreateApprovalMatrix extends Component {
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
// margin="normal"
{...this.state.approvedBy}
id="approvedby"
onChange={(event, newInputValue) => this.setState({userId:newInputValue.user_id})}
disableClearable
renderInput={(params) => <TextField {...params} label="Pemberi Persetujuan" />}
// value={this.state.value}
onChange={(event, newInputValue) => this.setState({userId:newInputValue})}
// disableClearable
debug
renderInput={(params) =>
<TextField {...params}
label="Pemberi Persetujuan"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>}
value={this.state.userId}
// inputProps={{
// style: {
// fontSize: 11
// }
// }}
// InputLabelProps={{
// style: {
// fontSize: 11,
// color: '#7e8085'
// }
// }}
// style={{ padding: 0, margin: 0, width: '100%'}}
/>
</div>
......@@ -260,23 +275,27 @@ export default class CreateApprovalMatrix extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.operators}
// margin="normal"
id="operator"
disableClearable
onChange={(event, newInputValue) => this.setState({operatorId:newInputValue.operator_type_id})}
renderInput={(params) => <TextField {...params} label="Operator" />}
// value={this.state.value}
// disableClearable
debug
onChange={(event, newInputValue) => this.setState({operatorId:newInputValue})}
renderInput={(params) =>
<TextField {...params}
label="Operator"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>}
value={this.state.operatorId}
// inputProps={{
// style: {
// fontSize: 11
// }
// }}
// InputLabelProps={{
// style: {
// fontSize: 11,
// color: '#7e8085'
// }
// }}
// style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
......
......@@ -76,7 +76,7 @@ export default class EditApprovalMatrix extends Component {
};
this.setState({ approvedBy: defaultProps, userData: response.data.data, getApprovedBy: index == -1 ? userData[0]: userData[index] })
} else {
alert(response.data.message)
alert('Pemberi Persetujuan: ' +response.data.message)
}
})
}
......@@ -98,7 +98,7 @@ export default class EditApprovalMatrix extends Component {
};
this.setState({ operators: operatorProps, operatorData: response.data.data, getOperators: index == -1 ? operatorData[0]: operatorData[index] })
} else {
alert(response.data.message)
alert('Operator: ' +response.data.message)
}
})
}
......@@ -120,7 +120,7 @@ export default class EditApprovalMatrix extends Component {
};
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0]: typeData[index] })
} else {
alert(response.data.message)
alert('Tipe Persetujuan: ' +response.data.message)
}
})
}
......@@ -144,10 +144,10 @@ export default class EditApprovalMatrix extends Component {
}
validasi() {
if (R.isNil(this.state.getTypeId)) return alert("Tipe Persetujuan is Required.");
if (R.isNil(this.state.getTypes)) return alert("Tipe Persetujuan is Required.");
if (R.isEmpty(this.state.order)) return alert("Order is Required.");
if (R.isNil(this.state.getUserId)) return alert("Pemberi Persetujuan is Required.");
if (R.isNil(this.state.getOperatorId)) return alert("Operator is Required.");
if (R.isNil(this.state.getApprovedBy)) return alert("Pemberi Persetujuan is Required.");
if (R.isNil(this.state.getOperators)) return alert("Operator is Required.");
if (!R.isEmpty(this.state.startDate) && !R.isEmpty(this.state.endDate) && (this.state.startDate > this.state.endDate)) return alert("Masa Berlaku Tidak Boleh Kurang Dari Tanggal Mulai");
if (R.isEmpty(this.state.startDate)) return alert("Tanggal Mulai is Required.");
if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required.");
......@@ -223,10 +223,20 @@ export default class EditApprovalMatrix extends Component {
<Autocomplete
{...this.state.types}
option
disableClearable
debug
id="tipe"
onChange={(event, newInputValue) => this.setState({getTypes:newInputValue})}
renderInput={(params) => <TextField {...params} label="Tipe Persetujuan" />}
renderInput={(params) =>
<TextField {...params}
label="Tipe Persetujuan"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>}
value={this.state.getTypes}
/>
</div>
......@@ -261,10 +271,20 @@ export default class EditApprovalMatrix extends Component {
<Autocomplete
{...this.state.approvedBy}
option
disableClearable
debug
id="approvedby"
onChange={(event, newInputValue) => this.setState({getApprovedBy: newInputValue})}
renderInput={(params) => <TextField {...params} label="Pemberi Persetujuan" />}
renderInput={(params) =>
<TextField {...params}
label="Pemberi Persetujuan"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>}
value={this.state.getApprovedBy}
/>
</div>
......@@ -279,7 +299,17 @@ export default class EditApprovalMatrix extends Component {
disableClearable
id="operator"
onChange={(event, newInputValue) => this.setState({getOperators: newInputValue})}
renderInput={(params) => <TextField {...params} label="Operator" />}
renderInput={(params) =>
<TextField {...params}
label="Operator"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>}
value={this.state.getOperators}
/>
</div>
......
import React, { Component } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { TextField, List, ListSubheader, Typography } from '@material-ui/core';
import { TextField, List, ListSubheader, Typography, Collapse } from '@material-ui/core';
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) => ({
root: {
......@@ -49,7 +50,30 @@ export default class VisualReportItems extends Component {
constructor(props) {
super(props)
this.state = {
open: false
open: false,
items: [
{ id: 0, text: 'Accumulated Depreciation (negative value)', collapse: false,
children: [
{ id: 3, text: 'Beginning Balance', collapse: false },
{ id: 4, text: 'Depreciation expense MTD (please fill in, if any)', collapse: false },
{ id: 5, text: 'Depreciation expense MTD (please fill in, if any)', collapse: false }
]
},{
id: 1, text: 'Control Gain/(Loss) on Fixed Assets', collapse: false
},{
id: 2, text: 'Gain/(Loss) on Fixed Assets', collapse: false,
children: [
{ id: 6, text: 'NBV', collapse: false,
children : [
{ id: 8, text: 'Cost', collapse: false },
{ id: 9, text: 'Accm. Depreciation', collapse: false },
]
},
{ id: 7, text: 'Proceed from sale or disposal of Fixed Assets (please fill in, if any)', collapse: false },
]
},
],
arrayCollapse: []
}
}
......@@ -57,6 +81,47 @@ export default class VisualReportItems extends Component {
console.log(this.props.height)
}
handleCollapse(item) {
let index = this.state.items.findIndex((val) => val.id === item.id)
let items = this.state.items
if ( index == -1 ){
if (item.children.length > 0) {
this.handleCollapse(item)
}
} else {
items[index].collapse = !items[index].collapse
console.log(items[index])
}
}
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}/>
// )
// }
};
render() {
return (
......@@ -143,26 +208,11 @@ export default class VisualReportItems extends Component {
</TextField>
</div>
<div className="margin-top-30px">
<TreeView
defaultCollapseIcon={<RemoveIcon />}
defaultExpandIcon={< AddIcon/>}
>
<TreeItem nodeId="1" style={{margin: 10}} label="Accumulated Depreciation (negative value)">
<TreeItem nodeId="2" style={{margin: 20}} label="Beginning Balance" />
<TreeItem nodeId="3" style={{margin: 20}} label="Depreciation expense MTD (please fill in, if any)" />
<TreeItem nodeId="4" style={{margin: 20}} label="Disposal (positive value) (please fill in, if any)" />
</TreeItem>
<TreeItem nodeId="10" style={{margin: 20}} label="Control Gain/(Loss) on Fixed Assets" />
<TreeItem nodeId="5" style={{margin: 10}} label="Gain/(Loss) on Fixed Assets">
<TreeItem nodeId="6" style={{margin: 20}} label="NBV">
<TreeItem nodeId="7" style={{margin: 20}} label="Cost"/>
<TreeItem nodeId="9" style={{margin: 20}} label="Accm. Depreciation" />
</TreeItem>
<TreeItem nodeId="10" style={{margin: 20}} label="Proceed from sale or disposal of Fixed Assets (please fill in, if any)" />
</TreeItem>
</TreeView>
<Nestable
items={this.state.items}
renderItem={this.renderItem}
onChange={(e) => this.setState({items: e})}
/>
</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