Commit b155406f authored by r.kurnia's avatar r.kurnia

control should be nil done

parent 4de9dcb5
......@@ -1989,7 +1989,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover == true ? true : false}
value={Number(value.tbc).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2107,7 +2107,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// disabled={this.props.isApprover == true ? true : false}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(1) : Number(value.fcp).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 1)
......@@ -2224,7 +2224,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover == true ? true : false}
value={Number(value.tbf).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2376,7 +2376,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover == true ? true : false}
value={Number(value.tbc).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2494,7 +2494,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
// disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// disabled={this.props.isApprover == true ? true : false}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(1) : Number(value.fcp).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 1)
......@@ -2611,7 +2611,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover == true ? true : false}
value={Number(value.tbf).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2754,7 +2754,7 @@ export default class TaxPlanningOLPA extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover == true ? true : false}
value={Number(handleTotal(tableMeta, 3)).toFixed(1)}
/>
}
......@@ -3186,7 +3186,8 @@ export default class TaxPlanningOLPA extends Component {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
// this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
this.handleValidate()
}, 100);
})
}}
......
......@@ -105,7 +105,7 @@ export default class TaxPlanning extends Component {
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.setState({loading: true, get_for: type}, () => {
this.getSettingControl()
this.getLatestUpdate()
console.log("masukhandle")
......@@ -741,103 +741,52 @@ export default class TaxPlanning extends Component {
}
handleValidate() {
let data = []
// let data = []
let errorContrl = this.state.buttonError
let editAble = this.state.editAble
console.log(this.state.dataTable)
// this.state.dataTable.map(i => {
// // console.log(i[0])
// data.push({
// item_report_id: i[4],
// january: {
// tbc: i[1] === 3 && i[9].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[9].tbc.value).toFixed(1)) : String(Number(i[9].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[9].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[9].fcp.value).toFixed(1)) : String(Number(i[9].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[9].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[9].tbf.value).toFixed(1)) : String(Number(i[9].tbf).toFixed(1))
// },
// february: {
// tbc: i[1] === 3 && i[10].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[10].tbc.value).toFixed(1)) : String(Number(i[10].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[10].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[10].fcp.value).toFixed(1)) : String(Number(i[10].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[10].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[10].tbf.value).toFixed(1)) : String(Number(i[10].tbf).toFixed(1))
// },
// march: {
// tbc: i[1] === 3 && i[11].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[11].tbc.value).toFixed(1)) : String(Number(i[11].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[11].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[11].fcp.value).toFixed(1)) : String(Number(i[11].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[11].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[11].tbf.value).toFixed(1)) : String(Number(i[11].tbf).toFixed(1))
// },
// april: {
// tbc: i[1] === 3 && i[12].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[12].tbc.value).toFixed(1)) : String(Number(i[12].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[12].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[12].fcp.value).toFixed(1)) : String(Number(i[12].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[12].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[12].tbf.value).toFixed(1)) : String(Number(i[12].tbf).toFixed(1))
// },
// may: {
// tbc: i[1] === 3 && i[13].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[13].tbc.value).toFixed(1)) : String(Number(i[13].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[13].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[13].fcp.value).toFixed(1)) : String(Number(i[13].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[13].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[13].tbf.value).toFixed(1)) : String(Number(i[13].tbf).toFixed(1))
// },
// june: {
// tbc: i[1] === 3 && i[14].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[14].tbc.value).toFixed(1)) : String(Number(i[14].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[14].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[14].fcp.value).toFixed(1)) : String(Number(i[14].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[14].tbc === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[14].tbf.value).toFixed(1)) : String(Number(i[14].tbf).toFixed(1))
// },
// july: {
// tbc: i[1] === 3 && i[15].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[15].tbc.value).toFixed(1)) : String(Number(i[15].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[15].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[15].fcp.value).toFixed(1)) : String(Number(i[15].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[15].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[15].tbf.value).toFixed(1)) : String(Number(i[15].tbf).toFixed(1))
// },
// august: {
// tbc: i[1] === 3 && i[16].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[16].tbc.value).toFixed(1)) : String(Number(i[16].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[16].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[16].fcp.value).toFixed(1)) : String(Number(i[16].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[16].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[16].tbf.value).toFixed(1)) : String(Number(i[16].tbf).toFixed(1))
// },
// september: {
// tbc: i[1] === 3 && i[17].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[17].tbc.value).toFixed(1)) : String(Number(i[17].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[17].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[17].fcp.value).toFixed(1)) : String(Number(i[17].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[17].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[17].tbf.value).toFixed(1)) : String(Number(i[17].tbf).toFixed(1))
// },
// october: {
// tbc: i[1] === 3 && i[18].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[18].tbc.value).toFixed(1)) : String(Number(i[18].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[18].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[18].fcp.value).toFixed(1)) : String(Number(i[18].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[18].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[18].tbf.value).toFixed(1)) : String(Number(i[18].tbf).toFixed(1))
// },
// november: {
// tbc: i[1] === 3 && i[19].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[19].tbc.value).toFixed(1)) : String(Number(i[19].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[19].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[19].fcp.value).toFixed(1)) : String(Number(i[19].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[19].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[19].tbf.value).toFixed(1)) : String(Number(i[19].tbf).toFixed(1))
// },
// december: {
// tbc: i[1] === 3 && i[20].tbc === "" ? "0.0" : i[1] === 5 || i[1] === 6 || i[1] === 7 ? String(Number(i[20].tbc.value).toFixed(1)) : String(Number(i[20].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[20].fcp === "" ? "0.0" : i[2] === 5 || i[2] === 6 || i[2] === 7 ? String(Number(i[20].fcp.value).toFixed(1)) : String(Number(i[20].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[20].tbf === "" ? "0.0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(Number(i[20].tbf.value).toFixed(1)) : String(Number(i[20].tbf).toFixed(1))
// },
// total_current_year: i[2] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
// total_next_year: {
// tbc: i[1] === 3 && i[22].tbc === "" ? "0.0" : String(Number(i[22].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[22].fcp === "" ? "0.0" : String(Number(i[22].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[22].tbf === "" ? "0.0" : String(Number(i[22].tbf).toFixed(1))
// },
// total_more_year: {
// tbc: i[1] === 3 && i[23].tbc === "" ? "0.0" : String(Number(i[23].tbc).toFixed(1)),
// fcp: i[2] === 3 && i[23].fcp === "" ? "0.0" : String(Number(i[23].fcp).toFixed(1)),
// tbf: i[3] === 3 && i[23].tbf === "" ? "0.0" : String(Number(i[23].tbf).toFixed(1))
this.state.dataTable.map((i, index) => {
if (String(i[8]) == "Control (should be nil)") {
this.setState({ loading: true })
let n = 0
for (n = 9; n <= 20; n++) {
if ((Number(i[n].tbf.value) < Number(this.state.minValue) || Number(i[n].tbf.value) > Number(this.state.maxValue))) {
errorContrl = true
editAble = true
break
}
else {
errorContrl = false
editAble = false
}
}
}
})
// this.state.dataTable[tableMeta.rowIndex].map((i, index) => {
// if (String(i[8]) == "Control (should be nil)") {
// this.setState({ loading: true })
// let n = 0
// if (index >= 9 && index <=20) {
// if ((Number(i[index].tbf.value) < Number(this.state.minValue) || Number(i[index].tbf.value) > Number(this.state.maxValue))) {
// errorContrl = true
// editAble = true
// }
// else {
// errorContrl = false
// editAble = false
// }
// })
// })
// let payload = {
// "submission_id": this.props.submissionID,
// "company_id": this.props.company.company_id,
// "periode": this.props.periode,
// "report_id": this.props.report_id,
// "tax_planning": data,
// "status": "submitted"
// }
// // console.log(JSON.stringify(payload));
// api.create().validateSubmitReport(payload).then((response) => {
// // console.log(response)
// if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
// // alert("Type Input Can't be Empty")
// } else {
// this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
// }
// })
// api.create().validateSubmitReport(payload).then((response) => {
console.log(errorContrl)
console.log(editAble)
if (errorContrl === false && editAble === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
}
downloadTemplate = async () => {
......
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