From 560fb356fa57de84bba7c0fa5ca2fcb0e9000c82 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Sat, 2 Apr 2022 23:32:27 -0400 Subject: [PATCH] Move to today in cuentas.show --- ui/public/assets/scripts/cuentas/show.js | 14 ++++++++++++++ ui/resources/views/cuentas/show.blade.php | 3 +++ 2 files changed, 17 insertions(+) diff --git a/ui/public/assets/scripts/cuentas/show.js b/ui/public/assets/scripts/cuentas/show.js index 1e71fec..4ed2a7f 100644 --- a/ui/public/assets/scripts/cuentas/show.js +++ b/ui/public/assets/scripts/cuentas/show.js @@ -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) }) diff --git a/ui/resources/views/cuentas/show.blade.php b/ui/resources/views/cuentas/show.blade.php index 14177e3..4eabd2b 100644 --- a/ui/resources/views/cuentas/show.blade.php +++ b/ui/resources/views/cuentas/show.blade.php @@ -18,6 +18,9 @@
+
+ +