Move to today in cuentas.show

This commit is contained in:
2022-04-02 23:32:27 -04:00
parent 10e5383a3e
commit 560fb356fa
2 changed files with 17 additions and 0 deletions

View File

@ -95,6 +95,7 @@ const transacciones = {
buttons: {
prev: '#prev_button',
left: '#left_button',
today: '#today_button',
right: '#right_button',
next: '#next_button'
},
@ -342,6 +343,11 @@ const transacciones = {
this.checkButtons()
$(this.mes).calendar('set date', this.date)
},
today: function() {
this.date = new Date()
this.checkButtons()
$(this.mes).calendar('set date', this.date)
},
changeYear: function(dif) {
let d = this.date
d.setFullYear(this.date.getFullYear() + dif)
@ -356,6 +362,11 @@ const transacciones = {
} else {
$(this.buttons.right).removeClass('disabled')
}
if (this.date.toDateString() === f.toDateString()) {
$(this.buttons.today).addClass('disabled')
} else {
$(this.buttons.today).removeClass('disabled')
}
if (this.date.getFullYear() === f.getFullYear()) {
$(this.buttons.next).addClass('disabled')
} else {
@ -422,6 +433,9 @@ const transacciones = {
})
},
buttons: () => {
$(this.buttons.today).click((e) => {
this.today()
})
$(this.buttons.right).click((e) => {
this.changeMonth(1)
})

View File

@ -18,6 +18,9 @@
<div class="ui icon button" id="left_button">
<i class="left angle icon"></i>
</div>
<div class="ui icon disabled button" id="today_button">
<i class="calendar day icon"></i>
</div>
<div class="ui icon disabled button" id="right_button">
<i class="right angle icon"></i>
</div>