Commit 14142c03 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

update validasi dan taxplan

parent c0a4393c
......@@ -54,7 +54,8 @@ export default class CreateApprovalMatrix extends Component {
getUserData() {
api.create().getApprovedByAM().then((response) => {
if(response.status == null){
alert(response.problem)
// alert(response.problem)
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
else if (response.data.status == 'success') {
let data = response.data.data
......@@ -71,7 +72,8 @@ export default class CreateApprovalMatrix extends Component {
};
this.setState({ approvedBy: defaultProps, userData: response.data.data})
} else {
alert('Approver Name: ' +response.data.message)
// alert('Approver Name: ' +response.data.message)
this.setState({ alert: true, messageAlert: 'Approver Name: ' +response.problem, tipeAlert: 'error' })
}
})
}
......@@ -92,7 +94,8 @@ export default class CreateApprovalMatrix extends Component {
};
this.setState({ types: typeProps, typeData: response.data.data })
} else {
alert('Approval Type: ' +response.data.message)
// alert('Approval Type: ' +response.data.message)
this.setState({ alert: true, messageAlert: 'Approval Type: ' +response.problem, tipeAlert: 'error' })
}
})
}
......@@ -114,7 +117,8 @@ export default class CreateApprovalMatrix extends Component {
};
this.setState({ operators: operatorProps, operatorData: response.data.data })
} else {
alert('Operator: ' +response.data.message)
// alert('Operator: ' +response.data.message)
this.setState({ alert: true, messageAlert: 'Operator: ' +response.problem, tipeAlert: 'error' })
}
})
}
......@@ -157,22 +161,22 @@ export default class CreateApprovalMatrix extends Component {
validasi() {
if (R.isNil(this.state.typeId)) {
this.setState({ errorType: true, msgErrType: 'Approval Type Cannot be Empty' })
this.setState({ errorType: true, msgErrType: 'Approval Type Cannot be Empty.' })
}
else if (R.isEmpty(this.state.order)) {
this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty'})
this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty.'})
}
else if (R.isNil(this.state.userId)) {
// return alert("Pemberi Persetujuan tidak boleh kosong");
this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty' })
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.' })
}
else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty' })
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty' })
this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty.' })
} else {
console.log('masuk');
let payload = {
......
......@@ -13,6 +13,7 @@ export default class EditApprovalMatrix extends Component {
this.state = {
id: '',
order: '',
status: "",
startDate: null,
endDate: null,
date: new Date(),
......@@ -86,9 +87,12 @@ export default class EditApprovalMatrix extends Component {
options: userData,
getOptionLabel: (option) => option.fullname,
};
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] })
this.setState({ approvedBy: defaultProps, userData: response.data.data, getApprovedBy: index == -1 ? this.setState({ errorApproved: true, msgErrApproved: 'Approver Name has been Inactive.' }): userData[index] })
} else {
alert('Pemberi Persetujuan: ' +response.data.message)
// alert('Pemberi Persetujuan: ' +response.data.message)
this.setState({ alert: true, messageAlert: 'Pemberi Persetujuan: ' +response.data.message, tipeAlert: 'error' })
}
})
}
......@@ -108,9 +112,10 @@ export default class EditApprovalMatrix extends Component {
options: operatorData,
getOptionLabel: (option) => option.operator_type_name,
};
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 {
alert('Operator: ' +response.data.message)
// alert('Operator: ' +response.data.message)
this.setState({ alert: true, messageAlert: 'Operator: ' +response.data.message, tipeAlert: 'error' })
}
})
}
......@@ -132,7 +137,8 @@ export default class EditApprovalMatrix extends Component {
};
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0]: typeData[index] })
} else {
alert('Approval Type: ' +response.data.message)
// alert('Approval Type: ' +response.data.message)
this.setState({ alert: true, messageAlert: 'Approval Type: ' +response.data.message, tipeAlert: 'error' })
}
})
}
......@@ -176,21 +182,21 @@ export default class EditApprovalMatrix extends Component {
validasi() {
if (R.isNil(this.state.getTypes)) {
this.setState({ errorType: true, msgErrType: 'Approval Type Cannot be Empty' })
this.setState({ errorType: true, msgErrType: 'Approval Type Cannot be Empty.' })
}
else if (R.isEmpty(this.state.order)) {
this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty'})
this.setState({ errorOrder: true, msgErrOrder: 'Order Cannot be Empty.'})
}
else if (R.isNil(this.state.getApprovedBy)) {
this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty' })
this.setState({ errorApproved: true, msgErrApproved: 'Approver Name Cannot be Empty.' })
}
else if (R.isNil(this.state.getOperators)) {
this.setState({ errorOperator: true, msgErrOperator: 'Operator Cannot be Empty' })
this.setState({ errorOperator: true, msgErrOperator: 'Operator Cannot be Empty.' })
}
else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty' })
this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty.' })
} else if (R.isEmpty(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty' })
this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty.' })
} else {
console.log('masuk');
if (this.props.type == 'edit') {
......
......@@ -145,6 +145,7 @@ export default class TaxPlanning extends Component {
} else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
this.forceUpdate()
// console.log(this.state.dataTable)
// this.setState({
// data: a,
......@@ -195,23 +196,23 @@ export default class TaxPlanning extends Component {
)
}
}
}, {
name: "31 Dec 2020 Actual",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({
style: {
position: "sticky",
left: 420,
background: "white",
zIndex: 101
}
})
}
// }, {
// name: "31 Dec 2020 Actual",
// options: {
// customHeadRender: (columnMeta) => (
// <TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
// <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
// </TableCell>
// ),
// setCellProps: () => ({
// style: {
// position: "sticky",
// left: 420,
// background: "white",
// zIndex: 101
// }
// })
// }
}, {
name: "January 2021",
options: {
......@@ -234,7 +235,7 @@ export default class TaxPlanning extends Component {
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
placeholder="input"
value={value}
onChange={event => {
// console.log(event.target)
......@@ -304,7 +305,7 @@ export default class TaxPlanning extends Component {
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: '100%', backgroundColor: 'transparent' }}
type="text"
placeholder=""
placeholder="input"
value={value}
onChange={event => {
// console.log(event.target)
......
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