Commit 9d7f6ab3 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

Deni dev(pc)

See merge request !334
parents 89571848 8e7966d4
......@@ -411,23 +411,6 @@ export default class BudgetTahunan extends Component {
name: "",
options: { display: false }
}]
const dataTable = [
["1", "Balance Sheet", "done"],
["2", "Profit & Loss", ""],
["3", "CAT", "done"],
["4", "Fixed Assets Movement", ""],
["5", "Tax Planning", "done"],
["6", "Balance Sheet", "done"],
["7", "Profit & Loss", ""],
["8", "CAT", "done"],
["9", "Fixed Assets Movement", ""],
["10", "Tax Planning", "done"],
["11", "Balance Sheet", "done"],
["12", "Profit & Loss", "done"],
["13", "CAT", "done"],
["14", "Fixed Assets Movement", "done"],
["15", "Tax Planning", "done"],
]
const options = {
filter: false,
sort: false,
......@@ -440,25 +423,6 @@ export default class BudgetTahunan extends Component {
rowsPerPageOptions: [5, 25, 100],
search: false
}
const periode = [
{ value: '2021', label: '2021' },
{ value: '2020', label: '2020' },
{ value: '2019', label: '2019' },
{ value: '2018', label: '2018' },
{ value: '2017', label: '2017' },
{ value: '2016', label: '2016' },
]
const perusahaan = [
{ value: 'TAP Group', label: 'TAP Group' },
{ value: '2019', label: '2019' },
{ value: '2018', label: '2018' },
{ value: '2017', label: '2017' },
{ value: '2016', label: '2016' },
]
const revisi = [
{ value: '0', label: '0' },
{ value: '1', label: '1' },
]
const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
......@@ -497,10 +461,11 @@ export default class BudgetTahunan extends Component {
this.getReportAttachment()
this.getSubmission()
})}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }} />}
renderInput={(params) =>
<TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.periode}
/>
</div>
......@@ -513,7 +478,6 @@ export default class BudgetTahunan extends Component {
this.getReportAttachment()
this.getSubmission()
})}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
......@@ -528,7 +492,6 @@ export default class BudgetTahunan extends Component {
this.getReport()
this.getReportAttachment()
})}
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
......
......@@ -44,7 +44,8 @@ export default class BalanceSheet extends Component {
visibleBalanceSheet: true,
disabledSave: true,
editable: false,
buttonError: false
buttonError: false,
judulColumn: null
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -56,7 +57,7 @@ export default class BalanceSheet extends Component {
}
getItemHierarki() {
this.setState({ loading: true })
this.setState({ loading: true, judulColumn: null })
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
......@@ -67,11 +68,45 @@ export default class BalanceSheet extends Component {
api.create().getDetailReportMB(payload).then(response => {
console.log(response);
let dataTable = []
let res = response.data.data
console.log(res)
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "" : item.balance_sheet.total_actual_before,
item.balance_sheet.january,
item.balance_sheet.february,
item.balance_sheet.march,
item.balance_sheet.april,
item.balance_sheet.may,
item.balance_sheet.june,
item.balance_sheet.july,
item.balance_sheet.august,
item.balance_sheet.september,
item.balance_sheet.october,
item.balance_sheet.november,
item.balance_sheet.december,
item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
......@@ -96,50 +131,18 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
})
this.setState({ dataTable, loading: false, buttonError: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true })
}
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "" : item.balance_sheet.total_actual_before,
item.balance_sheet.january,
item.balance_sheet.february,
item.balance_sheet.march,
item.balance_sheet.april,
item.balance_sheet.may,
item.balance_sheet.june,
item.balance_sheet.july,
item.balance_sheet.august,
item.balance_sheet.september,
item.balance_sheet.october,
item.balance_sheet.november,
item.balance_sheet.december,
item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable, loading: false, buttonError: true })
})
}
......@@ -230,7 +233,7 @@ export default class BalanceSheet extends Component {
}
else {
let isi = resp.rows.slice(3)
console.log(isi);
console.log(resp.rows[2]);
let payload = []
let reg = /^\d+$/;
isi.map((i, index) => {
......@@ -264,7 +267,7 @@ export default class BalanceSheet extends Component {
balance_sheet: payload
}
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] })
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
}
});
}
......@@ -475,7 +478,7 @@ export default class BalanceSheet extends Component {
display: false
}
}, {
name: "Account",
name: this.state.judulColumn !== null ? this.state.judulColumn[1] : "Account",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
......@@ -513,7 +516,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "31 Dec 2020 Actual",
name: this.state.judulColumn !== null ? this.state.judulColumn[2] : "31 Dec 2020 Actual",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
......@@ -600,7 +603,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Jan 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[3] : "Jan 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -686,7 +689,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Feb 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[4] : "Feb 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -773,7 +776,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Mar 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[5] : "Mar 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -860,7 +863,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Apr 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[6] : "Apr 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -947,7 +950,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "May 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[7] : "May 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1034,7 +1037,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Jun 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[8] : "Jun 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1121,7 +1124,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Jul 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[9] : "Jul 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1208,7 +1211,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Aug 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[10] : "Aug 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1295,7 +1298,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Sep 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[11] : "Sep 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1382,7 +1385,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Oct 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[12] : "Oct 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1469,7 +1472,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Nov 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[13] : "Nov 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1556,7 +1559,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Dec 2021",
name: this.state.judulColumn !== null ? this.state.judulColumn[14] : "Dec 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1643,7 +1646,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Current Total",
name: this.state.judulColumn !== null ? this.state.judulColumn[15] : "Current Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
......@@ -1730,7 +1733,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "31 Dec 2022 Total",
name: this.state.judulColumn !== null ? this.state.judulColumn[16] : "31 Dec 2022 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
......@@ -1817,7 +1820,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "31 Dec 2023 Total",
name: this.state.judulColumn !== null ? this.state.judulColumn[17] : "31 Dec 2023 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
......@@ -1938,7 +1941,7 @@ export default class BalanceSheet extends Component {
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
......@@ -2008,12 +2011,12 @@ export default class BalanceSheet extends Component {
<div className="col-1">
<button
type="button"
onClick={() => this.state.editable === true ?
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
......@@ -2098,11 +2101,11 @@ export default class BalanceSheet extends Component {
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......
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