Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
c2c26692
Commit
c2c26692
authored
Jan 26, 2021
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bentar
parent
a0cb23e1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
15 deletions
+134
-15
SubHolding.js
src/container/Laporan/SubHolding.js
+134
-15
No files found.
src/container/Laporan/SubHolding.js
View file @
c2c26692
...
@@ -10,6 +10,7 @@ import ReactTooltip from 'react-tooltip'
...
@@ -10,6 +10,7 @@ import ReactTooltip from 'react-tooltip'
import Images from '../../assets/Images'
import Images from '../../assets/Images'
import MuiAlert from '@material-ui/lab/Alert';
import MuiAlert from '@material-ui/lab/Alert';
import * as R from 'ramda'
import * as R from 'ramda'
import { format } from 'date-fns';
const Alert = withStyles({
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
...
@@ -41,7 +42,13 @@ export default class SubHolding extends Component {
...
@@ -41,7 +42,13 @@ export default class SubHolding extends Component {
report: null,
report: null,
loading: false,
loading: false,
previewTable: false,
previewTable: false,
OPID
:
null
OPID: null,
listMonths: null,
listUom: null,
listQuarter: null,
month: null,
quarter: null,
uom: null
}
}
}
}
...
@@ -133,6 +140,7 @@ export default class SubHolding extends Component {
...
@@ -133,6 +140,7 @@ export default class SubHolding extends Component {
if (response.data) {
if (response.data) {
if (response.data.status === "success") {
if (response.data.status === "success") {
let data = []
let data = []
let listMonths = []
response.data.data.map((item) => {
response.data.data.map((item) => {
if (this.state.isApprover) {
if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) {
...
@@ -155,6 +163,7 @@ export default class SubHolding extends Component {
...
@@ -155,6 +163,7 @@ export default class SubHolding extends Component {
};
};
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// console.log(data)
// console.log(data)
// console.log(this.state.latestPeriode)
// console.log(this.state.latestPeriode)
// console.log(periodeData)
// console.log(periodeData)
...
@@ -162,7 +171,7 @@ export default class SubHolding extends Component {
...
@@ -162,7 +171,7 @@ export default class SubHolding extends Component {
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// this.getDataTable()
// this.getDataTable()
// this.getSubmission()
// this.getSubmission()
this
.
get
ReportType
()
this.get
Month
()
// if (this.state.isApprover === true) {
// if (this.state.isApprover === true) {
// this.getCompanySubmitted()
// this.getCompanySubmitted()
// } else {
// } else {
...
@@ -174,6 +183,78 @@ export default class SubHolding extends Component {
...
@@ -174,6 +183,78 @@ export default class SubHolding extends Component {
})
})
}
}
getMonth() {
api.create().getMonthTransaction().then(response => {
let dateNow = new Date
let month = format(dateNow, 'MMMM')
console.log(response);
if (response.data) {
if (response.data.status === "success") {
// console.log(response);
let data = response.data.data
let monthData = data.map((item) => {
return {
month_id: item.id,
month_value: String(item.month_name).substr(0, 3)
}
})
let defaultProps = {
options: monthData,
getOptionLabel: (option) => option.month_value,
};
let index = data.findIndex((val) => val.month_name == month)
let listQuarter = [
{name: 'Q1', value: '3'},
{name: 'Q2', value: '6'},
{name: 'Q3', value: '9'},
{name: 'Q4', value: '12'},
]
let listUom = [{value: 'Mio IDR'}]
let defaultPropsQuarter = {
options: listQuarter,
getOptionLabel: (option) => option.name,
};
let defaultPropsUom = {
options: listUom,
getOptionLabel: (option) => option.value,
};
// console.log(month)
// console.log(index)
this.setState({ listMonths: defaultProps, month: index == -1 ? monthData[0] : monthData[index], listQuarter: defaultPropsQuarter, quarter: listQuarter[0], listUom: defaultPropsUom, uom: listUom[0] }, () => {
// if (this.state.isApprover === true) {
// if (this.state.submittedOnly) {
// console.log('masuk cuk')
// this.getPeriode()
// } else {
// this.getLastPeriod()
// }
// this.getPeriode()
this.getReportType()
// } else {
// this.getLastPeriod()
// this.getPeriode()
// }
})
} else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
// if (response.data.message.includes("Someone Logged In")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
}
} else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
})
}
getReportType() {
getReportType() {
let payload = {
let payload = {
"company_id": this.state.company.company_id,
"company_id": this.state.company.company_id,
...
@@ -874,7 +955,8 @@ export default class SubHolding extends Component {
...
@@ -874,7 +955,8 @@ export default class SubHolding extends Component {
})
})
} else if (this.state.report.value === 6) {
} else if (this.state.report.value === 6) {
let dbSumaCF = []
let dbSumaCF = []
api
.
create
().
getReportCFSuma
(
payload
).
then
(
response
=>
{
let paylodCF = {...payload, months: this.state.month.month_id}
api.create().getReportCFSuma(paylodCF).then(response => {
if (response.data) {
if (response.data) {
if (response.data.status === 'success') {
if (response.data.status === 'success') {
let res = response.data.data
let res = response.data.data
...
@@ -1059,7 +1141,7 @@ export default class SubHolding extends Component {
...
@@ -1059,7 +1141,7 @@ export default class SubHolding extends Component {
})
})
this.setState({ dataTable }, () => {
this.setState({ dataTable }, () => {
console.log(this.state.dataTable)
console.log(this.state.dataTable)
this
.
getCFSumaMR
(
paylo
ad
,
dbSumaCF
)
this.getCFSumaMR(paylo
dCF
, dbSumaCF)
})
})
} else {
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
...
@@ -1407,14 +1489,15 @@ export default class SubHolding extends Component {
...
@@ -1407,14 +1489,15 @@ export default class SubHolding extends Component {
}
}
getCFSumaMR(payload, dbSumaCF) {
getCFSumaMR(payload, dbSumaCF) {
// let payloadOI = {...payload, "periode": Number(this.state.periode.periode) - 1}
let payloadLast = {...payload, "periode": Number(this.state.periode.periode) - 1}
let
payloadLast
=
{
// let payloadLast = {
"report_id"
:
this
.
state
.
report
.
value
,
// "report_id": this.state.report.value,
"revision"
:
this
.
state
.
revisionType
,
// "revision": this.state.revisionType,
"periode"
:
Number
(
this
.
state
.
periode
.
periode
)
-
1
,
// "periode": Number(this.state.periode.periode) -1,
"company_id"
:
this
.
state
.
company
.
company_id
,
// "months" : this.state.
"submission_id"
:
this
.
state
.
submissionID
// "company_id": this.state.company.company_id,
}
// "submission_id": this.state.submissionID
// }
api.create().getReportCFSumaMR(payload).then(response => {
api.create().getReportCFSumaMR(payload).then(response => {
console.log(payload);
console.log(payload);
console.log(response);
console.log(response);
...
@@ -2472,7 +2555,7 @@ export default class SubHolding extends Component {
...
@@ -2472,7 +2555,7 @@ export default class SubHolding extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Sub Holding</Typography>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Sub Holding</Typography>
</div>
</div>
<div style={{ minWidth: 'max-content', padding: '20px 20px 0px 20px' }}>
<div style={{ minWidth: 'max-content', padding: '20px 20px 0px 20px' }}>
<
div
style
=
{{
marginTop
:
15
}}
>
<div style={{ marginTop: 15
, display: 'flex'
}}>
<Autocomplete
<Autocomplete
options={this.state.reportType}
options={this.state.reportType}
getOptionLabel={(option) => titleCase(option.label)}
getOptionLabel={(option) => titleCase(option.label)}
...
@@ -2485,8 +2568,20 @@ export default class SubHolding extends Component {
...
@@ -2485,8 +2568,20 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />}
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.report}
value={this.state.report}
/>
/>
{this.state.report != null? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listMonths}
// getOptionLabel={(option) => titleCase(option.label)}
id="months"
onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250, marginLeft: 10 }}
renderInput={(params) => <TextField {...params} label="Months" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/> : null : null}
</div>
</div>
<
div
style
=
{{
marginTop
:
15
}}
>
<div style={{ marginTop: 15
, display: 'flex'
}}>
<Autocomplete
<Autocomplete
{...this.state.listCompany}
{...this.state.listCompany}
id="company"
id="company"
...
@@ -2499,8 +2594,20 @@ export default class SubHolding extends Component {
...
@@ -2499,8 +2594,20 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company}
value={this.state.company}
/>
/>
{this.state.report != null? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listQuarter}
// getOptionLabel={(option) => titleCase(option.label)}
id="quarter"
onChange={(event, newInputValue) => this.setState({ quarter: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250, marginLeft: 10 }}
renderInput={(params) => <TextField {...params} label="Quarter" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.quarter}
/> : null : null}
</div>
</div>
<
div
style
=
{{
marginTop
:
15
}}
>
<div style={{ marginTop: 15
, display: 'flex'
}}>
<Autocomplete
<Autocomplete
{...this.state.listPeriode}
{...this.state.listPeriode}
id="periode"
id="periode"
...
@@ -2515,6 +2622,18 @@ export default class SubHolding extends Component {
...
@@ -2515,6 +2622,18 @@ export default class SubHolding extends Component {
/>}
/>}
value={this.state.periode}
value={this.state.periode}
/>
/>
{this.state.report != null? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listUom}
// getOptionLabel={(option) => titleCase(option.label)}
id="uom"
onChange={(event, newInputValue) => this.setState({ uom: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250, marginLeft: 10}}
renderInput={(params) => <TextField {...params} label="Uom" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.uom}
/> : null : null}
</div>
</div>
</div>
</div>
<div>
<div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment