Erweiterungen
This commit is contained in:
@@ -29,6 +29,7 @@ import com.vaadin.flow.data.binder.Binder;
|
||||
import com.vaadin.flow.data.binder.ValidationException;
|
||||
import com.vaadin.flow.router.Menu;
|
||||
import com.vaadin.flow.component.Component;
|
||||
import com.vaadin.flow.component.textfield.TextArea;
|
||||
import com.vaadin.flow.router.PageTitle;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import com.vaadin.flow.theme.lumo.LumoUtility;
|
||||
@@ -289,6 +290,8 @@ public class AddJobView extends Main {
|
||||
add(belowSection);
|
||||
// Ladung – Bereich vor dem Button
|
||||
add(createCargoSection());
|
||||
// Aufgaben, Bemerkung, Preis – unter Ladung
|
||||
add(createTasksAndNotesSection());
|
||||
|
||||
// Submit button
|
||||
HorizontalLayout submitLayout = new HorizontalLayout();
|
||||
@@ -714,6 +717,8 @@ public class AddJobView extends Main {
|
||||
cargoArea.getStyle().set("border-radius", "var(--lumo-border-radius-m)");
|
||||
cargoArea.getStyle().set("padding", "var(--lumo-space-m)");
|
||||
|
||||
wrapper.add(new H3("Ladung"));
|
||||
|
||||
VerticalLayout cargoList = new VerticalLayout();
|
||||
cargoList.setPadding(false);
|
||||
cargoList.setSpacing(true);
|
||||
@@ -724,8 +729,12 @@ public class AddJobView extends Main {
|
||||
row.setWidthFull();
|
||||
row.setAlignItems(FlexComponent.Alignment.END);
|
||||
|
||||
TextField desc = new TextField("Beschreibung");
|
||||
desc.setPlaceholder("z. B. Gitterboxpalette, Paket …");
|
||||
|
||||
|
||||
ComboBox<String> desc = new ComboBox<>("Beschreibung");
|
||||
desc.setItems("Europalette", "Einwegpalette", "Düsseldorfer-Palette", "Gitterboxpalette", "Gitterwagen", "Paket");
|
||||
desc.setAllowCustomValue(true);
|
||||
desc.setPlaceholder("Wählen Sie eine Option oder geben Sie eigenen Text ein...");
|
||||
desc.setWidth("40%");
|
||||
|
||||
IntegerField qty = new IntegerField("Anzahl");
|
||||
@@ -796,6 +805,79 @@ public class AddJobView extends Main {
|
||||
if (job.getAppUser() != null) appUser.setValue(job.getAppUser());
|
||||
}
|
||||
|
||||
private Component createTasksAndNotesSection() {
|
||||
VerticalLayout wrapper = new VerticalLayout();
|
||||
wrapper.setWidthFull();
|
||||
wrapper.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
|
||||
|
||||
// Fester Content-Container für zentrierte Darstellung
|
||||
VerticalLayout content = new VerticalLayout();
|
||||
content.setWidth("720px");
|
||||
content.setPadding(false);
|
||||
content.setSpacing(true);
|
||||
content.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.STRETCH);
|
||||
|
||||
// Aufgabentitel
|
||||
H3 tasksTitle = new H3("Zu quittierende Aufgaben");
|
||||
tasksTitle.getStyle().set("margin", "0");
|
||||
content.add(tasksTitle);
|
||||
|
||||
// Dynamische Aufgabenliste
|
||||
VerticalLayout tasksList = new VerticalLayout();
|
||||
tasksList.setPadding(false);
|
||||
tasksList.setSpacing(true);
|
||||
|
||||
java.util.function.Consumer<Void> addTask = (v) -> {
|
||||
HorizontalLayout row = new HorizontalLayout();
|
||||
row.setWidthFull();
|
||||
row.setAlignItems(FlexComponent.Alignment.END);
|
||||
|
||||
TextField taskField = new TextField();
|
||||
taskField.setPlaceholder("Aufgabe");
|
||||
taskField.setWidth("100%");
|
||||
|
||||
Button remove = new Button(new Icon(VaadinIcon.CLOSE_SMALL));
|
||||
remove.addThemeVariants(ButtonVariant.LUMO_ERROR, ButtonVariant.LUMO_TERTIARY);
|
||||
remove.addClickListener(e -> tasksList.remove(row));
|
||||
|
||||
row.add(taskField, remove);
|
||||
row.setFlexGrow(1, taskField);
|
||||
tasksList.add(row);
|
||||
};
|
||||
|
||||
// 4 Beispielzeilen
|
||||
addTask.accept(null);
|
||||
addTask.accept(null);
|
||||
addTask.accept(null);
|
||||
addTask.accept(null);
|
||||
|
||||
Button addTaskBtn = new Button("Aufgabe hinzufügen", new Icon(VaadinIcon.PLUS));
|
||||
addTaskBtn.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
addTaskBtn.addClickListener(e -> addTask.accept(null));
|
||||
|
||||
content.add(tasksList, addTaskBtn);
|
||||
|
||||
// Bemerkung
|
||||
H3 remarksTitle = new H3("Bemerkung");
|
||||
remarksTitle.getStyle().set("margin", "0");
|
||||
TextArea remark = new TextArea();
|
||||
remark.setPlaceholder("z.B. rückwärtigen Liefereingang benutzen o. ä.");
|
||||
remark.setWidthFull();
|
||||
remark.setMinHeight("180px");
|
||||
content.add(remarksTitle, remark);
|
||||
|
||||
// Preis (netto)
|
||||
H3 priceTitle = new H3("Preis (netto)");
|
||||
priceTitle.getStyle().set("margin", "0");
|
||||
TextField price = new TextField("Preis");
|
||||
price.setRequiredIndicatorVisible(true);
|
||||
content.add(priceTitle, price);
|
||||
|
||||
wrapper.add(content);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hilfsmethode zum Abrufen des aktuellen Benutzernamens
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user