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 @@ ...@@ -4341,6 +4341,16 @@
"sha.js": "^2.4.8" "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": { "cross-spawn": {
"version": "6.0.5", "version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
...@@ -14990,6 +15000,24 @@ ...@@ -14990,6 +15000,24 @@
"prop-types": "^15.6.2" "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": { "react-app-polyfill": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz", "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz",
...@@ -15392,6 +15420,44 @@ ...@@ -15392,6 +15420,44 @@
"@babel/runtime": "^7.1.2" "@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": { "react-number-format": {
"version": "4.4.1", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/react-number-format/-/react-number-format-4.4.1.tgz", "resolved": "https://registry.npmjs.org/react-number-format/-/react-number-format-4.4.1.tgz",
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
"react-dropzone": "^11.0.2", "react-dropzone": "^11.0.2",
"react-excel-renderer": "^1.1.0", "react-excel-renderer": "^1.1.0",
"react-linechart": "^1.1.12", "react-linechart": "^1.1.12",
"react-nestable": "^1.3.0",
"react-number-format": "^4.4.1", "react-number-format": "^4.4.1",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-scripts": "3.4.1", "react-scripts": "3.4.1",
......
...@@ -34,7 +34,10 @@ export default class CreateApprovalMatrix extends Component { ...@@ -34,7 +34,10 @@ export default class CreateApprovalMatrix extends Component {
getUserData() { getUserData() {
api.create().getApprovedByAM().then((response) => { 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 data = response.data.data
let userData = data.map((item) => { let userData = data.map((item) => {
return { return {
...@@ -49,7 +52,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -49,7 +52,7 @@ export default class CreateApprovalMatrix extends Component {
}; };
this.setState({ approvedBy: defaultProps, userData: response.data.data}) this.setState({ approvedBy: defaultProps, userData: response.data.data})
} else { } else {
alert(response.data.message) alert('Pemberi Persetujuan: ' +response.data.message)
} }
}) })
} }
...@@ -70,7 +73,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -70,7 +73,7 @@ export default class CreateApprovalMatrix extends Component {
}; };
this.setState({ types: typeProps, typeData: response.data.data }) this.setState({ types: typeProps, typeData: response.data.data })
} else { } else {
alert(response.data.message) alert('Tipe Persetujuan: ' +response.data.message)
} }
}) })
} }
...@@ -92,7 +95,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -92,7 +95,7 @@ export default class CreateApprovalMatrix extends Component {
}; };
this.setState({ operators: operatorProps, operatorData: response.data.data }) this.setState({ operators: operatorProps, operatorData: response.data.data })
} else { } else {
alert(response.data.message) alert('Operator: ' +response.data.message)
} }
}) })
} }
...@@ -125,10 +128,10 @@ export default class CreateApprovalMatrix extends Component { ...@@ -125,10 +128,10 @@ export default class CreateApprovalMatrix extends Component {
if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required."); if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required.");
console.log('masuk'); console.log('masuk');
let payload = { let payload = {
"approval_type_id": this.state.typeId, "approval_type_id": this.state.typeId.approval_type_id,
"orders": this.state.order, "orders": this.state.order,
"user_id": this.state.userId, "user_id": this.state.userId.user_id,
"operator_type_id": this.state.operatorId, "operator_type_id": this.state.operatorId.operator_type_id,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
} }
...@@ -187,20 +190,28 @@ export default class CreateApprovalMatrix extends Component { ...@@ -187,20 +190,28 @@ export default class CreateApprovalMatrix extends Component {
<Autocomplete <Autocomplete
{...this.state.types} {...this.state.types}
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({typeId:newInputValue.approval_type_id})} onChange={(event, newInputValue) => this.setState({typeId:newInputValue})}
disableClearable // disableClearable
renderInput={(params) => <TextField {...params} label="Tipe Persetujuan" />} 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={{ // inputProps={{
// style: { // style: {
// fontSize: 11 // fontSize: 11
// } // }
// }} // }}
// InputLabelProps={{
// style: {
// fontSize: 11,
// color: '#7e8085'
// }
// }}
/> />
</div> </div>
</div> </div>
...@@ -232,24 +243,28 @@ export default class CreateApprovalMatrix extends Component { ...@@ -232,24 +243,28 @@ export default class CreateApprovalMatrix extends Component {
<div className="column-2"> <div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
// margin="normal"
{...this.state.approvedBy} {...this.state.approvedBy}
id="approvedby" id="approvedby"
onChange={(event, newInputValue) => this.setState({userId:newInputValue.user_id})} onChange={(event, newInputValue) => this.setState({userId:newInputValue})}
disableClearable // disableClearable
renderInput={(params) => <TextField {...params} label="Pemberi Persetujuan" />} debug
// value={this.state.value} renderInput={(params) =>
<TextField {...params}
label="Pemberi Persetujuan"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>}
value={this.state.userId}
// inputProps={{ // inputProps={{
// style: { // style: {
// fontSize: 11 // fontSize: 11
// } // }
// }} // }}
// InputLabelProps={{
// style: {
// fontSize: 11,
// color: '#7e8085'
// }
// }}
// style={{ padding: 0, margin: 0, width: '100%'}} // style={{ padding: 0, margin: 0, width: '100%'}}
/> />
</div> </div>
...@@ -260,23 +275,27 @@ export default class CreateApprovalMatrix extends Component { ...@@ -260,23 +275,27 @@ export default class CreateApprovalMatrix extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
{...this.state.operators} {...this.state.operators}
// margin="normal"
id="operator" id="operator"
disableClearable // disableClearable
onChange={(event, newInputValue) => this.setState({operatorId:newInputValue.operator_type_id})} debug
renderInput={(params) => <TextField {...params} label="Operator" />} onChange={(event, newInputValue) => this.setState({operatorId:newInputValue})}
// value={this.state.value} renderInput={(params) =>
<TextField {...params}
label="Operator"
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
/>}
value={this.state.operatorId}
// inputProps={{ // inputProps={{
// style: { // style: {
// fontSize: 11 // fontSize: 11
// } // }
// }} // }}
// InputLabelProps={{
// style: {
// fontSize: 11,
// color: '#7e8085'
// }
// }}
// style={{ padding: 0, margin: 0, width: '100%' }} // style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
......
...@@ -76,7 +76,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -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] }) this.setState({ approvedBy: defaultProps, userData: response.data.data, getApprovedBy: index == -1 ? userData[0]: userData[index] })
} else { } else {
alert(response.data.message) alert('Pemberi Persetujuan: ' +response.data.message)
} }
}) })
} }
...@@ -98,7 +98,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -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] }) this.setState({ operators: operatorProps, operatorData: response.data.data, getOperators: index == -1 ? operatorData[0]: operatorData[index] })
} else { } else {
alert(response.data.message) alert('Operator: ' +response.data.message)
} }
}) })
} }
...@@ -120,7 +120,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -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] }) this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0]: typeData[index] })
} else { } else {
alert(response.data.message) alert('Tipe Persetujuan: ' +response.data.message)
} }
}) })
} }
...@@ -144,10 +144,10 @@ export default class EditApprovalMatrix extends Component { ...@@ -144,10 +144,10 @@ export default class EditApprovalMatrix extends Component {
} }
validasi() { 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.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.getApprovedBy)) return alert("Pemberi Persetujuan is Required.");
if (R.isNil(this.state.getOperatorId)) return alert("Operator 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) && !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.startDate)) return alert("Tanggal Mulai is Required.");
if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required."); if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required.");
...@@ -223,10 +223,20 @@ export default class EditApprovalMatrix extends Component { ...@@ -223,10 +223,20 @@ export default class EditApprovalMatrix extends Component {
<Autocomplete <Autocomplete
{...this.state.types} {...this.state.types}
option option
disableClearable debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({getTypes:newInputValue})} 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} value={this.state.getTypes}
/> />
</div> </div>
...@@ -261,10 +271,20 @@ export default class EditApprovalMatrix extends Component { ...@@ -261,10 +271,20 @@ export default class EditApprovalMatrix extends Component {
<Autocomplete <Autocomplete
{...this.state.approvedBy} {...this.state.approvedBy}
option option
disableClearable debug
id="approvedby" id="approvedby"
onChange={(event, newInputValue) => this.setState({getApprovedBy: newInputValue})} 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} value={this.state.getApprovedBy}
/> />
</div> </div>
...@@ -279,7 +299,17 @@ export default class EditApprovalMatrix extends Component { ...@@ -279,7 +299,17 @@ export default class EditApprovalMatrix extends Component {
disableClearable disableClearable
id="operator" id="operator"
onChange={(event, newInputValue) => this.setState({getOperators: newInputValue})} 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} value={this.state.getOperators}
/> />
</div> </div>
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { makeStyles } from '@material-ui/core/styles'; 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 MinimizeIcon from '@material-ui/icons/Minimize';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove'; import RemoveIcon from '@material-ui/icons/Remove';
import TreeView from '@material-ui/lab/TreeView'; import TreeView from '@material-ui/lab/TreeView';
import TreeItem from '@material-ui/lab/TreeItem'; import TreeItem from '@material-ui/lab/TreeItem';
import Nestable from 'react-nestable';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
...@@ -49,7 +50,30 @@ export default class VisualReportItems extends Component { ...@@ -49,7 +50,30 @@ export default class VisualReportItems extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { 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 { ...@@ -57,6 +81,47 @@ export default class VisualReportItems extends Component {
console.log(this.props.height) 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() { render() {
return ( return (
...@@ -143,26 +208,11 @@ export default class VisualReportItems extends Component { ...@@ -143,26 +208,11 @@ export default class VisualReportItems extends Component {
</TextField> </TextField>
</div> </div>
<div className="margin-top-30px"> <div className="margin-top-30px">
<TreeView <Nestable
defaultCollapseIcon={<RemoveIcon />} items={this.state.items}
defaultExpandIcon={< AddIcon/>} renderItem={this.renderItem}
onChange={(e) => this.setState({items: e})}
> />
<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>
</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