From ff2f543f008d9eb409fcb870c32b2140c136015d Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Mon, 22 Jul 2019 20:32:38 +0200
Subject: [PATCH] Fixed #467: charts: quick date range for all

---
 src/main/resources/languages/_de.properties    |  2 ++
 src/main/resources/languages/_en.properties    |  2 ++
 src/main/resources/static/js/charts.js         | 12 ++++++++++--
 src/main/resources/templates/charts/charts.ftl |  8 +++++---
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/languages/_de.properties b/src/main/resources/languages/_de.properties
index 13e25359a..7d0760d16 100644
--- a/src/main/resources/languages/_de.properties
+++ b/src/main/resources/languages/_de.properties
@@ -358,10 +358,12 @@ chart.steps.third=Wende Filter an (optional)
 chart.quick.this.week=Diese Woche
 chart.quick.this.month=Diesen Monat
 chart.quick.this.year=Dieses Jahr
+chart.quick.all=Alle
 
 chart.quick.last.week.days=Letzte 7 Tage
 chart.quick.last.month.days=Letzte 30 Tage
 chart.quick.last.year.days=Letzte 365 Tage
+chart.quick.last.three.months=Letzte 3 Monate
 
 chart.script.default=/* This list will be dynamically filled with all the transactions between\n \
 * the start and and date you select on the "Show Chart" page\n \
diff --git a/src/main/resources/languages/_en.properties b/src/main/resources/languages/_en.properties
index cadf523fd..a0c4d4b05 100644
--- a/src/main/resources/languages/_en.properties
+++ b/src/main/resources/languages/_en.properties
@@ -357,10 +357,12 @@ chart.steps.third=Apply filters (optional)
 chart.quick.this.week=This week
 chart.quick.this.month=This month
 chart.quick.this.year=This year
+chart.quick.all=All
 
 chart.quick.last.week.days=Last 7 days
 chart.quick.last.month.days=Last 30 days
 chart.quick.last.year.days=Last 365 days
+chart.quick.last.three.months=Last 3 months
 
 chart.script.default=/* This list will be dynamically filled with all the transactions between\n \
 * the start and and date you select on the "Show Chart" page\n \
diff --git a/src/main/resources/static/js/charts.js b/src/main/resources/static/js/charts.js
index c2922bf6a..3700b412f 100644
--- a/src/main/resources/static/js/charts.js
+++ b/src/main/resources/static/js/charts.js
@@ -163,17 +163,25 @@ function handleQuickDate(element, pickerStartDate, pickerEndDate)
             endDate = moment().endOf('year');
             break;
         case '3':
+            startDate = moment("2000-01-01");
+            endDate = moment("2100-01-01");
+            break;
+        case '4':
             startDate = moment().subtract(7, 'days');
             endDate = moment();
             break;
-        case '4':
+        case '5':
             startDate = moment().subtract(30, 'days');
             endDate = moment();
             break;
-        case '5':
+        case '6':
             startDate = moment().subtract(365, 'days');
             endDate = moment();
             break;
+        case '7':
+            startDate = moment().subtract(3, 'months');
+            endDate = moment();
+            break;
     }
 
     setDateRange(startDate, endDate, pickerStartDate, pickerEndDate);
diff --git a/src/main/resources/templates/charts/charts.ftl b/src/main/resources/templates/charts/charts.ftl
index 8ef96b8a7..a17fd5957 100644
--- a/src/main/resources/templates/charts/charts.ftl
+++ b/src/main/resources/templates/charts/charts.ftl
@@ -87,11 +87,13 @@
                                                             <td class="quick-date" data-quick="0">${locale.getString("chart.quick.this.week")}</td>
                                                             <td class="quick-date" data-quick="1">${locale.getString("chart.quick.this.month")}</td>
                                                             <td class="quick-date" data-quick="2">${locale.getString("chart.quick.this.year")}</td>
+                                                            <td class="quick-date" data-quick="3">${locale.getString("chart.quick.all")}</td>
                                                         </tr>
                                                         <tr>
-                                                            <td class="quick-date" data-quick="3">${locale.getString("chart.quick.last.week.days")}</td>
-                                                            <td class="quick-date" data-quick="4">${locale.getString("chart.quick.last.month.days")}</td>
-                                                            <td class="quick-date" data-quick="5">${locale.getString("chart.quick.last.year.days")}</td>
+                                                            <td class="quick-date" data-quick="4">${locale.getString("chart.quick.last.week.days")}</td>
+                                                            <td class="quick-date" data-quick="5">${locale.getString("chart.quick.last.month.days")}</td>
+                                                            <td class="quick-date" data-quick="6">${locale.getString("chart.quick.last.year.days")}</td>
+                                                            <td class="quick-date" data-quick="7">${locale.getString("chart.quick.last.three.months")}</td>
                                                         </tr>
                                                     </table>
                                                 </div>
-- 
GitLab