Stuff all over the place
This commit is contained in:
@@ -12,6 +12,7 @@ public class FinancerConfig {
|
|||||||
|
|
||||||
private String serverUrl;
|
private String serverUrl;
|
||||||
private String dateFormat;
|
private String dateFormat;
|
||||||
|
private String version;
|
||||||
|
|
||||||
public String getServerUrl() {
|
public String getServerUrl() {
|
||||||
return serverUrl;
|
return serverUrl;
|
||||||
@@ -28,4 +29,12 @@ public class FinancerConfig {
|
|||||||
public void setDateFormat(String dateFormat) {
|
public void setDateFormat(String dateFormat) {
|
||||||
this.dateFormat = dateFormat;
|
this.dateFormat = dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import de.financer.controller.template.*;
|
|||||||
import de.financer.form.NewAccountForm;
|
import de.financer.form.NewAccountForm;
|
||||||
import de.financer.model.*;
|
import de.financer.model.*;
|
||||||
import de.financer.util.ControllerUtils;
|
import de.financer.util.ControllerUtils;
|
||||||
|
import de.financer.util.TransactionUtils;
|
||||||
|
import de.financer.util.comparator.TransactionByDateComparator;
|
||||||
import org.apache.commons.collections4.IterableUtils;
|
import org.apache.commons.collections4.IterableUtils;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -16,6 +18,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class AccountController {
|
public class AccountController {
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -34,6 +38,7 @@ public class AccountController {
|
|||||||
model.addAttribute("rtDueTodayCount", IterableUtils.size(rtDtRes.getBody()));
|
model.addAttribute("rtDueTodayCount", IterableUtils.size(rtDtRes.getBody()));
|
||||||
model.addAttribute("rtAllActiveCount", IterableUtils.size(rtAllActRes.getBody()));
|
model.addAttribute("rtAllActiveCount", IterableUtils.size(rtAllActRes.getBody()));
|
||||||
model.addAttribute("showClosed", showClosedBoolean);
|
model.addAttribute("showClosed", showClosedBoolean);
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "account/accountOverview";
|
return "account/accountOverview";
|
||||||
}
|
}
|
||||||
@@ -41,25 +46,27 @@ public class AccountController {
|
|||||||
@GetMapping("/newAccount")
|
@GetMapping("/newAccount")
|
||||||
public String newAccount(Model model) {
|
public String newAccount(Model model) {
|
||||||
model.addAttribute("accounttypes", AccountType.valueList());
|
model.addAttribute("accounttypes", AccountType.valueList());
|
||||||
model.addAttribute("newAccountForm", new NewAccountForm());
|
model.addAttribute("form", new NewAccountForm());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "account/newAccount";
|
return "account/newAccount";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/saveAccount")
|
@PostMapping("/saveAccount")
|
||||||
public String saveAccont(NewAccountForm newAccountForm, Model model) {
|
public String saveAccont(NewAccountForm form, Model model) {
|
||||||
final UriComponentsBuilder builder = UriComponentsBuilder
|
final UriComponentsBuilder builder = UriComponentsBuilder
|
||||||
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.ACC_CREATE_ACCOUNT))
|
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.ACC_CREATE_ACCOUNT))
|
||||||
.queryParam("key", newAccountForm.getKey())
|
.queryParam("key", form.getKey())
|
||||||
.queryParam("type", newAccountForm.getType());
|
.queryParam("type", form.getType());
|
||||||
|
|
||||||
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
||||||
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
||||||
|
|
||||||
if (!ResponseReason.OK.equals(responseReason)) {
|
if (!ResponseReason.OK.equals(responseReason)) {
|
||||||
model.addAttribute("form", newAccountForm);
|
model.addAttribute("form", form);
|
||||||
model.addAttribute("accounttypes", AccountType.valueList());
|
model.addAttribute("accounttypes", AccountType.valueList());
|
||||||
model.addAttribute("errorMessage", responseReason.name());
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "account/newAccount";
|
return "account/newAccount";
|
||||||
}
|
}
|
||||||
@@ -74,9 +81,15 @@ public class AccountController {
|
|||||||
final ResponseEntity<Iterable<Transaction>> transactionResponse = new GetAllTransactionsForAccountTemplate()
|
final ResponseEntity<Iterable<Transaction>> transactionResponse = new GetAllTransactionsForAccountTemplate()
|
||||||
.exchange(this.financerConfig, account.getKey());
|
.exchange(this.financerConfig, account.getKey());
|
||||||
|
|
||||||
|
List<Transaction> transactions = IterableUtils.toList(transactionResponse.getBody());
|
||||||
|
|
||||||
|
transactions.sort(new TransactionByDateComparator());
|
||||||
|
transactions.stream().forEach((t) -> TransactionUtils.adjustAmount(t, account));
|
||||||
|
|
||||||
model.addAttribute("account", account);
|
model.addAttribute("account", account);
|
||||||
model.addAttribute("transactions", IterableUtils.toList(transactionResponse.getBody()));
|
model.addAttribute("transactions", transactions);
|
||||||
model.addAttribute("isClosed", AccountStatus.CLOSED.equals(account.getStatus()));
|
model.addAttribute("isClosed", AccountStatus.CLOSED.equals(account.getStatus()));
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "account/accountDetails";
|
return "account/accountDetails";
|
||||||
}
|
}
|
||||||
@@ -97,10 +110,16 @@ public class AccountController {
|
|||||||
final ResponseEntity<Iterable<Transaction>> transactionResponse = new GetAllTransactionsForAccountTemplate()
|
final ResponseEntity<Iterable<Transaction>> transactionResponse = new GetAllTransactionsForAccountTemplate()
|
||||||
.exchange(this.financerConfig, account.getKey());
|
.exchange(this.financerConfig, account.getKey());
|
||||||
|
|
||||||
|
List<Transaction> transactions = IterableUtils.toList(transactionResponse.getBody());
|
||||||
|
|
||||||
|
transactions.sort(new TransactionByDateComparator());
|
||||||
|
transactions.stream().forEach((t) -> TransactionUtils.adjustAmount(t, account));
|
||||||
|
|
||||||
model.addAttribute("account", account);
|
model.addAttribute("account", account);
|
||||||
model.addAttribute("transactions", IterableUtils.toList(transactionResponse.getBody()));
|
model.addAttribute("transactions", transactions);
|
||||||
model.addAttribute("isClosed", AccountStatus.CLOSED.equals(account.getStatus()));
|
model.addAttribute("isClosed", AccountStatus.CLOSED.equals(account.getStatus()));
|
||||||
model.addAttribute("errorMessage", responseReason.name());
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "account/accountDetails";
|
return "account/accountDetails";
|
||||||
}
|
}
|
||||||
@@ -124,10 +143,16 @@ public class AccountController {
|
|||||||
final ResponseEntity<Iterable<Transaction>> transactionResponse = new GetAllTransactionsForAccountTemplate()
|
final ResponseEntity<Iterable<Transaction>> transactionResponse = new GetAllTransactionsForAccountTemplate()
|
||||||
.exchange(this.financerConfig, account.getKey());
|
.exchange(this.financerConfig, account.getKey());
|
||||||
|
|
||||||
|
List<Transaction> transactions = IterableUtils.toList(transactionResponse.getBody());
|
||||||
|
|
||||||
|
transactions.sort(new TransactionByDateComparator());
|
||||||
|
transactions.stream().forEach((t) -> TransactionUtils.adjustAmount(t, account));
|
||||||
|
|
||||||
model.addAttribute("account", account);
|
model.addAttribute("account", account);
|
||||||
model.addAttribute("transactions", IterableUtils.toList(transactionResponse.getBody()));
|
model.addAttribute("transactions", transactions);
|
||||||
model.addAttribute("isClosed", AccountStatus.CLOSED.equals(account.getStatus()));
|
model.addAttribute("isClosed", AccountStatus.CLOSED.equals(account.getStatus()));
|
||||||
model.addAttribute("errorMessage", responseReason.name());
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "account/accountDetails";
|
return "account/accountDetails";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import de.financer.ResponseReason;
|
|||||||
import de.financer.config.FinancerConfig;
|
import de.financer.config.FinancerConfig;
|
||||||
import de.financer.controller.template.*;
|
import de.financer.controller.template.*;
|
||||||
import de.financer.form.NewRecurringTransactionForm;
|
import de.financer.form.NewRecurringTransactionForm;
|
||||||
|
import de.financer.form.RecurringToTransactionWithAmountForm;
|
||||||
import de.financer.model.Account;
|
import de.financer.model.Account;
|
||||||
import de.financer.model.HolidayWeekendType;
|
import de.financer.model.HolidayWeekendType;
|
||||||
import de.financer.model.IntervalType;
|
import de.financer.model.IntervalType;
|
||||||
@@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class RecurringTransactionController {
|
public class RecurringTransactionController {
|
||||||
|
|
||||||
@@ -30,33 +33,24 @@ public class RecurringTransactionController {
|
|||||||
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(response.getBody()));
|
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(response.getBody()));
|
||||||
model.addAttribute("intervalTypes", IntervalType.valueList());
|
model.addAttribute("intervalTypes", IntervalType.valueList());
|
||||||
model.addAttribute("holidayWeekendTypes", HolidayWeekendType.valueList());
|
model.addAttribute("holidayWeekendTypes", HolidayWeekendType.valueList());
|
||||||
model.addAttribute("newRecurringTransactionForm", new NewRecurringTransactionForm());
|
model.addAttribute("form", new NewRecurringTransactionForm());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "recurringTransaction/newRecurringTransaction";
|
return "recurringTransaction/newRecurringTransaction";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/saveRecurringTransaction")
|
@PostMapping("/saveRecurringTransaction")
|
||||||
public String saveRecurringTransaction(NewRecurringTransactionForm newRecurringTransactionForm, Model model) {
|
public String saveRecurringTransaction(NewRecurringTransactionForm form, Model model) {
|
||||||
final UriComponentsBuilder builder = UriComponentsBuilder
|
final UriComponentsBuilder builder = UriComponentsBuilder
|
||||||
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.RT_CREATE_RECURRING_TRANSACTION))
|
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.RT_CREATE_RECURRING_TRANSACTION))
|
||||||
.queryParam("fromAccountKey", newRecurringTransactionForm
|
.queryParam("fromAccountKey", form.getFromAccountKey())
|
||||||
.getFromAccountKey())
|
.queryParam("toAccountKey", form.getToAccountKey())
|
||||||
.queryParam("toAccountKey", newRecurringTransactionForm
|
.queryParam("amount", form.getAmount())
|
||||||
.getToAccountKey())
|
.queryParam("firstOccurrence", ControllerUtils.formatDate(this.financerConfig, form.getFirstOccurrence()))
|
||||||
.queryParam("amount", newRecurringTransactionForm
|
.queryParam("lastOccurrence", ControllerUtils.formatDate(this.financerConfig, form.getLastOccurrence()))
|
||||||
.getAmount())
|
.queryParam("holidayWeekendType", form.getHolidayWeekendType())
|
||||||
.queryParam("firstOccurrence", ControllerUtils
|
.queryParam("intervalType", form.getIntervalType())
|
||||||
.formatDate(this.financerConfig, newRecurringTransactionForm
|
.queryParam("description", form.getDescription());
|
||||||
.getFirstOccurrence()))
|
|
||||||
.queryParam("lastOccurrence", ControllerUtils
|
|
||||||
.formatDate(this.financerConfig, newRecurringTransactionForm
|
|
||||||
.getLastOccurrence()))
|
|
||||||
.queryParam("holidayWeekendType", newRecurringTransactionForm
|
|
||||||
.getHolidayWeekendType())
|
|
||||||
.queryParam("intervalType", newRecurringTransactionForm
|
|
||||||
.getIntervalType())
|
|
||||||
.queryParam("description", newRecurringTransactionForm
|
|
||||||
.getDescription());
|
|
||||||
|
|
||||||
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
||||||
|
|
||||||
@@ -69,8 +63,9 @@ public class RecurringTransactionController {
|
|||||||
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(getAllResponse.getBody()));
|
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(getAllResponse.getBody()));
|
||||||
model.addAttribute("intervalTypes", IntervalType.valueList());
|
model.addAttribute("intervalTypes", IntervalType.valueList());
|
||||||
model.addAttribute("holidayWeekendTypes", HolidayWeekendType.valueList());
|
model.addAttribute("holidayWeekendTypes", HolidayWeekendType.valueList());
|
||||||
model.addAttribute("form", newRecurringTransactionForm);
|
model.addAttribute("form", form);
|
||||||
model.addAttribute("errorMessage", responseReason.name());
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "recurringTransaction/newRecurringTransaction";
|
return "recurringTransaction/newRecurringTransaction";
|
||||||
}
|
}
|
||||||
@@ -85,6 +80,7 @@ public class RecurringTransactionController {
|
|||||||
|
|
||||||
model.addAttribute("recurringTransactions", response.getBody());
|
model.addAttribute("recurringTransactions", response.getBody());
|
||||||
model.addAttribute("subTitle", "dueToday");
|
model.addAttribute("subTitle", "dueToday");
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "recurringTransaction/recurringTransactionList";
|
return "recurringTransaction/recurringTransactionList";
|
||||||
}
|
}
|
||||||
@@ -96,6 +92,7 @@ public class RecurringTransactionController {
|
|||||||
|
|
||||||
model.addAttribute("recurringTransactions", response.getBody());
|
model.addAttribute("recurringTransactions", response.getBody());
|
||||||
model.addAttribute("subTitle", "active");
|
model.addAttribute("subTitle", "active");
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "recurringTransaction/recurringTransactionList";
|
return "recurringTransaction/recurringTransactionList";
|
||||||
}
|
}
|
||||||
@@ -107,7 +104,130 @@ public class RecurringTransactionController {
|
|||||||
|
|
||||||
model.addAttribute("recurringTransactions", response.getBody());
|
model.addAttribute("recurringTransactions", response.getBody());
|
||||||
model.addAttribute("subTitle", "all");
|
model.addAttribute("subTitle", "all");
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "recurringTransaction/recurringTransactionList";
|
return "recurringTransaction/recurringTransactionList";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/deleteRecurringTransaction")
|
||||||
|
public String deleteRecurringTransaction(String recurringTransactionId, Model model) {
|
||||||
|
final UriComponentsBuilder builder = UriComponentsBuilder
|
||||||
|
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.RT_DELETE_RECURRING_TRANSACTION))
|
||||||
|
.queryParam("recurringTransactionId", recurringTransactionId);
|
||||||
|
|
||||||
|
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
||||||
|
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
||||||
|
final ResponseEntity<Iterable<RecurringTransaction>> allResponse = new GetAllRecurringTransactionsTemplate()
|
||||||
|
.exchange(this.financerConfig);
|
||||||
|
|
||||||
|
model.addAttribute("recurringTransactions", allResponse.getBody());
|
||||||
|
model.addAttribute("subTitle", "all");
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
|
if (!ResponseReason.OK.equals(responseReason)) {
|
||||||
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
|
||||||
|
return "recurringTransaction/recurringTransactionList";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "recurringTransaction/recurringTransactionList";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/recurringToTransaction")
|
||||||
|
public String recurringToTransaction(String recurringTransactionId, String sub, Model model) {
|
||||||
|
final UriComponentsBuilder builder = UriComponentsBuilder
|
||||||
|
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.RT_CREATE_TRANSACTION))
|
||||||
|
.queryParam("recurringTransactionId", recurringTransactionId);
|
||||||
|
|
||||||
|
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
||||||
|
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
||||||
|
|
||||||
|
if (!ResponseReason.OK.equals(responseReason)) {
|
||||||
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
model.addAttribute("subTitle", sub);
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
|
Iterable<RecurringTransaction> recurringTransactions;
|
||||||
|
|
||||||
|
switch (sub) {
|
||||||
|
case "all":
|
||||||
|
recurringTransactions = new GetAllRecurringTransactionsTemplate()
|
||||||
|
.exchange(this.financerConfig).getBody();
|
||||||
|
break;
|
||||||
|
case "active":
|
||||||
|
recurringTransactions = new GetAllRecurringTransactionsTemplate()
|
||||||
|
.exchange(this.financerConfig).getBody();
|
||||||
|
break;
|
||||||
|
case "dueToday":
|
||||||
|
recurringTransactions = new GetAllRecurringTransactionsDueTodayTemplate()
|
||||||
|
.exchange(this.financerConfig).getBody();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
recurringTransactions = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute("recurringTransactions", recurringTransactions);
|
||||||
|
|
||||||
|
return "recurringTransaction/recurringTransactionList";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "redirect:/accountOverview";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/recurringToTransactionWithAmount")
|
||||||
|
public String recurringToTransactionWithAmount(String recurringTransactionId, String sub, Model model) {
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
|
RecurringToTransactionWithAmountForm form = new RecurringToTransactionWithAmountForm();
|
||||||
|
|
||||||
|
form.setRecurringTransactionId(recurringTransactionId);
|
||||||
|
form.setSubTitle(sub);
|
||||||
|
|
||||||
|
model.addAttribute("form", form);
|
||||||
|
|
||||||
|
return "recurringTransaction/recurringToTransactionWithAmount";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/createTransactionWithAmount")
|
||||||
|
public String createTransactionWithAmount(RecurringToTransactionWithAmountForm form, Model model) {
|
||||||
|
final UriComponentsBuilder builder = UriComponentsBuilder
|
||||||
|
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.RT_CREATE_TRANSACTION))
|
||||||
|
.queryParam("recurringTransactionId", form.getRecurringTransactionId())
|
||||||
|
.queryParam("amount", form.getAmount());
|
||||||
|
|
||||||
|
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
||||||
|
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
||||||
|
|
||||||
|
if (!ResponseReason.OK.equals(responseReason)) {
|
||||||
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
model.addAttribute("subTitle", form.getSubTitle());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
|
Iterable<RecurringTransaction> recurringTransactions;
|
||||||
|
|
||||||
|
switch (form.getSubTitle()) {
|
||||||
|
case "all":
|
||||||
|
recurringTransactions = new GetAllRecurringTransactionsTemplate()
|
||||||
|
.exchange(this.financerConfig).getBody();
|
||||||
|
break;
|
||||||
|
case "active":
|
||||||
|
recurringTransactions = new GetAllRecurringTransactionsTemplate()
|
||||||
|
.exchange(this.financerConfig).getBody();
|
||||||
|
break;
|
||||||
|
case "dueToday":
|
||||||
|
recurringTransactions = new GetAllRecurringTransactionsDueTodayTemplate()
|
||||||
|
.exchange(this.financerConfig).getBody();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
recurringTransactions = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute("recurringTransactions", recurringTransactions);
|
||||||
|
|
||||||
|
return "recurringTransaction/recurringTransactionList";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "redirect:/accountOverview";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,18 @@ package de.financer.controller;
|
|||||||
|
|
||||||
import de.financer.ResponseReason;
|
import de.financer.ResponseReason;
|
||||||
import de.financer.config.FinancerConfig;
|
import de.financer.config.FinancerConfig;
|
||||||
|
import de.financer.controller.template.GetAccountByKeyTemplate;
|
||||||
import de.financer.controller.template.GetAllAccountsTemplate;
|
import de.financer.controller.template.GetAllAccountsTemplate;
|
||||||
|
import de.financer.controller.template.GetAllTransactionsForAccountTemplate;
|
||||||
import de.financer.controller.template.StringTemplate;
|
import de.financer.controller.template.StringTemplate;
|
||||||
import de.financer.form.NewTransactionForm;
|
import de.financer.form.NewTransactionForm;
|
||||||
import de.financer.model.Account;
|
import de.financer.model.Account;
|
||||||
|
import de.financer.model.AccountStatus;
|
||||||
|
import de.financer.model.Transaction;
|
||||||
import de.financer.util.ControllerUtils;
|
import de.financer.util.ControllerUtils;
|
||||||
|
import de.financer.util.TransactionUtils;
|
||||||
|
import de.financer.util.comparator.TransactionByDateComparator;
|
||||||
|
import org.apache.commons.collections4.IterableUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -15,6 +22,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class TransactionController {
|
public class TransactionController {
|
||||||
|
|
||||||
@@ -26,20 +35,21 @@ public class TransactionController {
|
|||||||
final ResponseEntity<Iterable<Account>> response = new GetAllAccountsTemplate().exchange(this.financerConfig);
|
final ResponseEntity<Iterable<Account>> response = new GetAllAccountsTemplate().exchange(this.financerConfig);
|
||||||
|
|
||||||
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(response.getBody()));
|
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(response.getBody()));
|
||||||
model.addAttribute("newTransactionForm", new NewTransactionForm());
|
model.addAttribute("form", new NewTransactionForm());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "transaction/newTransaction";
|
return "transaction/newTransaction";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/saveTransaction")
|
@PostMapping("/saveTransaction")
|
||||||
public String saveTransaction(NewTransactionForm newTransactionForm, Model model) {
|
public String saveTransaction(NewTransactionForm form, Model model) {
|
||||||
final UriComponentsBuilder builder = UriComponentsBuilder
|
final UriComponentsBuilder builder = UriComponentsBuilder
|
||||||
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.TR_CREATE_TRANSACTION))
|
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.TR_CREATE_TRANSACTION))
|
||||||
.queryParam("fromAccountKey", newTransactionForm.getFromAccountKey())
|
.queryParam("fromAccountKey", form.getFromAccountKey())
|
||||||
.queryParam("toAccountKey", newTransactionForm.getToAccountKey())
|
.queryParam("toAccountKey", form.getToAccountKey())
|
||||||
.queryParam("amount", newTransactionForm.getAmount())
|
.queryParam("amount", form.getAmount())
|
||||||
.queryParam("date", ControllerUtils.formatDate(this.financerConfig, newTransactionForm.getDate()))
|
.queryParam("date", ControllerUtils.formatDate(this.financerConfig, form.getDate()))
|
||||||
.queryParam("description", newTransactionForm.getDescription());
|
.queryParam("description", form.getDescription());
|
||||||
|
|
||||||
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
||||||
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
||||||
@@ -48,12 +58,46 @@ public class TransactionController {
|
|||||||
final ResponseEntity<Iterable<Account>> accRes = new GetAllAccountsTemplate().exchange(this.financerConfig);
|
final ResponseEntity<Iterable<Account>> accRes = new GetAllAccountsTemplate().exchange(this.financerConfig);
|
||||||
|
|
||||||
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(accRes.getBody()));
|
model.addAttribute("accounts", ControllerUtils.filterAndSortAccounts(accRes.getBody()));
|
||||||
model.addAttribute("form", newTransactionForm);
|
model.addAttribute("form", form);
|
||||||
model.addAttribute("errorMessage", responseReason.name());
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
return "transaction/newTransaction";
|
return "transaction/newTransaction";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "redirect:/accountOverview";
|
return "redirect:/accountOverview";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/deleteTransaction")
|
||||||
|
public String deleteTransaction(String transactionId, String accountKey, Model model) {
|
||||||
|
final UriComponentsBuilder builder = UriComponentsBuilder
|
||||||
|
.fromHttpUrl(ControllerUtils.buildUrl(this.financerConfig, Function.TR_DELETE_TRANSACTION))
|
||||||
|
.queryParam("transactionId", transactionId);
|
||||||
|
|
||||||
|
final ResponseEntity<String> response = new StringTemplate().exchange(builder);
|
||||||
|
final ResponseReason responseReason = ResponseReason.fromResponseEntity(response);
|
||||||
|
|
||||||
|
final ResponseEntity<Account> accountResponse = new GetAccountByKeyTemplate().exchange(this.financerConfig, accountKey);
|
||||||
|
final Account account = accountResponse.getBody();
|
||||||
|
final ResponseEntity<Iterable<Transaction>> transactionResponse = new GetAllTransactionsForAccountTemplate()
|
||||||
|
.exchange(this.financerConfig, account.getKey());
|
||||||
|
|
||||||
|
List<Transaction> transactions = IterableUtils.toList(transactionResponse.getBody());
|
||||||
|
|
||||||
|
transactions.sort(new TransactionByDateComparator());
|
||||||
|
transactions.stream().forEach((t) -> TransactionUtils.adjustAmount(t, account));
|
||||||
|
|
||||||
|
model.addAttribute("account", account);
|
||||||
|
model.addAttribute("transactions", transactions);
|
||||||
|
model.addAttribute("isClosed", AccountStatus.CLOSED.equals(account.getStatus()));
|
||||||
|
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||||
|
|
||||||
|
if (!ResponseReason.OK.equals(responseReason)) {
|
||||||
|
model.addAttribute("errorMessage", responseReason.name());
|
||||||
|
|
||||||
|
return "account/accountDetails";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "account/accountDetails";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package de.financer.form;
|
||||||
|
|
||||||
|
public class RecurringToTransactionWithAmountForm {
|
||||||
|
private String recurringTransactionId;
|
||||||
|
private String amount;
|
||||||
|
private String subTitle;
|
||||||
|
|
||||||
|
public String getRecurringTransactionId() {
|
||||||
|
return recurringTransactionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecurringTransactionId(String recurringTransactionId) {
|
||||||
|
this.recurringTransactionId = recurringTransactionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(String amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubTitle() {
|
||||||
|
return subTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubTitle(String subTitle) {
|
||||||
|
this.subTitle = subTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import de.financer.model.RecurringTransaction;
|
|||||||
import de.financer.util.comparator.AccountByTypeComparator;
|
import de.financer.util.comparator.AccountByTypeComparator;
|
||||||
import org.apache.commons.collections4.IterableUtils;
|
import org.apache.commons.collections4.IterableUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -47,4 +48,8 @@ public class ControllerUtils {
|
|||||||
.filter((rt) -> rt.getFromAccount() != null && rt.getToAccount() != null)
|
.filter((rt) -> rt.getFromAccount() != null && rt.getToAccount() != null)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addVersionAttribute(Model model, FinancerConfig financerConfig) {
|
||||||
|
model.addAttribute("financerVersion", financerConfig.getVersion());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
64
src/main/java/de/financer/util/TransactionUtils.java
Normal file
64
src/main/java/de/financer/util/TransactionUtils.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package de.financer.util;
|
||||||
|
|
||||||
|
import de.financer.model.Account;
|
||||||
|
import de.financer.model.AccountType;
|
||||||
|
import de.financer.model.Transaction;
|
||||||
|
|
||||||
|
import static de.financer.model.AccountType.*;
|
||||||
|
|
||||||
|
public class TransactionUtils {
|
||||||
|
public static final void adjustAmount(Transaction t, Account account) {
|
||||||
|
boolean isFrom = t.getFromAccount().getKey().equals(account.getKey());
|
||||||
|
|
||||||
|
if (AccountType.START.equals(t.getFromAccount().getType()) && AccountType.LIABILITY.equals(t.getToAccount().getType())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFrom) {
|
||||||
|
t.setAmount(t.getAmount() * TransactionUtils.getMultiplierFromAccount(account));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
t.setAmount(t.getAmount() * TransactionUtils.getMultiplierToAccount(account));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getMultiplierFromAccount(Account fromAccount) {
|
||||||
|
// There is no multiplier if the from account is an EXPENSE account because
|
||||||
|
// it's not a valid from account type
|
||||||
|
|
||||||
|
final AccountType accountType = fromAccount.getType();
|
||||||
|
|
||||||
|
if (INCOME.equals(accountType)) {
|
||||||
|
return 1L;
|
||||||
|
} else if (BANK.equals(accountType)) {
|
||||||
|
return -1L;
|
||||||
|
} else if (CASH.equals(accountType)) {
|
||||||
|
return -1L;
|
||||||
|
} else if (LIABILITY.equals(accountType)) {
|
||||||
|
return 1L;
|
||||||
|
} else if (START.equals(accountType)) {
|
||||||
|
return 1L;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1L;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getMultiplierToAccount(Account toAccount) {
|
||||||
|
// There are no multipliers for INCOME and START accounts
|
||||||
|
// because they are not valid to account types
|
||||||
|
|
||||||
|
final AccountType accountType = toAccount.getType();
|
||||||
|
|
||||||
|
if (BANK.equals(accountType)) {
|
||||||
|
return 1L;
|
||||||
|
} else if (CASH.equals(accountType)) {
|
||||||
|
return 1L;
|
||||||
|
} else if (LIABILITY.equals(accountType)) {
|
||||||
|
return -1L;
|
||||||
|
} else if (EXPENSE.equals(accountType)) {
|
||||||
|
return 1L;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1L;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package de.financer.util.comparator;
|
||||||
|
|
||||||
|
import de.financer.model.Transaction;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
public class TransactionByDateComparator implements Comparator<Transaction> {
|
||||||
|
@Override
|
||||||
|
public int compare(Transaction o1, Transaction o2) {
|
||||||
|
return o1.getDate().compareTo(o2.getDate()) * -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ logging.file=financer-web-client.log
|
|||||||
|
|
||||||
# The date format of the client-supplied date string, used to parse the string into a proper object
|
# The date format of the client-supplied date string, used to parse the string into a proper object
|
||||||
financer.dateFormat=dd.MM.yyyy
|
financer.dateFormat=dd.MM.yyyy
|
||||||
|
financer.version=@project.version@
|
||||||
financer.serverUrl=http://localhost:8089/financer-server/
|
financer.serverUrl=http://localhost:8089/financer-server/
|
||||||
|
|
||||||
spring.messages.basename=i18n/message
|
spring.messages.basename=i18n/message
|
||||||
@@ -73,6 +73,7 @@ financer.account-details.title=financer\: account details
|
|||||||
financer.account-details.available-actions=Available actions\:
|
financer.account-details.available-actions=Available actions\:
|
||||||
financer.account-details.available-actions.close-account=Close account
|
financer.account-details.available-actions.close-account=Close account
|
||||||
financer.account-details.available-actions.open-account=Open account
|
financer.account-details.available-actions.open-account=Open account
|
||||||
|
financer.account-details.available-actions.back-to-overview=Back to overview
|
||||||
financer.account-details.table-header.id=ID
|
financer.account-details.table-header.id=ID
|
||||||
financer.account-details.table-header.fromAccount=From account
|
financer.account-details.table-header.fromAccount=From account
|
||||||
financer.account-details.table-header.toAccount=To account
|
financer.account-details.table-header.toAccount=To account
|
||||||
@@ -83,9 +84,12 @@ financer.account-details.table-header.byRecurring=Recurring?
|
|||||||
financer.account-details.details.type=Type\:
|
financer.account-details.details.type=Type\:
|
||||||
financer.account-details.details.balance=Current Balance\:
|
financer.account-details.details.balance=Current Balance\:
|
||||||
financer.account-details.table-header.actions=Actions
|
financer.account-details.table-header.actions=Actions
|
||||||
financer.account-details.table.actions.editTransaction=Edit
|
|
||||||
financer.account-details.table.actions.deleteTransaction=Delete
|
financer.account-details.table.actions.deleteTransaction=Delete
|
||||||
|
|
||||||
|
financer.recurring-to-transaction-with-amount.title=financer\: create transaction from recurring with amount
|
||||||
|
financer.recurring-to-transaction-with-amount.label.amount=Amount\:
|
||||||
|
financer.recurring-to-transaction-with-amount.submit=Create
|
||||||
|
|
||||||
financer.interval-type.DAILY=Daily
|
financer.interval-type.DAILY=Daily
|
||||||
financer.interval-type.WEEKLY=Weekly
|
financer.interval-type.WEEKLY=Weekly
|
||||||
financer.interval-type.MONTHLY=Monthly
|
financer.interval-type.MONTHLY=Monthly
|
||||||
@@ -114,6 +118,7 @@ financer.heading.account-details=financer\: account details for {0}
|
|||||||
financer.heading.recurring-transaction-list.dueToday=financer\: recurring transactions due today
|
financer.heading.recurring-transaction-list.dueToday=financer\: recurring transactions due today
|
||||||
financer.heading.recurring-transaction-list.active=financer\: active recurring transactions
|
financer.heading.recurring-transaction-list.active=financer\: active recurring transactions
|
||||||
financer.heading.recurring-transaction-list.all=financer\: all recurring transaction
|
financer.heading.recurring-transaction-list.all=financer\: all recurring transaction
|
||||||
|
financer.heading.recurring-to-transaction-with-amount=financer\: create transaction from recurring with amount
|
||||||
|
|
||||||
financer.error-message.UNKNOWN_ERROR=An unknown error occurred!
|
financer.error-message.UNKNOWN_ERROR=An unknown error occurred!
|
||||||
financer.error-message.INVALID_ACCOUNT_TYPE=The selected account type is not valid!
|
financer.error-message.INVALID_ACCOUNT_TYPE=The selected account type is not valid!
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ financer.account-details.title=financer\: Kontodetails
|
|||||||
financer.account-details.available-actions=Verf\u00FCgbare Aktionen\:
|
financer.account-details.available-actions=Verf\u00FCgbare Aktionen\:
|
||||||
financer.account-details.available-actions.close-account=Konto schlie\u00DFen
|
financer.account-details.available-actions.close-account=Konto schlie\u00DFen
|
||||||
financer.account-details.available-actions.open-account=Konto \u00F6ffnen
|
financer.account-details.available-actions.open-account=Konto \u00F6ffnen
|
||||||
|
financer.account-details.available-actions.back-to-overview=Zur\u00FCck zur \u00DCbersicht
|
||||||
financer.account-details.table-header.id=ID
|
financer.account-details.table-header.id=ID
|
||||||
financer.account-details.table-header.fromAccount=Von Konto
|
financer.account-details.table-header.fromAccount=Von Konto
|
||||||
financer.account-details.table-header.toAccount=An Konto
|
financer.account-details.table-header.toAccount=An Konto
|
||||||
@@ -83,8 +84,11 @@ financer.account-details.table-header.byRecurring=Wiederkehrend?
|
|||||||
financer.account-details.details.type=Typ\:
|
financer.account-details.details.type=Typ\:
|
||||||
financer.account-details.details.balance=Kontostand\:
|
financer.account-details.details.balance=Kontostand\:
|
||||||
financer.account-details.table-header.actions=Aktionen
|
financer.account-details.table-header.actions=Aktionen
|
||||||
financer.account-details.table.actions.editTransaction=Bearbeiten
|
financer.account-details.table.actions.deleteTransaction=L\u00F6schen
|
||||||
financer.account-details.table.actions.deleteTransaction=Löschen
|
|
||||||
|
financer.recurring-to-transaction-with-amount.title=financer\: Buchung mit Betrag aus wiederkehrender Buchung erstellen
|
||||||
|
financer.recurring-to-transaction-with-amount.label.amount=Betrag\:
|
||||||
|
financer.recurring-to-transaction-with-amount.submit=Erstellen
|
||||||
|
|
||||||
financer.interval-type.DAILY=T\u00E4glich
|
financer.interval-type.DAILY=T\u00E4glich
|
||||||
financer.interval-type.WEEKLY=W\u00F6chentlich
|
financer.interval-type.WEEKLY=W\u00F6chentlich
|
||||||
@@ -114,3 +118,4 @@ financer.heading.account-details=financer\: Kontodetails f\u00FCr {0}
|
|||||||
financer.heading.recurring-transaction-list.dueToday=financer\: wiederkehrende Buchungen heute f\u00E4llig
|
financer.heading.recurring-transaction-list.dueToday=financer\: wiederkehrende Buchungen heute f\u00E4llig
|
||||||
financer.heading.recurring-transaction-list.active=financer\: aktive wiederkehrende Buchungen
|
financer.heading.recurring-transaction-list.active=financer\: aktive wiederkehrende Buchungen
|
||||||
financer.heading.recurring-transaction-list.all=financer\: alle wiederkehrende Buchungen
|
financer.heading.recurring-transaction-list.all=financer\: alle wiederkehrende Buchungen
|
||||||
|
financer.heading.recurring-to-transaction-with-amount=financer\: Buchung mit Betrag aus wiederkehrender Buchung erstellen
|
||||||
@@ -55,13 +55,28 @@ tr:hover {
|
|||||||
|
|
||||||
#new-account-form *,
|
#new-account-form *,
|
||||||
#new-transaction-form *,
|
#new-transaction-form *,
|
||||||
#new-recurring-transaction-form * {
|
#new-recurring-transaction-form *,
|
||||||
|
#recurring-to-transaction-with-amount-form * {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
width: 20em;
|
width: 20em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.errorMessage {
|
#footer-container * {
|
||||||
color: #ff6666
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer-container > hr {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer-container > span {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorMessage {
|
||||||
|
color: #ff6666;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
th:text="#{financer.account-details.available-actions.close-account}"/>
|
th:text="#{financer.account-details.available-actions.close-account}"/>
|
||||||
<a th:if="${isClosed}" th:href="@{/openAccount(key=${account.key})}"
|
<a th:if="${isClosed}" th:href="@{/openAccount(key=${account.key})}"
|
||||||
th:text="#{financer.account-details.available-actions.open-account}"/>
|
th:text="#{financer.account-details.available-actions.open-account}"/>
|
||||||
|
<a th:href="@{/accountOverview}"
|
||||||
|
th:text="#{financer.account-details.available-actions.back-to-overview}"/>
|
||||||
</div>
|
</div>
|
||||||
<table id="account-transaction-table">
|
<table id="account-transaction-table">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -47,13 +49,12 @@
|
|||||||
<td th:text="${transaction.recurringTransaction != null}" />
|
<td th:text="${transaction.recurringTransaction != null}" />
|
||||||
<td>
|
<td>
|
||||||
<div id="account-transaction-table-actions-container">
|
<div id="account-transaction-table-actions-container">
|
||||||
<a th:href="@{/editTransaction}"
|
<a th:href="@{/deleteTransaction(transactionId=${transaction.id}, accountKey=${account.key})}"
|
||||||
th:text="#{financer.account-details.table.actions.editTransaction}"/>
|
|
||||||
<a th:href="@{/deleteTransaction}"
|
|
||||||
th:text="#{financer.account-details.table.actions.deleteTransaction}"/>
|
th:text="#{financer.account-details.table.actions.deleteTransaction}"/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<div th:replace="includes/footer :: footer"/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -50,5 +50,6 @@
|
|||||||
<td class="hideable-column" th:text="#{'financer.account-status.' + ${acc.status}}"/>
|
<td class="hideable-column" th:text="#{'financer.account-status.' + ${acc.status}}"/>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<div th:replace="includes/footer :: footer"/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1 th:text="#{financer.heading.account-new}" />
|
<h1 th:text="#{financer.heading.account-new}" />
|
||||||
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
||||||
<form id="new-account-form" action="#" th:action="@{/saveAccount}" th:object="${newAccountForm}" method="post">
|
<form id="new-account-form" action="#" th:action="@{/saveAccount}" th:object="${form}" method="post">
|
||||||
<label for="inputKey" th:text="#{financer.account-new.label.key}"/>
|
<label for="inputKey" th:text="#{financer.account-new.label.key}"/>
|
||||||
<input type="text" id="inputKey" th:field="*{key}" placeholder="accounts."/>
|
<input type="text" id="inputKey" th:field="*{key}" placeholder="accounts."/>
|
||||||
<label for="selectType" th:text="#{financer.account-new.label.type}"/>
|
<label for="selectType" th:text="#{financer.account-new.label.type}"/>
|
||||||
@@ -18,5 +18,6 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="submit" th:value="#{financer.account-new.submit}" />
|
<input type="submit" th:value="#{financer.account-new.submit}" />
|
||||||
</form>
|
</form>
|
||||||
|
<div th:replace="includes/footer :: footer"/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
4
src/main/resources/templates/includes/footer.html
Normal file
4
src/main/resources/templates/includes/footer.html
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<div id="footer-container" th:fragment="footer">
|
||||||
|
<hr>
|
||||||
|
<span th:text="'financer v' + ${financerVersion}"/>
|
||||||
|
</div>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1 th:text="#{financer.heading.recurring-transaction-new}" />
|
<h1 th:text="#{financer.heading.recurring-transaction-new}" />
|
||||||
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
||||||
<form id="new-recurring-transaction-form" action="#" th:action="@{/saveRecurringTransaction}" th:object="${newRecurringTransactionForm}"
|
<form id="new-recurring-transaction-form" action="#" th:action="@{/saveRecurringTransaction}" th:object="${form}"
|
||||||
method="post">
|
method="post">
|
||||||
<label for="selectFromAccount" th:text="#{financer.recurring-transaction-new.label.from-account}"/>
|
<label for="selectFromAccount" th:text="#{financer.recurring-transaction-new.label.from-account}"/>
|
||||||
<select id="selectFromAccount" th:field="*{fromAccountKey}">
|
<select id="selectFromAccount" th:field="*{fromAccountKey}">
|
||||||
@@ -41,5 +41,6 @@
|
|||||||
<input type="text" id="inputDescription" th:field="*{description}"/>
|
<input type="text" id="inputDescription" th:field="*{description}"/>
|
||||||
<input type="submit" th:value="#{financer.recurring-transaction-new.submit}"/>
|
<input type="submit" th:value="#{financer.recurring-transaction-new.submit}"/>
|
||||||
</form>
|
</form>
|
||||||
|
<div th:replace="includes/footer :: footer"/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<title th:text="#{financer.recurring-to-transaction-with-amount.title}"/>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" th:href="@{/css/main.css}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 th:text="#{financer.heading.recurring-to-transaction-with-amount}" />
|
||||||
|
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
||||||
|
<form id="recurring-to-transaction-with-amount-form" action="#" th:action="@{/createTransactionWithAmount}" th:object="${form}"
|
||||||
|
method="post">
|
||||||
|
<label for="inputAmount" th:text="#{financer.recurring-to-transaction-with-amount.label.amount}"/>
|
||||||
|
<input type="text" id="inputAmount" th:field="*{amount}"/>
|
||||||
|
<input type="hidden" id="inputId" th:field="*{recurringTransactionId}"/>
|
||||||
|
<input type="hidden" id="inputSub" th:field="*{subTitle}"/>
|
||||||
|
<input type="submit" th:value="#{financer.recurring-to-transaction-with-amount.submit}"/>
|
||||||
|
</form>
|
||||||
|
<div th:replace="includes/footer :: footer"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 th:text="#{'financer.heading.recurring-transaction-list.' + ${subTitle}}"/>
|
<h1 th:text="#{'financer.heading.recurring-transaction-list.' + ${subTitle}}"/>
|
||||||
|
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
||||||
<table id="recurring-transaction-list-table">
|
<table id="recurring-transaction-list-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="hideable-column" th:text="#{financer.recurring-transaction-list.table-header.id}"/>
|
<th class="hideable-column" th:text="#{financer.recurring-transaction-list.table-header.id}"/>
|
||||||
@@ -33,21 +34,20 @@
|
|||||||
<td th:text="${rt.lastOccurrence}"/>
|
<td th:text="${rt.lastOccurrence}"/>
|
||||||
<td th:text="${#numbers.formatDecimal(rt.amount/100D, 1, 'DEFAULT', 2, 'DEFAULT')}"/>
|
<td th:text="${#numbers.formatDecimal(rt.amount/100D, 1, 'DEFAULT', 2, 'DEFAULT')}"/>
|
||||||
<td th:text="${rt.description}"/>
|
<td th:text="${rt.description}"/>
|
||||||
<td th:text="${rt.intervalType}"/>
|
<td th:text="#{'financer.interval-type.' + ${rt.intervalType}}"/>
|
||||||
<td th:text="${rt.holidayWeekendType}"/>
|
<td th:text="#{'financer.holiday-weekend-type.' + ${rt.holidayWeekendType}}"/>
|
||||||
<td>
|
<td>
|
||||||
<div id="recurring-transaction-list-table-actions-container">
|
<div id="recurring-transaction-list-table-actions-container">
|
||||||
<a th:href="@{/recurringToTransaction}"
|
<a th:href="@{/recurringToTransaction(recurringTransactionId=${rt.id}, sub=${subTitle})}"
|
||||||
th:text="#{financer.recurring-transaction-list.table.actions.createTransaction}"/>
|
th:text="#{financer.recurring-transaction-list.table.actions.createTransaction}"/>
|
||||||
<a th:href="@{/recurringToTransactionWithAmount}"
|
<a th:href="@{/recurringToTransactionWithAmount(recurringTransactionId=${rt.id}, sub=${subTitle})}"
|
||||||
th:text="#{financer.recurring-transaction-list.table.actions.createTransactionWithAmount}"/>
|
th:text="#{financer.recurring-transaction-list.table.actions.createTransactionWithAmount}"/>
|
||||||
<a th:href="@{/editRecurringTransaction}"
|
<a th:if="${subTitle == 'all'}" th:href="@{/deleteRecurringTransaction(recurringTransactionId=${rt.id})}"
|
||||||
th:text="#{financer.recurring-transaction-list.table.actions.editRecurringTransaction}"/>
|
|
||||||
<a th:href="@{/deleteRecurringTransaction}"
|
|
||||||
th:text="#{financer.recurring-transaction-list.table.actions.deleteRecurringTransaction}"/>
|
th:text="#{financer.recurring-transaction-list.table.actions.deleteRecurringTransaction}"/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<div th:replace="includes/footer :: footer"/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1 th:text="#{financer.heading.transaction-new}" />
|
<h1 th:text="#{financer.heading.transaction-new}" />
|
||||||
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
<span class="errorMessage" th:if="${errorMessage != null}" th:text="#{'financer.error-message.' + ${errorMessage}}"/>
|
||||||
<form id="new-transaction-form" action="#" th:action="@{/saveTransaction}" th:object="${newTransactionForm}"
|
<form id="new-transaction-form" action="#" th:action="@{/saveTransaction}" th:object="${form}"
|
||||||
method="post">
|
method="post">
|
||||||
<label for="selectFromAccount" th:text="#{financer.transaction-new.label.from-account}"/>
|
<label for="selectFromAccount" th:text="#{financer.transaction-new.label.from-account}"/>
|
||||||
<select id="selectFromAccount" th:field="*{fromAccountKey}">
|
<select id="selectFromAccount" th:field="*{fromAccountKey}">
|
||||||
|
|||||||
Reference in New Issue
Block a user