Tested locally on a separate branch before merging.
- Selected model (and package to open) live in the URL (?model=…&paket=…),
so going back or reloading returns to the same vehicle.
- Packages are compact rows (price, product/upgrade count, badge,
visibility); a click expands one package with its texts on the left and
markup, live price calculation, products and upgrades on the right.
- Products and upgrades are edited inline and saved immediately. Several
audio4cars links can be pasted at once, and products/upgrades are
reordered by drag & drop (@dnd-kit). The separate product/upgrade pages
are gone; old links redirect to the package in the editor.
- New GET /models/{id}/package-items loads all products and upgrades of a
model in one request.
- "Pakete kopieren" can include upgrades (include_upgrades).
No database changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 line
6.5 KiB
JavaScript
1 line
6.5 KiB
JavaScript
import{b as h,r as d,a as i,j as e,L as c}from"./index-D6g8QQLx.js";const m={tag:"M4 4h7l9 9-7 7-9-9V4Zm3.5 3.5h.01",car:"M3 13.5 4.5 9A2 2 0 0 1 6.4 7.5h11.2A2 2 0 0 1 19.5 9L21 13.5M3 13.5v4a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1h12v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-4M3 13.5h18M6.5 16.5h.01M17.5 16.5h.01",box:"M12 3 4 7.5v9L12 21l8-4.5v-9L12 3Zm0 9 8-4.5M12 12v9M12 12 4 7.5",mail:"M4 6h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm0 0 8 7 8-7"},u=({path:a,className:s="h-6 w-6"})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:s,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:a})});function g(){const[a,s]=d.useState(null),[n,l]=d.useState("");if(d.useEffect(()=>{i.get("/analytics/report").then(s).catch(t=>l(t.message))},[]),n)return e.jsxs("section",{className:"mt-8 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:"Google Analytics"}),e.jsx("p",{className:"text-sm text-red-600",children:n})]});if(!a)return null;if(!a.configured)return e.jsxs("section",{className:"mt-8 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:"Google Analytics"}),e.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:["Noch nicht eingerichtet. Unter"," ",e.jsx(c,{to:"/admin/settings/website",className:"text-brand-600 hover:underline dark:text-brand-400",children:"Einstellungen → Website"})," ","kannst du die Dashboard-Anbindung konfigurieren, um hier Besucherzahlen zu sehen."]})]});const o=Math.max(1,...a.daily.map(t=>t.pageviews));return e.jsxs("section",{className:"mt-8 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:"Google Analytics"}),e.jsx("p",{className:"mb-5 text-sm text-neutral-500 dark:text-neutral-400",children:"Letzte 7 Tage."}),e.jsxs("div",{className:"mb-6 grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:a.totals.users}),e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Nutzer"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:a.totals.sessions}),e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Sitzungen"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:a.totals.pageviews}),e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Seitenaufrufe"})]})]}),a.daily.length>0&&e.jsx("div",{className:"mb-6 flex h-24 items-end gap-1.5",children:a.daily.map(t=>e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full rounded-t bg-brand-400 dark:bg-brand-500",style:{height:`${Math.max(4,t.pageviews/o*80)}px`},title:`${t.date}: ${t.pageviews} Seitenaufrufe`}),e.jsxs("span",{className:"text-[10px] text-neutral-400",children:[t.date.slice(6,8),".",t.date.slice(4,6),"."]})]},t.date))}),a.top_pages.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-neutral-400",children:"Meistbesuchte Seiten"}),e.jsx("ul",{className:"space-y-1 text-sm",children:a.top_pages.map(t=>e.jsxs("li",{className:"flex items-center justify-between gap-3 text-neutral-700 dark:text-neutral-300",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:t.path}),e.jsx("span",{className:"shrink-0 font-semibold",children:t.pageviews})]},t.path))})]})]})}function p(){const{user:a,hasPermission:s}=h(),[n,l]=d.useState({});d.useEffect(()=>{s("brands.manage")&&i.get("/brands").then(t=>l(r=>({...r,brands:t.length}))),(s("models.manage")||s("packages.manage"))&&i.get("/models").then(t=>l(r=>({...r,models:t.length}))),s("packages.manage")&&i.get("/packages").then(t=>l(r=>({...r,packages:t.length}))),s("contact.manage")&&i.get("/contact").then(t=>l(r=>({...r,newContacts:t.filter(x=>x.status==="new").length})))},[]);const o=[{key:"brands",label:"Marken",icon:"tag",hint:"Die Hersteller, z. B. Audi oder BMW.",value:n.brands,to:"/admin/brands",show:s("brands.manage")},{key:"models",label:"Modelle",icon:"car",hint:"Die Fahrzeuge einer Marke, z. B. A4.",value:n.models,to:"/admin/models",show:s("models.manage")},{key:"packages",label:"Pakete",icon:"box",hint:"Die Sound-Pakete für ein Modell.",value:n.packages,to:"/admin/packages",show:s("packages.manage")},{key:"contacts",label:"Neue Anfragen",icon:"mail",hint:"Kunden, die noch auf Antwort warten.",value:n.newContacts,to:"/admin/contact-requests",show:s("contact.manage"),highlight:!0}].filter(t=>t.show);return e.jsxs("div",{children:[e.jsxs("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:["Willkommen, ",a==null?void 0:a.username,"!"]}),e.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Hier siehst du auf einen Blick, wie viel in deinem Shop hinterlegt ist. Klicke auf eine Kachel, um dorthin zu gelangen."}),o.length===0?e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:"Für deinen Account sind noch keine Bereiche freigeschaltet. Bitte wende dich an einen Administrator."}):e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:o.map(t=>e.jsxs(c,{to:t.to,className:`rounded-xl border p-5 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md ${t.highlight&&t.value>0?"border-brand-300 bg-brand-50 dark:border-brand-900 dark:bg-brand-900/20":"border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900"}`,children:[e.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:e.jsx(u,{path:m[t.icon]})}),e.jsx("p",{className:"text-sm font-semibold text-neutral-700 dark:text-neutral-200",children:t.label}),e.jsx("p",{className:"mt-1 text-3xl font-extrabold text-brand-600 dark:text-brand-400",children:t.value??"…"}),e.jsx("p",{className:"mt-2 text-xs text-neutral-500 dark:text-neutral-400",children:t.hint})]},t.key))}),s("settings.manage")&&e.jsx(g,{})]})}export{p as default};
|