feat: einheitliches Station-Dialog-Styling für AddJobView
This commit is contained in:
@@ -1185,13 +1185,10 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
||||
}
|
||||
|
||||
private void openAddServiceDialog() {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.setHeaderTitle(getTranslation("addjob.services.dialog.title"));
|
||||
dialog.setWidth("560px");
|
||||
Dialog dialog = createStationStyledDialog(getTranslation("addjob.services.dialog.title"), "720px");
|
||||
dialog.setCloseOnOutsideClick(false);
|
||||
|
||||
VerticalLayout dialogContent = new VerticalLayout();
|
||||
dialogContent.setPadding(true);
|
||||
dialogContent.setSpacing(true);
|
||||
VerticalLayout dialogContent = createStationDialogContentLayout("620px");
|
||||
|
||||
// Load available services for current user
|
||||
List<Service> availableServices = serviceRepository
|
||||
@@ -1224,11 +1221,6 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
||||
|
||||
dialogContent.add(serviceCombo, deliveryStationCombo);
|
||||
|
||||
HorizontalLayout buttonLayout = new HorizontalLayout();
|
||||
buttonLayout.setWidthFull();
|
||||
buttonLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END);
|
||||
buttonLayout.setSpacing(true);
|
||||
|
||||
Button cancelButton = new Button(getTranslation("button.cancel"), e -> dialog.close());
|
||||
cancelButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
|
||||
|
||||
@@ -1245,10 +1237,8 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
||||
});
|
||||
addButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
|
||||
buttonLayout.add(cancelButton, addButton);
|
||||
dialogContent.add(buttonLayout);
|
||||
|
||||
dialog.add(dialogContent);
|
||||
dialog.add(wrapInStationDialogCard(dialogContent));
|
||||
dialog.getFooter().add(cancelButton, addButton);
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
@@ -2275,15 +2265,13 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
||||
}
|
||||
|
||||
private Dialog createRouteLoadingDialog() {
|
||||
Dialog dialog = new Dialog();
|
||||
Dialog dialog = createStationStyledDialog(getTranslation("addjob.route.title"), "460px");
|
||||
dialog.setCloseOnOutsideClick(false);
|
||||
dialog.setCloseOnEsc(false);
|
||||
dialog.setHeaderTitle(getTranslation("addjob.route.title"));
|
||||
|
||||
VerticalLayout content = new VerticalLayout();
|
||||
VerticalLayout content = createStationDialogContentLayout("340px");
|
||||
content.setAlignItems(FlexComponent.Alignment.CENTER);
|
||||
content.setPadding(true);
|
||||
content.setSpacing(true);
|
||||
content.getStyle().set("text-align", "center");
|
||||
|
||||
Span loadingText = new Span("Strecke zwischen allen Stationen wird berechnet...");
|
||||
ProgressBar progressBar = new ProgressBar();
|
||||
@@ -2291,7 +2279,7 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
||||
progressBar.setWidthFull();
|
||||
|
||||
content.add(loadingText, progressBar);
|
||||
dialog.add(content);
|
||||
dialog.add(wrapInStationDialogCard(content));
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@@ -2316,13 +2304,9 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
||||
}
|
||||
|
||||
private void showRouteSummaryDialog(RouteCalculationResult routeResult) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.setHeaderTitle(getTranslation("addjob.route.title"));
|
||||
dialog.setWidth("420px");
|
||||
Dialog dialog = createStationStyledDialog(getTranslation("addjob.route.title"), "480px");
|
||||
|
||||
VerticalLayout content = new VerticalLayout();
|
||||
content.setPadding(false);
|
||||
content.setSpacing(true);
|
||||
VerticalLayout content = createStationDialogContentLayout("360px");
|
||||
content.add(createRouteSummaryRow(getTranslation("addjob.route.distance"), routeResult.getFormattedDistance()));
|
||||
content.add(
|
||||
createRouteSummaryRow(getTranslation("addjob.route.duration"), routeResult.getFormattedDurationLong()));
|
||||
@@ -2330,11 +2314,49 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
||||
Button closeButton = new Button(getTranslation("dialog.confirm"), event -> dialog.close());
|
||||
closeButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
|
||||
dialog.add(content);
|
||||
dialog.add(wrapInStationDialogCard(content));
|
||||
dialog.getFooter().add(closeButton);
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
private Dialog createStationStyledDialog(String title, String width) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.setHeaderTitle(title);
|
||||
dialog.setWidth(width);
|
||||
dialog.setMaxWidth("95vw");
|
||||
dialog.getElement().setAttribute("theme", "no-inner-card");
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private Component wrapInStationDialogCard(Component content) {
|
||||
Div frame = new Div();
|
||||
frame.getStyle().set("border", "10px solid transparent");
|
||||
frame.getStyle().set("border-radius", "0");
|
||||
frame.getStyle().set("box-sizing", "border-box");
|
||||
frame.setWidthFull();
|
||||
|
||||
Div whiteCard = new Div();
|
||||
whiteCard.getStyle().set("background", "white");
|
||||
whiteCard.getStyle().set("border-radius", "24px");
|
||||
whiteCard.getStyle().set("overflow", "auto");
|
||||
whiteCard.setWidthFull();
|
||||
whiteCard.add(content);
|
||||
|
||||
frame.add(whiteCard);
|
||||
return frame;
|
||||
}
|
||||
|
||||
private VerticalLayout createStationDialogContentLayout(String maxWidth) {
|
||||
VerticalLayout content = new VerticalLayout();
|
||||
content.setPadding(true);
|
||||
content.setSpacing(true);
|
||||
content.setWidthFull();
|
||||
content.setMaxWidth(maxWidth);
|
||||
content.setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.STRETCH);
|
||||
content.getStyle().set("margin", "0 auto");
|
||||
return content;
|
||||
}
|
||||
|
||||
private HorizontalLayout createRouteSummaryRow(String label, String value) {
|
||||
HorizontalLayout row = new HorizontalLayout();
|
||||
row.setWidthFull();
|
||||
|
||||
Reference in New Issue
Block a user