Commit b0268411 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

++

See merge request !403
parents da660f5d 498a0b3e
......@@ -38,7 +38,7 @@ const create = (type = "") => {
'Content-Type': 'application/json',
},
// 40 second timeout...
timeout: 60000
timeout: 100000
})
break;
default:
......
......@@ -268,7 +268,7 @@ export default class BudgetTahunan extends Component {
this.setState({
submissionID: response.data.data.submission_id, isSubmit: false,
submitter: response.data.data.submitter,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null? '' : response.data.data.approver,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status
}, () => {
this.setState({ loading: false })
......@@ -319,15 +319,15 @@ export default class BudgetTahunan extends Component {
}
approvalSubmission(type) {
this.setState({loading: true})
this.setState({ loading: true })
let body = {
"approval_id": this.props.location.state == undefined? this.state.approverID : this.state.rawData.approval_id,
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type,
"detail": this.state.detailRevisiCheck
}
api.create().approvalSubmission(body).then((res) => {
console.log(res)
this.setState({loading: false}, () => {
this.setState({ loading: false }, () => {
this.checkApprover()
})
})
......@@ -462,12 +462,22 @@ export default class BudgetTahunan extends Component {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.getCompanyActive()
this.getSubmission()
this.getReport()
this.getReportAttachment()
} else {
this.setState({ loading: false })
this.setState({ loading: false }, () => {
this.getSubmission()
this.getReport()
this.getReportAttachment()
})
}
} else {
this.setState({ loading: false })
this.setState({ loading: false }, ()=> {
this.getSubmission()
this.getReport()
this.getReportAttachment()
})
}
})
}
......@@ -624,8 +634,8 @@ export default class BudgetTahunan extends Component {
value={val}
control={
<Checkbox
checked={this.state.detailRevisiCheck.findIndex((val) => val.report_id == tableMeta.rowData[0]) == -1? false : true}
onClick={() => handleCheckRevision(tableMeta.rowData)}/>
checked={this.state.detailRevisiCheck.findIndex((val) => val.report_id == tableMeta.rowData[0]) == -1 ? false : true}
onClick={() => handleCheckRevision(tableMeta.rowData)} />
}
/>
</div >
......@@ -675,7 +685,7 @@ export default class BudgetTahunan extends Component {
detailRevisiCheck[indexId].remarks = value
}
this.setState({dataTableRevision, detailRevisiCheck})
this.setState({ dataTableRevision, detailRevisiCheck })
}
const handleCheckRevision = (value) => {
......@@ -691,7 +701,7 @@ export default class BudgetTahunan extends Component {
} else {
detailRevisiCheck.splice(indexId, 1)
}
this.setState({detailRevisiCheck})
this.setState({ detailRevisiCheck })
console.log(detailRevisiCheck)
}
......@@ -926,7 +936,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.setState({visibleRevision: true})}
onClick={() => this.setState({ visibleRevision: true })}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Revision</Typography>
......@@ -1214,7 +1224,7 @@ export default class BudgetTahunan extends Component {
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
type="button"
onClick={() => this.setState({visibleRevision: false})}
onClick={() => this.setState({ visibleRevision: false })}
>
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
......@@ -1224,7 +1234,7 @@ export default class BudgetTahunan extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => this.setState({visibleRevision: false}, () => this.approvalSubmission('revision'))}
onClick={() => this.setState({ visibleRevision: false }, () => this.approvalSubmission('revision'))}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Revision</span>
......
......@@ -331,11 +331,11 @@ export default class BalanceSheet extends Component {
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[23].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true })
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// console.log(this.state.dataTable);
......@@ -2220,7 +2220,7 @@ export default class BalanceSheet extends Component {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false })
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
}, 100);
})
}}
......@@ -2231,16 +2231,23 @@ export default class BalanceSheet extends Component {
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () =>
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadBalanceSheet('draft')
}, 100);
})
)}
style={{ marginRight: 20 }}
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
......@@ -2248,15 +2255,22 @@ export default class BalanceSheet extends Component {
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () =>
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadBalanceSheet('submitted')
}, 100);
})
)}
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
......
......@@ -48,7 +48,7 @@ const theme = createMuiTheme({
}
}
},
});
});
export default class CorporateAnnualTarget extends Component {
constructor(props) {
......@@ -65,7 +65,7 @@ export default class CorporateAnnualTarget extends Component {
loading: false,
uomList: [],
formulaYtdList: {
options: [{value: 'SUM'}, {value: 'AVG'}, {value: 'LAST'}],
options: [{ value: 'SUM' }, { value: 'AVG' }, { value: 'LAST' }],
getOptionLabel: (option) => titleCase(option.value),
},
kpiTypeList: [],
......@@ -77,7 +77,8 @@ export default class CorporateAnnualTarget extends Component {
dataReal: [],
buttonDraft: true,
updateBy: '',
handleTekTekTek: 0
handleTekTekTek: 0,
editable: false
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -117,40 +118,40 @@ export default class CorporateAnnualTarget extends Component {
item.level,
"",
item.description,
item.type_report_id == 1? `${Number(item.weight) * 100}%` : item.cat.weight,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.cat.weight,
item.cat.uom,
item.cat.kpi_type == "" ? null : {value: item.cat.kpi_type},
item.cat.max_ach == "" ? null : {value: item.cat.max_ach},
item.cat.formula == "" ? null : {value: item.cat.formula},
item.cat.total_actual_before == ""? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == ""? item.cat.january : String(item.cat.january).indexOf(".") == -1? Number(item.cat.january) : Number(item.cat.january).toFixed(1),
item.cat.february == ""? item.cat.february : String(item.cat.february).indexOf(".") == -1? Number(item.cat.february) : Number(item.cat.february).toFixed(1),
item.cat.march == ""? item.cat.march : String(item.cat.march).indexOf(".") == -1? Number(item.cat.march) : Number(item.cat.march).toFixed(1),
item.cat.april == ""? item.cat.april : String(item.cat.april).indexOf(".") == -1? Number(item.cat.april) : Number(item.cat.april).toFixed(1),
item.cat.may == ""? item.cat.may : String(item.cat.may).indexOf(".") == -1? Number(item.cat.may) : Number(item.cat.may).toFixed(1),
item.cat.june == ""? item.cat.june : String(item.cat.june).indexOf(".") == -1? Number(item.cat.june) : Number(item.cat.june).toFixed(1),
item.cat.july == ""? item.cat.july : String(item.cat.july).indexOf(".") == -1? Number(item.cat.july) : Number(item.cat.july).toFixed(1),
item.cat.august == ""? item.cat.august : String(item.cat.august).indexOf(".") == -1? Number(item.cat.august) : Number(item.cat.august).toFixed(1),
item.cat.september == ""? item.cat.september : String(item.cat.september).indexOf(".") == -1? Number(item.cat.september) : Number(item.cat.september).toFixed(1),
item.cat.october == ""? item.cat.october : String(item.cat.october).indexOf(".") == -1? Number(item.cat.october) : Number(item.cat.october).toFixed(1),
item.cat.november == ""? item.cat.november : String(item.cat.november).indexOf(".") == -1? Number(item.cat.november) : Number(item.cat.november).toFixed(1),
item.cat.december == ""? item.cat.december : String(item.cat.december).indexOf(".") == -1? Number(item.cat.december) : Number(item.cat.december).toFixed(1),
item.cat.total_current_year == ""? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == ""? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == ""? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.kpi_type == "" ? null : { value: item.cat.kpi_type },
item.cat.max_ach == "" ? null : { value: item.cat.max_ach },
item.cat.formula == "" ? null : { value: item.cat.formula },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1),
item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1),
item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1),
item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1),
item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1),
item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1),
item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1),
item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1),
item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1),
item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1),
item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1),
item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1),
item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic,
item.cat.pic
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item,index) => {
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
......@@ -159,39 +160,39 @@ export default class CorporateAnnualTarget extends Component {
item.level,
"",
item.description,
item.type_report_id == 1? `${Number(item.weight) * 100}%` : item.cat.weight,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.cat.weight,
item.cat.uom,
item.cat.kpi_type == "" ? null : {value: item.cat.kpi_type},
item.cat.max_ach == "" ? null : {value: item.cat.max_ach},
item.cat.formula == "" ? null : {value: item.cat.formula},
item.cat.total_actual_before == ""? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == ""? item.cat.january : String(item.cat.january).indexOf(".") == -1? Number(item.cat.january) : Number(item.cat.january).toFixed(1),
item.cat.february == ""? item.cat.february : String(item.cat.february).indexOf(".") == -1? Number(item.cat.february) : Number(item.cat.february).toFixed(1),
item.cat.march == ""? item.cat.march : String(item.cat.march).indexOf(".") == -1? Number(item.cat.march) : Number(item.cat.march).toFixed(1),
item.cat.april == ""? item.cat.april : String(item.cat.april).indexOf(".") == -1? Number(item.cat.april) : Number(item.cat.april).toFixed(1),
item.cat.may == ""? item.cat.may : String(item.cat.may).indexOf(".") == -1? Number(item.cat.may) : Number(item.cat.may).toFixed(1),
item.cat.june == ""? item.cat.june : String(item.cat.june).indexOf(".") == -1? Number(item.cat.june) : Number(item.cat.june).toFixed(1),
item.cat.july == ""? item.cat.july : String(item.cat.july).indexOf(".") == -1? Number(item.cat.july) : Number(item.cat.july).toFixed(1),
item.cat.august == ""? item.cat.august : String(item.cat.august).indexOf(".") == -1? Number(item.cat.august) : Number(item.cat.august).toFixed(1),
item.cat.september == ""? item.cat.september : String(item.cat.september).indexOf(".") == -1? Number(item.cat.september) : Number(item.cat.september).toFixed(1),
item.cat.october == ""? item.cat.october : String(item.cat.october).indexOf(".") == -1? Number(item.cat.october) : Number(item.cat.october).toFixed(1),
item.cat.november == ""? item.cat.november : String(item.cat.november).indexOf(".") == -1? Number(item.cat.november) : Number(item.cat.november).toFixed(1),
item.cat.december == ""? item.cat.december : String(item.cat.december).indexOf(".") == -1? Number(item.cat.december) : Number(item.cat.december).toFixed(1),
item.cat.total_current_year == ""? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == ""? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == ""? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.kpi_type == "" ? null : { value: item.cat.kpi_type },
item.cat.max_ach == "" ? null : { value: item.cat.max_ach },
item.cat.formula == "" ? null : { value: item.cat.formula },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1),
item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1),
item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1),
item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1),
item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1),
item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1),
item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1),
item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1),
item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1),
item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1),
item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1),
item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1),
item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic,
item.cat.pic
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({dataTable, loading: false, dataReal: res})
this.setState({ dataTable, loading: false, dataReal: res, editable: true })
})
}
......@@ -212,7 +213,7 @@ export default class CorporateAnnualTarget extends Component {
async downloadAllData() {
console.log('masuk')
let bram = [this.props.submissionID,this.props.report_id,this.props.company.company_id,this.props.periode,this.props.revision]
let bram = [this.props.submissionID, this.props.report_id, this.props.company.company_id, this.props.periode, this.props.revision]
console.log(bram)
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
......@@ -290,10 +291,10 @@ export default class CorporateAnnualTarget extends Component {
if (response.data) {
let idDelete = response.data.data.item_report_id
if (idDelete.length > 0) {
idDelete.map((item,index) => {
idDelete.map((item, index) => {
dataDelete.push(item)
})
this.setState({dataDelete})
this.setState({ dataDelete })
}
}
})
......@@ -314,27 +315,27 @@ export default class CorporateAnnualTarget extends Component {
item.level,
"",
item.item_report,
item.type_report_id == 1? `${Number(item.weight) * 100}%` : item.weight,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.weight,
item.uom,
item.kpi_type == "" || item.kpi_type == null? null : {value: item.kpi_type},
item.max_ach == "" || item.max_ach == null? null : {value: item.max_ach},
item.formula == "" || item.formula == null? null : {value: item.formula},
item.total_actual_before == ""? item.total_actual_before : String(item.total_actual_before).indexOf(".") == -1? Number(item.total_actual_before) : Number(item.total_actual_before).toFixed(1),
item.january == ""? item.january : String(item.january).indexOf(".") == -1? Number(item.january) : Number(item.january).toFixed(1),
item.february == ""? item.february : String(item.february).indexOf(".") == -1? Number(item.february) : Number(item.february).toFixed(1),
item.march == ""? item.march : String(item.march).indexOf(".") == -1? Number(item.march) : Number(item.march).toFixed(1),
item.april == ""? item.april : String(item.april).indexOf(".") == -1? Number(item.april) : Number(item.april).toFixed(1),
item.may == ""? item.may : String(item.may).indexOf(".") == -1? Number(item.may) : Number(item.may).toFixed(1),
item.june == ""? item.june : String(item.june).indexOf(".") == -1? Number(item.june) : Number(item.june).toFixed(1),
item.july == ""? item.july : String(item.july).indexOf(".") == -1? Number(item.july) : Number(item.july).toFixed(1),
item.august == ""? item.august : String(item.august).indexOf(".") == -1? Number(item.august) : Number(item.august).toFixed(1),
item.september == ""? item.september : String(item.september).indexOf(".") == -1? Number(item.september) : Number(item.september).toFixed(1),
item.october == ""? item.october : String(item.october).indexOf(".") == -1? Number(item.october) : Number(item.october).toFixed(1),
item.november == ""? item.november : String(item.november).indexOf(".") == -1? Number(item.november) : Number(item.november).toFixed(1),
item.december == ""? item.december : String(item.december).indexOf(".") == -1? Number(item.december) : Number(item.december).toFixed(1),
item.total_current_year == ""? item.total_current_year : String(item.total_current_year).indexOf(".") == -1? Number(item.total_current_year) : Number(item.total_current_year).toFixed(1),
item.total_next_year == ""? item.total_next_year : String(item.total_next_year).indexOf(".") == -1? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1),
item.total_more_year == ""? item.total_more_year : String(item.total_more_year).indexOf(".") == -1? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1),
item.kpi_type == "" || item.kpi_type == null ? null : { value: item.kpi_type },
item.max_ach == "" || item.max_ach == null ? null : { value: item.max_ach },
item.formula == "" || item.formula == null ? null : { value: item.formula },
item.total_actual_before == "" ? item.total_actual_before : String(item.total_actual_before).indexOf(".") == -1 ? Number(item.total_actual_before) : Number(item.total_actual_before).toFixed(1),
item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1),
item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1),
item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march).toFixed(1),
item.april == "" ? item.april : String(item.april).indexOf(".") == -1 ? Number(item.april) : Number(item.april).toFixed(1),
item.may == "" ? item.may : String(item.may).indexOf(".") == -1 ? Number(item.may) : Number(item.may).toFixed(1),
item.june == "" ? item.june : String(item.june).indexOf(".") == -1 ? Number(item.june) : Number(item.june).toFixed(1),
item.july == "" ? item.july : String(item.july).indexOf(".") == -1 ? Number(item.july) : Number(item.july).toFixed(1),
item.august == "" ? item.august : String(item.august).indexOf(".") == -1 ? Number(item.august) : Number(item.august).toFixed(1),
item.september == "" ? item.september : String(item.september).indexOf(".") == -1 ? Number(item.september) : Number(item.september).toFixed(1),
item.october == "" ? item.october : String(item.october).indexOf(".") == -1 ? Number(item.october) : Number(item.october).toFixed(1),
item.november == "" ? item.november : String(item.november).indexOf(".") == -1 ? Number(item.november) : Number(item.november).toFixed(1),
item.december == "" ? item.december : String(item.december).indexOf(".") == -1 ? Number(item.december) : Number(item.december).toFixed(1),
item.total_current_year == "" ? item.total_current_year : String(item.total_current_year).indexOf(".") == -1 ? Number(item.total_current_year) : Number(item.total_current_year).toFixed(1),
item.total_next_year == "" ? item.total_next_year : String(item.total_next_year).indexOf(".") == -1 ? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1),
item.total_more_year == "" ? item.total_more_year : String(item.total_more_year).indexOf(".") == -1 ? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1),
item.strategic,
item.pic,
item.error
......@@ -342,11 +343,11 @@ export default class CorporateAnnualTarget extends Component {
})
console.log(dataTable)
console.log(this.state.buttonError)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[30].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true })
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// console.log(this.state.dataTable);
......@@ -357,7 +358,7 @@ export default class CorporateAnnualTarget extends Component {
}
uploadCAT(type) {
let payload = {"item_report_id": this.state.dataDelete}
let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => {
......@@ -378,25 +379,25 @@ export default class CorporateAnnualTarget extends Component {
"item_report": String(i[6]),
"weight": String(i[7]),
"uom": String(i[8]),
"kpi_type": i[9] == null? "" : i[9].value,
"max_ach": i[10] == null? "" : i[10].value,
"formula": i[11] == null? "" : i[11].value,
"total_actual_before": String(i[12]),
"january": String(i[13]),
"february": String(i[14]),
"march": String(i[15]),
"april": String(i[16]),
"may": String(i[17]),
"june": String(i[18]),
"july": String(i[19]),
"august": String(i[20]),
"september": String(i[21]),
"october": String(i[22]),
"november": String(i[23]),
"december": String(i[24]),
"total_current_year": String(i[25]),
"total_next_year": String(i[26]),
"total_more_year": String(i[27]),
"kpi_type": i[9] == null ? "" : i[9].value,
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": String(i[13]) == "" ? "0.0" : String(i[13]),
"february": String(i[14]) == "" ? "0.0" : String(i[14]),
"march": String(i[15]) == "" ? "0.0" : String(i[15]),
"april": String(i[16]) == "" ? "0.0" : String(i[16]),
"may": String(i[17]) == "" ? "0.0" : String(i[17]),
"june": String(i[18]) == "" ? "0.0" : String(i[18]),
"july": String(i[19]) == "" ? "0.0" : String(i[19]),
"august": String(i[20]) == "" ? "0.0" : String(i[20]),
"september": String(i[21]) == "" ? "0.0" : String(i[21]),
"october": String(i[22]) == "" ? "0.0" : String(i[22]),
"november": String(i[23]) == "" ? "0.0" : String(i[23]),
"december": String(i[24]) == "" ? "0.0" : String(i[24]),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]),
"strategic": String(i[28]),
"pic": String(i[29])
})
......@@ -434,29 +435,29 @@ export default class CorporateAnnualTarget extends Component {
// console.log(i[9] == null? "" : i[9].value)
data.push({
"item_report_id": i[1],
"item_name": i[1] == ""? null : String(i[6]),
"parent": i[1] == ""? null : i[2],
"item_name": i[1] == "" ? null : String(i[6]),
"parent": i[1] == "" ? null : i[2],
"weight": String(i[7]),
"uom": String(i[8]),
"kpi_type": i[9] == null? "" : i[9].value,
"max_ach": i[10] == null? "" : i[10].value,
"formula": i[11] == null? "" : i[11].value,
"total_actual_before": String(i[12]) == ""? "0,0" : String(i(12)),
"january": String(i[13]) == ""? "0,0" : String(i[13]),
"february": String(i[14]) == ""? "0,0" : String(i[14]),
"march": String(i[15]) == ""? "0,0" : String(i[15]),
"april": String(i[16]) == ""? "0,0" : String(i[16]),
"may": String(i[17]) == ""? "0,0" : String(i[17]),
"june": String(i[18]) == ""? "0,0" : String(i[18]),
"july": String(i[19]) == ""? "0,0" : String(i[19]),
"august": String(i[20]) == ""? "0,0" : String(i[20]),
"september": String(i[21]) == ""? "0,0" : String(i[21]),
"october": String(i[22]) == ""? "0,0" : String(i[22]),
"november": String(i[23]) == ""? "0,0" : String(i[23]),
"december": String(i[24]) == ""? "0,0" : String(i[24]),
"total_current_year": String(i[25]) == ""? "0,0" : String(i[25]),
"total_next_year": String(i[26]) == ""? "0,0" : String(i[26]),
"total_more_year": String(i[27]) == ""? "0,0" : String(i[27]),
"kpi_type": i[9] == null ? "" : i[9].value,
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": String(i[13]) == "" ? "0.0" : String(i[13]),
"february": String(i[14]) == "" ? "0.0" : String(i[14]),
"march": String(i[15]) == "" ? "0.0" : String(i[15]),
"april": String(i[16]) == "" ? "0.0" : String(i[16]),
"may": String(i[17]) == "" ? "0.0" : String(i[17]),
"june": String(i[18]) == "" ? "0.0" : String(i[18]),
"july": String(i[19]) == "" ? "0.0" : String(i[19]),
"august": String(i[20]) == "" ? "0.0" : String(i[20]),
"september": String(i[21]) == "" ? "0.0" : String(i[21]),
"october": String(i[22]) == "" ? "0.0" : String(i[22]),
"november": String(i[23]) == "" ? "0.0" : String(i[23]),
"december": String(i[24]) == "" ? "0.0" : String(i[24]),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]),
"strategic": String(i[28]),
"pic": String(i[29])
})
......@@ -471,7 +472,7 @@ export default class CorporateAnnualTarget extends Component {
"cat": data
}
let totalWeight = 0
this.state.dataTable.map((items,indexs) => {
this.state.dataTable.map((items, indexs) => {
if (items[0] !== 1 || items[0] !== 4) {
console.log(items[7])
totalWeight += Number(items[7].replace('%', ''))
......@@ -484,7 +485,7 @@ export default class CorporateAnnualTarget extends Component {
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true })
this.setState({ loading: false, buttonError: false, editable: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true })
}
......@@ -503,29 +504,29 @@ export default class CorporateAnnualTarget extends Component {
// console.log(i[9] == null? "" : i[9].value)
data.push({
"item_report_id": i[1],
"item_name": i[1] == ""? null : String(i[6]),
"parent": i[1] == ""? null : i[2],
"item_name": i[1] == "" ? null : String(i[6]),
"parent": i[1] == "" ? null : i[2],
"weight": String(i[7]),
"uom": String(i[8]),
"kpi_type": i[9] == null? "" : i[9].value,
"max_ach": i[10] == null? "" : i[10].value,
"formula": i[11] == null? "" : i[11].value,
"total_actual_before": String(i[12]) == ""? "0,0" : String(i(12)),
"january": String(i[13]) == ""? "0,0" : String(i[13]),
"february": String(i[14]) == ""? "0,0" : String(i[14]),
"march": String(i[15]) == ""? "0,0" : String(i[15]),
"april": String(i[16]) == ""? "0,0" : String(i[16]),
"may": String(i[17]) == ""? "0,0" : String(i[17]),
"june": String(i[18]) == ""? "0,0" : String(i[18]),
"july": String(i[19]) == ""? "0,0" : String(i[19]),
"august": String(i[20]) == ""? "0,0" : String(i[20]),
"september": String(i[21]) == ""? "0,0" : String(i[21]),
"october": String(i[22]) == ""? "0,0" : String(i[22]),
"november": String(i[23]) == ""? "0,0" : String(i[23]),
"december": String(i[24]) == ""? "0,0" : String(i[24]),
"total_current_year": String(i[25]) == ""? "0,0" : String(i[25]),
"total_next_year": String(i[26]) == ""? "0,0" : String(i[26]),
"total_more_year": String(i[27]) == ""? "0,0" : String(i[27]),
"kpi_type": i[9] == null ? "" : i[9].value,
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": String(i[13]) == "" ? "0.0" : String(i[13]),
"february": String(i[14]) == "" ? "0.0" : String(i[14]),
"march": String(i[15]) == "" ? "0.0" : String(i[15]),
"april": String(i[16]) == "" ? "0.0" : String(i[16]),
"may": String(i[17]) == "" ? "0.0" : String(i[17]),
"june": String(i[18]) == "" ? "0.0" : String(i[18]),
"july": String(i[19]) == "" ? "0.0" : String(i[19]),
"august": String(i[20]) == "" ? "0.0" : String(i[20]),
"september": String(i[21]) == "" ? "0.0" : String(i[21]),
"october": String(i[22]) == "" ? "0.0" : String(i[22]),
"november": String(i[23]) == "" ? "0.0" : String(i[23]),
"december": String(i[24]) == "" ? "0.0" : String(i[24]),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]),
"strategic": String(i[28]),
"pic": String(i[29])
})
......@@ -544,7 +545,7 @@ export default class CorporateAnnualTarget extends Component {
}
deleteReport(payloadBro) {
let payload = {"item_report_id": this.state.dataDelete}
let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => {
......@@ -685,17 +686,17 @@ export default class CorporateAnnualTarget extends Component {
let total = 0
let lastValz = 0
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
dataTable2[tableMeta.rowIndex].map((item,index) => {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 13 && index <= 24) {
let valItem = item == undefined || item == ""? 0 : item
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
if (index == 24) {
lastValz += Number(valItem)
}
}
})
let valz = dataTable2[tableMeta.rowIndex][11] == null? 'SUM' : dataTable2[tableMeta.rowIndex][11].value
dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM'? total : (valz == 'AVG'? (total / 12) : lastValz))
let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value
dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
console.log(dataTable2[tableMeta.rowIndex])
}
......@@ -705,16 +706,16 @@ export default class CorporateAnnualTarget extends Component {
let total = 0
let lastValz = 0
if (valz == 'SUM' || valz == 'AVG' || valz == 'LAST') {
dataTable2[tableMeta.rowIndex].map((item,index) => {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 13 && index <= 24) {
let valItem = item == undefined || item == ""? 0 : item
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
if (index == 24) {
lastValz += Number(valItem)
}
}
})
dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM'? total : (valz == 'AVG'? (total / 12) : lastValz))
dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
}
}
......@@ -728,9 +729,9 @@ export default class CorporateAnnualTarget extends Component {
valParent.replace('%', '')
let valChild = 0
dataTable2.map((item,index) => {
if(item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) {
let weightItem = item[7] == ""? 0 : item[7].replace('%', '')
dataTable2.map((item, index) => {
if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) {
let weightItem = item[7] == "" ? 0 : item[7].replace('%', '')
console.log(weightItem)
valChild += Number(weightItem)
}
......@@ -812,9 +813,9 @@ export default class CorporateAnnualTarget extends Component {
}
})
dataTable2 = newData
this.setState({dataTable: dataTable2}, () => {
this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => {
this.setState({loading: false})
this.setState({ loading: false })
}, 500)
})
}
......@@ -824,9 +825,9 @@ export default class CorporateAnnualTarget extends Component {
dataDelete.push(dataTable2[index][1])
}
dataTable2.splice(index, 1)
this.setState({dataTable: dataTable2, dataDelete}, () => {
this.setState({ dataTable: dataTable2, dataDelete }, () => {
setTimeout(() => {
this.setState({loading: false})
this.setState({ loading: false })
}, 500)
})
}
......@@ -860,9 +861,9 @@ export default class CorporateAnnualTarget extends Component {
name: "",
options: {
filter: false,
display: this.props.isApprover? false : true,
display: this.props.isApprover ? false : true,
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#dbdbdb'}}>
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#dbdbdb' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -881,8 +882,8 @@ export default class CorporateAnnualTarget extends Component {
}}
// onClick={() => console.log(tableMeta.rowData[1])}
onClick={() => {
this.setState({loading: true})
handleTambah(tableMeta.rowData[1],tableMeta.rowIndex)
this.setState({ loading: true })
handleTambah(tableMeta.rowData[1], tableMeta.rowIndex)
}}
>
<img src={Images.add} />
......@@ -899,7 +900,7 @@ export default class CorporateAnnualTarget extends Component {
marginLeft: 5
}}
onClick={() => {
this.setState({loading: true})
this.setState({ loading: true })
handleDelete(tableMeta.rowIndex)
}}
>
......@@ -915,7 +916,7 @@ export default class CorporateAnnualTarget extends Component {
name: "Key Performance Indicator",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8'}}>
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell>
),
......@@ -956,8 +957,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
tableMeta.rowData[1] == null?
<div style={{ paddingLeft: 20}}>
tableMeta.rowData[1] == null ?
<div style={{ paddingLeft: 20 }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
......@@ -968,8 +969,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
tableMeta.rowData[1] == null?
<div style={{ paddingLeft: 20}}>
tableMeta.rowData[1] == null ?
<div style={{ paddingLeft: 20 }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
......@@ -993,7 +994,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
tableMeta.rowData[0] === 1 ?
value
......@@ -1029,20 +1030,20 @@ export default class CorporateAnnualTarget extends Component {
name: "UOM",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8'}}>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
!handleAction(tableMeta.rowData[2])?
!handleAction(tableMeta.rowData[2]) ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
......@@ -1050,7 +1051,7 @@ export default class CorporateAnnualTarget extends Component {
placeholder=""
defaultValue={value}
color={"#5198ea"}
disabled={this.props.isApprover? true : !handleAction(tableMeta.rowData[2])}
disabled={this.props.isApprover ? true : !handleAction(tableMeta.rowData[2])}
onBlur={(event) => {
console.log(event.target.value)
// updateValue(event.target.value)
......@@ -1066,7 +1067,7 @@ export default class CorporateAnnualTarget extends Component {
placeholder=""
defaultValue={value}
color={"#5198ea"}
disabled={this.props.isApprover? true : !handleAction(tableMeta.rowData[2])}
disabled={this.props.isApprover ? true : !handleAction(tableMeta.rowData[2])}
onBlur={(event) => {
console.log(event.target.value)
// updateValue(event.target.value)
......@@ -1093,7 +1094,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<Autocomplete
{...this.state.kpiTypeList}
......@@ -1101,12 +1102,12 @@ export default class CorporateAnnualTarget extends Component {
onChange={(event, newInputValue) => handleChangeDropdown(newInputValue, tableMeta)}
debug
disableClearable
disabled={this.props.isApprover? true : !handleAction(tableMeta.rowData[2])}
disabled={this.props.isApprover ? true : !handleAction(tableMeta.rowData[2])}
value={val}
style={{padding: 0, margin: 0}}
style={{ padding: 0, margin: 0 }}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{padding: 0, margin: 0}}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2])? "#5198ea" : "black"}} type="text" {...params.inputProps} />
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} />
</div>
}
/>
......@@ -1127,7 +1128,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<Autocomplete
{...this.state.maxAchList}
......@@ -1136,11 +1137,11 @@ export default class CorporateAnnualTarget extends Component {
debug
disableClearable
value={val}
style={{padding: 0, margin: 0}}
disabled={this.props.isApprover? true : !handleAction(tableMeta.rowData[2])}
style={{ padding: 0, margin: 0 }}
disabled={this.props.isApprover ? true : !handleAction(tableMeta.rowData[2])}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{padding: 0, margin: 0}}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2])? "#5198ea" : "black"}} type="text" {...params.inputProps} />
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} />
</div>
}
// value={this.state.parent}
......@@ -1161,23 +1162,24 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<Autocomplete
{...this.state.formulaYtdList}
id="formulaYtdList"
onChange={(event, newInputValue) => {
// updateValue(newInputValue)
handleChangeDropdown(newInputValue, tableMeta)}
handleChangeDropdown(newInputValue, tableMeta)
}
}
debug
disableClearable
value={val}
disabled={this.props.isApprover? true : !handleAction(tableMeta.rowData[2])}
style={{padding: 0, margin: 0}}
disabled={this.props.isApprover ? true : !handleAction(tableMeta.rowData[2])}
style={{ padding: 0, margin: 0 }}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{padding: 0, margin: 0}}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2])? "#5198ea" : "black"}} type="text" {...params.inputProps} />
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} />
</div>
}
// value={this.state.parent}
......@@ -1198,7 +1200,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1239,7 +1241,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1280,7 +1282,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1321,7 +1323,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1362,7 +1364,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1403,7 +1405,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1444,7 +1446,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1485,7 +1487,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1526,7 +1528,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1567,7 +1569,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1608,7 +1610,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1649,7 +1651,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1690,7 +1692,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1731,7 +1733,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<FormControlLabel
style={{ margin: 0 }}
......@@ -1769,7 +1771,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1810,7 +1812,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1851,7 +1853,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<FormControlLabel
style={{ margin: 0 }}
......@@ -1890,7 +1892,7 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<FormControlLabel
style={{ margin: 0 }}
......@@ -1945,7 +1947,7 @@ export default class CorporateAnnualTarget extends Component {
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleCAT? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
{this.state.visibleCAT ? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Corporate Annual Target</Typography>
</div>
......@@ -2035,7 +2037,8 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100)})}
}, 100)
})}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
......@@ -2054,7 +2057,7 @@ export default class CorporateAnnualTarget extends Component {
marginRight: 20
}}
onClick={() =>
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false}, () => {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
......@@ -2070,15 +2073,17 @@ export default class CorporateAnnualTarget extends Component {
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
disabled={this.state.buttonDraft}
onClick={() =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft')
})
}
......@@ -2090,11 +2095,11 @@ export default class CorporateAnnualTarget extends Component {
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.state.buttonError?
onClick={() => this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
......@@ -2161,7 +2166,7 @@ export default class CorporateAnnualTarget extends Component {
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false })
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
}, 100)
})
}
......@@ -2177,19 +2182,20 @@ export default class CorporateAnnualTarget extends Component {
disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
cursor: this.state.editable === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
onClick={() => this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("draft")
}, 100);
})
)}
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
......@@ -2197,15 +2203,22 @@ export default class CorporateAnnualTarget extends Component {
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("submitted")
}, 100);
})
)}
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
......
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