Erweiterungen

This commit is contained in:
2025-09-09 10:30:00 +02:00
parent 9b0cc32605
commit f796b268c1
2 changed files with 38 additions and 2 deletions

View File

@@ -273,6 +273,7 @@ public class AddJobView extends Main {
// Digital processing // Digital processing
digitalProcessing = new Checkbox("Digitale Abwicklung per App"); digitalProcessing = new Checkbox("Digitale Abwicklung per App");
digitalProcessing.setValue(true);
appUser = new ComboBox<>("App-Nutzer"); appUser = new ComboBox<>("App-Nutzer");
// Load app users for current user and set up the ComboBox // Load app users for current user and set up the ComboBox
@@ -788,8 +789,32 @@ public class AddJobView extends Main {
.orElse(null); .orElse(null);
} }
) )
// Require App-Nutzer when digital processing is enabled
.withValidator(
selectedUserId -> {
boolean digital = Boolean.TRUE.equals(digitalProcessing.getValue());
boolean hasUser = selectedUserId != null && !selectedUserId.trim().isEmpty();
return !digital || hasUser;
},
"Bitte App-Nutzer auswählen, wenn Digitale Abwicklung aktiv ist"
)
.bind(Job::getAppUser, Job::setAppUser); .bind(Job::getAppUser, Job::setAppUser);
// Toggle required indicator for App-Nutzer based on digitalProcessing
digitalProcessing.addValueChangeListener(e -> {
boolean required = Boolean.TRUE.equals(e.getValue());
appUser.setRequiredIndicatorVisible(required);
triggerValidation();
updateTabLabels();
});
// Also revalidate when appUser changes
appUser.addValueChangeListener(e -> {
triggerValidation();
updateTabLabels();
});
// Initialize required indicator state
appUser.setRequiredIndicatorVisible(Boolean.TRUE.equals(digitalProcessing.getValue()));
// Set up validation triggers and visual styling // Set up validation triggers and visual styling
setupValidationTriggers(); setupValidationTriggers();
@@ -1337,7 +1362,7 @@ public class AddJobView extends Main {
saveDeliveryAddress.setValue(false); saveDeliveryAddress.setValue(false);
// Digital processing // Digital processing
digitalProcessing.setValue(false); digitalProcessing.setValue(true);
appUser.clear(); appUser.clear();
// Price field // Price field

View File

@@ -111,7 +111,18 @@ public class JobSummaryView extends Main implements HasUrlParameter<String> {
if (tasks == null || tasks.stream().filter(Objects::nonNull).map(TaskEntry::getText).filter(t -> t != null && !t.isBlank()).findAny().isEmpty()) { if (tasks == null || tasks.stream().filter(Objects::nonNull).map(TaskEntry::getText).filter(t -> t != null && !t.isBlank()).findAny().isEmpty()) {
tasksBox.add(new Span("Keine Aufgaben")); tasksBox.add(new Span("Keine Aufgaben"));
} else { } else {
tasks.stream().filter(Objects::nonNull).map(TaskEntry::getText).filter(t -> t != null && !t.isBlank()).forEach(t -> tasksBox.add(new Span("" + t))); tasks.stream()
.filter(Objects::nonNull)
.forEach(task -> {
String t = task.getText();
if (t == null || t.isBlank()) return;
Span s = new Span("" + t);
if (task.isCompleted()) {
// Use Lumo success color for completed tasks
s.getStyle().set("color", "var(--lumo-success-text-color)");
}
tasksBox.add(s);
});
} }
content.add(tasksBox); content.add(tasksBox);