refactor: ExpensesView
This commit is contained in:
parent
7af47b86a5
commit
e916e6edff
1 changed files with 2 additions and 4 deletions
|
@ -47,16 +47,14 @@ public class DashboardView extends Div {
|
||||||
List<Integer> availableYears = this.expenseService.getAvailableExpenseYearsForUser(loggedUser.getId());
|
List<Integer> availableYears = this.expenseService.getAvailableExpenseYearsForUser(loggedUser.getId());
|
||||||
|
|
||||||
// Initialize the ComboBox for year selection
|
// Initialize the ComboBox for year selection
|
||||||
yearComboBox = new ComboBox<>("Select Year");
|
yearComboBox = new ComboBox<>();
|
||||||
yearComboBox.setItems(availableYears);
|
yearComboBox.setItems(availableYears);
|
||||||
yearComboBox.setValue(Year.now().getValue()); // Default to current year
|
yearComboBox.setValue(Year.now().getValue()); // Default to current year
|
||||||
yearComboBox.setWidth("200px");
|
yearComboBox.setWidth("200px");
|
||||||
|
|
||||||
// Add listener to update charts when a new year is selected
|
// Add listener to update charts when a new year is selected
|
||||||
yearComboBox.addValueChangeListener(event -> {
|
yearComboBox.addValueChangeListener(event -> {
|
||||||
if (event.getValue() != null) {
|
if (event.getValue() != null) updateCharts(Year.of(event.getValue()));
|
||||||
updateCharts(Year.of(event.getValue()));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
VerticalLayout mainLayout = new VerticalLayout();
|
VerticalLayout mainLayout = new VerticalLayout();
|
||||||
|
|
Loading…
Reference in a new issue