diff --git a/web/modules/custom/figli_compta_ledger/js/home.js b/web/modules/custom/figli_compta_ledger/js/home.js
index 86c1c33..8e3c03e 100644
--- a/web/modules/custom/figli_compta_ledger/js/home.js
+++ b/web/modules/custom/figli_compta_ledger/js/home.js
@@ -197,6 +197,7 @@
filterClient: '',
filterType: '',
filterYear: '',
+ jumpYearValue: '',
groupBy: 'month',
onlyErrors: false,
hoverCol: null,
@@ -649,9 +650,52 @@
if (wrap) wrap.scrollTop = wrap.scrollHeight;
this.detectCurrentYear();
},
+ // "Aller à" -- a one-shot navigation shortcut, distinct from the
+ // "Année" filter: it re-centers the sliding window on 1 January of
+ // the chosen year and scrolls there, but (unlike filterYear) doesn't
+ // restrict the view to just that year -- scrolling up/down still
+ // extends the window normally, so you can still see the overlap
+ // with neighbouring years.
+ onJumpYearChange() {
+ const year = this.jumpYearValue;
+ this.jumpYearValue = ''; // reset immediately -- this is an action, not a sticky filter
+ this.jumpToYear(year);
+ },
+ async jumpToYear(year) {
+ if (!year) return;
+ // A year filter would otherwise fight with the window this sets
+ // below -- clear it first, silencing the watcher's own
+ // exitYearMode() so its (different) window doesn't race this one.
+ if (this.filterYear) {
+ this._skipYearWatch = true;
+ this.filterYear = '';
+ }
+ this.loading = true;
+ this.error = null;
+ try {
+ const yearStart = year + '-01-01';
+ this.windowStart = yearStart;
+ this.windowEnd = addMonths(yearStart, WINDOW_MONTHS * 2);
+ const { data, includedMap } = await fetchLignes(rangeUrl(this.windowStart, this.windowEnd));
+ this.rows = buildRows(data, includedMap);
+ } catch (err) {
+ this.error = err.message;
+ } finally {
+ this.loading = false;
+ }
+ await this.$nextTick();
+ const wrap = this.$refs.tableWrap;
+ if (wrap) wrap.scrollTop = 0;
+ this.detectCurrentYear();
+ this.checkEdges();
+ },
},
watch: {
filterYear(newYear, oldYear) {
+ if (this._skipYearWatch) {
+ this._skipYearWatch = false;
+ return;
+ }
if (newYear) {
this.enterYearMode(newYear);
} else if (oldYear) {
diff --git a/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig b/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig
index 907637d..96ed064 100644
--- a/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig
+++ b/web/modules/custom/figli_compta_ledger/templates/figli-compta-home.html.twig
@@ -43,6 +43,13 @@
+
+