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

update

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