Erweiterungen
This commit is contained in:
@@ -30,6 +30,7 @@ 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.component.tabs.TabSheet;
|
||||
import com.vaadin.flow.router.PageTitle;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import com.vaadin.flow.theme.lumo.LumoUtility;
|
||||
@@ -201,6 +202,40 @@ public class AddJobView extends Main {
|
||||
|
||||
add(new ViewToolbar("Neuen Auftrag anlegen"));
|
||||
|
||||
// Create TabSheet for organizing the form
|
||||
TabSheet tabSheet = new TabSheet();
|
||||
tabSheet.setSizeFull();
|
||||
|
||||
// Tab 1: Customer & Addresses
|
||||
tabSheet.add("Auftraggeber & Adressen", createCustomerAndAddressesTab());
|
||||
|
||||
// Tab 2: Appointments & Processing
|
||||
tabSheet.add("Termine & Verarbeitung", createAppointmentsAndProcessingTab());
|
||||
|
||||
// Tab 3: Cargo & Tasks
|
||||
tabSheet.add("Ladung & Aufgaben", createCargoAndTasksTab());
|
||||
|
||||
// Tab 4: Price & Submit
|
||||
tabSheet.add("Preis & Abschluss", createPriceAndSubmitTab());
|
||||
|
||||
add(tabSheet);
|
||||
|
||||
// Add submit button horizontally centered below the tabs
|
||||
HorizontalLayout buttonLayout = new HorizontalLayout();
|
||||
buttonLayout.setWidthFull();
|
||||
buttonLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
|
||||
buttonLayout.setPadding(true);
|
||||
buttonLayout.add(submitButton);
|
||||
|
||||
add(buttonLayout);
|
||||
}
|
||||
|
||||
private Component createCustomerAndAddressesTab() {
|
||||
VerticalLayout tabContent = new VerticalLayout();
|
||||
tabContent.setSizeFull();
|
||||
tabContent.setPadding(true);
|
||||
tabContent.setSpacing(true);
|
||||
|
||||
// Customer selection section
|
||||
HorizontalLayout customerLayout = new HorizontalLayout();
|
||||
customerLayout.setWidthFull();
|
||||
@@ -209,7 +244,7 @@ public class AddJobView extends Main {
|
||||
customerSelection.setWidth("70%");
|
||||
preloadAddressButton.setWidth("30%");
|
||||
|
||||
add(customerLayout);
|
||||
tabContent.add(customerLayout);
|
||||
|
||||
// Main content layout with two equal columns (50% each)
|
||||
mainLayout = new HorizontalLayout();
|
||||
@@ -231,15 +266,17 @@ public class AddJobView extends Main {
|
||||
setupInputFieldFocusListeners();
|
||||
|
||||
mainLayout.add(pickupSection, deliverySection);
|
||||
tabContent.add(mainLayout);
|
||||
|
||||
add(mainLayout);
|
||||
return tabContent;
|
||||
}
|
||||
|
||||
// Section under the stages (centered)
|
||||
VerticalLayout belowSection = new VerticalLayout();
|
||||
belowSection.setWidthFull();
|
||||
belowSection.setPadding(false);
|
||||
belowSection.setSpacing(true);
|
||||
belowSection.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
|
||||
private Component createAppointmentsAndProcessingTab() {
|
||||
VerticalLayout tabContent = new VerticalLayout();
|
||||
tabContent.setSizeFull();
|
||||
tabContent.setPadding(true);
|
||||
tabContent.setSpacing(true);
|
||||
tabContent.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
|
||||
|
||||
// Container with fixed width to center content
|
||||
VerticalLayout content = new VerticalLayout();
|
||||
@@ -286,18 +323,48 @@ public class AddJobView extends Main {
|
||||
deliveryTime.setWidth("50%");
|
||||
content.add(deliveryApptTitle, deliveryApptRow);
|
||||
|
||||
belowSection.add(content);
|
||||
add(belowSection);
|
||||
// Ladung – Bereich vor dem Button
|
||||
add(createCargoSection());
|
||||
// Aufgaben, Bemerkung, Preis – unter Ladung
|
||||
add(createTasksAndNotesSection());
|
||||
tabContent.add(content);
|
||||
return tabContent;
|
||||
}
|
||||
|
||||
// Submit button
|
||||
HorizontalLayout submitLayout = new HorizontalLayout();
|
||||
submitLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
|
||||
submitLayout.add(submitButton);
|
||||
add(submitLayout);
|
||||
private Component createCargoAndTasksTab() {
|
||||
VerticalLayout tabContent = new VerticalLayout();
|
||||
tabContent.setSizeFull();
|
||||
tabContent.setPadding(true);
|
||||
tabContent.setSpacing(true);
|
||||
|
||||
// Add cargo section
|
||||
tabContent.add(createCargoSection());
|
||||
|
||||
// Add tasks and notes section
|
||||
tabContent.add(createTasksAndNotesSection());
|
||||
|
||||
return tabContent;
|
||||
}
|
||||
|
||||
private Component createPriceAndSubmitTab() {
|
||||
VerticalLayout tabContent = new VerticalLayout();
|
||||
tabContent.setSizeFull();
|
||||
tabContent.setPadding(true);
|
||||
tabContent.setSpacing(true);
|
||||
tabContent.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
|
||||
|
||||
// Container with fixed width to center content
|
||||
VerticalLayout content = new VerticalLayout();
|
||||
content.setPadding(false);
|
||||
content.setSpacing(true);
|
||||
content.setWidth("720px");
|
||||
content.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.STRETCH);
|
||||
|
||||
// Preis (netto) - moved from createTasksAndNotesSection
|
||||
H3 priceTitle = new H3("Preis (netto)");
|
||||
priceTitle.getStyle().set("margin", "0");
|
||||
TextField price = new TextField("Preis");
|
||||
price.setRequiredIndicatorVisible(true);
|
||||
content.add(priceTitle, price);
|
||||
|
||||
tabContent.add(content);
|
||||
return tabContent;
|
||||
}
|
||||
|
||||
private VerticalLayout createPickupSection() {
|
||||
@@ -845,10 +912,7 @@ public class AddJobView extends Main {
|
||||
tasksList.add(row);
|
||||
};
|
||||
|
||||
// 4 Beispielzeilen
|
||||
addTask.accept(null);
|
||||
addTask.accept(null);
|
||||
addTask.accept(null);
|
||||
// 1 Beispielzeile
|
||||
addTask.accept(null);
|
||||
|
||||
Button addTaskBtn = new Button("Aufgabe hinzufügen", new Icon(VaadinIcon.PLUS));
|
||||
@@ -866,13 +930,6 @@ public class AddJobView extends Main {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user