Move to today in cuentas.show
This commit is contained in:
@ -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)
|
||||
})
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user