Commit f6c68730 authored by d.arizona's avatar d.arizona

apdet

parent 246cfd3b
...@@ -195,6 +195,7 @@ const create = (type = "") => { ...@@ -195,6 +195,7 @@ const create = (type = "") => {
const getSubmission = (body) => api.post('transaction/get_submission_id', body) const getSubmission = (body) => api.post('transaction/get_submission_id', body)
const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body) const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body)
const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body) const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body)
const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body) const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
...@@ -339,7 +340,8 @@ const create = (type = "") => { ...@@ -339,7 +340,8 @@ const create = (type = "") => {
getAllSettingByType, getAllSettingByType,
getOpetratingIndID, getOpetratingIndID,
createAllItemReport, createAllItemReport,
deleteAllItemReport deleteAllItemReport,
validateSubmitReport
} }
} }
......
...@@ -195,9 +195,12 @@ export default class CorporateAnnualTarget extends Component { ...@@ -195,9 +195,12 @@ 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]
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}`
) )
res = await res.blob() res = await res.blob()
console.log(res) console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -332,9 +335,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -332,9 +335,9 @@ 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": String(i[9].value) == undefined || String(i[9]) == null ? String(i[9]) : (String(i[9].value) == undefined ? String(i[9].value) : String(i[9].value)), "kpi_type": i[9] == null? "" : i[9].value,
"max_ach": String(i[10].value) == undefined || String(i[10]) == null ? String(i[10]) : (String(i[10].value) == undefined ? String(i[10].value) : String(i[10].value)), "max_ach": i[10] == null? "" : i[10].value,
"formula": String(i[11].value) == undefined || String(i[11]) == null ? String(i[11]) : (String(i[11].value) == undefined ? String(i[11].value) :String(i[11].value)), "formula": i[11] == null? "" : i[11].value,
"total_actual_before": String(i[12]), "total_actual_before": String(i[12]),
"january": String(i[13]), "january": String(i[13]),
"february": String(i[14]), "february": String(i[14]),
...@@ -558,6 +561,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -558,6 +561,7 @@ export default class CorporateAnnualTarget extends Component {
const handleChangeText = (value, tableMeta) => { const handleChangeText = (value, tableMeta) => {
console.log(value) console.log(value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// this.setState({dataTable: dataTable2})
} }
const handleValue = (data) => { const handleValue = (data) => {
...@@ -717,6 +721,11 @@ export default class CorporateAnnualTarget extends Component { ...@@ -717,6 +721,11 @@ export default class CorporateAnnualTarget extends Component {
options: { options: {
filter: false, filter: false,
display: this.state.visibleCAT, display: this.state.visibleCAT,
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#dbdbdb'}}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
// handleAction(tableMeta.rowData[2]) && // handleAction(tableMeta.rowData[2]) &&
...@@ -747,7 +756,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -747,7 +756,7 @@ export default class CorporateAnnualTarget extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
marginLeft: 10 marginLeft: 5
}} }}
onClick={() => { onClick={() => {
this.setState({loading: true}) this.setState({loading: true})
...@@ -773,6 +782,28 @@ export default class CorporateAnnualTarget extends Component { ...@@ -773,6 +782,28 @@ export default class CorporateAnnualTarget extends Component {
setCellProps: () => ({ style }), setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
tableMeta.rowData[1] == "" ?
<div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<FormControlLabel
style={{ margin: 0 }}
control={
<Input
disableUnderline={true}
style={{ color: tableMeta.rowData[1] == "" ? "#5198ea" : "black", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent' }}
type="text"
placeholder=""
defaultValue={val}
// disabled={!handleAction(tableMeta.rowData[2])}
onBlur={(event) => {
console.log(event.target.value)
handleChangeText(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div>
:
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[22] ? {tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ? tableMeta.rowData[22].length > 0 ?
...@@ -877,31 +908,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -877,31 +908,30 @@ export default class CorporateAnnualTarget extends Component {
null : null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value} // value={value}
control={ control={
<TextField <Input
InputProps={{ disableUnderline: true }} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
defaultValue={value}
disabled={!handleAction(tableMeta.rowData[2])} disabled={!handleAction(tableMeta.rowData[2])}
value={value}
onChange={(event) => { onChange={(event) => {
// console.log(event.target.value)
// // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
}} }}
onBlur={(event) => { onBlur={(event) => {
let abc = ''
abc = event.target.value
console.log(abc)
console.log(event.target.value) console.log(event.target.value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = event.target.value
// updateValue(event.target.value) // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = event.target.value console.log(dataTable2)
// this.setState({dataTable: dataTable2})
}} }}
/> />
} }
/> />
} }
</div> </div>
) )
...@@ -931,7 +961,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -931,7 +961,7 @@ export default class CorporateAnnualTarget extends Component {
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}} 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>
} }
/> />
...@@ -965,7 +995,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -965,7 +995,7 @@ export default class CorporateAnnualTarget extends Component {
disabled={!handleAction(tableMeta.rowData[2])} disabled={!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}} 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}
...@@ -1002,7 +1032,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1002,7 +1032,7 @@ export default class CorporateAnnualTarget extends Component {
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}} 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}
...@@ -1527,11 +1557,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1527,11 +1557,31 @@ export default class CorporateAnnualTarget extends Component {
<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: (val, 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 : val} null :
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
disabled={true}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
// }}
/>
}
/>
}
</div> </div>
) )
} }
......
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