Let admins hide whole site areas (pages and home sections) from the dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-10-13 21:16:34 +02:00
parent e32bced40f
commit 4fd3c7a035
53 changed files with 847 additions and 592 deletions

View file

@ -1,7 +1,7 @@
import { Link, useLocation } from 'react-router-dom'; import { Link, useLocation } from 'react-router-dom';
import { Clock, MapPin, Navigation, Phone } from 'lucide-react'; import { Clock, MapPin, Navigation, Phone } from 'lucide-react';
import { useCookieConsent } from '../context/CookieConsentContext.jsx'; import { useCookieConsent } from '../context/CookieConsentContext.jsx';
import { useSiteSettings } from '../context/SiteSettingsContext.jsx'; import { useIsAreaHidden, useSiteSettings } from '../context/SiteSettingsContext.jsx';
import { useLanguage } from '../context/LanguageContext.jsx'; import { useLanguage } from '../context/LanguageContext.jsx';
import { isOpenNow, formatBusinessHours } from '../utils/businessHours.js'; import { isOpenNow, formatBusinessHours } from '../utils/businessHours.js';
@ -17,6 +17,8 @@ export default function Footer() {
business_hours: businessHours, business_hours: businessHours,
has_downloads: hasDownloads, has_downloads: hasDownloads,
} = useSiteSettings(); } = useSiteSettings();
const isHidden = useIsAreaHidden();
const showDownloads = hasDownloads && !isHidden('page.downloads');
const open = isOpenNow(businessHours); const open = isOpenNow(businessHours);
const { openSettings } = useCookieConsent(); const { openSettings } = useCookieConsent();
// Auf der Startseite blendet sich unten eine fixierte CTA-Leiste ein, die // Auf der Startseite blendet sich unten eine fixierte CTA-Leiste ein, die
@ -113,7 +115,7 @@ export default function Footer() {
<span>·</span> <span>·</span>
<Link to="/agb" className="hover:text-brand-500">{t('footer.terms')}</Link> <Link to="/agb" className="hover:text-brand-500">{t('footer.terms')}</Link>
<span>·</span> <span>·</span>
{hasDownloads && ( {showDownloads && (
<> <>
<Link to="/downloads" className="hover:text-brand-500">{t('footer.downloads')}</Link> <Link to="/downloads" className="hover:text-brand-500">{t('footer.downloads')}</Link>
<span>·</span> <span>·</span>

View file

@ -4,7 +4,7 @@ import { Link, useLocation } from 'react-router-dom';
import { LayoutDashboard, MessageCircle, Phone, ShoppingBag } from 'lucide-react'; import { LayoutDashboard, MessageCircle, Phone, ShoppingBag } from 'lucide-react';
import ThemeToggle from './ThemeToggle.jsx'; import ThemeToggle from './ThemeToggle.jsx';
import { useAuth } from '../context/AuthContext.jsx'; import { useAuth } from '../context/AuthContext.jsx';
import { useSiteSettings } from '../context/SiteSettingsContext.jsx'; import { useIsAreaHidden, useSiteSettings } from '../context/SiteSettingsContext.jsx';
import { useLanguage } from '../context/LanguageContext.jsx'; import { useLanguage } from '../context/LanguageContext.jsx';
import logoDark from '../assets/logo-dark.png'; import logoDark from '../assets/logo-dark.png';
@ -124,9 +124,15 @@ export default function Navbar() {
const [menuVisible, setMenuVisible] = useState(false); const [menuVisible, setMenuVisible] = useState(false);
const { user } = useAuth(); const { user } = useAuth();
const { phone, whatsapp, logo_dark_path: logoDarkPath, has_downloads: hasDownloads } = useSiteSettings(); const { phone, whatsapp, logo_dark_path: logoDarkPath, has_downloads: hasDownloads } = useSiteSettings();
const isHidden = useIsAreaHidden();
const { t } = useLanguage(); const { t } = useLanguage();
// 4 Hauptlinks + Trennlinie + Shop, dazu die optionalen Eintraege. // Hauptlinks, die im Dashboard ausgeblendet werden koennen, fallen hier raus.
const totalItems = 6 + (hasDownloads ? 1 : 0) + (phone ? 1 : 0) + (whatsapp ? 1 : 0); const showVehicles = !isHidden('page.vehicles');
const showServices = !isHidden('page.services');
const showGallery = !isHidden('page.gallery');
const showDownloads = hasDownloads && !isHidden('page.downloads');
// Kontakt + Trennlinie + Shop, dazu die optionalen Eintraege.
const totalItems = 3 + [showVehicles, showServices, showGallery, showDownloads, phone, whatsapp].filter(Boolean).length;
const location = useLocation(); const location = useLocation();
const isHome = location.pathname === '/'; const isHome = location.pathname === '/';
const [scrolled, setScrolled] = useState(!isHome); const [scrolled, setScrolled] = useState(!isHome);
@ -252,19 +258,25 @@ export default function Navbar() {
<span className="text-xs font-semibold uppercase tracking-wide">{t('nav.close')}</span> <span className="text-xs font-semibold uppercase tracking-wide">{t('nav.close')}</span>
</button> </button>
{showVehicles && (
<Link to="/fahrzeuge" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}> <Link to="/fahrzeuge" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
{t('nav.vehicles')} {t('nav.vehicles')}
</Link> </Link>
)}
{showServices && (
<Link to="/leistungen" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}> <Link to="/leistungen" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
{t('nav.services')} {t('nav.services')}
</Link> </Link>
)}
{showGallery && (
<Link to="/galerie" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}> <Link to="/galerie" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
{t('nav.gallery')} {t('nav.gallery')}
</Link> </Link>
)}
<Link to="/kontakt" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}> <Link to="/kontakt" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
{t('nav.contact')} {t('nav.contact')}
</Link> </Link>
{hasDownloads && ( {showDownloads && (
<Link to="/downloads" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}> <Link to="/downloads" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
{t('nav.downloads')} {t('nav.downloads')}
</Link> </Link>

View file

@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Outlet, useLocation } from 'react-router-dom'; import { Navigate, Outlet, useLocation } from 'react-router-dom';
import Navbar from './Navbar.jsx'; import Navbar from './Navbar.jsx';
import Footer from './Footer.jsx'; import Footer from './Footer.jsx';
import ScrollProgress from './ScrollProgress.jsx'; import ScrollProgress from './ScrollProgress.jsx';
@ -16,6 +16,7 @@ import PageImageLoader from './PageImageLoader.jsx';
import { LanguageProvider } from '../context/LanguageContext.jsx'; import { LanguageProvider } from '../context/LanguageContext.jsx';
import { useAuth } from '../context/AuthContext.jsx'; import { useAuth } from '../context/AuthContext.jsx';
import { api } from '../api/client.js'; import { api } from '../api/client.js';
import { isPathHidden } from '../utils/siteAreas.js';
const FALLBACK_STATUS = { const FALLBACK_STATUS = {
global: { enabled: false, message: null }, global: { enabled: false, message: null },
@ -57,6 +58,7 @@ const DEFAULT_SITE_SETTINGS = {
site_font: null, site_font: null,
page_loader_enabled: 1, page_loader_enabled: 1,
has_downloads: false, has_downloads: false,
hidden_areas: [],
}; };
// Das Impressum (und die anderen rechtlichen Pflichtseiten) müssen laut § 5 DDG // Das Impressum (und die anderen rechtlichen Pflichtseiten) müssen laut § 5 DDG
@ -68,6 +70,9 @@ const LEGAL_PATHS = ['/impressum', '/datenschutz', '/agb'];
export default function PublicLayout() { export default function PublicLayout() {
const [status, setStatus] = useState(null); const [status, setStatus] = useState(null);
const [siteSettings, setSiteSettings] = useState(DEFAULT_SITE_SETTINGS); const [siteSettings, setSiteSettings] = useState(DEFAULT_SITE_SETTINGS);
// Erst rendern, wenn klar ist, welche Bereiche ausgeblendet sind - sonst blitzt eine
// ausgeblendete Seite/Sektion kurz auf, bevor die Einstellungen da sind.
const [siteSettingsLoaded, setSiteSettingsLoaded] = useState(false);
const [textStyles, setTextStyles] = useState({}); const [textStyles, setTextStyles] = useState({});
const [customFonts, setCustomFonts] = useState([]); const [customFonts, setCustomFonts] = useState([]);
const { loading: authLoading, hasPermission } = useAuth(); const { loading: authLoading, hasPermission } = useAuth();
@ -75,7 +80,11 @@ export default function PublicLayout() {
useEffect(() => { useEffect(() => {
api.get('/maintenance').then(setStatus).catch(() => setStatus(FALLBACK_STATUS)); api.get('/maintenance').then(setStatus).catch(() => setStatus(FALLBACK_STATUS));
api.get('/site-settings').then(setSiteSettings).catch(() => {}); api
.get('/site-settings')
.then(setSiteSettings)
.catch(() => {})
.finally(() => setSiteSettingsLoaded(true));
api.get('/text-styles').then(setTextStyles).catch(() => {}); api.get('/text-styles').then(setTextStyles).catch(() => {});
api.get('/custom-fonts').then(setCustomFonts).catch(() => {}); api.get('/custom-fonts').then(setCustomFonts).catch(() => {});
}, []); }, []);
@ -91,7 +100,7 @@ export default function PublicLayout() {
} }
}, [siteSettings.site_font]); }, [siteSettings.site_font]);
if (status === null || authLoading) { if (status === null || !siteSettingsLoaded || authLoading) {
return <div className="min-h-screen bg-white dark:bg-neutral-950" />; return <div className="min-h-screen bg-white dark:bg-neutral-950" />;
} }
@ -122,7 +131,8 @@ export default function PublicLayout() {
Seite, auf der das Warten am wenigsten lohnt. Ueberall sonst greift weiterhin Seite, auf der das Warten am wenigsten lohnt. Ueberall sonst greift weiterhin
die globale Einstellung. */} die globale Einstellung. */}
<PageImageLoader enabled={location.pathname !== '/' && !!siteSettings.page_loader_enabled}> <PageImageLoader enabled={location.pathname !== '/' && !!siteSettings.page_loader_enabled}>
<Outlet /> {/* Im Dashboard ausgeblendete Seiten (inkl. Unterseiten) -> Startseite. */}
{isPathHidden(location.pathname, siteSettings.hidden_areas) ? <Navigate to="/" replace /> : <Outlet />}
</PageImageLoader> </PageImageLoader>
</main> </main>
<Footer /> <Footer />

View file

@ -22,6 +22,7 @@ const SiteSettingsContext = createContext({
package_card_height: 480, package_card_height: 480,
vehicle_tile_width: 240, vehicle_tile_width: 240,
vehicle_tile_height: 180, vehicle_tile_height: 180,
hidden_areas: [],
}); });
export const SiteSettingsProvider = SiteSettingsContext.Provider; export const SiteSettingsProvider = SiteSettingsContext.Provider;
@ -29,3 +30,9 @@ export const SiteSettingsProvider = SiteSettingsContext.Provider;
export function useSiteSettings() { export function useSiteSettings() {
return useContext(SiteSettingsContext); return useContext(SiteSettingsContext);
} }
/** true, wenn der Bereich (z. B. 'home.faq') im Dashboard ausgeblendet wurde - siehe utils/siteAreas.js. */
export function useIsAreaHidden() {
const { hidden_areas: hiddenAreas } = useContext(SiteSettingsContext);
return (area) => (hiddenAreas || []).includes(area);
}

View file

@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { api } from '../../api/client.js'; import { api } from '../../api/client.js';
import { useAuth } from '../../context/AuthContext.jsx'; import { useAuth } from '../../context/AuthContext.jsx';
import { SITE_AREA_GROUPS } from '../../utils/siteAreas.js';
const ICONS = { const ICONS = {
tag: 'M4 4h7l9 9-7 7-9-9V4Zm3.5 3.5h.01', tag: 'M4 4h7l9 9-7 7-9-9V4Zm3.5 3.5h.01',
@ -16,6 +17,87 @@ const Icon = ({ path, className = 'h-6 w-6' }) => (
</svg> </svg>
); );
/** Schalter zum Ein-/Ausblenden ganzer Bereiche der Website - speichert jeden Klick sofort. */
function VisibilityWidget() {
const [hidden, setHidden] = useState(null);
const [savingKey, setSavingKey] = useState(null);
const [error, setError] = useState('');
useEffect(() => {
api
.get('/site-settings')
.then((res) => setHidden(res.hidden_areas || []))
.catch((e) => setError(e.message));
}, []);
const toggle = async (key) => {
const previous = hidden;
const next = hidden.includes(key) ? hidden.filter((k) => k !== key) : [...hidden, key];
setHidden(next);
setSavingKey(key);
setError('');
try {
const res = await api.put('/site-settings/visibility', { hidden_areas: next });
setHidden(res.hidden_areas);
} catch (err) {
setHidden(previous);
setError(err.message);
} finally {
setSavingKey(null);
}
};
return (
<section className="mt-8 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900">
<h2 className="mb-1 font-semibold text-neutral-900 dark:text-white">Sichtbarkeit der Website</h2>
<p className="mb-5 text-sm text-neutral-500 dark:text-neutral-400">
Schalte Bereiche aus, die Besucher gerade nicht sehen sollen. Die Inhalte bleiben gespeichert und sind nach dem
Wiedereinschalten sofort wieder da. Änderungen gelten sofort.
</p>
{error && <p className="mb-4 text-sm text-red-600">{error}</p>}
{hidden === null ? (
!error && <p className="text-sm text-neutral-400">Lädt…</p>
) : (
<div className="grid gap-6 md:grid-cols-2">
{SITE_AREA_GROUPS.map((group) => (
<div key={group.title}>
<p className="mb-1 text-xs font-semibold uppercase tracking-wide text-neutral-400">{group.title}</p>
<p className="mb-3 text-xs text-neutral-500 dark:text-neutral-400">{group.hint}</p>
<ul className="divide-y divide-neutral-100 dark:divide-neutral-800">
{group.areas.map((area) => {
const visible = !hidden.includes(area.key);
return (
<li key={area.key} className="flex items-center justify-between gap-3 py-2.5">
<div className="min-w-0">
<p className={`text-sm font-medium ${visible ? 'text-neutral-800 dark:text-neutral-100' : 'text-neutral-400 line-through dark:text-neutral-500'}`}>
{area.label}
</p>
{area.note && <p className="text-xs text-neutral-400">{area.note}</p>}
</div>
<label className="relative inline-flex shrink-0 cursor-pointer items-center" title={visible ? 'Sichtbar – zum Ausblenden klicken' : 'Ausgeblendet – zum Einblenden klicken'}>
<span className="sr-only">{area.label} sichtbar</span>
<input
type="checkbox"
checked={visible}
disabled={savingKey !== null}
onChange={() => toggle(area.key)}
className="peer sr-only"
/>
<div className="h-6 w-11 rounded-full bg-neutral-200 transition peer-checked:bg-brand-500 peer-disabled:opacity-60 dark:bg-neutral-700" />
<div className="absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition peer-checked:translate-x-5" />
</label>
</li>
);
})}
</ul>
</div>
))}
</div>
)}
</section>
);
}
function AnalyticsWidget() { function AnalyticsWidget() {
const [report, setReport] = useState(null); const [report, setReport] = useState(null);
const [error, setError] = useState(''); const [error, setError] = useState('');
@ -159,6 +241,7 @@ export default function Dashboard() {
</div> </div>
)} )}
{(hasPermission('content.manage') || hasPermission('settings.manage')) && <VisibilityWidget />}
{hasPermission('settings.manage') && <AnalyticsWidget />} {hasPermission('settings.manage') && <AnalyticsWidget />}
</div> </div>
); );

