Erweiterungen
This commit is contained in:
@@ -273,6 +273,7 @@ public class AddJobView extends Main {
|
||||
|
||||
// Digital processing
|
||||
digitalProcessing = new Checkbox("Digitale Abwicklung per App");
|
||||
digitalProcessing.setValue(true);
|
||||
appUser = new ComboBox<>("App-Nutzer");
|
||||
|
||||
// Load app users for current user and set up the ComboBox
|
||||
@@ -788,8 +789,32 @@ public class AddJobView extends Main {
|
||||
.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);
|
||||
|
||||
// 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
|
||||
setupValidationTriggers();
|
||||
|
||||
@@ -1337,7 +1362,7 @@ public class AddJobView extends Main {
|
||||
saveDeliveryAddress.setValue(false);
|
||||
|
||||
// Digital processing
|
||||
digitalProcessing.setValue(false);
|
||||
digitalProcessing.setValue(true);
|
||||
appUser.clear();
|
||||
|
||||
// Price field
|
||||
|
||||
@@ -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()) {
|
||||
tasksBox.add(new Span("Keine Aufgaben"));
|
||||
} 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user