Commit 0029c985 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

delete approval matrix

parent 3e4aeeeb
......@@ -117,6 +117,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const updateVAM = (body) => api.post('/approval_matrix/visual_approval_matrix', body)
const checkUploadAM = (body) => api.post('/approval_matrix/check_import_approval_matrix', body)
const uploadAM = (body) => api.post('approval_matrix/import_approval_matrix', body)
const deleteAM = (id) => api.post(`approval_matrix/delete_approval_matrix/${id}`)
//User
const getUser = () => api.get('user/get_all_user')
......@@ -213,6 +214,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
updateVAM,
checkUploadAM,
uploadAM,
deleteAM,
getUser,
getDetailUser,
searchUser,
......
......@@ -218,7 +218,7 @@ export default class CreateApprovalMatrix extends Component {
this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty.' })
}
else if (R.isNil(this.state.operatorId)) {
this.setState({ errorOperator: true, msgErrOperator: 'Operator Cannot be Empty.' })
this.setState({ errorOperator: true, msgErrOperator: 'Operator Cannot be Empty. Please Choose - Option' })
}
else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
......
import React, { Component } from 'react';
import Images from '../../assets/Images';
import { Typography } from '@material-ui/core';
import api from "../../api";
import Constant from '../../library/Constant';
export default class PopUpDelete extends Component {
constructor(props) {
super(props)
this.state = {
id: '',
getApprovedBy: null,
getTypes: null,
}
}
componentDidMount() {
if (this.props.type === 'delete') {
this.getDetailAM()
}
}
getDetailAM() {
api.create().getDetailAM(this.props.data[1]).then(response => {
console.log(response.data)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
let data = response.data.data
this.setState({
id: data.approval_matrix_id,
getTypes: data.approval_type_name,
getApprovedBy: data.fullname
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
// hapus(){
// this.setState({ popupDel: false })
// api.create().deleteAM(this.state.id).then(response => {
// console.log(response.data)
// if (response.data) {
// if (response.ok) {
// if (response.data.status == 'success') {
// // this.getData()
// this.props.getList()
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
// if (response.data.message.includes("Token")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
// }
// })
// }
hapus() {
if (this.props.type == 'delete') {
let payload = this.state.id
this.props.deleteAM(payload)
}
}
render() {
return (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8, padding: 50 }}>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<img src={Images.failedCopy} />
</div>
<div style={{ display: 'grid', justifyContent: 'center', marginTop: 20 }}>
<span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
Delete {this.state.getTypes} - {this.state.getApprovedBy} ?
</span>
{/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please try again later.`}
</span> */}
</div>
<div style={{ display: 'flex', justifyContent: 'center', marginTop: 24 }}>
<button
className={"btn-save"}
onClick={()=> this.props.onClickClose()}
>
<span style={{ color: 'white' }}>Cancel</span>
</button>
<button
className={"btn-save"}
style={{ marginLeft: 50}}
onClick={()=> this.hapus()}
>
<span style={{ color: 'white' }}>Delete</span>
</button>
</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