View file

@ -7,7 +7,8 @@ import Reveal from '../../components/Reveal.jsx';
import Accordion from '../../components/Accordion.jsx'; import Accordion from '../../components/Accordion.jsx';
import StarRating from '../../components/StarRating.jsx'; import StarRating from '../../components/StarRating.jsx';
import TestimonialSlider from '../../components/TestimonialSlider.jsx'; import TestimonialSlider from '../../components/TestimonialSlider.jsx';
import { useSiteSettings } from '../../context/SiteSettingsContext.jsx'; import { useIsAreaHidden, useSiteSettings } from '../../context/SiteSettingsContext.jsx';
import { isPathHidden } from '../../utils/siteAreas.js';
import { useTextStyle } from '../../context/TextStylesContext.jsx'; import { useTextStyle } from '../../context/TextStylesContext.jsx';
import { useLanguage } from '../../context/LanguageContext.jsx'; import { useLanguage } from '../../context/LanguageContext.jsx';
import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js'; import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js';
@ -35,9 +36,12 @@ const EMPTY_SECTION = {
}; };
/** Rendert nur, wenn sowohl Beschriftung als auch Ziel gesetzt sind - interne Ziele (mit "/") /** Rendert nur, wenn sowohl Beschriftung als auch Ziel gesetzt sind - interne Ziele (mit "/")
* bleiben in der SPA, alles andere oeffnet extern in einem neuen Tab. */ * bleiben in der SPA, alles andere oeffnet extern in einem neuen Tab. Zeigt das Ziel auf eine
* im Dashboard ausgeblendete Seite, entfaellt der Button (er wuerde nur zur Startseite fuehren). */
function SectionButton({ label, url, className, style }) { function SectionButton({ label, url, className, style }) {
const { hidden_areas: hiddenAreas } = useSiteSettings();
if (!label || !url) return null; if (!label || !url) return null;
if (isPathHidden(url, hiddenAreas)) return null;
if (url.startsWith('/')) { if (url.startsWith('/')) {
return ( return (
<Link to={url} className={className} style={style}> <Link to={url} className={className} style={style}>
@ -69,6 +73,8 @@ export default function Home() {
const { hero_image_path: heroImagePath } = useSiteSettings(); const { hero_image_path: heroImagePath } = useSiteSettings();
const heroImage = heroImagePath || defaultHeroImage; const heroImage = heroImagePath || defaultHeroImage;
const { t, language } = useLanguage(); const { t, language } = useLanguage();
const isHidden = useIsAreaHidden();
const showVehicles = !isHidden('page.vehicles');
const stats = t('home.stats'); const stats = t('home.stats');
const galleryAlts = t('home.galleryAlts'); const galleryAlts = t('home.galleryAlts');
@ -162,7 +168,7 @@ export default function Home() {
}); });
useEffect(() => { useEffect(() => {
if (faqs.length === 0) return; if (faqs.length === 0 || isHidden('home.faq')) return;
const script = document.createElement('script'); const script = document.createElement('script');
script.type = 'application/ld+json'; script.type = 'application/ld+json';
@ -222,12 +228,14 @@ export default function Home() {
{t('home.stickyCta')} {t('home.stickyCta')}
</p> </p>
<div className="flex w-full gap-3 sm:w-auto"> <div className="flex w-full gap-3 sm:w-auto">
{showVehicles && (
<Link <Link
to="/fahrzeuge" to="/fahrzeuge"
className="flex-1 rounded-md bg-brand-500 px-5 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 sm:flex-none" className="flex-1 rounded-md bg-brand-500 px-5 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 sm:flex-none"
> >
{t('home.selectVehicle')} {t('home.selectVehicle')}
</Link> </Link>
)}
<Link <Link
to="/kontakt" to="/kontakt"
className="flex-1 rounded-md border border-neutral-300 px-5 py-2.5 text-center text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800 sm:flex-none" className="flex-1 rounded-md border border-neutral-300 px-5 py-2.5 text-center text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800 sm:flex-none"
@ -280,12 +288,14 @@ export default function Home() {
dangerouslySetInnerHTML={{ __html: section('hero').bodyHtml }} dangerouslySetInnerHTML={{ __html: section('hero').bodyHtml }}
/> />
<div className="mt-8 flex flex-wrap items-center justify-center gap-3"> <div className="mt-8 flex flex-wrap items-center justify-center gap-3">
{showVehicles && (
<Link <Link
to="/fahrzeuge" to="/fahrzeuge"
className="rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 hover:shadow-lg" className="rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 hover:shadow-lg"
> >
{t('home.selectVehicle')} {t('home.selectVehicle')}
</Link> </Link>
)}
<Link <Link
to="/kontakt" to="/kontakt"
className="rounded-md border border-white/30 bg-white/10 px-6 py-3 text-sm font-semibold text-white backdrop-blur transition hover:-translate-y-0.5 hover:bg-white/20" className="rounded-md border border-white/30 bg-white/10 px-6 py-3 text-sm font-semibold text-white backdrop-blur transition hover:-translate-y-0.5 hover:bg-white/20"
@ -298,6 +308,7 @@ export default function Home() {
</motion.div> </motion.div>
</section> </section>
{!isHidden('home.stats') && (
<section className="border-b border-neutral-200 bg-neutral-950 py-8 dark:border-neutral-800"> <section className="border-b border-neutral-200 bg-neutral-950 py-8 dark:border-neutral-800">
<div className="mx-auto grid max-w-6xl grid-cols-2 gap-6 px-4 text-center sm:grid-cols-4 sm:px-6"> <div className="mx-auto grid max-w-6xl grid-cols-2 gap-6 px-4 text-center sm:grid-cols-4 sm:px-6">
{stats.map((stat, i) => ( {stats.map((stat, i) => (
@ -308,7 +319,9 @@ export default function Home() {
))} ))}
</div> </div>
</section> </section>
)}
{!isHidden('home.partners') && (
<section className="border-b border-neutral-200 py-8 dark:border-neutral-800"> <section className="border-b border-neutral-200 py-8 dark:border-neutral-800">
<div className="mx-auto max-w-6xl px-4 sm:px-6"> <div className="mx-auto max-w-6xl px-4 sm:px-6">
<p className="mb-4 text-center text-xs font-semibold uppercase tracking-wide text-neutral-400"> <p className="mb-4 text-center text-xs font-semibold uppercase tracking-wide text-neutral-400">
@ -327,7 +340,9 @@ export default function Home() {
</div> </div>
</div> </div>
</section> </section>
)}
{!isHidden('home.youtube') && (
<section className="relative min-h-[70vh] overflow-hidden sm:min-h-[85vh]"> <section className="relative min-h-[70vh] overflow-hidden sm:min-h-[85vh]">
<video <video
ref={videoRef} ref={videoRef}
@ -369,7 +384,9 @@ export default function Home() {
</Reveal> </Reveal>
</div> </div>
</section> </section>
)}
{!isHidden('home.craft') && (
<section className="grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40"> <section className="grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40">
<div className="mx-auto max-w-6xl space-y-16 overflow-hidden px-4 sm:px-6"> <div className="mx-auto max-w-6xl space-y-16 overflow-hidden px-4 sm:px-6">
<div className="grid items-center gap-8 md:grid-cols-2"> <div className="grid items-center gap-8 md:grid-cols-2">
@ -419,7 +436,9 @@ export default function Home() {
</div> </div>
</div> </div>
</section> </section>
)}
{!isHidden('home.insights') && (
<section className="mx-auto max-w-6xl px-4 py-16 sm:px-6"> <section className="mx-auto max-w-6xl px-4 py-16 sm:px-6">
<Reveal className={`mb-8 ${ALIGN_TEXT[section('insights').align]}`} style={{ fontFamily: section('insights').fontFamily }}> <Reveal className={`mb-8 ${ALIGN_TEXT[section('insights').align]}`} style={{ fontFamily: section('insights').fontFamily }}>
{section('insights').eyebrow && ( {section('insights').eyebrow && (
@ -446,7 +465,9 @@ export default function Home() {
))} ))}
</div> </div>
</section> </section>
)}
{!isHidden('home.reviews') && (
<section className="grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40"> <section className="grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40">
<div className="mx-auto max-w-6xl px-4 sm:px-6"> <div className="mx-auto max-w-6xl px-4 sm:px-6">
<Reveal className="mb-10 text-center"> <Reveal className="mb-10 text-center">
@ -471,7 +492,9 @@ export default function Home() {
</Reveal> </Reveal>
</div> </div>
</section> </section>
)}
{!isHidden('home.more') && (
<section className="mx-auto max-w-6xl overflow-hidden px-4 py-16 sm:px-6"> <section className="mx-auto max-w-6xl overflow-hidden px-4 py-16 sm:px-6">
<div className="grid items-center gap-10 md:grid-cols-2"> <div className="grid items-center gap-10 md:grid-cols-2">
<Reveal direction="left" shine className="overflow-hidden rounded-xl shadow-lg"> <Reveal direction="left" shine className="overflow-hidden rounded-xl shadow-lg">
@ -507,7 +530,9 @@ export default function Home() {
</Reveal> </Reveal>
</div> </div>
</section> </section>
)}
{!isHidden('home.faq') && (
<section className="border-t border-neutral-300 py-16 dark:border-neutral-700"> <section className="border-t border-neutral-300 py-16 dark:border-neutral-700">
<div className="mx-auto max-w-3xl px-4 sm:px-6"> <div className="mx-auto max-w-3xl px-4 sm:px-6">
<Reveal className="mb-8 text-center"> <Reveal className="mb-8 text-center">
@ -518,6 +543,7 @@ export default function Home() {
</Reveal> </Reveal>
</div> </div>
</section> </section>
)}
</div> </div>
); );
} }

View file

@ -0,0 +1,44 @@
// Bereiche, die im Dashboard per Schalter ausgeblendet werden koennen. Die Schluessel muessen
// mit SiteSettingsController::AREAS im Backend uebereinstimmen. Gespeichert wird nur die Liste
// der ausgeblendeten Schluessel (site-settings.hidden_areas) - alles andere ist sichtbar.
export const SITE_AREA_GROUPS = [
{
title: 'Seiten',
hint: 'Ausgeblendete Seiten verschwinden aus dem Menü und leiten Besucher auf die Startseite um.',
areas: [
{ key: 'page.vehicles', label: 'Fahrzeuge & Pakete', path: '/fahrzeuge' },
{ key: 'page.services', label: 'Leistungen', path: '/leistungen' },
{ key: 'page.gallery', label: 'Galerie', path: '/galerie' },
{ key: 'page.downloads', label: 'Downloads', path: '/downloads', note: 'Erscheint ohnehin nur, wenn Downloads hinterlegt sind.' },
],
},
{
title: 'Startseite',
hint: 'Einzelne Abschnitte der Startseite. Das große Titelbild oben bleibt immer sichtbar.',
areas: [
{ key: 'home.stats', label: 'Zahlen-Leiste' },
{ key: 'home.partners', label: 'Marken / Partner-Logos' },
{ key: 'home.youtube', label: 'Video-Abschnitt' },
{ key: 'home.craft', label: 'Handwerk & Beratung' },
{ key: 'home.insights', label: 'Einblicke (Bilder)' },
{ key: 'home.reviews', label: 'Kundenbewertungen' },
{ key: 'home.more', label: '„Mehr als Car-Hifi"' },
{ key: 'home.faq', label: 'Häufige Fragen (FAQ)' },
],
},
];
const PAGE_AREAS = SITE_AREA_GROUPS[0].areas;
/** Liefert den Seiten-Bereich zu einem internen Pfad (inkl. Unterseiten), sonst null. */
export function areaForPath(path) {
if (!path) return null;
const match = PAGE_AREAS.find((a) => path === a.path || path.startsWith(`${a.path}/`));
return match ? match.key : null;
}
/** true, wenn der interne Link auf eine ausgeblendete Seite zeigt. */
export function isPathHidden(path, hiddenAreas = []) {
const area = areaForPath(path);
return !!area && hiddenAreas.includes(area);
}

View file

@ -0,0 +1,10 @@
USE hifi_shop;
-- Bereiche (Seiten wie Galerie/Leistungen und einzelne Startseiten-Abschnitte), die der Admin
-- per Schalter im Dashboard ausblenden kann - JSON-Liste der ausgeblendeten Schluessel, siehe
-- SiteSettingsController::AREAS. Additiv, nichts wird geloescht.
-- Hinweis: Auf der Live-Seite reicht stattdessen ein Klick auf "Datenbankstruktur aktualisieren"
-- unter Admin-Panel -> Einstellungen -> Datenbank.
ALTER TABLE app_settings
ADD COLUMN IF NOT EXISTS hidden_areas TEXT NULL AFTER page_loader_enabled;

View file

@ -44,6 +44,7 @@ CREATE TABLE app_settings (
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100, gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
site_font VARCHAR(255) NULL, site_font VARCHAR(255) NULL,
page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1, page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1,
hidden_areas TEXT NULL,
downloads_password VARCHAR(100) NULL, downloads_password VARCHAR(100) NULL,
mail_host VARCHAR(255) NULL, mail_host VARCHAR(255) NULL,
mail_port INT NULL, mail_port INT NULL,

View file

@ -276,6 +276,7 @@ $router->post('/maintenance', $perm('settings.manage', fn($p) => MaintenanceCont
$router->get('/site-settings', fn($p) => SiteSettingsController::show()); $router->get('/site-settings', fn($p) => SiteSettingsController::show());
$router->post('/site-settings', $perm('settings.manage', fn($p) => SiteSettingsController::update())); $router->post('/site-settings', $perm('settings.manage', fn($p) => SiteSettingsController::update()));
$router->put('/site-settings/visibility', $anyPerm(['content.manage', 'settings.manage'], fn($p) => SiteSettingsController::updateVisibility()));
$router->get('/legal-pages', fn($p) => PageContentController::index()); $router->get('/legal-pages', fn($p) => PageContentController::index());
$router->get('/legal-pages/{slug}', fn($p) => PageContentController::show($p)); $router->get('/legal-pages/{slug}', fn($p) => PageContentController::show($p));

View file

@ -4,6 +4,7 @@ require __DIR__ . '/../vendor/autoload.php';
use App\Config\Database; use App\Config\Database;
use App\Controllers\DownloadController; use App\Controllers\DownloadController;
use App\Controllers\SiteSettingsController;
$config = require __DIR__ . '/../config/config.php'; $config = require __DIR__ . '/../config/config.php';
$siteUrl = rtrim($config['app']['site_url'], '/'); $siteUrl = rtrim($config['app']['site_url'], '/');
@ -15,14 +16,20 @@ $models = $db->query(
)->fetchAll(); )->fetchAll();
$brands = $db->query('SELECT slug, updated_at FROM brands')->fetchAll(); $brands = $db->query('SELECT slug, updated_at FROM brands')->fetchAll();
$urls = [ // Im Dashboard ausgeblendete Bereiche leiten auf die Startseite um - gehoeren nicht in die Sitemap.
['loc' => '/', 'priority' => '1.0'], $vehiclesHidden = SiteSettingsController::isHidden('page.vehicles');
['loc' => '/fahrzeuge', 'priority' => '0.9'], if ($vehiclesHidden) {
['loc' => '/kontakt', 'priority' => '0.5'], $models = $brands = [];
]; }
$urls = [['loc' => '/', 'priority' => '1.0']];
if (!$vehiclesHidden) {
$urls[] = ['loc' => '/fahrzeuge', 'priority' => '0.9'];
}
$urls[] = ['loc' => '/kontakt', 'priority' => '0.5'];
// Passwortgeschuetzt zeigt die Seite nur ein Eingabefeld - nichts, was ein Suchmaschinen- // Passwortgeschuetzt zeigt die Seite nur ein Eingabefeld - nichts, was ein Suchmaschinen-
// Eintrag wert waere. // Eintrag wert waere.
if (DownloadController::hasVisible() && !DownloadController::isProtected()) { if (DownloadController::hasVisible() && !DownloadController::isProtected() && !SiteSettingsController::isHidden('page.downloads')) {
$urls[] = ['loc' => '/downloads', 'priority' => '0.4']; $urls[] = ['loc' => '/downloads', 'priority' => '0.4'];
} }

View file

@ -46,7 +46,7 @@ class SettingsController
'ga_measurement_id', 'ga_property_id', 'google_place_id', 'ga_measurement_id', 'ga_property_id', 'google_place_id',
'package_card_theme', 'package_card_layout', 'package_wheel_hint_interval', 'package_card_theme', 'package_card_layout', 'package_wheel_hint_interval',
'package_card_width', 'package_card_height', 'vehicle_tile_width', 'vehicle_tile_height', 'package_card_width', 'package_card_height', 'vehicle_tile_width', 'vehicle_tile_height',
'gallery_card_text_x', 'gallery_card_text_y', 'site_font', 'page_loader_enabled', 'gallery_card_text_x', 'gallery_card_text_y', 'site_font', 'page_loader_enabled', 'hidden_areas',
'mail_host', 'mail_port', 'mail_username', 'mail_encryption', 'mail_host', 'mail_port', 'mail_username', 'mail_encryption',
'mail_from_email', 'mail_from_name', 'mail_notify_email', 'mail_from_email', 'mail_from_name', 'mail_notify_email',
'mail_customer_subject', 'mail_customer_body', 'mail_owner_subject', 'mail_owner_body', 'mail_customer_subject', 'mail_customer_body', 'mail_owner_subject', 'mail_owner_body',

View file

@ -52,7 +52,17 @@ class SiteSettingsController
logo_path, logo_dark_path, business_hours, hero_image_path, ga_measurement_id, logo_path, logo_dark_path, business_hours, hero_image_path, ga_measurement_id,
package_card_theme, package_card_layout, package_wheel_hint_interval, package_card_theme, package_card_layout, package_wheel_hint_interval,
package_card_width, package_card_height, vehicle_tile_width, vehicle_tile_height, package_card_width, package_card_height, vehicle_tile_width, vehicle_tile_height,
gallery_card_text_x, gallery_card_text_y, site_font, page_loader_enabled'; gallery_card_text_x, gallery_card_text_y, site_font, page_loader_enabled, hidden_areas';
// Bereiche, die der Admin per Schalter im Dashboard ausblenden kann (siehe Dashboard.jsx
// und utils/siteAreas.js im Frontend - die Schluessel muessen dort identisch sein).
// Seiten verschwinden aus Menue/Links und leiten auf die Startseite um, Startseiten-
// Abschnitte werden einfach nicht gerendert.
public const AREAS = [
'page.vehicles', 'page.services', 'page.gallery', 'page.downloads',
'home.stats', 'home.partners', 'home.youtube', 'home.craft', 'home.insights',
'home.reviews', 'home.more', 'home.faq',
];
public static function show(): void public static function show(): void
{ {
@ -72,12 +82,52 @@ class SiteSettingsController
} }
$decodedHours = is_string($row['business_hours'] ?? null) ? json_decode($row['business_hours'], true) : null; $decodedHours = is_string($row['business_hours'] ?? null) ? json_decode($row['business_hours'], true) : null;
$result['business_hours'] = is_array($decodedHours) ? $decodedHours : self::DEFAULT_BUSINESS_HOURS; $result['business_hours'] = is_array($decodedHours) ? $decodedHours : self::DEFAULT_BUSINESS_HOURS;
$result['hidden_areas'] = self::decodeHiddenAreas($row['hidden_areas'] ?? null);
// Navbar/Footer zeigen "Downloads" nur, wenn dort auch etwas zu finden ist. // Navbar/Footer zeigen "Downloads" nur, wenn dort auch etwas zu finden ist.
$result['has_downloads'] = DownloadController::hasVisible(); $result['has_downloads'] = DownloadController::hasVisible();
Http::send($result); Http::send($result);
} }
/** Gespeicherte Liste auf bekannte Schluessel filtern - alte/unbekannte Eintraege fallen raus. */
public static function decodeHiddenAreas($raw): array
{
$decoded = is_string($raw) ? json_decode($raw, true) : null;
if (!is_array($decoded)) {
return [];
}
return array_values(array_intersect(self::AREAS, $decoded));
}
/** Liefert true, wenn der Bereich (z. B. 'page.vehicles') gerade ausgeblendet ist. */
public static function isHidden(string $area): bool
{
try {
$raw = Database::connection()->query('SELECT hidden_areas FROM app_settings WHERE id = 1')->fetchColumn();
} catch (\Throwable $e) {
return false;
}
return in_array($area, self::decodeHiddenAreas($raw), true);
}
/**
* Eigener Endpunkt statt Teil von update(): die Schalter im Dashboard speichern sofort
* einzeln, ohne das komplette Website-Einstellungsformular mitschicken zu muessen.
*/
public static function updateVisibility(): void
{
$body = Http::jsonBody();
$hidden = is_array($body['hidden_areas'] ?? null) ? $body['hidden_areas'] : [];
$hidden = array_values(array_intersect(self::AREAS, $hidden));
$db = Database::connection();
$db->exec('INSERT IGNORE INTO app_settings (id) VALUES (1)');
$stmt = $db->prepare('UPDATE app_settings SET hidden_areas = ? WHERE id = 1');
$stmt->execute([json_encode($hidden)]);
Http::send(['hidden_areas' => $hidden]);
}
private const PACKAGE_CARD_THEMES = ['graphite', 'deep-blue', 'warm-bronze']; private const PACKAGE_CARD_THEMES = ['graphite', 'deep-blue', 'warm-bronze'];
private const PACKAGE_CARD_LAYOUTS = ['grid', 'strip', 'coverflow']; private const PACKAGE_CARD_LAYOUTS = ['grid', 'strip', 'coverflow'];

View file

@ -61,6 +61,7 @@ class Schema
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100, gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
site_font VARCHAR(255) NULL, site_font VARCHAR(255) NULL,
page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1, page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1,
hidden_areas TEXT NULL,
downloads_password VARCHAR(100) NULL, downloads_password VARCHAR(100) NULL,
mail_host VARCHAR(255) NULL, mail_host VARCHAR(255) NULL,
mail_port INT NULL, mail_port INT NULL,
@ -420,6 +421,7 @@ class Schema
'gallery_card_text_y' => 'TINYINT UNSIGNED NOT NULL DEFAULT 100', 'gallery_card_text_y' => 'TINYINT UNSIGNED NOT NULL DEFAULT 100',
'site_font' => 'VARCHAR(255) NULL', 'site_font' => 'VARCHAR(255) NULL',
'page_loader_enabled' => 'TINYINT(1) NOT NULL DEFAULT 1', 'page_loader_enabled' => 'TINYINT(1) NOT NULL DEFAULT 1',
'hidden_areas' => 'TEXT NULL',
'downloads_password' => 'VARCHAR(100) NULL', 'downloads_password' => 'VARCHAR(100) NULL',
'mail_host' => 'VARCHAR(255) NULL', 'mail_host' => 'VARCHAR(255) NULL',
'mail_port' => 'INT NULL', 'mail_port' => 'INT NULL',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{r as l,j as e,L as k,a as n}from"./index-CeNRYcbS.js";import{I as N}from"./ImageUploadField-DZzU8Hmm.js";import{T as f}from"./TextStyleWidget-DErOyFHL.js";const u={name:"",image_path:"",sort_order:0};function _(){const[i,h]=l.useState([]),[r,s]=l.useState(u),[a,o]=l.useState(null),[c,m]=l.useState(""),d=()=>n.get("/brands").then(h);l.useEffect(()=>{d()},[]);const p=t=>{o(t.id),s({name:t.name,image_path:t.image_path||"",sort_order:t.sort_order})},x=()=>{o(null),s(u)},b=async t=>{t.preventDefault(),m("");try{a?await n.put(`/brands/${a}`,r):await n.post("/brands",r),x(),d()}catch(j){m(j.message)}},g=async t=>{confirm("Marke inkl. aller Modelle/Pakete/Produkte wirklich löschen?")&&(await n.delete(`/brands/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Marken"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Bild"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[i.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.image_path?e.jsx("img",{src:t.image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:e.jsx(k,{to:`/marken/${t.slug}`,target:"_blank",className:"hover:text-brand-500",children:t.name})}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>p(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Marken angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:b,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:a?"Marke bearbeiten":"Neue Marke"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>s({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),a&&e.jsx(f,{fieldKey:`brands.${a}.name`,previewText:r.name||"Beispieltext"})]}),e.jsx(N,{value:r.image_path,onChange:t=>s({...r,image_path:t}),label:"Bild (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>s({...r,sort_order:Number(t.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:a?"Speichern":"Anlegen"}),a&&e.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{_ as default}; import{r as l,j as e,L as k,a as n}from"./index-DM5dAVp5.js";import{I as N}from"./ImageUploadField-oqjVVSSG.js";import{T as f}from"./TextStyleWidget-CkwixV2h.js";const u={name:"",image_path:"",sort_order:0};function _(){const[i,h]=l.useState([]),[r,s]=l.useState(u),[a,o]=l.useState(null),[c,m]=l.useState(""),d=()=>n.get("/brands").then(h);l.useEffect(()=>{d()},[]);const p=t=>{o(t.id),s({name:t.name,image_path:t.image_path||"",sort_order:t.sort_order})},x=()=>{o(null),s(u)},b=async t=>{t.preventDefault(),m("");try{a?await n.put(`/brands/${a}`,r):await n.post("/brands",r),x(),d()}catch(j){m(j.message)}},g=async t=>{confirm("Marke inkl. aller Modelle/Pakete/Produkte wirklich löschen?")&&(await n.delete(`/brands/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Marken"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Bild"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[i.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.image_path?e.jsx("img",{src:t.image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:e.jsx(k,{to:`/marken/${t.slug}`,target:"_blank",className:"hover:text-brand-500",children:t.name})}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>p(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Marken angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:b,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:a?"Marke bearbeiten":"Neue Marke"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>s({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),a&&e.jsx(f,{fieldKey:`brands.${a}.name`,previewText:r.name||"Beispieltext"})]}),e.jsx(N,{value:r.image_path,onChange:t=>s({...r,image_path:t}),label:"Bild (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>s({...r,sort_order:Number(t.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:a?"Speichern":"Anlegen"}),a&&e.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{_ as default};

View file

@ -1 +1 @@
import{b as f,r as l,j as t,a as c}from"./index-CeNRYcbS.js";const j=d=>new Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(d),k={new:"Neu",in_progress:"In Bearbeitung",done:"Erledigt"},v={new:"bg-brand-100 text-brand-700 dark:bg-brand-900/40 dark:text-brand-300",in_progress:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",done:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"},N=()=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"h-4 w-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0-.8 12.1a1 1 0 0 1-1 .9H7.8a1 1 0 0 1-1-.9L6 7h12ZM10 11v6M14 11v6"})});function _(){const{hasPermission:d}=f(),[n,u]=l.useState([]),[s,m]=l.useState("all"),i=()=>c.get("/contact").then(u);l.useEffect(()=>{i()},[]);const x=async(e,r)=>{await c.patch(`/contact/${e}`,{status:r}),i()},h=async e=>{confirm("Diese Kontaktanfrage wirklich unwiderruflich löschen?")&&(await c.delete(`/contact/${e}`),i())},g=l.useMemo(()=>({all:n.length,new:n.filter(e=>e.status==="new").length,in_progress:n.filter(e=>e.status==="in_progress").length,done:n.filter(e=>e.status==="done").length}),[n]),o=s==="all"?n:n.filter(e=>e.status===s),b=[{value:"all",label:"Alle"},{value:"new",label:"Neu"},{value:"in_progress",label:"In Bearbeitung"},{value:"done",label:"Erledigt"}];return t.jsxs("div",{children:[t.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Kontaktanfragen"}),t.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Alle Anfragen deiner Kunden. Wähle oben einen Reiter, um nur bestimmte Anfragen zu sehen."}),t.jsx("div",{className:"mb-5 flex flex-wrap gap-2",children:b.map(e=>t.jsxs("button",{onClick:()=>m(e.value),className:`rounded-full px-4 py-1.5 text-sm font-medium transition ${s===e.value?"bg-brand-500 text-white":"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"}`,children:[e.label," (",g[e.value],")"]},e.value))}),t.jsxs("div",{className:"space-y-3",children:[o.map(e=>{var r;return t.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"font-semibold text-neutral-800 dark:text-neutral-100",children:[e.name," · ",e.email,e.phone?` · ${e.phone}`:""]}),e.vin&&t.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["FIN: ",t.jsx("span",{className:"font-mono",children:e.vin})]}),t.jsx("p",{className:"text-xs text-neutral-400",children:new Date(e.created_at.replace(" ","T")).toLocaleString("de-DE")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("select",{value:e.status,onChange:a=>x(e.id,a.target.value),className:`rounded-full border-0 px-3 py-1 text-xs font-medium ${v[e.status]}`,children:Object.entries(k).map(([a,p])=>t.jsx("option",{value:a,children:p},a))}),d("contact.delete")&&t.jsx("button",{onClick:()=>h(e.id),"aria-label":"Anfrage löschen",title:"Anfrage löschen",className:"rounded-md p-1.5 text-neutral-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20",children:t.jsx(N,{})})]})]}),(e.brand_name||e.model_name||e.package_name||e.product_name)&&t.jsx("p",{className:"mb-2 text-sm text-neutral-500 dark:text-neutral-400",children:[e.brand_name,e.model_name,e.package_name,e.product_name].filter(Boolean).join(" · ")}),((r=e.selected_upgrades)==null?void 0:r.length)>0&&t.jsxs("div",{className:"mb-2 rounded-md bg-brand-50 p-2 text-sm text-brand-800 dark:bg-brand-900/20 dark:text-brand-200",children:[t.jsx("p",{className:"font-semibold",children:"Gewünschte Upgrades:"}),t.jsx("ul",{className:"list-disc pl-5",children:e.selected_upgrades.map(a=>t.jsxs("li",{children:[a.name," – ",j(a.price)]},a.id))})]}),e.message&&t.jsx("p",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:e.message})]},e.id)}),o.length===0&&t.jsx("p",{className:"text-neutral-400",children:s==="all"?"Noch keine Kontaktanfragen eingegangen.":"Keine Anfragen mit diesem Status."})]})]})}export{_ as default}; import{b as f,r as l,j as t,a as c}from"./index-DM5dAVp5.js";const j=d=>new Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(d),k={new:"Neu",in_progress:"In Bearbeitung",done:"Erledigt"},v={new:"bg-brand-100 text-brand-700 dark:bg-brand-900/40 dark:text-brand-300",in_progress:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",done:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"},N=()=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"h-4 w-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0-.8 12.1a1 1 0 0 1-1 .9H7.8a1 1 0 0 1-1-.9L6 7h12ZM10 11v6M14 11v6"})});function _(){const{hasPermission:d}=f(),[n,u]=l.useState([]),[s,m]=l.useState("all"),i=()=>c.get("/contact").then(u);l.useEffect(()=>{i()},[]);const x=async(e,r)=>{await c.patch(`/contact/${e}`,{status:r}),i()},h=async e=>{confirm("Diese Kontaktanfrage wirklich unwiderruflich löschen?")&&(await c.delete(`/contact/${e}`),i())},g=l.useMemo(()=>({all:n.length,new:n.filter(e=>e.status==="new").length,in_progress:n.filter(e=>e.status==="in_progress").length,done:n.filter(e=>e.status==="done").length}),[n]),o=s==="all"?n:n.filter(e=>e.status===s),b=[{value:"all",label:"Alle"},{value:"new",label:"Neu"},{value:"in_progress",label:"In Bearbeitung"},{value:"done",label:"Erledigt"}];return t.jsxs("div",{children:[t.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Kontaktanfragen"}),t.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Alle Anfragen deiner Kunden. Wähle oben einen Reiter, um nur bestimmte Anfragen zu sehen."}),t.jsx("div",{className:"mb-5 flex flex-wrap gap-2",children:b.map(e=>t.jsxs("button",{onClick:()=>m(e.value),className:`rounded-full px-4 py-1.5 text-sm font-medium transition ${s===e.value?"bg-brand-500 text-white":"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"}`,children:[e.label," (",g[e.value],")"]},e.value))}),t.jsxs("div",{className:"space-y-3",children:[o.map(e=>{var r;return t.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"font-semibold text-neutral-800 dark:text-neutral-100",children:[e.name," · ",e.email,e.phone?` · ${e.phone}`:""]}),e.vin&&t.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["FIN: ",t.jsx("span",{className:"font-mono",children:e.vin})]}),t.jsx("p",{className:"text-xs text-neutral-400",children:new Date(e.created_at.replace(" ","T")).toLocaleString("de-DE")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("select",{value:e.status,onChange:a=>x(e.id,a.target.value),className:`rounded-full border-0 px-3 py-1 text-xs font-medium ${v[e.status]}`,children:Object.entries(k).map(([a,p])=>t.jsx("option",{value:a,children:p},a))}),d("contact.delete")&&t.jsx("button",{onClick:()=>h(e.id),"aria-label":"Anfrage löschen",title:"Anfrage löschen",className:"rounded-md p-1.5 text-neutral-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20",children:t.jsx(N,{})})]})]}),(e.brand_name||e.model_name||e.package_name||e.product_name)&&t.jsx("p",{className:"mb-2 text-sm text-neutral-500 dark:text-neutral-400",children:[e.brand_name,e.model_name,e.package_name,e.product_name].filter(Boolean).join(" · ")}),((r=e.selected_upgrades)==null?void 0:r.length)>0&&t.jsxs("div",{className:"mb-2 rounded-md bg-brand-50 p-2 text-sm text-brand-800 dark:bg-brand-900/20 dark:text-brand-200",children:[t.jsx("p",{className:"font-semibold",children:"Gewünschte Upgrades:"}),t.jsx("ul",{className:"list-disc pl-5",children:e.selected_upgrades.map(a=>t.jsxs("li",{children:[a.name," – ",j(a.price)]},a.id))})]}),e.message&&t.jsx("p",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:e.message})]},e.id)}),o.length===0&&t.jsx("p",{className:"text-neutral-400",children:s==="all"?"Noch keine Kontaktanfragen eingegangen.":"Keine Anfragen mit diesem Status."})]})]})}export{_ as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{r as l,j as e,L as N,a as n}from"./index-CeNRYcbS.js";import{I as k}from"./ImageUploadField-DZzU8Hmm.js";const u={name:"",cover_image_path:"",sort_order:0};function f(){const[i,h]=l.useState([]),[r,a]=l.useState(u),[s,o]=l.useState(null),[c,m]=l.useState(""),d=()=>n.get("/gallery-brands").then(h);l.useEffect(()=>{d()},[]);const p=t=>{o(t.id),a({name:t.name,cover_image_path:t.cover_image_path||"",sort_order:t.sort_order})},x=()=>{o(null),a(u)},b=async t=>{t.preventDefault(),m("");try{s?await n.put(`/gallery-brands/${s}`,r):await n.post("/gallery-brands",r),x(),d()}catch(j){m(j.message)}},g=async t=>{confirm("Marke inkl. aller Projekte/Fotos wirklich löschen?")&&(await n.delete(`/gallery-brands/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Marken"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Bild"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[i.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.cover_image_path?e.jsx("img",{src:t.cover_image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:e.jsx(N,{to:`/galerie/${t.slug}`,target:"_blank",className:"hover:text-brand-500",children:t.name})}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>p(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Galerie-Marken angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:b,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Marke bearbeiten":"Neue Marke"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(k,{value:r.cover_image_path,onChange:t=>a({...r,cover_image_path:t}),aspect:4/3,label:"Titelbild (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>a({...r,sort_order:Number(t.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{f as default}; import{r as l,j as e,L as N,a as n}from"./index-DM5dAVp5.js";import{I as k}from"./ImageUploadField-oqjVVSSG.js";const u={name:"",cover_image_path:"",sort_order:0};function f(){const[i,h]=l.useState([]),[r,a]=l.useState(u),[s,o]=l.useState(null),[c,m]=l.useState(""),d=()=>n.get("/gallery-brands").then(h);l.useEffect(()=>{d()},[]);const p=t=>{o(t.id),a({name:t.name,cover_image_path:t.cover_image_path||"",sort_order:t.sort_order})},x=()=>{o(null),a(u)},b=async t=>{t.preventDefault(),m("");try{s?await n.put(`/gallery-brands/${s}`,r):await n.post("/gallery-brands",r),x(),d()}catch(j){m(j.message)}},g=async t=>{confirm("Marke inkl. aller Projekte/Fotos wirklich löschen?")&&(await n.delete(`/gallery-brands/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Marken"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Bild"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[i.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.cover_image_path?e.jsx("img",{src:t.cover_image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:e.jsx(N,{to:`/galerie/${t.slug}`,target:"_blank",className:"hover:text-brand-500",children:t.name})}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>p(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Galerie-Marken angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:b,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Marke bearbeiten":"Neue Marke"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(k,{value:r.cover_image_path,onChange:t=>a({...r,cover_image_path:t}),aspect:4/3,label:"Titelbild (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>a({...r,sort_order:Number(t.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{f as default};

View file

@ -1 +1 @@
import{e as w,r as l,j as t,L as P,a as n}from"./index-CeNRYcbS.js";function C(){const{projectId:d}=w(),[i,c]=l.useState([]),[m,h]=l.useState(""),[x,g]=l.useState(!1),[f,p]=l.useState(""),u=l.useRef(null),o=()=>n.get(`/gallery-projects/${d}/photos`).then(c);l.useEffect(()=>{o()},[d]);const j=async e=>{const r=Array.from(e.target.files||[]);if(r.length!==0){h(""),g(!0);try{for(let a=0;a<r.length;a++){p(`Lade Bild ${a+1} von ${r.length} hoch…`);const s=new FormData;s.append("file",r[a]);const v=await n.post("/uploads",s);await n.post("/gallery-photos",{gallery_project_id:Number(d),image_path:v.path,sort_order:i.length+a})}o()}catch(a){h(a.message)}finally{g(!1),p(""),u.current&&(u.current.value="")}}},N=(e,r)=>{c(a=>a.map(s=>s.id===e.id?{...s,caption:r}:s))},k=(e,r)=>{c(a=>a.map(s=>s.id===e.id?{...s,sort_order:r}:s))},b=async e=>{await n.put(`/gallery-photos/${e.id}`,{caption:e.caption,sort_order:e.sort_order}),o()},y=async e=>{confirm("Foto wirklich entfernen?")&&(await n.delete(`/gallery-photos/${e}`),o())};return t.jsxs("div",{children:[t.jsx("p",{className:"mb-2 text-sm",children:t.jsx(P,{to:"/admin/gallery-projects",className:"text-brand-600 hover:underline",children:"← Zurück zu den Projekten"})}),t.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Fotos im Projekt"}),t.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Fotos hinzufügen (Mehrfachauswahl möglich)"}),t.jsx("input",{ref:u,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp",onChange:j,disabled:x,className:"text-sm"}),x&&t.jsx("p",{className:"mt-2 text-sm text-neutral-500",children:f})]}),m&&t.jsx("p",{className:"mb-4 text-sm text-red-600",children:m}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:[i.map(e=>t.jsxs("div",{className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("img",{src:e.image_path,alt:e.caption||"",className:"aspect-square w-full object-cover"}),t.jsxs("div",{className:"space-y-2 p-3",children:[t.jsx("input",{value:e.caption||"",onChange:r=>N(e,r.target.value),onBlur:()=>b(e),placeholder:"Bildunterschrift (optional)",className:"w-full rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"number",value:e.sort_order,onChange:r=>k(e,Number(r.target.value)),onBlur:()=>b(e),className:"w-16 rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),t.jsx("button",{onClick:()=>y(e.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]},e.id)),i.length===0&&t.jsx("p",{className:"col-span-full py-6 text-center text-neutral-400",children:"Noch keine Fotos in diesem Projekt."})]})]})}export{C as default}; import{e as w,r as l,j as t,L as P,a as n}from"./index-DM5dAVp5.js";function C(){const{projectId:d}=w(),[i,c]=l.useState([]),[m,h]=l.useState(""),[x,g]=l.useState(!1),[f,p]=l.useState(""),u=l.useRef(null),o=()=>n.get(`/gallery-projects/${d}/photos`).then(c);l.useEffect(()=>{o()},[d]);const j=async e=>{const r=Array.from(e.target.files||[]);if(r.length!==0){h(""),g(!0);try{for(let a=0;a<r.length;a++){p(`Lade Bild ${a+1} von ${r.length} hoch…`);const s=new FormData;s.append("file",r[a]);const v=await n.post("/uploads",s);await n.post("/gallery-photos",{gallery_project_id:Number(d),image_path:v.path,sort_order:i.length+a})}o()}catch(a){h(a.message)}finally{g(!1),p(""),u.current&&(u.current.value="")}}},N=(e,r)=>{c(a=>a.map(s=>s.id===e.id?{...s,caption:r}:s))},k=(e,r)=>{c(a=>a.map(s=>s.id===e.id?{...s,sort_order:r}:s))},b=async e=>{await n.put(`/gallery-photos/${e.id}`,{caption:e.caption,sort_order:e.sort_order}),o()},y=async e=>{confirm("Foto wirklich entfernen?")&&(await n.delete(`/gallery-photos/${e}`),o())};return t.jsxs("div",{children:[t.jsx("p",{className:"mb-2 text-sm",children:t.jsx(P,{to:"/admin/gallery-projects",className:"text-brand-600 hover:underline",children:"← Zurück zu den Projekten"})}),t.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Fotos im Projekt"}),t.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Fotos hinzufügen (Mehrfachauswahl möglich)"}),t.jsx("input",{ref:u,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp",onChange:j,disabled:x,className:"text-sm"}),x&&t.jsx("p",{className:"mt-2 text-sm text-neutral-500",children:f})]}),m&&t.jsx("p",{className:"mb-4 text-sm text-red-600",children:m}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:[i.map(e=>t.jsxs("div",{className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("img",{src:e.image_path,alt:e.caption||"",className:"aspect-square w-full object-cover"}),t.jsxs("div",{className:"space-y-2 p-3",children:[t.jsx("input",{value:e.caption||"",onChange:r=>N(e,r.target.value),onBlur:()=>b(e),placeholder:"Bildunterschrift (optional)",className:"w-full rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"number",value:e.sort_order,onChange:r=>k(e,Number(r.target.value)),onBlur:()=>b(e),className:"w-16 rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),t.jsx("button",{onClick:()=>y(e.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]},e.id)),i.length===0&&t.jsx("p",{className:"col-span-full py-6 text-center text-neutral-400",children:"Noch keine Fotos in diesem Projekt."})]})]})}export{C as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
import{t as mt,r as d,j as u,a as ft}from"./index-CeNRYcbS.js";var V=!1,E,Z,k,_,N,rt,W,U,B,H,nt,G,X,st,at;function g(){if(!V){V=!0;var o=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(o),t=/(Mac OS X)|(Windows)|(Linux)/.exec(o);if(G=/\b(iPhone|iP[ao]d)/.exec(o),X=/\b(iP[ao]d)/.exec(o),H=/Android/i.exec(o),st=/FBAN\/\w+;/i.exec(o),at=/Mobile/i.exec(o),nt=!!/Win64/.exec(o),e){E=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN,E&&document&&document.documentMode&&(E=document.documentMode);var i=/(?:Trident\/(\d+.\d+))/.exec(o);rt=i?parseFloat(i[1])+4:E,Z=e[2]?parseFloat(e[2]):NaN,k=e[3]?parseFloat(e[3]):NaN,_=e[4]?parseFloat(e[4]):NaN,_?(e=/(?:Chrome\/(\d+\.\d+))/.exec(o),N=e&&e[1]?parseFloat(e[1]):NaN):N=NaN}else E=Z=k=N=_=NaN;if(t){if(t[1]){var r=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(o);W=r?parseFloat(r[1].replace("_",".")):!0}else W=!1;U=!!t[2],B=!!t[3]}else W=U=B=!1}}var Y={ie:function(){return g()||E},ieCompatibilityMode:function(){return g()||rt>E},ie64:function(){return Y.ie()&&nt},firefox:function(){return g()||Z},opera:function(){return g()||k},webkit:function(){return g()||_},safari:function(){return Y.webkit()},chrome:function(){return g()||N},windows:function(){return g()||U},osx:function(){return g()||W},linux:function(){return g()||B},iphone:function(){return g()||G},mobile:function(){return g()||G||X||H||at},nativeApp:function(){return g()||st},android:function(){return g()||H},ipad:function(){return g()||X}},gt=Y,vt=!!(typeof window<"u"&&window.document&&window.document.createElement),wt={canUseDOM:vt},bt=wt,ht=bt,ct;ht.canUseDOM&&(ct=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/** import{t as mt,r as d,j as u,a as ft}from"./index-DM5dAVp5.js";var V=!1,E,Z,k,_,N,rt,W,U,B,H,nt,G,X,st,at;function g(){if(!V){V=!0;var o=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(o),t=/(Mac OS X)|(Windows)|(Linux)/.exec(o);if(G=/\b(iPhone|iP[ao]d)/.exec(o),X=/\b(iP[ao]d)/.exec(o),H=/Android/i.exec(o),st=/FBAN\/\w+;/i.exec(o),at=/Mobile/i.exec(o),nt=!!/Win64/.exec(o),e){E=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN,E&&document&&document.documentMode&&(E=document.documentMode);var i=/(?:Trident\/(\d+.\d+))/.exec(o);rt=i?parseFloat(i[1])+4:E,Z=e[2]?parseFloat(e[2]):NaN,k=e[3]?parseFloat(e[3]):NaN,_=e[4]?parseFloat(e[4]):NaN,_?(e=/(?:Chrome\/(\d+\.\d+))/.exec(o),N=e&&e[1]?parseFloat(e[1]):NaN):N=NaN}else E=Z=k=N=_=NaN;if(t){if(t[1]){var r=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(o);W=r?parseFloat(r[1].replace("_",".")):!0}else W=!1;U=!!t[2],B=!!t[3]}else W=U=B=!1}}var Y={ie:function(){return g()||E},ieCompatibilityMode:function(){return g()||rt>E},ie64:function(){return Y.ie()&&nt},firefox:function(){return g()||Z},opera:function(){return g()||k},webkit:function(){return g()||_},safari:function(){return Y.webkit()},chrome:function(){return g()||N},windows:function(){return g()||U},osx:function(){return g()||W},linux:function(){return g()||B},iphone:function(){return g()||G},mobile:function(){return g()||G||X||H||at},nativeApp:function(){return g()||st},android:function(){return g()||H},ipad:function(){return g()||X}},gt=Y,vt=!!(typeof window<"u"&&window.document&&window.document.createElement),wt={canUseDOM:vt},bt=wt,ht=bt,ct;ht.canUseDOM&&(ct=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
* Checks if an event is supported in the current execution environment. * Checks if an event is supported in the current execution environment.
* *
* NOTE: This will not work correctly for non-generic events such as `change`, * NOTE: This will not work correctly for non-generic events such as `change`,

View file

@ -1 +1 @@
import{r as s,a as b,j as e}from"./index-CeNRYcbS.js";import{R as v}from"./RichTextEditor-BR1AFZHM.js";const j=[{slug:"impressum",label:"Impressum"},{slug:"datenschutz",label:"Datenschutzerklärung"},{slug:"agb",label:"AGB"}];function k(){const[d,u]=s.useState(null),[r,h]=s.useState("impressum"),[c,i]=s.useState(!1),[o,n]=s.useState(""),[g,l]=s.useState(!1);if(s.useEffect(()=>{b.get("/legal-pages").then(u)},[]),!d)return e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const a=d[r],m=(t,f)=>{u(x=>({...x,[r]:{...x[r],[t]:f}})),l(!1)},p=async()=>{i(!0),n(""),l(!1);try{await b.put(`/legal-pages/${r}`,{title:a.title,body_html:a.body_html}),l(!0)}catch(t){n(t.message)}finally{i(!1)}};return e.jsx("div",{className:"max-w-3xl space-y-6",children:e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Rechtstexte"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Impressum, Datenschutzerklärung und AGB direkt hier pflegen, statt einen Deploy für jede Textänderung zu brauchen. Bitte bei Rechtstexten im Zweifel rechtlich beraten lassen, bevor du größere Änderungen veröffentlichst."}),e.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:j.map(t=>e.jsx("button",{type:"button",onClick:()=>{h(t.slug),l(!1),n("")},className:`rounded-md px-3 py-1.5 text-sm font-medium transition ${r===t.slug?"bg-brand-500 text-white":"border border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:t.label},t.slug))}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Überschrift"}),e.jsx("input",{value:a.title,onChange:t=>m("title",t.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(v,{label:"Inhalt",value:a.body_html,onChange:t=>m("body_html",t)})]}),a.updated_at&&e.jsxs("p",{className:"mt-3 text-xs text-neutral-400",children:["Zuletzt geändert: ",new Date(a.updated_at.replace(" ","T")).toLocaleString("de-DE")]}),o&&e.jsx("p",{className:"mt-3 text-sm text-red-600",children:o}),g&&e.jsx("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:"mt-4 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:c?"Speichere…":"Speichern"})]})})}export{k as default}; import{r as s,a as b,j as e}from"./index-DM5dAVp5.js";import{R as v}from"./RichTextEditor-DTscIhNf.js";const j=[{slug:"impressum",label:"Impressum"},{slug:"datenschutz",label:"Datenschutzerklärung"},{slug:"agb",label:"AGB"}];function k(){const[d,u]=s.useState(null),[r,h]=s.useState("impressum"),[c,i]=s.useState(!1),[o,n]=s.useState(""),[g,l]=s.useState(!1);if(s.useEffect(()=>{b.get("/legal-pages").then(u)},[]),!d)return e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const a=d[r],m=(t,f)=>{u(x=>({...x,[r]:{...x[r],[t]:f}})),l(!1)},p=async()=>{i(!0),n(""),l(!1);try{await b.put(`/legal-pages/${r}`,{title:a.title,body_html:a.body_html}),l(!0)}catch(t){n(t.message)}finally{i(!1)}};return e.jsx("div",{className:"max-w-3xl space-y-6",children:e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Rechtstexte"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Impressum, Datenschutzerklärung und AGB direkt hier pflegen, statt einen Deploy für jede Textänderung zu brauchen. Bitte bei Rechtstexten im Zweifel rechtlich beraten lassen, bevor du größere Änderungen veröffentlichst."}),e.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:j.map(t=>e.jsx("button",{type:"button",onClick:()=>{h(t.slug),l(!1),n("")},className:`rounded-md px-3 py-1.5 text-sm font-medium transition ${r===t.slug?"bg-brand-500 text-white":"border border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:t.label},t.slug))}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Überschrift"}),e.jsx("input",{value:a.title,onChange:t=>m("title",t.target.value),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(v,{label:"Inhalt",value:a.body_html,onChange:t=>m("body_html",t)})]}),a.updated_at&&e.jsxs("p",{className:"mt-3 text-xs text-neutral-400",children:["Zuletzt geändert: ",new Date(a.updated_at.replace(" ","T")).toLocaleString("de-DE")]}),o&&e.jsx("p",{className:"mt-3 text-sm text-red-600",children:o}),g&&e.jsx("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:"mt-4 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:c?"Speichere…":"Speichern"})]})})}export{k as default};

View file

@ -1 +1 @@
import{b as N,c as v,r,j as e,N as y,l as C,d as S}from"./index-CeNRYcbS.js";function P(){const{user:x,login:h,verifyTwoFactor:g}=N(),o=v(),[f,u]=r.useState("credentials"),[i,p]=r.useState(""),[c,w]=r.useState(""),[m,b]=r.useState(""),[s,a]=r.useState(""),[n,l]=r.useState(!1);if(x)return e.jsx(y,{to:"/admin",replace:!0});const k=async t=>{t.preventDefault(),l(!0),a("");try{(await h(i,c)).requires2fa?u("code"):o("/admin")}catch(d){a(d.message)}finally{l(!1)}},j=async t=>{t.preventDefault(),l(!0),a("");try{await g(m),o("/admin")}catch(d){a(d.message)}finally{l(!1)}};return e.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 dark:bg-neutral-950",children:[e.jsx("img",{src:C,alt:"HifiPlanet",className:"h-16 w-auto dark:hidden sm:h-20"}),e.jsx("img",{src:S,alt:"HifiPlanet",className:"hidden h-16 w-auto dark:block sm:h-20"}),f==="credentials"?e.jsxs("form",{onSubmit:k,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-6 text-xl font-bold text-neutral-900 dark:text-white",children:"Admin-Login"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername"}),e.jsx("input",{value:i,onChange:t=>p(t.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort"}),e.jsx("input",{type:"password",value:c,onChange:t=>w(t.target.value),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Anmelden…":"Anmelden"})]}):e.jsxs("form",{onSubmit:j,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bestätigungscode"}),e.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Öffne die Google Authenticator App und gib den 6-stelligen Code ein. Alternativ kannst du auch einen deiner Wiederherstellungscodes verwenden."}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Code"}),e.jsx("input",{value:m,onChange:t=>b(t.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Prüfe…":"Bestätigen"}),e.jsx("button",{type:"button",onClick:()=>{u("credentials"),b(""),a("")},className:"mt-3 w-full text-sm text-neutral-500 hover:underline dark:text-neutral-400",children:"Zurück zum Login"})]})]})}export{P as default}; import{b as N,c as v,r,j as e,N as y,l as C,d as S}from"./index-DM5dAVp5.js";function P(){const{user:x,login:h,verifyTwoFactor:g}=N(),o=v(),[f,u]=r.useState("credentials"),[i,p]=r.useState(""),[c,w]=r.useState(""),[m,b]=r.useState(""),[s,a]=r.useState(""),[n,l]=r.useState(!1);if(x)return e.jsx(y,{to:"/admin",replace:!0});const k=async t=>{t.preventDefault(),l(!0),a("");try{(await h(i,c)).requires2fa?u("code"):o("/admin")}catch(d){a(d.message)}finally{l(!1)}},j=async t=>{t.preventDefault(),l(!0),a("");try{await g(m),o("/admin")}catch(d){a(d.message)}finally{l(!1)}};return e.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 dark:bg-neutral-950",children:[e.jsx("img",{src:C,alt:"HifiPlanet",className:"h-16 w-auto dark:hidden sm:h-20"}),e.jsx("img",{src:S,alt:"HifiPlanet",className:"hidden h-16 w-auto dark:block sm:h-20"}),f==="credentials"?e.jsxs("form",{onSubmit:k,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-6 text-xl font-bold text-neutral-900 dark:text-white",children:"Admin-Login"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername"}),e.jsx("input",{value:i,onChange:t=>p(t.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort"}),e.jsx("input",{type:"password",value:c,onChange:t=>w(t.target.value),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Anmelden…":"Anmelden"})]}):e.jsxs("form",{onSubmit:j,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bestätigungscode"}),e.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Öffne die Google Authenticator App und gib den 6-stelligen Code ein. Alternativ kannst du auch einen deiner Wiederherstellungscodes verwenden."}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Code"}),e.jsx("input",{value:m,onChange:t=>b(t.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Prüfe…":"Bestätigen"}),e.jsx("button",{type:"button",onClick:()=>{u("credentials"),b(""),a("")},className:"mt-3 w-full text-sm text-neutral-500 hover:underline dark:text-neutral-400",children:"Zurück zum Login"})]})]})}export{P as default};

View file

@ -1 +1 @@
import{r as s,a as o,j as a}from"./index-CeNRYcbS.js";const v={global:{enabled:!1,message:""},services:{enabled:!1,message:""},vehicles:{enabled:!1,message:""}};function N(){const[l,n]=s.useState(v),[g,h]=s.useState(!0),[i,d]=s.useState(!1),[x,r]=s.useState(!1),[c,u]=s.useState("");s.useEffect(()=>{o.get("/maintenance").then(e=>{n({global:{enabled:e.global.enabled,message:e.global.message||""},services:{enabled:e.services.enabled,message:e.services.message||""},vehicles:{enabled:e.vehicles.enabled,message:e.vehicles.message||""}})}).finally(()=>h(!1))},[]);const m=(e,t,k)=>{n(b=>({...b,[e]:{...b[e],[t]:k}})),r(!1)},p=async e=>{e.preventDefault(),d(!0),u(""),r(!1);try{const t=await o.post("/maintenance",l);n({global:{enabled:t.global.enabled,message:t.global.message||""},services:{enabled:t.services.enabled,message:t.services.message||""},vehicles:{enabled:t.vehicles.enabled,message:t.vehicles.message||""}}),r(!0)}catch(t){u(t.message)}finally{d(!1)}},f=[{key:"global",title:"Gesamte Seite",hint:"Besucher sehen nur noch eine Wartungsmeldung – egal welche Seite sie aufrufen. Das Admin-Panel bleibt für dich erreichbar."},{key:"services",title:"Nur Leistungen",hint:"Nur die Leistungen-Seite zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."},{key:"vehicles",title:"Nur Fahrzeugkatalog",hint:"Nur die Fahrzeugauswahl (Marke → Modell → Pakete) zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."}];return g?a.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):a.jsxs("form",{onSubmit:p,className:"max-w-2xl space-y-6",children:[a.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:'Ist "Gesamte Seite" aktiv, gewinnt das immer – die beiden anderen Schalter spielen dann keine Rolle mehr.'}),f.map(e=>a.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[a.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:e.title}),a.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[a.jsx("input",{type:"checkbox",checked:l[e.key].enabled,onChange:t=>m(e.key,"enabled",t.target.checked),className:"peer sr-only"}),a.jsx("div",{className:"h-6 w-11 rounded-full bg-neutral-200 transition peer-checked:bg-brand-500 dark:bg-neutral-700"}),a.jsx("div",{className:"absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition peer-checked:translate-x-5"})]})]}),a.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:e.hint}),a.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Eigene Nachricht (optional)"}),a.jsx("textarea",{rows:2,value:l[e.key].message,onChange:t=>m(e.key,"message",t.target.value),placeholder:"z. B. Wir aktualisieren gerade unser Angebot. Schau bald wieder vorbei!",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]},e.key)),c&&a.jsx("p",{className:"text-sm text-red-600",children:c}),x&&a.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),a.jsx("button",{type:"submit",disabled:i,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:i?"Speichere…":"Speichern"})]})}export{N as default}; import{r as s,a as o,j as a}from"./index-DM5dAVp5.js";const v={global:{enabled:!1,message:""},services:{enabled:!1,message:""},vehicles:{enabled:!1,message:""}};function N(){const[l,n]=s.useState(v),[g,h]=s.useState(!0),[i,d]=s.useState(!1),[x,r]=s.useState(!1),[c,u]=s.useState("");s.useEffect(()=>{o.get("/maintenance").then(e=>{n({global:{enabled:e.global.enabled,message:e.global.message||""},services:{enabled:e.services.enabled,message:e.services.message||""},vehicles:{enabled:e.vehicles.enabled,message:e.vehicles.message||""}})}).finally(()=>h(!1))},[]);const m=(e,t,k)=>{n(b=>({...b,[e]:{...b[e],[t]:k}})),r(!1)},p=async e=>{e.preventDefault(),d(!0),u(""),r(!1);try{const t=await o.post("/maintenance",l);n({global:{enabled:t.global.enabled,message:t.global.message||""},services:{enabled:t.services.enabled,message:t.services.message||""},vehicles:{enabled:t.vehicles.enabled,message:t.vehicles.message||""}}),r(!0)}catch(t){u(t.message)}finally{d(!1)}},f=[{key:"global",title:"Gesamte Seite",hint:"Besucher sehen nur noch eine Wartungsmeldung – egal welche Seite sie aufrufen. Das Admin-Panel bleibt für dich erreichbar."},{key:"services",title:"Nur Leistungen",hint:"Nur die Leistungen-Seite zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."},{key:"vehicles",title:"Nur Fahrzeugkatalog",hint:"Nur die Fahrzeugauswahl (Marke → Modell → Pakete) zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."}];return g?a.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):a.jsxs("form",{onSubmit:p,className:"max-w-2xl space-y-6",children:[a.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:'Ist "Gesamte Seite" aktiv, gewinnt das immer – die beiden anderen Schalter spielen dann keine Rolle mehr.'}),f.map(e=>a.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[a.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:e.title}),a.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[a.jsx("input",{type:"checkbox",checked:l[e.key].enabled,onChange:t=>m(e.key,"enabled",t.target.checked),className:"peer sr-only"}),a.jsx("div",{className:"h-6 w-11 rounded-full bg-neutral-200 transition peer-checked:bg-brand-500 dark:bg-neutral-700"}),a.jsx("div",{className:"absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition peer-checked:translate-x-5"})]})]}),a.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:e.hint}),a.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Eigene Nachricht (optional)"}),a.jsx("textarea",{rows:2,value:l[e.key].message,onChange:t=>m(e.key,"message",t.target.value),placeholder:"z. B. Wir aktualisieren gerade unser Angebot. Schau bald wieder vorbei!",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]},e.key)),c&&a.jsx("p",{className:"text-sm text-red-600",children:c}),x&&a.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),a.jsx("button",{type:"submit",disabled:i,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:i?"Speichere…":"Speichern"})]})}export{N as default};

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
import{r as c,R as J,f as Ze,j as a,a as U,g as Gn,C as mn,h as qn,i as Jn}from"./index-CeNRYcbS.js";import{T as Jt}from"./TextStyleWidget-DErOyFHL.js";import{P as bn,R as Zn,T as xn,G as Qn}from"./trash-2-CR1es5DZ.js";import{E as er,a as tr}from"./eye-B3iFgvk-.js";const nr=["Base","Clear","Drive","Prime","Elite","Apex","The Statement","Limitless"],rr=e=>(e+1)*10;function sr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const St=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ut(e){return"nodeType"in e}function Z(e){var t,n;return e?Fe(e)?e:Ut(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Kt(e){const{Document:t}=Z(e);return e instanceof t}function ot(e){return Fe(e)?!1:e instanceof Z(e).HTMLElement}function vn(e){return e instanceof Z(e).SVGElement}function Ue(e){return e?Fe(e)?e.document:Ut(e)?Kt(e)?e:ot(e)||vn(e)?e.ownerDocument:document:document:document}const ve=St?c.useLayoutEffect:c.useEffect;function Wt(e){const t=c.useRef(e);return ve(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function ar(){const e=c.useRef(null),t=c.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function rt(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return ve(()=>{n.current!==e&&(n.current=e)},t),n}function lt(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function vt(e){const t=Wt(e),n=c.useRef(null),r=c.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Tt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let Mt={};function ct(e,t){return c.useMemo(()=>{if(t)return t;const n=Mt[e]==null?0:Mt[e]+1;return Mt[e]=n,e+"-"+n},[e,t])}function yn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,l)=>{const d=Object.entries(l);for(const[f,h]of d){const g=i[f];g!=null&&(i[f]=g+e*h)}return i},{...t})}}const Be=yn(1),st=yn(-1);function ir(e){return"clientX"in e&&"clientY"in e}function Xt(e){if(!e)return!1;const{KeyboardEvent:t}=Z(e.target);return t&&e instanceof t}function or(e){if(!e)return!1;const{TouchEvent:t}=Z(e.target);return t&&e instanceof t}function Ot(e){if(or(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ir(e)?{x:e.clientX,y:e.clientY}:null}const at=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[at.Translate.toString(e),at.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Zt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function lr(e){return e.matches(Zt)?e:e.querySelector(Zt)}const cr={display:"none"};function dr(e){let{id:t,value:n}=e;return J.createElement("div",{id:t,style:cr},n)}function ur(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return J.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function fr(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const wn=c.createContext(null);function hr(e){const t=c.useContext(wn);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function gr(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:s,event:i}=r;e.forEach(l=>{var d;return(d=l[s])==null?void 0:d.call(l,i)})},[e]),t]}const pr={draggable:` import{r as c,R as J,f as Ze,j as a,a as U,g as Gn,C as mn,h as qn,i as Jn}from"./index-DM5dAVp5.js";import{T as Jt}from"./TextStyleWidget-CkwixV2h.js";import{P as bn,R as Zn,T as xn,G as Qn}from"./trash-2-CQGOvKRj.js";import{E as er,a as tr}from"./eye-CZFeBsZS.js";const nr=["Base","Clear","Drive","Prime","Elite","Apex","The Statement","Limitless"],rr=e=>(e+1)*10;function sr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const St=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ut(e){return"nodeType"in e}function Z(e){var t,n;return e?Fe(e)?e:Ut(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Kt(e){const{Document:t}=Z(e);return e instanceof t}function ot(e){return Fe(e)?!1:e instanceof Z(e).HTMLElement}function vn(e){return e instanceof Z(e).SVGElement}function Ue(e){return e?Fe(e)?e.document:Ut(e)?Kt(e)?e:ot(e)||vn(e)?e.ownerDocument:document:document:document}const ve=St?c.useLayoutEffect:c.useEffect;function Wt(e){const t=c.useRef(e);return ve(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function ar(){const e=c.useRef(null),t=c.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function rt(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return ve(()=>{n.current!==e&&(n.current=e)},t),n}function lt(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function vt(e){const t=Wt(e),n=c.useRef(null),r=c.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Tt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let Mt={};function ct(e,t){return c.useMemo(()=>{if(t)return t;const n=Mt[e]==null?0:Mt[e]+1;return Mt[e]=n,e+"-"+n},[e,t])}function yn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,l)=>{const d=Object.entries(l);for(const[f,h]of d){const g=i[f];g!=null&&(i[f]=g+e*h)}return i},{...t})}}const Be=yn(1),st=yn(-1);function ir(e){return"clientX"in e&&"clientY"in e}function Xt(e){if(!e)return!1;const{KeyboardEvent:t}=Z(e.target);return t&&e instanceof t}function or(e){if(!e)return!1;const{TouchEvent:t}=Z(e.target);return t&&e instanceof t}function Ot(e){if(or(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ir(e)?{x:e.clientX,y:e.clientY}:null}const at=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[at.Translate.toString(e),at.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Zt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function lr(e){return e.matches(Zt)?e:e.querySelector(Zt)}const cr={display:"none"};function dr(e){let{id:t,value:n}=e;return J.createElement("div",{id:t,style:cr},n)}function ur(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return J.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function fr(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const wn=c.createContext(null);function hr(e){const t=c.useContext(wn);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function gr(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:s,event:i}=r;e.forEach(l=>{var d;return(d=l[s])==null?void 0:d.call(l,i)})},[e]),t]}const pr={draggable:`
To pick up a draggable item, press the space bar. To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item. While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel. Press space again to drop the item in its new position, or press escape to cancel.

View file

@ -1 +1 @@
import{r as l,j as e,a as n}from"./index-CeNRYcbS.js";import{I as N}from"./ImageUploadField-DZzU8Hmm.js";const u={name:"",logo_path:"",sort_order:0};function y(){const[o,h]=l.useState([]),[r,a]=l.useState(u),[s,i]=l.useState(null),[c,x]=l.useState(""),d=()=>n.get("/partners").then(h);l.useEffect(()=>{d()},[]);const b=t=>{i(t.id),a({name:t.name,logo_path:t.logo_path||"",sort_order:t.sort_order})},m=()=>{i(null),a(u)},p=async t=>{t.preventDefault(),x("");try{s?await n.put(`/partners/${s}`,r):await n.post("/partners",r),m(),d()}catch(j){x(j.message)}},g=async t=>{confirm("Partner wirklich löschen?")&&(await n.delete(`/partners/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Partner"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Marken-Logozeile auf der Startseite. Ohne Logo wird der Name als Text angezeigt."}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Logo"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[o.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.logo_path?e.jsx("img",{src:t.logo_path,alt:"",className:"h-10 w-10 rounded-md object-contain"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:t.name}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>b(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),o.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Partner angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:p,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Partner bearbeiten":"Neuer Partner"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(N,{value:r.logo_path,onChange:t=>a({...r,logo_path:t}),label:"Logo (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>a({...r,sort_order:Number(t.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:m,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{y as default}; import{r as l,j as e,a as n}from"./index-DM5dAVp5.js";import{I as N}from"./ImageUploadField-oqjVVSSG.js";const u={name:"",logo_path:"",sort_order:0};function y(){const[o,h]=l.useState([]),[r,a]=l.useState(u),[s,i]=l.useState(null),[c,x]=l.useState(""),d=()=>n.get("/partners").then(h);l.useEffect(()=>{d()},[]);const b=t=>{i(t.id),a({name:t.name,logo_path:t.logo_path||"",sort_order:t.sort_order})},m=()=>{i(null),a(u)},p=async t=>{t.preventDefault(),x("");try{s?await n.put(`/partners/${s}`,r):await n.post("/partners",r),m(),d()}catch(j){x(j.message)}},g=async t=>{confirm("Partner wirklich löschen?")&&(await n.delete(`/partners/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Partner"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Marken-Logozeile auf der Startseite. Ohne Logo wird der Name als Text angezeigt."}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Logo"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[o.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.logo_path?e.jsx("img",{src:t.logo_path,alt:"",className:"h-10 w-10 rounded-md object-contain"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:t.name}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>b(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),o.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Partner angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:p,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Partner bearbeiten":"Neuer Partner"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(N,{value:r.logo_path,onChange:t=>a({...r,logo_path:t}),label:"Logo (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>a({...r,sort_order:Number(t.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:m,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{y as default};

View file

@ -1 +1 @@
import{r as n,j as e,a as i}from"./index-CeNRYcbS.js";const h={name:"",description:"",permissions:[]};function w(){const[c,b]=n.useState([]),[o,g]=n.useState([]),[r,a]=n.useState(h),[l,u]=n.useState(null),[m,x]=n.useState(""),d=()=>{i.get("/permission-groups").then(b),i.get("/permissions/catalog").then(g)};n.useEffect(d,[]);const j=t=>{u(t.id),a({name:t.name,description:t.description||"",permissions:t.permissions})},p=()=>{u(null),a(h)},N=t=>{a(s=>({...s,permissions:s.permissions.includes(t)?s.permissions.filter(y=>y!==t):[...s.permissions,t]}))},k=async t=>{t.preventDefault(),x("");try{l?await i.put(`/permission-groups/${l}`,r):await i.post("/permission-groups",r),p(),d()}catch(s){x(s.message)}},f=async t=>{confirm("Diese Berechtigungsgruppe wirklich löschen? Benutzer behalten ihre sonstigen Rechte.")&&(await i.delete(`/permission-groups/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Berechtigungsgruppen"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Fasse mehrere Berechtigungen zu einer Gruppe zusammen (z. B. „Werkstatt"), die du dann bequem einem oder mehreren Benutzern zuweisen kannst.'}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Berechtigungen"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[c.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsxs("td",{className:"px-4 py-2",children:[e.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:t.name}),t.description&&e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:t.description})]}),e.jsxs("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:[t.permissions.length," von ",o.length]}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>j(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>f(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),c.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Berechtigungsgruppen angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:k,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:l?"Gruppe bearbeiten":"Neue Gruppe"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),e.jsx("textarea",{rows:2,value:r.description,onChange:t=>a({...r,description:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Berechtigungen"}),e.jsx("div",{className:"space-y-1.5 rounded-md border border-neutral-200 p-3 dark:border-neutral-700",children:o.map(t=>e.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[e.jsx("input",{type:"checkbox",checked:r.permissions.includes(t.key),onChange:()=>N(t.key),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),t.label]},t.key))})]}),m&&e.jsx("p",{className:"text-sm text-red-600",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:l?"Speichern":"Anlegen"}),l&&e.jsx("button",{type:"button",onClick:p,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{w as default}; import{r as n,j as e,a as i}from"./index-DM5dAVp5.js";const h={name:"",description:"",permissions:[]};function w(){const[c,b]=n.useState([]),[o,g]=n.useState([]),[r,a]=n.useState(h),[l,u]=n.useState(null),[m,x]=n.useState(""),d=()=>{i.get("/permission-groups").then(b),i.get("/permissions/catalog").then(g)};n.useEffect(d,[]);const j=t=>{u(t.id),a({name:t.name,description:t.description||"",permissions:t.permissions})},p=()=>{u(null),a(h)},N=t=>{a(s=>({...s,permissions:s.permissions.includes(t)?s.permissions.filter(y=>y!==t):[...s.permissions,t]}))},k=async t=>{t.preventDefault(),x("");try{l?await i.put(`/permission-groups/${l}`,r):await i.post("/permission-groups",r),p(),d()}catch(s){x(s.message)}},f=async t=>{confirm("Diese Berechtigungsgruppe wirklich löschen? Benutzer behalten ihre sonstigen Rechte.")&&(await i.delete(`/permission-groups/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Berechtigungsgruppen"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Fasse mehrere Berechtigungen zu einer Gruppe zusammen (z. B. „Werkstatt"), die du dann bequem einem oder mehreren Benutzern zuweisen kannst.'}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Berechtigungen"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[c.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsxs("td",{className:"px-4 py-2",children:[e.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:t.name}),t.description&&e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:t.description})]}),e.jsxs("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:[t.permissions.length," von ",o.length]}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>j(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>f(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),c.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Berechtigungsgruppen angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:k,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:l?"Gruppe bearbeiten":"Neue Gruppe"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),e.jsx("textarea",{rows:2,value:r.description,onChange:t=>a({...r,description:t.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Berechtigungen"}),e.jsx("div",{className:"space-y-1.5 rounded-md border border-neutral-200 p-3 dark:border-neutral-700",children:o.map(t=>e.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[e.jsx("input",{type:"checkbox",checked:r.permissions.includes(t.key),onChange:()=>N(t.key),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),t.label]},t.key))})]}),m&&e.jsx("p",{className:"text-sm text-red-600",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:l?"Speichern":"Anlegen"}),l&&e.jsx("button",{type:"button",onClick:p,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{w as default};

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
import{r as q,R as xt,j as R,v as Gu,n as Yu}from"./index-CeNRYcbS.js";var Hl={exports:{}},jl={};/** import{r as q,R as xt,j as R,v as Gu,n as Yu}from"./index-DM5dAVp5.js";var Hl={exports:{}},jl={};/**
* @license React * @license React
* use-sync-external-store-shim.production.js * use-sync-external-store-shim.production.js
* *

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{b as l,j as t,p as i,r,O as m}from"./index-CeNRYcbS.js";const o=[{to:"/admin/settings/website",label:"Website"},{to:"/admin/settings/legal",label:"Rechtstexte"},{to:"/admin/settings/email",label:"E-Mail"},{to:"/admin/settings/database",label:"Datenbank"},{to:"/admin/settings/export-import",label:"Export & Import"},{to:"/admin/settings/maintenance",label:"Wartungsmodus"},{to:"/admin/settings/update",label:"Updates",permission:"system.update"},{to:"/admin/settings/reset",label:"Zurücksetzen"}];function u(){const{hasPermission:s}=l(),a=o.filter(e=>!e.permission||s(e.permission)),n=({isActive:e})=>`rounded-md px-4 py-2 text-sm font-medium transition ${e?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`;return t.jsxs("div",{children:[t.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Einstellungen"}),t.jsx("p",{className:"mb-5 text-sm text-neutral-500 dark:text-neutral-400",children:"Werkzeuge rund um Datenbank, Server-Umzug und Zurücksetzen dieser Seite."}),t.jsx("nav",{className:"mb-6 flex flex-wrap gap-2",children:a.map(e=>t.jsx(i,{to:e.to,className:n,children:e.label},e.to))}),t.jsx(r.Suspense,{fallback:t.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}),children:t.jsx(m,{})})]})}export{u as default}; import{b as l,j as t,p as i,r,O as m}from"./index-DM5dAVp5.js";const o=[{to:"/admin/settings/website",label:"Website"},{to:"/admin/settings/legal",label:"Rechtstexte"},{to:"/admin/settings/email",label:"E-Mail"},{to:"/admin/settings/database",label:"Datenbank"},{to:"/admin/settings/export-import",label:"Export & Import"},{to:"/admin/settings/maintenance",label:"Wartungsmodus"},{to:"/admin/settings/update",label:"Updates",permission:"system.update"},{to:"/admin/settings/reset",label:"Zurücksetzen"}];function u(){const{hasPermission:s}=l(),a=o.filter(e=>!e.permission||s(e.permission)),n=({isActive:e})=>`rounded-md px-4 py-2 text-sm font-medium transition ${e?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`;return t.jsxs("div",{children:[t.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Einstellungen"}),t.jsx("p",{className:"mb-5 text-sm text-neutral-500 dark:text-neutral-400",children:"Werkzeuge rund um Datenbank, Server-Umzug und Zurücksetzen dieser Seite."}),t.jsx("nav",{className:"mb-6 flex flex-wrap gap-2",children:a.map(e=>t.jsx(i,{to:e.to,className:n,children:e.label},e.to))}),t.jsx(r.Suspense,{fallback:t.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}),children:t.jsx(m,{})})]})}export{u as default};

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{n as g,r as l,a as x,j as t}from"./index-CeNRYcbS.js";const y=[{label:"Standard",value:""},{label:"S (14px)",value:"14px"},{label:"M (16px)",value:"16px"},{label:"L (18px)",value:"18px"},{label:"XL (20px)",value:"20px"},{label:"XXL (24px)",value:"24px"},{label:"XXXL (28px)",value:"28px"},{label:"Groß (36px)",value:"36px"},{label:"Riesig (48px)",value:"48px"}],s={font_family:"",font_size:"",color:""};function k({fieldKey:n,previewText:p="Beispieltext",label:c="Stil"}){const b=g(),[a,o]=l.useState(s),[m,u]=l.useState(!0),[d,i]=l.useState("");l.useEffect(()=>{u(!0),x.get(`/text-styles/one?key=${encodeURIComponent(n)}`).then(e=>o({font_family:e.font_family||"",font_size:e.font_size||"",color:e.color||""})).catch(()=>o(s)).finally(()=>u(!1))},[n]);const r=async e=>{o(e),i("");try{await x.put("/text-styles",{field_key:n,...e})}catch(v){i(v.message)}};if(m)return null;const f={fontFamily:a.font_family||void 0,fontSize:a.font_size||void 0,color:a.color||void 0};return t.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 rounded-md border border-neutral-200 bg-neutral-50 p-2 dark:border-neutral-700 dark:bg-neutral-800/50",children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral-400",children:c}),t.jsx("select",{value:a.font_family,onChange:e=>r({...a,font_family:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:b.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("select",{value:a.font_size,onChange:e=>r({...a,font_size:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:y.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("input",{type:"color",value:a.color||"#000000",onChange:e=>r({...a,color:e.target.value}),className:"h-7 w-9 cursor-pointer rounded border border-neutral-300 bg-white p-0.5 dark:border-neutral-700 dark:bg-neutral-900",title:"Textfarbe"}),t.jsx("button",{type:"button",onClick:()=>r(s),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-700",children:"Zurücksetzen"}),t.jsx("span",{className:"ml-1 rounded px-2 py-1 text-sm",style:f,children:p}),d&&t.jsx("span",{className:"text-xs text-red-600",children:d})]})}export{k as T}; import{n as g,r as l,a as x,j as t}from"./index-DM5dAVp5.js";const y=[{label:"Standard",value:""},{label:"S (14px)",value:"14px"},{label:"M (16px)",value:"16px"},{label:"L (18px)",value:"18px"},{label:"XL (20px)",value:"20px"},{label:"XXL (24px)",value:"24px"},{label:"XXXL (28px)",value:"28px"},{label:"Groß (36px)",value:"36px"},{label:"Riesig (48px)",value:"48px"}],s={font_family:"",font_size:"",color:""};function k({fieldKey:n,previewText:p="Beispieltext",label:c="Stil"}){const b=g(),[a,o]=l.useState(s),[m,u]=l.useState(!0),[d,i]=l.useState("");l.useEffect(()=>{u(!0),x.get(`/text-styles/one?key=${encodeURIComponent(n)}`).then(e=>o({font_family:e.font_family||"",font_size:e.font_size||"",color:e.color||""})).catch(()=>o(s)).finally(()=>u(!1))},[n]);const r=async e=>{o(e),i("");try{await x.put("/text-styles",{field_key:n,...e})}catch(v){i(v.message)}};if(m)return null;const f={fontFamily:a.font_family||void 0,fontSize:a.font_size||void 0,color:a.color||void 0};return t.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 rounded-md border border-neutral-200 bg-neutral-50 p-2 dark:border-neutral-700 dark:bg-neutral-800/50",children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral-400",children:c}),t.jsx("select",{value:a.font_family,onChange:e=>r({...a,font_family:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:b.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("select",{value:a.font_size,onChange:e=>r({...a,font_size:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:y.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("input",{type:"color",value:a.color||"#000000",onChange:e=>r({...a,color:e.target.value}),className:"h-7 w-9 cursor-pointer rounded border border-neutral-300 bg-white p-0.5 dark:border-neutral-700 dark:bg-neutral-900",title:"Textfarbe"}),t.jsx("button",{type:"button",onClick:()=>r(s),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-700",children:"Zurücksetzen"}),t.jsx("span",{className:"ml-1 rounded px-2 py-1 text-sm",style:f,children:p}),d&&t.jsx("span",{className:"text-xs text-red-600",children:d})]})}export{k as T};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
import{w as e}from"./index-CeNRYcbS.js";/** import{w as e}from"./index-DM5dAVp5.js";/**
* @license lucide-react v1.23.0 - ISC * @license lucide-react v1.23.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View file

@ -1,4 +1,4 @@
import{w as e,B as L0,x as x0,y as w0,z as f0,E as I0,h as C0,F as N0,i as b0,G as $0,C as s,H as q0,I as z0,J as S0,K as A0,M as H0,P as j0,Q as l,S as V0,T as P0,U as B0,V as D0,W as F0,X as R0,Y as T0,Z as U0,_ as O0,$ as G0,a0 as Z0,a1 as W0,a2 as E0,a3 as X0,a4 as K0,a5 as Q0,a6 as J0,a7 as Y0,a8 as ea,a9 as aa,aa as ca,ab as fL,ac as IL,ad as CL,j as NL}from"./index-CeNRYcbS.js";import{a as ta,E as oa}from"./eye-B3iFgvk-.js";import{G as da,P as na,R as ha,T as ia}from"./trash-2-CR1es5DZ.js";/** import{w as e,B as L0,x as x0,y as w0,z as f0,E as I0,h as C0,F as N0,i as b0,G as $0,C as s,H as q0,I as z0,J as S0,K as A0,M as H0,P as j0,Q as l,T as V0,U as P0,V as B0,W as D0,X as F0,Y as R0,Z as T0,_ as U0,$ as O0,a0 as G0,a1 as Z0,a2 as W0,a3 as E0,a4 as X0,a5 as K0,a6 as Q0,a7 as J0,a8 as Y0,a9 as ea,aa,ab as ca,ac as fL,ad as IL,ae as CL,j as NL}from"./index-DM5dAVp5.js";import{a as ta,E as oa}from"./eye-CZFeBsZS.js";import{G as da,P as na,R as ha,T as ia}from"./trash-2-CQGOvKRj.js";/**
* @license lucide-react v1.23.0 - ISC * @license lucide-react v1.23.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
import{w as c}from"./index-CeNRYcbS.js";/** import{w as c}from"./index-DM5dAVp5.js";/**
* @license lucide-react v1.23.0 - ISC * @license lucide-react v1.23.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View file

@ -40,8 +40,8 @@
"sameAs": ["https://www.youtube.com/@hifiplanet2812"] "sameAs": ["https://www.youtube.com/@hifiplanet2812"]
} }
</script> </script>
<script type="module" crossorigin src="/assets/index-CeNRYcbS.js"></script> <script type="module" crossorigin src="/assets/index-DM5dAVp5.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DszEoLNc.css"> <link rel="stylesheet" crossorigin href="/assets/index-BNAemH7C.css">
</head> </head>
<body class="bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100"> <body class="bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100">
<div id="root"></div> <div id="root"></div>