feat: is Paid checkbox added

This commit is contained in:
filippo-ferrari 2024-07-07 17:41:14 +02:00
parent 239a08a326
commit bc1093b736

View file

@ -68,6 +68,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
private ComboBox<Category> category; private ComboBox<Category> category;
private TextArea description; private TextArea description;
private Checkbox isPeriodic; private Checkbox isPeriodic;
private Checkbox isResolved;
private ComboBox<PeriodUnit> periodUnit; private ComboBox<PeriodUnit> periodUnit;
private TextField periodInterval; private TextField periodInterval;
private DatePicker date; private DatePicker date;
@ -124,6 +125,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
// We set initial value of isPeriodic to true and show period fields // We set initial value of isPeriodic to true and show period fields
isPeriodic.setValue(false); isPeriodic.setValue(false);
isResolved.setValue(false);
periodUnit.setVisible(false); periodUnit.setVisible(false);
periodInterval.setVisible(false); periodInterval.setVisible(false);
@ -233,6 +235,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
category.setItemLabelGenerator(Category::getName); category.setItemLabelGenerator(Category::getName);
description = new TextArea("Description"); description = new TextArea("Description");
isPeriodic = new Checkbox("Is Periodic"); isPeriodic = new Checkbox("Is Periodic");
isResolved = new Checkbox("Paid");
periodUnit = new ComboBox<>("Period Unit"); periodUnit = new ComboBox<>("Period Unit");
periodUnit.setItems(PeriodUnit.values()); periodUnit.setItems(PeriodUnit.values());
periodInterval = new TextField("Period Interval"); periodInterval = new TextField("Period Interval");
@ -253,7 +256,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
? "var(--lumo-primary-text-color)" ? "var(--lumo-primary-text-color)"
: "var(--lumo-disabled-text-color)"); : "var(--lumo-disabled-text-color)");
formLayout.add(name, cost, category, description, isPeriodic, periodUnit, periodInterval, date, creditors, debtors, event); formLayout.add(name, cost, category, description, isPeriodic, isResolved, periodUnit, periodInterval, date, creditors, debtors, event);
grid.addColumn(isPeriodicRenderer).setHeader("Periodic").setAutoWidth(true); grid.addColumn(isPeriodicRenderer).setHeader("Periodic").setAutoWidth(true);
editorDiv.add(formLayout); editorDiv.add(formLayout);
createButtonLayout(editorLayoutDiv); createButtonLayout(editorLayoutDiv);