Commit 02881d0d authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

update ui create, edit, apprmatrix

parent b8835dc3
......@@ -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>
......
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