Commit 0a55af29 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

update

See merge request !1322
parents 4f6f300a a1d9abc9
......@@ -99,7 +99,7 @@ export default class OutlookPA extends Component {
"periode": this.state.periode.periode
}
api.create().getCompanySubmittedOLPA(body).then(response => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
let data = response.data.data
......@@ -233,7 +233,7 @@ export default class OutlookPA extends Component {
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
let data = response.data.data
......@@ -291,8 +291,9 @@ export default class OutlookPA extends Component {
getLastPeriod() {
api.create().getLastPeriodOLPA(this.state.company.company_id).then(response => {
// console.log(response);
let currentYear = new Date().getFullYear()
if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
this.setState({ lastPeriod: Number(response.data.data.last_periode) < Number(currentYear)? String(currentYear) : response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
this.getPeriode()
})
}
......@@ -310,11 +311,11 @@ export default class OutlookPA extends Component {
let data = []
response.data.data.map((item) => {
if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) {
if (item >= 2000 && item <= (Number(currentYear))) {
data.push(item)
}
} else {
if ((item >= 2000) && (item == Number(this.state.lastPeriod) + 1 || item < Number(this.state.lastPeriod) + 1)) {
if ((item >= 2000) && (item == Number(this.state.lastPeriod) || item < Number(this.state.lastPeriod))) {
data.push(item)
}
}
......@@ -328,7 +329,7 @@ export default class OutlookPA extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : Number(this.state.lastPeriod) + 1)
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear)) : Number(this.state.lastPeriod))
let index = data.sort((a, b) => a - b).findIndex((val) => val == periode)
// console.log(data)
// console.log(this.state.lastPeriod)
......
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