Commit b5ac7491 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'rifka' into 'master'

update validasi dan taxplan

See merge request !210
parents 64ef8ee2 75f870df
...@@ -54,7 +54,8 @@ export default class CreateApprovalMatrix extends Component { ...@@ -54,7 +54,8 @@ export default class CreateApprovalMatrix extends Component {
getUserData() { getUserData() {
api.create().getApprovedByAM().then((response) => { api.create().getApprovedByAM().then((response) => {
if(response.status == null){ 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') { else if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
...@@ -71,7 +72,8 @@ export default class CreateApprovalMatrix extends Component { ...@@ -71,7 +72,8 @@ export default class CreateApprovalMatrix extends Component {
}; };
this.setState({ approvedBy: defaultProps, userData: response.data.data}) this.setState({ approvedBy: defaultProps, userData: response.data.data})
} else { } 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 { ...@@ -92,7 +94,8 @@ export default class CreateApprovalMatrix extends Component {
}; };
this.setState({ types: typeProps, typeData: response.data.data }) this.setState({ types: typeProps, typeData: response.data.data })
} else { } 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 { ...@@ -114,7 +117,8 @@ export default class CreateApprovalMatrix extends Component {
}; };
this.setState({ operators: operatorProps, operatorData: response.data.data }) this.setState({ operators: operatorProps, operatorData: response.data.data })
} else { } 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 { ...@@ -157,22 +161,22 @@ export default class CreateApprovalMatrix extends Component {
validasi() { validasi() {
if (R.isNil(this.state.typeId)) { 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)) { 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)) { else if (R.isNil(this.state.userId)) {
// return alert("Pemberi Persetujuan tidak boleh kosong"); // 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)) { 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)) { 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)) { } 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 { } else {
console.log('masuk'); console.log('masuk');
let payload = { let payload = {
......
...@@ -13,6 +13,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -13,6 +13,7 @@ export default class EditApprovalMatrix extends Component {
this.state = { this.state = {
id: '', id: '',
order: '', order: '',
status: "",
startDate: null, startDate: null,
endDate: null, endDate: null,
date: new Date(), date: new Date(),
...@@ -86,9 +87,12 @@ export default class EditApprovalMatrix extends Component { ...@@ -86,9 +87,12 @@ export default class EditApprovalMatrix extends Component {
options: userData, options: userData,
getOptionLabel: (option) => option.fullname, 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 { } 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 { ...@@ -108,9 +112,10 @@ export default class EditApprovalMatrix extends Component {
options: operatorData, options: operatorData,
getOptionLabel: (option) => option.operator_type_name, 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 { } 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 { ...@@ -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] }) this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0]: typeData[index] })
} else { } 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 { ...@@ -176,21 +182,21 @@ export default class EditApprovalMatrix extends Component {
validasi() { validasi() {
if (R.isNil(this.state.getTypes)) { 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)) { 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)) { 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)) { 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)) { 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)) { } 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 { } else {
console.log('masuk'); console.log('masuk');
if (this.props.type == 'edit') { if (this.props.type == 'edit') {
......
...@@ -145,6 +145,7 @@ export default class TaxPlanning extends Component { ...@@ -145,6 +145,7 @@ export default class TaxPlanning extends Component {
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
this.forceUpdate()
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
// this.setState({ // this.setState({
// data: a, // data: a,
...@@ -195,23 +196,23 @@ export default class TaxPlanning extends Component { ...@@ -195,23 +196,23 @@ export default class TaxPlanning extends Component {
) )
} }
} }
}, { // }, {
name: "31 Dec 2020 Actual", // name: "31 Dec 2020 Actual",
options: { // options: {
customHeadRender: (columnMeta) => ( // customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}> // <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> // <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> // </TableCell>
), // ),
setCellProps: () => ({ // setCellProps: () => ({
style: { // style: {
position: "sticky", // position: "sticky",
left: 420, // left: 420,
background: "white", // background: "white",
zIndex: 101 // zIndex: 101
} // }
}) // })
} // }
}, { }, {
name: "January 2021", name: "January 2021",
options: { options: {
...@@ -234,7 +235,7 @@ export default class TaxPlanning extends Component { ...@@ -234,7 +235,7 @@ export default class TaxPlanning extends Component {
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder="input"
value={value} value={value}
onChange={event => { onChange={event => {
// console.log(event.target) // console.log(event.target)
...@@ -304,7 +305,7 @@ export default class TaxPlanning extends Component { ...@@ -304,7 +305,7 @@ export default class TaxPlanning extends Component {
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: '100%', backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: '100%', backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder="input"
value={value} value={value}
onChange={event => { onChange={event => {
// console.log(event.target) // 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