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.router.Menu;
|
||||||
import com.vaadin.flow.component.Component;
|
import com.vaadin.flow.component.Component;
|
||||||
import com.vaadin.flow.component.textfield.TextArea;
|
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.PageTitle;
|
||||||
import com.vaadin.flow.router.Route;
|
import com.vaadin.flow.router.Route;
|
||||||
import com.vaadin.flow.theme.lumo.LumoUtility;
|
import com.vaadin.flow.theme.lumo.LumoUtility;
|
||||||
@@ -201,6 +202,40 @@ public class AddJobView extends Main {
|
|||||||
|
|
||||||
add(new ViewToolbar("Neuen Auftrag anlegen"));
|
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
|
// Customer selection section
|
||||||
HorizontalLayout customerLayout = new HorizontalLayout();
|
HorizontalLayout customerLayout = new HorizontalLayout();
|
||||||
customerLayout.setWidthFull();
|
customerLayout.setWidthFull();
|
||||||
@@ -209,7 +244,7 @@ public class AddJobView extends Main {
|
|||||||
customerSelection.setWidth("70%");
|
customerSelection.setWidth("70%");
|
||||||
preloadAddressButton.setWidth("30%");
|
preloadAddressButton.setWidth("30%");
|
||||||
|
|
||||||
add(customerLayout);
|
tabContent.add(customerLayout);
|
||||||
|
|
||||||
// Main content layout with two equal columns (50% each)
|
// Main content layout with two equal columns (50% each)
|
||||||
mainLayout = new HorizontalLayout();
|
mainLayout = new HorizontalLayout();
|
||||||
@@ -231,15 +266,17 @@ public class AddJobView extends Main {
|
|||||||
setupInputFieldFocusListeners();
|
setupInputFieldFocusListeners();
|
||||||
|
|
||||||
mainLayout.add(pickupSection, deliverySection);
|
mainLayout.add(pickupSection, deliverySection);
|
||||||
|
tabContent.add(mainLayout);
|
||||||
|
|
||||||
add(mainLayout);
|
return tabContent;
|
||||||
|
}
|
||||||
|
|
||||||
// Section under the stages (centered)
|
private Component createAppointmentsAndProcessingTab() {
|
||||||
VerticalLayout belowSection = new VerticalLayout();
|
VerticalLayout tabContent = new VerticalLayout();
|
||||||
belowSection.setWidthFull();
|
tabContent.setSizeFull();
|
||||||
belowSection.setPadding(false);
|
tabContent.setPadding(true);
|
||||||
belowSection.setSpacing(true);
|
tabContent.setSpacing(true);
|
||||||
belowSection.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
|
tabContent.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
|
||||||
|
|
||||||
// Container with fixed width to center content
|
// Container with fixed width to center content
|
||||||
VerticalLayout content = new VerticalLayout();
|
VerticalLayout content = new VerticalLayout();
|
||||||
@@ -286,18 +323,48 @@ public class AddJobView extends Main {
|
|||||||
deliveryTime.setWidth("50%");
|
deliveryTime.setWidth("50%");
|
||||||
content.add(deliveryApptTitle, deliveryApptRow);
|
content.add(deliveryApptTitle, deliveryApptRow);
|
||||||
|
|
||||||
belowSection.add(content);
|
tabContent.add(content);
|
||||||
add(belowSection);
|
return tabContent;
|
||||||
// Ladung – Bereich vor dem Button
|
}
|
||||||
add(createCargoSection());
|
|
||||||
// Aufgaben, Bemerkung, Preis – unter Ladung
|
|
||||||
add(createTasksAndNotesSection());
|
|
||||||
|
|
||||||
// Submit button
|
private Component createCargoAndTasksTab() {
|
||||||
HorizontalLayout submitLayout = new HorizontalLayout();
|
VerticalLayout tabContent = new VerticalLayout();
|
||||||
submitLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
|
tabContent.setSizeFull();
|
||||||
submitLayout.add(submitButton);
|
tabContent.setPadding(true);
|
||||||
add(submitLayout);
|
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() {
|
private VerticalLayout createPickupSection() {
|
||||||
@@ -845,10 +912,7 @@ public class AddJobView extends Main {
|
|||||||
tasksList.add(row);
|
tasksList.add(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 4 Beispielzeilen
|
// 1 Beispielzeile
|
||||||
addTask.accept(null);
|
|
||||||
addTask.accept(null);
|
|
||||||
addTask.accept(null);
|
|
||||||
addTask.accept(null);
|
addTask.accept(null);
|
||||||
|
|
||||||
Button addTaskBtn = new Button("Aufgabe hinzufügen", new Icon(VaadinIcon.PLUS));
|
Button addTaskBtn = new Button("Aufgabe hinzufügen", new Icon(VaadinIcon.PLUS));
|
||||||
@@ -866,13 +930,6 @@ public class AddJobView extends Main {
|
|||||||
remark.setMinHeight("180px");
|
remark.setMinHeight("180px");
|
||||||
content.add(remarksTitle, remark);
|
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);
|
wrapper.add(content);
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user