#17 Period overview: add Actions
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
package de.financer.controller;
|
||||
|
||||
import de.financer.config.FinancerConfig;
|
||||
import de.financer.dto.Order;
|
||||
import de.financer.dto.PeriodOverviewDto;
|
||||
import de.financer.dto.SearchTransactionsResponseDto;
|
||||
import de.financer.form.SearchTransactionsForm;
|
||||
import de.financer.template.FinancerRestTemplate;
|
||||
import de.financer.template.SearchTransactionsTemplate;
|
||||
import de.financer.template.StringTemplate;
|
||||
import de.financer.template.exception.FinancerRestException;
|
||||
import de.financer.util.ControllerUtils;
|
||||
import org.apache.commons.collections4.IterableUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -53,4 +57,32 @@ public class PeriodController {
|
||||
|
||||
return "period/periodOverview";
|
||||
}
|
||||
|
||||
@GetMapping("/showTransactions")
|
||||
public String showTransactions(Model model, Long periodId) {
|
||||
try {
|
||||
final Iterable<SearchTransactionsResponseDto> response =
|
||||
new SearchTransactionsTemplate()
|
||||
.exchangeGet(financerConfig, null, null, periodId, null,
|
||||
Order.TRANSACTIONS_BY_DATE_DESC, null, false);
|
||||
|
||||
final List<SearchTransactionsResponseDto> transactions = IterableUtils.toList(response);
|
||||
|
||||
|
||||
model.addAttribute("transactions", transactions);
|
||||
model.addAttribute("transactionCount", IterableUtils.size(transactions));
|
||||
}
|
||||
catch(FinancerRestException e) {
|
||||
model.addAttribute("errorMessage", e.getResponseReason().name());
|
||||
model.addAttribute("transactionCount", 0);
|
||||
}
|
||||
|
||||
model.addAttribute("form", new SearchTransactionsForm());
|
||||
model.addAttribute("showSum", false);
|
||||
ControllerUtils.addVersionAttribute(model, this.financerConfig);
|
||||
ControllerUtils.addCurrencySymbol(model, this.financerConfig);
|
||||
ControllerUtils.addDarkMode(model, this.financerConfig);
|
||||
|
||||
return "transaction/searchTransactions";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +184,8 @@ financer.period-overview.table-header.liability=Liabilities
|
||||
financer.period-overview.table-header.total=Total
|
||||
financer.period-overview.table-header.assets=Assets
|
||||
financer.period-overview.table-header.transactions=Transaction count
|
||||
financer.period-overview.table-header.actions=Actions
|
||||
financer.period-overview.table.actions.showTransactions=Show transactions
|
||||
|
||||
financer.interval-type.DAILY=Daily
|
||||
financer.interval-type.WEEKLY=Weekly
|
||||
|
||||
@@ -184,6 +184,8 @@ financer.period-overview.table-header.liability=Verbindlichkeiten
|
||||
financer.period-overview.table-header.total=Insgesamt
|
||||
financer.period-overview.table-header.assets=Umlaufverm\u00F6gen
|
||||
financer.period-overview.table-header.transactions=Anzahl Buchungen
|
||||
financer.period-overview.table-header.actions=Aktionen
|
||||
financer.period-overview.table.actions.showTransactions=Zeige Buchungen
|
||||
|
||||
financer.interval-type.DAILY=T\u00E4glich
|
||||
financer.interval-type.WEEKLY=W\u00F6chentlich
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
v45 -> v46:
|
||||
- #17 Add actions to the period overview
|
||||
|
||||
v44 -> v45:
|
||||
- #5 Having no periods breaks the "expenses per period" graph on the account overview page
|
||||
- #14 Introduce toggleable dark mode
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<th th:text="#{financer.period-overview.table-header.total}"/>
|
||||
<th th:text="#{financer.period-overview.table-header.assets}"/>
|
||||
<th th:text="#{financer.period-overview.table-header.transactions}"/>
|
||||
<th th:text="#{financer.period-overview.table-header.actions}"/>
|
||||
</tr>
|
||||
<tr th:each="periodOverview : ${periodOverviews}">
|
||||
<td th:text="${periodOverview.periodId}"/>
|
||||
@@ -44,9 +45,14 @@
|
||||
<span th:if="${periodOverview.assetTrend == T(de.financer.dto.AssetTrend).EQUAL}" class="icon color-neutral"></span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td th:if="${periodOverview.assetsSum == null}" />
|
||||
<td th:text="${periodOverview.transactionCount}"/>
|
||||
<td nowrap>
|
||||
<div id="period-overview-actions-container">
|
||||
<a th:href="@{/showTransactions(periodId=${periodOverview.periodId})}"
|
||||
th:text="#{financer.period-overview.table.actions.showTransactions}" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div th:replace="includes/footer :: footer"/>
|
||||
|
||||
Reference in New Issue
Block a user