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.FlexDirection.COLUMN, LumoUtility.Padding.MEDIUM,
|
||||||
LumoUtility.Gap.SMALL);
|
LumoUtility.Gap.SMALL);
|
||||||
|
|
||||||
add(new ViewToolbar("Zusammenfassung"));
|
|
||||||
content = new VerticalLayout();
|
content = new VerticalLayout();
|
||||||
content.setSpacing(true);
|
content.setSpacing(true);
|
||||||
content.setPadding(true);
|
content.setPadding(true);
|
||||||
content.setWidthFull();
|
content.setWidthFull();
|
||||||
add(content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParameter(BeforeEvent event, String parameter) {
|
public void setParameter(BeforeEvent event, String parameter) {
|
||||||
content.removeAll();
|
content.removeAll();
|
||||||
|
removeAll(); // Remove existing toolbar
|
||||||
|
|
||||||
if (parameter == null || parameter.isBlank()) {
|
if (parameter == null || parameter.isBlank()) {
|
||||||
|
add(new ViewToolbar("Zusammenfassung"));
|
||||||
content.add(new Span("Fehler: Keine Job-ID angegeben"));
|
content.add(new Span("Fehler: Keine Job-ID angegeben"));
|
||||||
|
add(content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,20 +103,35 @@ public class JobSummaryView extends Main implements HasUrlParameter<String> {
|
|||||||
try {
|
try {
|
||||||
jobId = new ObjectId(parameter);
|
jobId = new ObjectId(parameter);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
add(new ViewToolbar("Zusammenfassung"));
|
||||||
content.add(new Span("Fehler: Ungültige Job-ID Format: " + parameter));
|
content.add(new Span("Fehler: Ungültige Job-ID Format: " + parameter));
|
||||||
|
add(content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Job job = jobRepository.findById(jobId).orElse(null);
|
Job job = jobRepository.findById(jobId).orElse(null);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
|
add(new ViewToolbar("Zusammenfassung"));
|
||||||
content.add(new Span("Fehler: Job mit ID " + parameter + " nicht gefunden"));
|
content.add(new Span("Fehler: Job mit ID " + parameter + " nicht gefunden"));
|
||||||
|
add(content);
|
||||||
return;
|
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<CargoItem> cargo = cargoItemRepository.findByJobId(jobId);
|
||||||
List<BaseTask> tasks = taskRepository.findByJobIdOrderByTaskOrderAsc(jobId);
|
List<BaseTask> tasks = taskRepository.findByJobIdOrderByTaskOrderAsc(jobId);
|
||||||
|
|
||||||
render(job, cargo, tasks);
|
render(job, cargo, tasks);
|
||||||
|
add(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void render(Job job, List<CargoItem> cargoItems, List<BaseTask> tasks) {
|
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
|
// Google Maps Karte mit Route
|
||||||
addRouteMap(job);
|
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() {
|
private VerticalLayout borderedBox() {
|
||||||
|
|||||||
Reference in New Issue
Block a user