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() {
|
private void openAddServiceDialog() {
|
||||||
Dialog dialog = new Dialog();
|
Dialog dialog = createStationStyledDialog(getTranslation("addjob.services.dialog.title"), "720px");
|
||||||
dialog.setHeaderTitle(getTranslation("addjob.services.dialog.title"));
|
dialog.setCloseOnOutsideClick(false);
|
||||||
dialog.setWidth("560px");
|
|
||||||
|
|
||||||
VerticalLayout dialogContent = new VerticalLayout();
|
VerticalLayout dialogContent = createStationDialogContentLayout("620px");
|
||||||
dialogContent.setPadding(true);
|
|
||||||
dialogContent.setSpacing(true);
|
|
||||||
|
|
||||||
// Load available services for current user
|
// Load available services for current user
|
||||||
List<Service> availableServices = serviceRepository
|
List<Service> availableServices = serviceRepository
|
||||||
@@ -1224,11 +1221,6 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
|||||||
|
|
||||||
dialogContent.add(serviceCombo, deliveryStationCombo);
|
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());
|
Button cancelButton = new Button(getTranslation("button.cancel"), e -> dialog.close());
|
||||||
cancelButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
|
cancelButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
|
||||||
|
|
||||||
@@ -1245,10 +1237,8 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
|||||||
});
|
});
|
||||||
addButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
addButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||||
|
|
||||||
buttonLayout.add(cancelButton, addButton);
|
dialog.add(wrapInStationDialogCard(dialogContent));
|
||||||
dialogContent.add(buttonLayout);
|
dialog.getFooter().add(cancelButton, addButton);
|
||||||
|
|
||||||
dialog.add(dialogContent);
|
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2275,15 +2265,13 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createRouteLoadingDialog() {
|
private Dialog createRouteLoadingDialog() {
|
||||||
Dialog dialog = new Dialog();
|
Dialog dialog = createStationStyledDialog(getTranslation("addjob.route.title"), "460px");
|
||||||
dialog.setCloseOnOutsideClick(false);
|
dialog.setCloseOnOutsideClick(false);
|
||||||
dialog.setCloseOnEsc(false);
|
dialog.setCloseOnEsc(false);
|
||||||
dialog.setHeaderTitle(getTranslation("addjob.route.title"));
|
|
||||||
|
|
||||||
VerticalLayout content = new VerticalLayout();
|
VerticalLayout content = createStationDialogContentLayout("340px");
|
||||||
content.setAlignItems(FlexComponent.Alignment.CENTER);
|
content.setAlignItems(FlexComponent.Alignment.CENTER);
|
||||||
content.setPadding(true);
|
content.getStyle().set("text-align", "center");
|
||||||
content.setSpacing(true);
|
|
||||||
|
|
||||||
Span loadingText = new Span("Strecke zwischen allen Stationen wird berechnet...");
|
Span loadingText = new Span("Strecke zwischen allen Stationen wird berechnet...");
|
||||||
ProgressBar progressBar = new ProgressBar();
|
ProgressBar progressBar = new ProgressBar();
|
||||||
@@ -2291,7 +2279,7 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
|||||||
progressBar.setWidthFull();
|
progressBar.setWidthFull();
|
||||||
|
|
||||||
content.add(loadingText, progressBar);
|
content.add(loadingText, progressBar);
|
||||||
dialog.add(content);
|
dialog.add(wrapInStationDialogCard(content));
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2316,13 +2304,9 @@ public class AddJobView extends Main implements HasDynamicTitle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showRouteSummaryDialog(RouteCalculationResult routeResult) {
|
private void showRouteSummaryDialog(RouteCalculationResult routeResult) {
|
||||||
Dialog dialog = new Dialog();
|
Dialog dialog = createStationStyledDialog(getTranslation("addjob.route.title"), "480px");
|
||||||
dialog.setHeaderTitle(getTranslation("addjob.route.title"));
|
|
||||||
dialog.setWidth("420px");
|
|
||||||
|
|
||||||
VerticalLayout content = new VerticalLayout();
|
VerticalLayout content = createStationDialogContentLayout("360px");
|
||||||
content.setPadding(false);
|
|
||||||
content.setSpacing(true);
|
|
||||||
content.add(createRouteSummaryRow(getTranslation("addjob.route.distance"), routeResult.getFormattedDistance()));
|
content.add(createRouteSummaryRow(getTranslation("addjob.route.distance"), routeResult.getFormattedDistance()));
|
||||||
content.add(
|
content.add(
|
||||||
createRouteSummaryRow(getTranslation("addjob.route.duration"), routeResult.getFormattedDurationLong()));
|
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());
|
Button closeButton = new Button(getTranslation("dialog.confirm"), event -> dialog.close());
|
||||||
closeButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
closeButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||||
|
|
||||||
dialog.add(content);
|
dialog.add(wrapInStationDialogCard(content));
|
||||||
dialog.getFooter().add(closeButton);
|
dialog.getFooter().add(closeButton);
|
||||||
dialog.open();
|
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) {
|
private HorizontalLayout createRouteSummaryRow(String label, String value) {
|
||||||
HorizontalLayout row = new HorizontalLayout();
|
HorizontalLayout row = new HorizontalLayout();
|
||||||
row.setWidthFull();
|
row.setWidthFull();
|
||||||
|
|||||||
Reference in New Issue
Block a user