Commit 02873894 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

update validasi dan css layout apprv matrix

parent 1b1ff58e
...@@ -282,12 +282,11 @@ export default class ApprovalMatrix extends Component { ...@@ -282,12 +282,11 @@ export default class ApprovalMatrix extends Component {
openPopUp(index, type) { openPopUp(index, type) {
if (type === 'edit') { if (type === 'edit') {
this.setState({ this.setState({
selectIndex: index, rowData: index,
visibleEdit: true visibleEdit: true
}) })
} else { } else {
this.setState({ this.setState({
data: this.state.listData[index],
visibleCreate: true visibleCreate: true
}) })
} }
...@@ -316,6 +315,7 @@ export default class ApprovalMatrix extends Component { ...@@ -316,6 +315,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ visibleCreate: false }) this.setState({ visibleCreate: false })
api.create().createAM(payload).then(response => { api.create().createAM(payload).then(response => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
alert(response.data.message)
this.getData() this.getData()
} else { } else {
alert(response.data.message) alert(response.data.message)
...@@ -327,6 +327,7 @@ export default class ApprovalMatrix extends Component { ...@@ -327,6 +327,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ visibleEdit: false }) this.setState({ visibleEdit: false })
api.create().updateAM(payload).then(response => { api.create().updateAM(payload).then(response => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
alert(response.data.message)
this.getData() this.getData()
} else { } else {
alert(response.data.message) alert(response.data.message)
...@@ -337,8 +338,8 @@ export default class ApprovalMatrix extends Component { ...@@ -337,8 +338,8 @@ export default class ApprovalMatrix extends Component {
updateVAM = (payload) => { updateVAM = (payload) => {
this.setState({ visibleVisual: false, visibleAM: true }) this.setState({ visibleVisual: false, visibleAM: true })
api.create().updateVAM(payload).then(response => { api.create().updateVAM(payload).then(response => {
// console.log(response.data)
if (response.data.status == 'success') { if (response.data.status == 'success') {
alert(response.data.message)
this.getData() this.getData()
} else { } else {
alert(response.data.message) alert(response.data.message)
...@@ -399,7 +400,7 @@ export default class ApprovalMatrix extends Component { ...@@ -399,7 +400,7 @@ export default class ApprovalMatrix extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => this.openPopUp(tableMeta.rowIndex, 'edit')} onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
// onClick={() => this.setState({ visibleEdit: true })} // onClick={() => this.setState({ visibleEdit: true })}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
...@@ -649,7 +650,7 @@ export default class ApprovalMatrix extends Component { ...@@ -649,7 +650,7 @@ export default class ApprovalMatrix extends Component {
<EditApprovalMatrix <EditApprovalMatrix
type={"edit"} type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })} onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.listData[this.state.selectIndex]} data={this.state.rowData}
updateAM={this.updateAM.bind(this)} updateAM={this.updateAM.bind(this)}
/> />
)} )}
......
...@@ -19,8 +19,8 @@ export default class CreateApprovalMatrix extends Component { ...@@ -19,8 +19,8 @@ export default class CreateApprovalMatrix extends Component {
approvedBy: null, approvedBy: null,
types: null, types: null,
operators: null, operators: null,
startDate: '', startDate: null,
endDate: '', endDate: null,
userData: [], userData: [],
value: null, value: null,
date: new Date(), date: new Date(),
...@@ -39,6 +39,12 @@ export default class CreateApprovalMatrix extends Component { ...@@ -39,6 +39,12 @@ export default class CreateApprovalMatrix extends Component {
this.getUserData() this.getUserData()
this.getTypeData() this.getTypeData()
this.getOperatorData() this.getOperatorData()
let date = format(new Date, 'yyyy-MM-dd')
console.log(date);
this.setState({
startDate: date,
endDate: date
})
} }
getUserData() { getUserData() {
...@@ -108,7 +114,6 @@ export default class CreateApprovalMatrix extends Component { ...@@ -108,7 +114,6 @@ export default class CreateApprovalMatrix extends Component {
} }
}) })
} }
handleChange(e, type) { handleChange(e, type) {
let data = this.state let data = this.state
...@@ -151,10 +156,9 @@ export default class CreateApprovalMatrix extends Component { ...@@ -151,10 +156,9 @@ export default class CreateApprovalMatrix extends Component {
} }
else if (R.isNil(this.state.userId)) return alert("Pemberi Persetujuan tidak boleh kosong"); else if (R.isNil(this.state.userId)) return alert("Pemberi Persetujuan tidak boleh kosong");
else if (R.isNil(this.state.operatorId)) return alert("Operator tidak boleh kosong"); else if (R.isNil(this.state.operatorId)) return alert("Operator tidak boleh kosong");
else 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"); else if (R.isNil(this.state.startDate)) {
else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Tanggal Mulai tidak boleh kosong' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Tanggal Mulai tidak boleh kosong' })
} else if (R.isEmpty(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'Tanggal Berakhir tidak boleh kosong' })
} else { } else {
console.log('masuk'); console.log('masuk');
...@@ -175,7 +179,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -175,7 +179,7 @@ export default class CreateApprovalMatrix extends Component {
return ( return (
<div className="test app-popup-show" style={{ paddingTop: 100 }}> <div className="test app-popup-show" style={{ paddingTop: 100 }}>
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}> <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}> <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title"> <div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Tambah Data</span> <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Tambah Data</span>
...@@ -255,6 +259,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -255,6 +259,7 @@ export default class CreateApprovalMatrix extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="order"
label="Order" label="Order"
type={"number"}
value={this.state.order} value={this.state.order}
error={this.state.errorOrder} error={this.state.errorOrder}
helperText={this.state.msgErrOrder} helperText={this.state.msgErrOrder}
......
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