From cb5e7a7eeab7f1d8b220ae7ab92e8112ad930efe Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Mon, 17 Oct 2022 16:15:41 +0200
Subject: [PATCH] #722 - added new button to edit this an upcoming repeating
 occurrences if editing an existing recurring transaction

---
 .../main/resources/languages/base_de.properties  |  1 +
 .../main/resources/languages/base_en.properties  |  1 +
 .../transactions/newTransactionMacros.ftl        | 16 +++++++++++++++-
 .../transactions/newTransactionNormal.ftl        |  2 +-
 .../transactions/newTransactionTransfer.ftl      |  2 +-
 5 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/BudgetMasterServer/src/main/resources/languages/base_de.properties b/BudgetMasterServer/src/main/resources/languages/base_de.properties
index 5242b8713..4fc5f02c7 100644
--- a/BudgetMasterServer/src/main/resources/languages/base_de.properties
+++ b/BudgetMasterServer/src/main/resources/languages/base_de.properties
@@ -365,6 +365,7 @@ transaction.new.label.repeating.all=Alle
 
 repeating.button.add=Wiederholung hinzufügen
 repeating.button.remove=Wiederholung entfernen
+repeating.button.edit.future=Diese und zukünftige Wiederholungen editieren
 
 repeating.modifier.days=Tage
 repeating.modifier.months=Monate
diff --git a/BudgetMasterServer/src/main/resources/languages/base_en.properties b/BudgetMasterServer/src/main/resources/languages/base_en.properties
index 1bbe6c93d..adcdae5d2 100644
--- a/BudgetMasterServer/src/main/resources/languages/base_en.properties
+++ b/BudgetMasterServer/src/main/resources/languages/base_en.properties
@@ -365,6 +365,7 @@ transaction.new.label.repeating.all=Every
 
 repeating.button.add=Add repetition
 repeating.button.remove=Remove repetition
+repeating.button.edit.future=Edit this and future occurrences
 
 repeating.modifier.days=Days
 repeating.modifier.months=Months
diff --git a/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionMacros.ftl b/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionMacros.ftl
index cce06b1ae..fcadb6ad1 100644
--- a/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionMacros.ftl
+++ b/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionMacros.ftl
@@ -160,7 +160,7 @@
     </script>
 </#macro>
 
-<#macro transactionRepeating transaction currentDate>
+<#macro transactionRepeating transaction currentDate isEdit>
     <div class="row <#if transaction.isRepeating()>hidden</#if>">
         <div class="col s12 center-align">
             <@header.buttonLink url='' icon='repeat' localizationKey='repeating.button.add' id='button-transaction-add-repeating-option' color='background-blue-baby' noUrl=true classes="text-black"/>
@@ -187,6 +187,20 @@
             <@header.buttonLink url='' icon='delete' localizationKey='repeating.button.remove' id='button-transaction-remove-repeating-option' color='background-blue-baby' noUrl=true classes="text-black hidden"/>
         </div>
     </div>
+
+    <div class="row">
+        <div class="col s12 center-align">
+            <#if isEdit && transaction.isRepeating()>
+                <#assign buttonEditFutureClasses='text-black'/>
+            <#else>
+                <#assign buttonEditFutureClasses='text-black hidden'/>
+            </#if>
+
+            <#if isEdit>
+                <@header.buttonLink url='/transactions/' + transaction.ID?c + '/editFutureRepetitions' icon='move_up' localizationKey='repeating.button.edit.future' id='button-transaction-edit-future-occurrences' color='background-blue-baby' classes="${buttonEditFutureClasses}"/>
+            </#if>
+        </div>
+    </div>
 </#macro>
 
 <#macro repeatingModifier transaction>
diff --git a/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionNormal.ftl b/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionNormal.ftl
index c529aaa42..4f5321a95 100644
--- a/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionNormal.ftl
+++ b/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionNormal.ftl
@@ -73,7 +73,7 @@
                             <@customSelectMacros.customAccountSelect "account-select-wrapper" "account" accounts selectedAccount "col s12 m12 l8 offset-l2" locale.getString("transaction.new.label.account") "transaction-account"/>
 
                             <#-- repeating options -->
-                            <@newTransactionMacros.transactionRepeating transaction currentDate/>
+                            <@newTransactionMacros.transactionRepeating transaction currentDate isEdit/>
 
                             <#-- buttons -->
                             <@newTransactionMacros.buttons cancelURL='/transactions' includeContinueButton=true/>
diff --git a/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionTransfer.ftl b/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionTransfer.ftl
index 3ef2b5821..b1f96bc1a 100644
--- a/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionTransfer.ftl
+++ b/BudgetMasterServer/src/main/resources/templates/transactions/newTransactionTransfer.ftl
@@ -79,7 +79,7 @@
                             <@customSelectMacros.customAccountSelect "transfer-account-select-wrapper" "transferAccount" accounts selectedTransferAccount "col s12 m12 l8 offset-l2" locale.getString("transaction.new.label.transfer.account") "transaction-destination-account"/>
 
                             <#-- repeating options -->
-                            <@newTransactionMacros.transactionRepeating transaction currentDate/>
+                            <@newTransactionMacros.transactionRepeating transaction currentDate isEdit/>
 
                             <#-- buttons -->
                             <@newTransactionMacros.buttons cancelURL='/transactions' includeContinueButton=true/>
-- 
GitLab