Erweiterungen

This commit is contained in:
2025-09-23 20:05:08 +02:00
parent 435522cf7e
commit 66fdcee6a9
7 changed files with 71 additions and 7 deletions

View File

@@ -7,7 +7,8 @@
"Bash(./mvnw:*)", "Bash(./mvnw:*)",
"Bash(rm:*)", "Bash(rm:*)",
"Bash(lsof:*)", "Bash(lsof:*)",
"Bash(xargs kill:*)" "Bash(xargs kill:*)",
"Bash(cat:*)"
], ],
"deny": [], "deny": [],
"ask": [] "ask": []

18
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>de.assecutor.votianlt</groupId> <groupId>de.assecutor.votianlt</groupId>
<artifactId>votianlt</artifactId> <artifactId>votianlt</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.5</version>
<packaging>jar</packaging> <packaging>jar</packaging>
@@ -217,6 +217,22 @@
<version>3.3.2</version> <version>3.3.2</version>
</plugin> </plugin>
</plugins> </plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>application.properties</exclude>
</excludes>
</resource>
</resources>
</build> </build>
<profiles> <profiles>

Binary file not shown.

View File

@@ -360,8 +360,29 @@ public class AddJobView extends Main {
// Date picker fields for appointments // Date picker fields for appointments
pickupDate = new DatePicker("Datum"); pickupDate = new DatePicker("Datum");
pickupDate.setRequiredIndicatorVisible(true); pickupDate.setRequiredIndicatorVisible(true);
pickupDate.setLocale(java.util.Locale.GERMANY); // Monday as first day of week
pickupDate.setI18n(new DatePicker.DatePickerI18n()
.setFirstDayOfWeek(1) // 1 = Monday
.setMonthNames(java.util.Arrays.asList(
"Januar", "Februar", "März", "April", "Mai", "Juni",
"Juli", "August", "September", "Oktober", "November", "Dezember"))
.setWeekdays(java.util.Arrays.asList(
"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"))
.setWeekdaysShort(java.util.Arrays.asList(
"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa")));
deliveryDate = new DatePicker("Datum"); deliveryDate = new DatePicker("Datum");
deliveryDate.setRequiredIndicatorVisible(true); deliveryDate.setRequiredIndicatorVisible(true);
deliveryDate.setLocale(java.util.Locale.GERMANY); // Monday as first day of week
deliveryDate.setI18n(new DatePicker.DatePickerI18n()
.setFirstDayOfWeek(1) // 1 = Monday
.setMonthNames(java.util.Arrays.asList(
"Januar", "Februar", "März", "April", "Mai", "Juni",
"Juli", "August", "September", "Oktober", "November", "Dezember"))
.setWeekdays(java.util.Arrays.asList(
"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"))
.setWeekdaysShort(java.util.Arrays.asList(
"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa")));
// Submit button // Submit button
submitButton = new Button("Auftrag anlegen", event -> submit()); submitButton = new Button("Auftrag anlegen", event -> submit());

View File

@@ -5,6 +5,7 @@ import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant; import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.H1; import com.vaadin.flow.component.html.H1;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.login.LoginForm; import com.vaadin.flow.component.login.LoginForm;
import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.component.notification.Notification; import com.vaadin.flow.component.notification.Notification;
@@ -26,6 +27,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
import com.vaadin.flow.server.VaadinSession; import com.vaadin.flow.server.VaadinSession;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import jakarta.annotation.PostConstruct;
@Route("login") @Route("login")
@PageTitle("Bei VotianLT anmelden") @PageTitle("Bei VotianLT anmelden")
@@ -46,7 +48,11 @@ public class LoginView extends VerticalLayout implements BeforeEnterObserver, Af
@Value("${app.security.two-factor.enabled:false}") @Value("${app.security.two-factor.enabled:false}")
private boolean twoFactorEnabled; private boolean twoFactorEnabled;
@Value("${app.version:unknown}")
private String appVersion;
private Authentication pendingAuth; private Authentication pendingAuth;
private Span versionSpan;
public LoginView() { public LoginView() {
addClassName("login-view"); addClassName("login-view");
@@ -75,6 +81,12 @@ public class LoginView extends VerticalLayout implements BeforeEnterObserver, Af
Button registerButton = new Button("Noch kein Konto? Registrieren", e -> UI.getCurrent().navigate("register")); Button registerButton = new Button("Noch kein Konto? Registrieren", e -> UI.getCurrent().navigate("register"));
registerButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY); registerButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
// Version display - will be set in @PostConstruct
versionSpan = new Span("");
versionSpan.getStyle().set("color", "var(--lumo-secondary-text-color)")
.set("font-size", "var(--lumo-font-size-s)")
.set("margin-top", "var(--lumo-space-m)");
// Inline flash message box (hidden by default) // Inline flash message box (hidden by default)
flashBox.getStyle().set("background", "var(--lumo-error-color-10pct)") flashBox.getStyle().set("background", "var(--lumo-error-color-10pct)")
.set("color", "var(--lumo-error-text-color)").set("border", "1px solid var(--lumo-error-color)") .set("color", "var(--lumo-error-text-color)").set("border", "1px solid var(--lumo-error-color)")
@@ -84,7 +96,7 @@ public class LoginView extends VerticalLayout implements BeforeEnterObserver, Af
VerticalLayout loginLayout = new VerticalLayout(); VerticalLayout loginLayout = new VerticalLayout();
loginLayout.setAlignItems(FlexComponent.Alignment.CENTER); loginLayout.setAlignItems(FlexComponent.Alignment.CENTER);
loginLayout.add(flashBox, title, loginForm, twoFaField, verify2faButton, registerButton); loginLayout.add(flashBox, title, loginForm, twoFaField, verify2faButton, registerButton, versionSpan);
loginLayout.setMaxWidth("400px"); loginLayout.setMaxWidth("400px");
loginLayout.setPadding(true); loginLayout.setPadding(true);
@@ -93,6 +105,12 @@ public class LoginView extends VerticalLayout implements BeforeEnterObserver, Af
loginForm.addLoginListener(e -> handlePasswordLogin(e.getUsername(), e.getPassword())); loginForm.addLoginListener(e -> handlePasswordLogin(e.getUsername(), e.getPassword()));
} }
@PostConstruct
private void init() {
// Set version after Spring injection
versionSpan.setText("Version " + appVersion);
}
private void handlePasswordLogin(String username, String password) { private void handlePasswordLogin(String username, String password) {
try { try {
// Prüfe Benutzername/Passwort // Prüfe Benutzername/Passwort

View File

@@ -148,9 +148,14 @@ public class CustomerInvoiceService {
} }
private String readCustomerInvoiceHtmlTemplate() throws Exception { private String readCustomerInvoiceHtmlTemplate() throws Exception {
// Read the HTML template file // Read the HTML template file from classpath (works in Docker/production)
java.nio.file.Path path = java.nio.file.Paths.get("src/main/resources/templates/customer_invoice.html"); try (java.io.InputStream inputStream = getClass().getClassLoader()
return java.nio.file.Files.readString(path); .getResourceAsStream("templates/customer_invoice.html")) {
if (inputStream == null) {
throw new java.io.IOException("Template file not found: templates/customer_invoice.html");
}
return new String(inputStream.readAllBytes(), java.nio.charset.StandardCharsets.UTF_8);
}
} }
private String fillCustomerInvoiceHtmlWithInvoiceData(String html, CustomerInvoiceData data) { private String fillCustomerInvoiceHtmlWithInvoiceData(String html, CustomerInvoiceData data) {

View File

@@ -59,4 +59,7 @@ app.mqtt.default-qos=2
app.mqtt.default-retained=false app.mqtt.default-retained=false
# 2FA Configuration # 2FA Configuration
app.security.two-factor.enabled=false app.security.two-factor.enabled=false
# Application Version - automatically set from pom.xml during build
app.version=@project.version@