Commit 432c66e7 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !86
parents 33b53923 63abacad
......@@ -32,7 +32,9 @@ export default class VisualisasiAM extends Component {
visibleAM: false,
visibleVisual: true,
data,
listApproval: []
listApproval: [],
listEdit: [],
listOriginal: []
}
}
......@@ -84,7 +86,7 @@ export default class VisualisasiAM extends Component {
listVisual[indexId].data.push(item)
}
})
this.setState({ listApproval: listVisual })
this.setState({ listApproval: listVisual})
console.log(listVisual);
} else {
alert(response.data.message)
......@@ -94,9 +96,37 @@ export default class VisualisasiAM extends Component {
handleChangeOrder(fromIndex, toIndex, that) {
let listApproval = that.state.listApproval
let orderIdFrom = listApproval[fromIndex].orderId
listApproval[fromIndex].orderId = listApproval[toIndex].orderId
listApproval[toIndex].orderId = listApproval[fromIndex].orderId
console.log(fromIndex, toIndex)
listApproval[toIndex].orderId = orderIdFrom
that.setState({listEdit: listApproval})
}
handleSave() {
let data = []
this.state.listEdit.map((item,index) => {
item.data.map((items,index) => {
data.push({
approval_matrix_id: items.approval_matrix_id,
approval_type_id: items.approval_type_id,
approval_type_name: items.approval_type_name,
created: items.created,
end_date: items.end_date,
fullname: items.fullname,
operator_type_id: items.operator_type_id,
operator_type_name: items.operator_type_name,
orders: item.orderId,
start_date: items.start_date,
status: items.status,
updated: items.updated,
user_id: items.user_id
})
})
})
setTimeout(() => {
this.setState({listOriginal: data})
}, 500);
}
render() {
......@@ -135,15 +165,20 @@ export default class VisualisasiAM extends Component {
/>
</div>
<ReactDragListView {...dragProps}>
<ol>
<ol style={{paddingLeft: 15}}>
{this.state.listApproval.map((item, index) => (
<li key={index}>
<a href="#">{`${item.data.map((items, indexs) => {return(items.fullname)})} ${item.data.length == 1? '' : item.data[0].operator_type_name}`}</a>
<li key={index} style={{color: '#525252', fontSize: 14}}>
<a href="#" style={{color: '#525252'}}>
<div className="grid grid-3x grid-mobile-none gap-20px" style={{width: '75%'}}>
{item.data.map((items, indexs) => {return(<label>{items.fullname}</label>)})}
<label>{item.data.length == 1? '' : item.data[0].operator_type_name}</label>
</div>
</a>
</li>
))}
</ol>
</ReactDragListView>
<div className="grid grid-4x grid-mobile-none gap-15px">
{/* <div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>1. John Doe</label>
......@@ -155,7 +190,7 @@ export default class VisualisasiAM extends Component {
</div>
<div className="column-4">
</div>
</div>
</div> */}
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
......@@ -211,7 +246,7 @@ export default class VisualisasiAM 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