Commit ac9aac2c authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !399
parents 3243630e f1735a80
......@@ -24,7 +24,7 @@ const create = (type = "") => {
'Content-Type': 'application/json',
},
// 60 second timeout...
timeout: 30000
timeout: 60000
})
break;
case 'UPLOAD':
......@@ -38,7 +38,7 @@ const create = (type = "") => {
'Content-Type': 'application/json',
},
// 40 second timeout...
timeout: 50000
timeout: 60000
})
break;
default:
......
import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, Snackbar, withStyles, createMuiTheme, MuiThemeProvider, Checkbox } from '@material-ui/core';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, Snackbar, withStyles, createMuiTheme, MuiThemeProvider, Checkbox, Input } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images';
import BalanceSheet from './BudgetTahunan/BalanceSheet';
......@@ -54,7 +54,10 @@ export default class BudgetTahunan extends Component {
visibleTableHistory: false,
isApprover: false,
lastStatus: "",
intent: ""
intent: "",
approverID: null,
pic: '',
detailRevisiCheck: []
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -123,7 +126,7 @@ export default class BudgetTahunan extends Component {
})
let dataTableRevision = response.data.data.map((item, index) => {
return [
"",
item.report_id,
item.report_name,
""
]
......@@ -263,6 +266,7 @@ export default class BudgetTahunan extends Component {
if (response.data.data) {
this.setState({
submissionID: response.data.data.submission_id, isSubmit: false,
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 })
......@@ -313,18 +317,18 @@ export default class BudgetTahunan extends Component {
}
approvalSubmission(type) {
this.setState({loading: true})
let body = {
"approval_id": this.state.rawData.approval_id,
"approval_id": this.props.location.state == undefined? this.state.approverID : this.state.rawData.approval_id,
"status": type,
"remarks": "tes",
"detail": [
{
"report_id": 1,
"remarks": ""
}
]
"detail": this.state.detailRevisiCheck
}
api.create().ApprovalSubmission(body)
api.create().approvalSubmission(body).then((res) => {
console.log(res)
this.setState({loading: false}, () => {
this.checkApprover()
})
})
}
clickDetail(item, id, revision, status) {
......@@ -618,16 +622,77 @@ 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)}/>
}
/>
</div >
);
}
}
}, "Report Type", "Remarks"
}, "Report Type",
{
name: 'Remarks',
options: {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'left' }}>
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
type="text"
placeholder=""
defaultValue={value}
color={"#5198ea"}
onBlur={(event) => {
// console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>}
/>
</div>
)
}
}
}
]
const handleChangeText = (value, tableMeta) => {
let dataTableRevision = this.state.dataTableRevision
dataTableRevision[tableMeta.rowIndex][tableMeta.columnIndex] = value
let detailRevisiCheck = this.state.detailRevisiCheck
let indexId = detailRevisiCheck.findIndex((val) => val.report_id == tableMeta.rowData[0])
if (indexId !== -1) {
detailRevisiCheck[indexId].remarks = value
}
this.setState({dataTableRevision, detailRevisiCheck})
}
const handleCheckRevision = (value) => {
let detailRevisiCheck = this.state.detailRevisiCheck
let payload = {
report_id: value[0],
remarks: value[2]
}
let indexId = detailRevisiCheck.findIndex((val) => val.report_id == value[0])
if (indexId == -1) {
detailRevisiCheck.push(payload)
} else {
detailRevisiCheck.splice(indexId, 1)
}
this.setState({detailRevisiCheck})
console.log(detailRevisiCheck)
}
const options = {
filter: false,
sort: false,
......@@ -808,7 +873,7 @@ export default class BudgetTahunan extends Component {
</div> :
this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center' }}>
<span>{this.state.lastStatus}</span>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> :
this.state.lastStatus === 'REVISION' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center' }}>
......@@ -841,7 +906,9 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.setState({ visibleRevision: true })}
onClick={() =>
this.approvalSubmission('review')
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography>
......@@ -857,7 +924,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => null}
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>
......@@ -872,7 +939,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => null}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
......@@ -906,7 +973,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => null}
onClick={() => this.approvalSubmission('cancel')}
>
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
......@@ -1145,7 +1212,7 @@ export default class BudgetTahunan extends Component {
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
type="button"
onClick={() => null}
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>
......@@ -1155,7 +1222,7 @@ export default class BudgetTahunan extends Component {
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
onClick={() => null}
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>
......
......@@ -434,29 +434,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]),
"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]),
"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])
})
......@@ -472,7 +472,7 @@ export default class CorporateAnnualTarget extends Component {
}
let totalWeight = 0
this.state.dataTable.map((items,indexs) => {
if (items[0] == 3) {
if (items[0] !== 1 || items[0] !== 4) {
console.log(items[7])
totalWeight += Number(items[7].replace('%', ''))
}
......@@ -503,29 +503,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]),
"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]),
"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])
})
......
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