Erweiterungen
This commit is contained in:
@@ -81,20 +81,21 @@ public class JobSummaryView extends Main implements HasUrlParameter<String> {
|
||||
LumoUtility.FlexDirection.COLUMN, LumoUtility.Padding.MEDIUM,
|
||||
LumoUtility.Gap.SMALL);
|
||||
|
||||
add(new ViewToolbar("Zusammenfassung"));
|
||||
content = new VerticalLayout();
|
||||
content.setSpacing(true);
|
||||
content.setPadding(true);
|
||||
content.setWidthFull();
|
||||
add(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameter(BeforeEvent event, String parameter) {
|
||||
content.removeAll();
|
||||
removeAll(); // Remove existing toolbar
|
||||
|
||||
if (parameter == null || parameter.isBlank()) {
|
||||
add(new ViewToolbar("Zusammenfassung"));
|
||||
content.add(new Span("Fehler: Keine Job-ID angegeben"));
|
||||
add(content);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,20 +103,35 @@ public class JobSummaryView extends Main implements HasUrlParameter<String> {
|
||||
try {
|
||||
jobId = new ObjectId(parameter);
|
||||
} catch (Exception e) {
|
||||
add(new ViewToolbar("Zusammenfassung"));
|
||||
content.add(new Span("Fehler: Ungültige Job-ID Format: " + parameter));
|
||||
add(content);
|
||||
return;
|
||||
}
|
||||
|
||||
Job job = jobRepository.findById(jobId).orElse(null);
|
||||
if (job == null) {
|
||||
add(new ViewToolbar("Zusammenfassung"));
|
||||
content.add(new Span("Fehler: Job mit ID " + parameter + " nicht gefunden"));
|
||||
add(content);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Job History Button for toolbar
|
||||
Button jobHistoryButton = new Button("Job History");
|
||||
jobHistoryButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
jobHistoryButton.addClickListener(e -> {
|
||||
getUI().ifPresent(ui -> ui.navigate("job_history/" + job.getId().toHexString()));
|
||||
});
|
||||
|
||||
// Add toolbar with Job History button in top right
|
||||
add(new ViewToolbar("Zusammenfassung", jobHistoryButton));
|
||||
|
||||
List<CargoItem> cargo = cargoItemRepository.findByJobId(jobId);
|
||||
List<BaseTask> tasks = taskRepository.findByJobIdOrderByTaskOrderAsc(jobId);
|
||||
|
||||
render(job, cargo, tasks);
|
||||
add(content);
|
||||
}
|
||||
|
||||
private void render(Job job, List<CargoItem> cargoItems, List<BaseTask> tasks) {
|
||||
@@ -222,18 +238,6 @@ public class JobSummaryView extends Main implements HasUrlParameter<String> {
|
||||
|
||||
// Google Maps Karte mit Route
|
||||
addRouteMap(job);
|
||||
|
||||
// Job History Button
|
||||
Button jobHistoryButton = new Button("Job History");
|
||||
jobHistoryButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
jobHistoryButton.getStyle().set("margin-top", "var(--lumo-space-m)");
|
||||
jobHistoryButton.addClickListener(e -> {
|
||||
getUI().ifPresent(ui -> ui.navigate("job_history/" + job.getId().toHexString()));
|
||||
});
|
||||
|
||||
HorizontalLayout buttonLayout = new HorizontalLayout(jobHistoryButton);
|
||||
buttonLayout.setJustifyContentMode(HorizontalLayout.JustifyContentMode.CENTER);
|
||||
content.add(buttonLayout);
|
||||
}
|
||||
|
||||
private VerticalLayout borderedBox() {
|
||||
|
||||
Reference in New Issue
Block a user