diff --git a/src/main/resources/languages/base_de.properties b/src/main/resources/languages/base_de.properties index bfe443661ae2d11598a98f1690fdb2ffe45bbed6..9383131d50fcd38712e2a1332ea9988a60883038 100644 --- a/src/main/resources/languages/base_de.properties +++ b/src/main/resources/languages/base_de.properties @@ -305,6 +305,8 @@ transaction.new.label.transfer.account=Zielkonto transaction.new.label.repeating=Wiederholung transaction.new.label.repeating.all=Alle +repeating.button=Wiederholung hinzufügen + repeating.modifier.days=Tage repeating.modifier.months=Monate repeating.modifier.years=Jahre diff --git a/src/main/resources/languages/base_en.properties b/src/main/resources/languages/base_en.properties index cf7c86c5ccd34e53e6e062e9b127943e8209bea2..c212409bbee85f8af696ef83e1bafb6b75d4cb0f 100644 --- a/src/main/resources/languages/base_en.properties +++ b/src/main/resources/languages/base_en.properties @@ -306,6 +306,8 @@ transaction.new.label.transfer.account=Destination Account transaction.new.label.repeating=Repeating transaction.new.label.repeating.all=Every +repeating.button=Add repetition + repeating.modifier.days=Days repeating.modifier.months=Months repeating.modifier.years=Years diff --git a/src/main/resources/static/js/transactions.js b/src/main/resources/static/js/transactions.js index 9a4bc75c8bb102a4f793005d8009609c5eb94c19..282bab801b5e94e1b2acfeb0e4583e0a357c45fe 100644 --- a/src/main/resources/static/js/transactions.js +++ b/src/main/resources/static/js/transactions.js @@ -263,6 +263,13 @@ $(document).ready(function() { fetchAndShowModalContent(this.dataset.url, '#deleteModalContainerOnDemand', '#modalConfirmDelete', function(){}); }); + + $('#button-transaction-add-repeating-option').click(function() + { + document.getElementById('button-transaction-add-repeating-option').classList.toggle('hidden', true); + document.getElementsByName('isRepeating')[0].value = 1; + document.getElementById('transaction-repeating-option').classList.toggle('hidden', false); + }); }); function isHidden(el) @@ -403,7 +410,7 @@ function validateForm(allowEmptyAmount = false) } } - if($(transactionRepeatingModifierID).length) + if(document.getElementsByName('isRepeating')[0].value === '1') { if(!validateNumber($(transactionRepeatingModifierID).val(), transactionRepeatingModifierID.substr(1), "hidden-" + transactionRepeatingModifierID.substr(1), numberValidationMessage, REGEX_NUMBER)) { diff --git a/src/main/resources/templates/transactions/newTransactionMacros.ftl b/src/main/resources/templates/transactions/newTransactionMacros.ftl index 3931e0b5cce5f81752de916809aa528425c66da3..75579718eaf51d4d8fe39f8f48b90f52d206ce62 100644 --- a/src/main/resources/templates/transactions/newTransactionMacros.ftl +++ b/src/main/resources/templates/transactions/newTransactionMacros.ftl @@ -154,16 +154,20 @@ </#macro> <#macro transactionRepeating transaction currentDate> - <div class="row"> - <div class="col s12 m12 l8 offset-l2"> - <i class="material-icons icon-repeating">repeat</i> - ${locale.getString("transaction.new.label.repeating")} + <div class="hidden" id="transaction-repeating-option"> + <input type="hidden" name="isRepeating" value="<#if transaction.getRepeatingOption()??>1}</#if>"> + + <div class="row"> + <div class="col s12 m12 l8 offset-l2"> + <i class="material-icons icon-repeating">repeat</i> + ${locale.getString("transaction.new.label.repeating")} + </div> </div> - </div> - <@newTransactionMacros.repeatingModifier transaction/> + <@repeatingModifier transaction/> - <@newTransactionMacros.repeatingEndOption transaction currentDate/> + <@repeatingEndOption transaction currentDate/> + </div> </#macro> <#macro repeatingModifier transaction> diff --git a/src/main/resources/templates/transactions/newTransactionNormal.ftl b/src/main/resources/templates/transactions/newTransactionNormal.ftl index bc29ed0f489200a2607c46390af3764640aa29b5..154f59ae4941d69a3908ac63fa80d770062c3ff5 100644 --- a/src/main/resources/templates/transactions/newTransactionNormal.ftl +++ b/src/main/resources/templates/transactions/newTransactionNormal.ftl @@ -72,6 +72,15 @@ </#if> <@customSelectMacros.customAccountSelect "account-select-wrapper" "account" accounts selectedAccount "col s12 m12 l8 offset-l2" locale.getString("transaction.new.label.account") "transaction-account"/> + <div class="row"> + <div class="col s12 center-align"> + <@header.buttonLink url='' icon='repeat' localizationKey='repeating.button' id='button-transaction-add-repeating-option' color='background-blue-baby' noUrl=true classes="text-black"/> + </div> + </div> + + <#-- repeating options --> + <@newTransactionMacros.transactionRepeating transaction currentDate/> + <#-- buttons --> <@newTransactionMacros.buttons "/transactions"/> <@newTransactionMacros.buttonTransactionActions isEdit true previousType??/>