Commit 4b705e7e authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !436
parents 963725e6 961c65fe
......@@ -172,7 +172,7 @@ export default class BudgetTahunan extends Component {
item.revision,
item.current_status,
item.report_id,
item.is_can_upload,
Number(item.revision) > 0? (String(item.current_status).toLocaleLowerCase() == 'submitted'? false : item.is_can_upload) : item.is_can_upload,
item.revision
]
})
......@@ -267,12 +267,20 @@ export default class BudgetTahunan extends Component {
api.create().getPeriodeTransaction().then(response => {
// let dateNow = new Date
// let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
let currentYear = new Date().getFullYear()
console.log(currentYear)
if (response.data) {
if (response.data.status === "success") {
let data = []
response.data.data.map((item) => {
if ((item == this.state.latestPeriode || item > this.state.latestPeriode) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
data.push(item)
if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) {
data.push(item)
}
} else {
if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
data.push(item)
}
}
})
let periodeData = data.map((item) => {
......@@ -284,7 +292,11 @@ export default class BudgetTahunan extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let index = data.sort((a, b) => a - b).findIndex((val) => val === this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === (this.state.lastPeriod == ""? String(Number(currentYear) + 1) : this.state.lastPeriod))
console.log(data)
console.log(this.state.lastPeriod)
console.log(periodeData)
console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
......@@ -913,7 +925,7 @@ export default class BudgetTahunan extends Component {
<div style={{ width: '50%' }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Attachment: </Typography>
</div>
{!this.state.isApprover && (
{!this.state.isApprover && (this.state.lastStatus !== 'SUBMITTED' && this.state.lastStatus !== 'APPROVED') && (
<div style={{ width: '50%' }}>
<button
style={{
......@@ -959,7 +971,7 @@ export default class BudgetTahunan extends Component {
: null
}
</div>
{!this.state.isApprover && (
{!this.state.isApprover && (this.state.lastStatus !== 'SUBMITTED' && this.state.lastStatus !== 'APPROVED') && (
<div style={{ width: '50%' }}>
{this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
......
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