Commit 498a0b3e authored by Deni Rinaldi's avatar Deni Rinaldi

++

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