fix(07): UAT fixes — SMTP test email, DKV routing, Exchange domain field
- SMTP: add test-to field, send real email via sendMail() instead of verify() - SMTP: fix no_auth warning shown as error for open-relay servers - DKV: register dkv-fleet in MODULE_REGISTRY (fixes "Modul nicht gefunden") - DKV: add dynamic [category]/[moduleSlug]/settings + vehicles sub-routes - DKV: settings/vehicles links use useParams for consistent URLs - DKV: add gear icon settings link to module main page - DKV: rename module to "DKV-Rechnung" in seed + translations - DKV: add optional domain field for Exchange (WebCredentials 3rd arg) - DKV: hide IMAP-only fields (Port/Verschlüsselung/Ordner) when Exchange selected - DKV: hide Exchange-only field (Domain) when IMAP selected - Prisma: add domain column to DkvModuleConfig Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
'use client';
|
||||
|
||||
import { useParams } from 'next/navigation';
|
||||
import DkvFleetSettingsPage from '@/app/(portal)/modules/dkv-fleet/settings/page';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
const SETTINGS_REGISTRY: Record<string, React.ComponentType> = {
|
||||
'dkv-fleet': DkvFleetSettingsPage,
|
||||
};
|
||||
|
||||
export default function DynamicModuleSettingsPage() {
|
||||
const { moduleSlug } = useParams<{ category: string; moduleSlug: string }>();
|
||||
const t = useTranslations('modules');
|
||||
|
||||
const Component = SETTINGS_REGISTRY[moduleSlug ?? ''];
|
||||
if (!Component) {
|
||||
return (
|
||||
<div className="mx-auto max-w-2xl p-6 text-center text-muted-foreground">
|
||||
{t('notFound')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <Component />;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
'use client';
|
||||
|
||||
import { useParams } from 'next/navigation';
|
||||
import DkvFleetVehiclesPage from '@/app/(portal)/modules/dkv-fleet/vehicles/page';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
const VEHICLES_REGISTRY: Record<string, React.ComponentType> = {
|
||||
'dkv-fleet': DkvFleetVehiclesPage,
|
||||
};
|
||||
|
||||
export default function DynamicModuleVehiclesPage() {
|
||||
const { moduleSlug } = useParams<{ category: string; moduleSlug: string }>();
|
||||
const t = useTranslations('modules');
|
||||
|
||||
const Component = VEHICLES_REGISTRY[moduleSlug ?? ''];
|
||||
if (!Component) {
|
||||
return (
|
||||
<div className="mx-auto max-w-2xl p-6 text-center text-muted-foreground">
|
||||
{t('notFound')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <Component />;
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useParams } from 'next/navigation';
|
||||
import Link from 'next/link';
|
||||
import { checkNow, type DkvHistoryEntry } from '@/lib/dkv-api';
|
||||
import { InvoiceHistoryTable } from './components/InvoiceHistoryTable';
|
||||
import { ExportFileList } from './components/ExportFileList';
|
||||
@@ -33,6 +35,10 @@ function SpinnerIcon() {
|
||||
*/
|
||||
export default function DkvFleetPage() {
|
||||
const t = useTranslations('dkvFleet');
|
||||
const params = useParams<{ category?: string; moduleSlug?: string }>();
|
||||
const basePath = params.category && params.moduleSlug
|
||||
? `/modules/${params.category}/${params.moduleSlug}`
|
||||
: '/modules/dkv-fleet';
|
||||
|
||||
const [isChecking, setIsChecking] = useState(false);
|
||||
const [pollError, setPollError] = useState<string | null>(null);
|
||||
@@ -83,6 +89,18 @@ export default function DkvFleetPage() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Einstellungen-Link */}
|
||||
<Link
|
||||
href={`${basePath}/settings`}
|
||||
className="rounded border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
||||
title={t('settingsTitle')}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
||||
</svg>
|
||||
</Link>
|
||||
|
||||
{/* "Jetzt prüfen" button per 07-UI-SPEC button states */}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
+77
-48
@@ -64,6 +64,7 @@ interface FormState {
|
||||
pollIntervalMin: string;
|
||||
username: string;
|
||||
password: string; // intentionally blank on load (T-07-12)
|
||||
domain: string;
|
||||
exportRecipient: string;
|
||||
vehicleFormatString: string;
|
||||
isActive: boolean;
|
||||
@@ -79,6 +80,7 @@ const DEFAULT_FORM: FormState = {
|
||||
pollIntervalMin: '30',
|
||||
username: '',
|
||||
password: '', // blank — T-07-12
|
||||
domain: '',
|
||||
exportRecipient: '',
|
||||
vehicleFormatString: '{Marke}/{Modell}/{Kennzeichen}',
|
||||
isActive: false,
|
||||
@@ -95,6 +97,7 @@ function configToForm(config: DkvConfig): FormState {
|
||||
pollIntervalMin: String(config.pollIntervalMin),
|
||||
username: config.username ?? '',
|
||||
password: '', // NEVER pre-fill from server — T-07-12
|
||||
domain: config.domain ?? '',
|
||||
exportRecipient: config.exportRecipient,
|
||||
vehicleFormatString: config.vehicleFormatString,
|
||||
isActive: config.isActive,
|
||||
@@ -113,6 +116,7 @@ function formToPayload(
|
||||
senderFilter: form.senderFilter || undefined,
|
||||
pollIntervalMin: Number(form.pollIntervalMin),
|
||||
username: form.username || undefined,
|
||||
domain: form.domain || undefined,
|
||||
exportRecipient: form.exportRecipient,
|
||||
vehicleFormatString: form.vehicleFormatString,
|
||||
isActive: form.isActive,
|
||||
@@ -245,69 +249,94 @@ export function InboxConfigForm() {
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Host */}
|
||||
{/* Host / EWS-URL */}
|
||||
<div>
|
||||
<label htmlFor="dkv-host" className={labelCls}>
|
||||
{t('form.host')} *
|
||||
{form.protocol === 'exchange' ? t('form.hostExchange') : t('form.host')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-host"
|
||||
type="text"
|
||||
required
|
||||
placeholder={form.protocol === 'exchange' ? 'https://mail.firma.de/EWS/Exchange.asmx' : 'imap.firma.de'}
|
||||
className={inputCls}
|
||||
value={form.host}
|
||||
onChange={(e) => update('host', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Port */}
|
||||
<div>
|
||||
<label htmlFor="dkv-port" className={labelCls}>
|
||||
{t('form.port')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-port"
|
||||
type="number"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.port}
|
||||
onChange={(e) => update('port', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
{/* IMAP-only: Port */}
|
||||
{form.protocol === 'imap' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-port" className={labelCls}>
|
||||
{t('form.port')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-port"
|
||||
type="number"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.port}
|
||||
onChange={(e) => update('port', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Verschlüsselung */}
|
||||
<div>
|
||||
<label htmlFor="dkv-encryption" className={labelCls}>
|
||||
{t('form.encryption')} *
|
||||
</label>
|
||||
<select
|
||||
id="dkv-encryption"
|
||||
className={inputCls}
|
||||
value={form.encryption}
|
||||
onChange={(e) =>
|
||||
update('encryption', e.target.value as 'none' | 'starttls' | 'ssl-tls')
|
||||
}
|
||||
>
|
||||
<option value="none">{t('form.encryptionNone')}</option>
|
||||
<option value="starttls">STARTTLS</option>
|
||||
<option value="ssl-tls">SSL-TLS</option>
|
||||
</select>
|
||||
</div>
|
||||
{/* IMAP-only: Verschlüsselung */}
|
||||
{form.protocol === 'imap' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-encryption" className={labelCls}>
|
||||
{t('form.encryption')} *
|
||||
</label>
|
||||
<select
|
||||
id="dkv-encryption"
|
||||
className={inputCls}
|
||||
value={form.encryption}
|
||||
onChange={(e) =>
|
||||
update('encryption', e.target.value as 'none' | 'starttls' | 'ssl-tls')
|
||||
}
|
||||
>
|
||||
<option value="none">{t('form.encryptionNone')}</option>
|
||||
<option value="starttls">STARTTLS</option>
|
||||
<option value="ssl-tls">SSL-TLS</option>
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Ordner */}
|
||||
<div>
|
||||
<label htmlFor="dkv-folder" className={labelCls}>
|
||||
{t('form.folder')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-folder"
|
||||
type="text"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.folder}
|
||||
onChange={(e) => update('folder', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
{/* IMAP-only: Ordner */}
|
||||
{form.protocol === 'imap' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-folder" className={labelCls}>
|
||||
{t('form.folder')} *
|
||||
</label>
|
||||
<input
|
||||
id="dkv-folder"
|
||||
type="text"
|
||||
required
|
||||
className={inputCls}
|
||||
value={form.folder}
|
||||
onChange={(e) => update('folder', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Exchange-only: Domain */}
|
||||
{form.protocol === 'exchange' && (
|
||||
<div>
|
||||
<label htmlFor="dkv-domain" className={labelCls}>
|
||||
{t('form.domain')}
|
||||
</label>
|
||||
<input
|
||||
id="dkv-domain"
|
||||
type="text"
|
||||
placeholder="CONTOSO"
|
||||
className={inputCls}
|
||||
value={form.domain}
|
||||
onChange={(e) => update('domain', e.target.value)}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-muted-foreground">{t('form.domainHelp')}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Absenderfilter */}
|
||||
<div>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import Link from 'next/link';
|
||||
import { useState } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { InboxConfigForm } from './components/InboxConfigForm';
|
||||
|
||||
type ActiveTab = 'inbox' | 'vehicles';
|
||||
@@ -14,6 +15,10 @@ type ActiveTab = 'inbox' | 'vehicles';
|
||||
*/
|
||||
export default function DkvFleetSettingsPage() {
|
||||
const t = useTranslations('dkvFleet');
|
||||
const params = useParams<{ category?: string; moduleSlug?: string }>();
|
||||
const basePath = params.category && params.moduleSlug
|
||||
? `/modules/${params.category}/${params.moduleSlug}`
|
||||
: '/modules/dkv-fleet';
|
||||
const [activeTab, setActiveTab] = useState<ActiveTab>('inbox');
|
||||
|
||||
const tabCls = (tab: ActiveTab) =>
|
||||
@@ -41,7 +46,7 @@ export default function DkvFleetSettingsPage() {
|
||||
</button>
|
||||
{/* Vehicles tab navigates to its own route */}
|
||||
<Link
|
||||
href="/modules/dkv-fleet/vehicles"
|
||||
href={`${basePath}/vehicles`}
|
||||
className={`px-4 py-2 text-sm transition-colors text-muted-foreground hover:text-foreground`}
|
||||
>
|
||||
{t('tabs.vehicles')}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import Link from 'next/link';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { VehicleTable } from '../settings/components/VehicleTable';
|
||||
|
||||
/**
|
||||
@@ -11,13 +12,17 @@ import { VehicleTable } from '../settings/components/VehicleTable';
|
||||
*/
|
||||
export default function DkvFleetVehiclesPage() {
|
||||
const t = useTranslations('dkvFleet');
|
||||
const params = useParams<{ category?: string; moduleSlug?: string }>();
|
||||
const basePath = params.category && params.moduleSlug
|
||||
? `/modules/${params.category}/${params.moduleSlug}`
|
||||
: '/modules/dkv-fleet';
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-5xl p-6">
|
||||
{/* Back link to settings */}
|
||||
<div className="mb-4">
|
||||
<Link
|
||||
href="/modules/dkv-fleet/settings"
|
||||
href={`${basePath}/settings`}
|
||||
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
← {t('tabs.inbox')} / {t('settingsTitle')}
|
||||
|
||||
Reference in New Issue
Block a user