diff --git a/src/main/resources/languages/base_de.properties b/src/main/resources/languages/base_de.properties index 9122bb84ec40f27f57be45bab1bf55a3cbfc06b8..0114d98da23d64ffc62334168b5d74759cbe0ce4 100644 --- a/src/main/resources/languages/base_de.properties +++ b/src/main/resources/languages/base_de.properties @@ -53,6 +53,9 @@ title.chart.new=Neues Diagramm title.chart.edit=Diagramm bearbeiten title.template.new=Neue Vorlage title.template.edit=Vorlage bearbeiten +title.template.group.new=Neue Vorlagengruppe +title.template.group.edit=Vorlagengruppe bearbeiten +title.template.group.edit.short=Gruppen bearbeiten # MISC category.none=Keine Kategorie @@ -135,6 +138,13 @@ notification.template.add.success=Die Vorlage "{0}" wurde erfolgreich angelegt. notification.template.save.success=Die Vorlage "{0}" wurde erfolgreich gespeichert. +info.title.template.group.delete=Vorlagengruppe löschen +info.text.template.group.delete=Möchtest du die Vorlagengruppe "{0}" wirklich unwiderruflich löschen? +notification.template.group.delete.success=Die Vorlagengruppe "{0}" wurde erfolgreich gelöscht. +notification.template.group.add.success=Die Vorlagengruppe "{0}" wurde erfolgreich angelegt. + +notification.template.group.save.success=Die Vorlagengruppe "{0}" wurde erfolgreich gespeichert. + info.title.database.delete=Datenbank löschen info.header.text.database.delete=Soll die Datenbank wirklich unwiderruflich gelöscht werden?<br>Hinweis: Beim Löschen der Datenbank werden alle Buchungen, Kategorien, Konten, Diagramme, Vorlagen und Bilder unwiderruflich gelöscht. Alle Einstellungen bleiben erhalten. info.text.database.delete=Gib den folgenden Code zur Bestätigung ein: @@ -200,6 +210,7 @@ warning.empty.git.token=Bitte gib dein git-Zugriffstoken ein. menu.home=Startseite menu.transactions=Buchungen menu.templates=Vorlagen +menu.template.groups=Vorlagengruppen menu.categories=Kategorien menu.charts=Diagramme menu.reports=Berichte diff --git a/src/main/resources/languages/base_en.properties b/src/main/resources/languages/base_en.properties index 3a5dd6b74101aa5f30862af5c479c0de77ee5386..8cef55684c7066c2e23f156425e3c731c013e1dd 100644 --- a/src/main/resources/languages/base_en.properties +++ b/src/main/resources/languages/base_en.properties @@ -54,6 +54,9 @@ title.chart.new=New Chart title.chart.edit=Edit Chart title.template.new=New Template title.template.edit=Edit Template +title.template.group.new=New Template Group +title.template.group.edit=Edit Template Group +title.template.group.edit.short=Edit Groups # MISC category.none=No Category @@ -136,6 +139,13 @@ notification.template.add.success=Successfully added new template "{0}". notification.template.save.success=Successfully saved template "{0}". +info.title.template.group.delete=Delete Template Group +info.text.template.group.delete=Do you really want to delete the template group "{0}"? +notification.template.group.delete.success=Successfully deleted template group "{0}". +notification.template.group.add.success=Successfully added new template group "{0}". + +notification.template.group.save.success=Successfully saved template group "{0}". + info.title.database.delete=Delete Database info.header.text.database.delete=Do you really want to delete the database? This can''t be undone.<br>Note: Deleting the database will delete all transactions, categories, accounts, charts, templates and images permanently. All settings will be preserved. info.text.database.delete=Please enter the following code for verification: @@ -201,6 +211,7 @@ warning.empty.git.token=Please insert your git access token. menu.home=Home menu.transactions=Transactions menu.templates=Templates +menu.template.groups=Template Groups menu.categories=Categories menu.charts=Charts menu.reports=Reports diff --git a/src/main/resources/static/js/templateGroups.js b/src/main/resources/static/js/templateGroups.js new file mode 100644 index 0000000000000000000000000000000000000000..fd63b5b306168e033d66b9479a7b0482cf3cde8b --- /dev/null +++ b/src/main/resources/static/js/templateGroups.js @@ -0,0 +1,12 @@ +$(document).ready(function() +{ + if($("#template-group-name").length) + { + document.getElementById('template-group-name').focus(); + } + + $('.button-request-delete-template-group').click(function() + { + fetchAndShowModalContent(this.dataset.url, '#deleteModalContainerOnDemand', '#modalConfirmDelete', function(){}); + }); +}); diff --git a/src/main/resources/templates/templateGroups/deleteTemplateGroupModal.ftl b/src/main/resources/templates/templateGroups/deleteTemplateGroupModal.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e8b078eeb2a5a35d4468c80f30ad632771596019 --- /dev/null +++ b/src/main/resources/templates/templateGroups/deleteTemplateGroupModal.ftl @@ -0,0 +1,7 @@ +<#global locale = static["de.thecodelabs.utils.util.Localization"]> +<#import "/spring.ftl" as s> +<#import "../helpers/header.ftl" as header> + +<@header.modalConfirmDelete title=locale.getString("info.title.template.group.delete") confirmUrl='/templateGroups' itemId=templateGroupToDelete.getID() confirmButtonTextKey='info.title.template.group.delete'> + <p>${locale.getString("info.text.template.group.delete", templateGroupToDelete.getName())}</p> +</@header.modalConfirmDelete> \ No newline at end of file diff --git a/src/main/resources/templates/templateGroups/newTemplateGroup.ftl b/src/main/resources/templates/templateGroups/newTemplateGroup.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5738f39fdbd7096f319970542c8588a007efc9b7 --- /dev/null +++ b/src/main/resources/templates/templateGroups/newTemplateGroup.ftl @@ -0,0 +1,78 @@ +<html> + <head> + <#import "../helpers/header.ftl" as header> + <@header.globals/> + <#if templateGroup.getID()??> + <#assign title=locale.getString("title.template.group.edit")/> + <#else> + <#assign title=locale.getString("title.template.group.new")/> + </#if> + + <@header.header "BudgetMaster - ${title}"/> + <#import "/spring.ftl" as s> + </head> + <@header.body> + <#import "../helpers/navbar.ftl" as navbar> + <@navbar.navbar "templates" settings/> + + <main> + <div class="card main-card background-color"> + <div class="container"> + <div class="section center-align"> + <div class="headline">${title}</div> + </div> + </div> + + <@header.content> + <div class="container"> + <#import "../helpers/validation.ftl" as validation> + <form name="NewTemplateGroup" action="<@s.url '/templateGroups/newTemplateGroup'/>" method="post" onsubmit="return validateForm(true)"> + <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/> + <input type="hidden" name="ID" value="<#if templateGroup.getID()??>${templateGroup.getID()?c}</#if>"> + + <#-- template group name --> + <div class="row"> + <div class="input-field col s12 m12 l8 offset-l2"> + <i class="material-icons prefix">file_copy</i> + <input id="template-group-name" type="text" name="name" <@validation.validation "name"/> value="<#if templateGroup.getName()??>${templateGroup.getName()}</#if>"> + <label for="template-group-name">${locale.getString("transaction.new.label.name")}</label> + </div> + </div> + + <br> + + <#-- buttons --> + <div class="row hide-on-small-only"> + <div class="col s6 right-align"> + <@header.buttonLink url='/templateGroups' icon='clear' localizationKey='cancel' color='red'/> + </div> + + <div class="col s6 left-align"> + <@header.buttonSubmit name='action' icon='save' localizationKey='save' color='green'/> + </div> + </div> + <div class="hide-on-med-and-up"> + <div class="row center-align"> + <div class="col s12"> + <@header.buttonLink url='/templateGroups' icon='clear' localizationKey='cancel' color='red'/> + </div> + </div> + <div class="row center-align"> + <div class="col s12"> + <@header.buttonSubmit name='action' icon='save' localizationKey='save' color='green'/> + </div> + </div> + </div> + </form> + </div> + </@header.content> + </div> + </main> + + <!-- Scripts--> + <#import "../helpers/scripts.ftl" as scripts> + <@scripts.scripts/> + <script src="<@s.url '/js/helpers.js'/>"></script> + <script src="<@s.url '/js/templateGroups.js'/>"></script> + </@header.body> +</html> diff --git a/src/main/resources/templates/templateGroups/templateGroups.ftl b/src/main/resources/templates/templateGroups/templateGroups.ftl new file mode 100644 index 0000000000000000000000000000000000000000..84bea99f0b2c4dd3f3cd46341ffdbac6a0e3a34c --- /dev/null +++ b/src/main/resources/templates/templateGroups/templateGroups.ftl @@ -0,0 +1,52 @@ +<html> + <head> + <#import "../helpers/header.ftl" as header> + <@header.globals/> + <@header.header "BudgetMaster - ${locale.getString('menu.template.groups')}"/> + <@header.style "collapsible"/> + <@header.style "templates"/> + <#import "/spring.ftl" as s> + </head> + <@header.body> + <#import "../helpers/navbar.ftl" as navbar> + <@navbar.navbar "templates" settings/> + + <main> + <div class="card main-card background-color"> + <div class="container"> + <div class="section center-align"> + <div class="headline"><i class="material-icons">file_copy</i> ${locale.getString("menu.template.groups")}</div> + </div> + </div> + + <@header.content> + <br> + <div class="center-align"><@header.buttonLink url='/templateGroups/newTemplateGroup' icon='add' localizationKey='title.template.group.new'/></div> + <br> + + <div class="container"> + <table class="bordered"> + <#list templateGroups as group> + <tr> + <td>${group.getName()} </td> + <td> + <@header.buttonFlat url='/templateGroups/' + group.ID?c + '/edit' icon='edit' localizationKey='' classes="no-padding text-default"/> + <@header.buttonFlat url='/templateGroups/' + group.ID?c + '/requestDelete' icon='delete' localizationKey='' classes="no-padding text-default button-request-delete-template-group" isDataUrl=true/> + </td> + </tr> + </#list> + </table> + <#if templateGroups?size == 0> + <div class="headline center-align">${locale.getString("placeholder")}</div> + </#if> + </div> + </@header.content> + + <div id="deleteModalContainerOnDemand"></div> + </main> + + <#import "../helpers/scripts.ftl" as scripts> + <@scripts.scripts/> + <script src="<@s.url '/js/templateGroups.js'/>"></script> + </@header.body> +</html> \ No newline at end of file