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 = "") => { ...@@ -24,7 +24,7 @@ const create = (type = "") => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
// 60 second timeout... // 60 second timeout...
timeout: 30000 timeout: 60000
}) })
break; break;
case 'UPLOAD': case 'UPLOAD':
...@@ -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: 50000 timeout: 60000
}) })
break; break;
default: default:
......
import React, { Component } from 'react'; 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 MUIDataTable from 'mui-datatables';
import Images from '../assets/Images'; import Images from '../assets/Images';
import BalanceSheet from './BudgetTahunan/BalanceSheet'; import BalanceSheet from './BudgetTahunan/BalanceSheet';
...@@ -54,7 +54,10 @@ export default class BudgetTahunan extends Component { ...@@ -54,7 +54,10 @@ export default class BudgetTahunan extends Component {
visibleTableHistory: false, visibleTableHistory: false,
isApprover: false, isApprover: false,
lastStatus: "", lastStatus: "",
intent: "" intent: "",
approverID: null,
pic: '',
detailRevisiCheck: []
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -123,7 +126,7 @@ export default class BudgetTahunan extends Component { ...@@ -123,7 +126,7 @@ export default class BudgetTahunan extends Component {
}) })
let dataTableRevision = response.data.data.map((item, index) => { let dataTableRevision = response.data.data.map((item, index) => {
return [ return [
"", item.report_id,
item.report_name, item.report_name,
"" ""
] ]
...@@ -263,6 +266,7 @@ export default class BudgetTahunan extends Component { ...@@ -263,6 +266,7 @@ export default class BudgetTahunan extends Component {
if (response.data.data) { if (response.data.data) {
this.setState({ this.setState({
submissionID: response.data.data.submission_id, isSubmit: false, 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 lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status
}, () => { }, () => {
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -313,18 +317,18 @@ export default class BudgetTahunan extends Component { ...@@ -313,18 +317,18 @@ export default class BudgetTahunan extends Component {
} }
approvalSubmission(type) { approvalSubmission(type) {
this.setState({loading: true})
let body = { 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, "status": type,
"remarks": "tes", "detail": this.state.detailRevisiCheck
"detail": [
{
"report_id": 1,
"remarks": ""
} }
] api.create().approvalSubmission(body).then((res) => {
} console.log(res)
api.create().ApprovalSubmission(body) this.setState({loading: false}, () => {
this.checkApprover()
})
})
} }
clickDetail(item, id, revision, status) { clickDetail(item, id, revision, status) {
...@@ -618,16 +622,77 @@ export default class BudgetTahunan extends Component { ...@@ -618,16 +622,77 @@ 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}
onClick={() => handleCheckRevision(tableMeta.rowData)}/>
} }
/> />
</div > </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 = { const options = {
filter: false, filter: false,
sort: false, sort: false,
...@@ -808,7 +873,7 @@ export default class BudgetTahunan extends Component { ...@@ -808,7 +873,7 @@ export default class BudgetTahunan extends Component {
</div> : </div> :
this.state.lastStatus === 'WAITING FOR APPROVAL' ? this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center' }}> <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> : </div> :
this.state.lastStatus === 'REVISION' ? this.state.lastStatus === 'REVISION' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center' }}> <div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center' }}>
...@@ -841,7 +906,9 @@ export default class BudgetTahunan extends Component { ...@@ -841,7 +906,9 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', 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' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Review</Typography>
...@@ -857,7 +924,7 @@ export default class BudgetTahunan extends Component { ...@@ -857,7 +924,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', 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' }}> <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>
...@@ -872,7 +939,7 @@ export default class BudgetTahunan extends Component { ...@@ -872,7 +939,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => null} onClick={() => this.approvalSubmission('approve')}
> >
<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' }}>Approve</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
...@@ -906,7 +973,7 @@ export default class BudgetTahunan extends Component { ...@@ -906,7 +973,7 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => null} onClick={() => this.approvalSubmission('cancel')}
> >
<div style={{ backgroundColor: 'gray', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
...@@ -1145,7 +1212,7 @@ export default class BudgetTahunan extends Component { ...@@ -1145,7 +1212,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={() => null} 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>
...@@ -1155,7 +1222,7 @@ export default class BudgetTahunan extends Component { ...@@ -1155,7 +1222,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={() => 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' }}> <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>
......
...@@ -434,29 +434,29 @@ export default class CorporateAnnualTarget extends Component { ...@@ -434,29 +434,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]), "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])
}) })
...@@ -472,7 +472,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -472,7 +472,7 @@ export default class CorporateAnnualTarget extends Component {
} }
let totalWeight = 0 let totalWeight = 0
this.state.dataTable.map((items,indexs) => { this.state.dataTable.map((items,indexs) => {
if (items[0] == 3) { 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('%', ''))
} }
...@@ -503,29 +503,29 @@ export default class CorporateAnnualTarget extends Component { ...@@ -503,29 +503,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]), "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])
}) })
......
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