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

apdet

parent 246cfd3b
......@@ -195,6 +195,7 @@ const create = (type = "") => {
const getSubmission = (body) => api.post('transaction/get_submission_id', 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 validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
......@@ -339,7 +340,8 @@ const create = (type = "") => {
getAllSettingByType,
getOpetratingIndID,
createAllItemReport,
deleteAllItemReport
deleteAllItemReport,
validateSubmitReport
}
}
......
......@@ -195,9 +195,12 @@ export default class CorporateAnnualTarget extends Component {
async downloadAllData() {
console.log('masuk')
let bram = [this.props.submissionID,this.props.report_id,this.props.company.company_id,this.props.periode,this.props.revision]
console.log(bram)
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
)
res = await res.blob()
console.log(res)
this.setState({ loading: false })
......@@ -332,9 +335,9 @@ export default class CorporateAnnualTarget extends Component {
"item_report": String(i[6]),
"weight": String(i[7]),
"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)),
"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)),
"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)),
"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]),
......@@ -558,6 +561,7 @@ export default class CorporateAnnualTarget extends Component {
const handleChangeText = (value, tableMeta) => {
console.log(value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// this.setState({dataTable: dataTable2})
}
const handleValue = (data) => {
......@@ -717,6 +721,11 @@ export default class CorporateAnnualTarget extends Component {
options: {
filter: false,
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) => {
return (
// handleAction(tableMeta.rowData[2]) &&
......@@ -747,7 +756,7 @@ export default class CorporateAnnualTarget extends Component {
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 10
marginLeft: 5
}}
onClick={() => {
this.setState({loading: true})
......@@ -773,6 +782,28 @@ export default class CorporateAnnualTarget extends Component {
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
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 }}>
{tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ?
......@@ -877,31 +908,30 @@ export default class CorporateAnnualTarget extends Component {
null :
<FormControlLabel
style={{ margin: 0 }}
value={value}
// value={value}
control={
<TextField
InputProps={{ disableUnderline: true }}
<Input
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])}
value={value}
onChange={(event) => {
// console.log(event.target.value)
// // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
}}
onBlur={(event) => {
let abc = ''
abc = event.target.value
console.log(abc)
console.log(event.target.value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = event.target.value
// updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = event.target.value
// this.setState({dataTable: dataTable2})
handleChangeText(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
}
/>
}
</div>
)
......@@ -931,7 +961,7 @@ export default class CorporateAnnualTarget extends Component {
style={{padding: 0, margin: 0}}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{padding: 0, margin: 0}}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0}} 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>
}
/>
......@@ -965,7 +995,7 @@ export default class CorporateAnnualTarget extends Component {
disabled={!handleAction(tableMeta.rowData[2])}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{padding: 0, margin: 0}}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0}} 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>
}
// value={this.state.parent}
......@@ -1002,7 +1032,7 @@ export default class CorporateAnnualTarget extends Component {
style={{padding: 0, margin: 0}}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{padding: 0, margin: 0}}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0}} 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>
}
// value={this.state.parent}
......@@ -1527,11 +1557,31 @@ export default class CorporateAnnualTarget extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val, tableMeta) => {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 96 }}>
{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>
)
}
......
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