PageSourceSearch

https://hyscore.io/assets/admin.statistics.kpi-revenue-config-PRClhOQ7.js

js hyscore.io collected 2026-10-01 11:36:26 UTC 14,851 bytes, 1 lines download raw bytes

1import{a3 as g,a4 as b,a5 as f,a6 as K,b as h,f as Q,r as p,al as j,aa as m,j as e}from"./index-DfAU25pB.js";import{l as U}from"./platform-shares.functions-Cmq9VL5P.js";import{F as A}from"./FinanceReportsBillingSection-MiMSIhCK.js";const w={standard:"Standard-MwSt.",reverse_charge:"Reverse Charge",exempt:"Steuerfrei"},R={included:"Share noch enthalten (Betrag = Netto 1)",deducted:"Share bereits abgezogen (Betrag = Netto 3)"},D=g({method:"GET"}).middleware([b]).handler(f("d8760e75ae3a3052749bc0b25519a50cab1d1e2143748b6bc05fd06fe2fecaea")),M=g({method:"POST"}).middleware([b]).handler(f("6a031c9826e028a52fe00035aeee3edc7ad96c62759ea7925db87a6a49230fd7")),O=g({method:"POST"}).middleware([b]).handler(f("dfcb83aa1f53c15c3b8efc5b588ccae4d781e1af6a849be9ae63a8e4c32d20be")),z=g({method:"POST"}).middleware([b]).handler(f("9c64109f306247fb8a6ab46b3c32d47f492db44f1c9bc1a88d0721a0cf5145a4")),T=g({method:"POST"}).middleware([b]).handler(f("3e4e747680f10c7d2eba404d67de333665ab668ad2bce54aa5948f7593338c77")),L=g({method:"POST"}).middleware([b]).handler(f("142761782c04bd4027f9bc4d05694605df37079faeecee669c85a6d1f7996e9d")),c="w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm";function $(){const r=K(),d=h(D),l=h(U),N=h(M),v=h(O),a=h(z),i=h(T),S=h(L),s=Q({queryKey:["bq-report-config"],queryFn:()=>d(),retry:!1}),_=Q({queryKey:["crm-platform-shares"],queryFn:()=>l(),retry:!1}),[n,u]=p.useState(null),[k,C]=p.useState("EUR");p.useEffect(()=>{s.data?.settings&&u(s.data.settings)},[s.data?.settings]),p.useEffect(()=>{s.data?.settings?.display_currency&&C(s.data.settings.display_currency)},[s.data?.settings?.display_currency]);const B=j({mutationFn:t=>N({data:{date_from:t.date_from,date_to:t.date_to||null,display_currency:t.display_currency,default_tax_rate_pct:t.default_tax_rate_pct,bq_project:t.bq_project,bq_dataset:t.bq_dataset,bq_table:t.bq_table}}),onSuccess:()=>{m.success("Report-Konfiguration gespeichert."),r.invalidateQueries({queryKey:["bq-report-config"]})},onError:t=>m.error(String(t?.message??t))}),E=j({mutationFn:t=>v({data:{id:t.id,source:t.source,display_name:t.display_name||null,currency:t.currency,share_basis:t.share_basis,tax_mode:t.tax_mode,tax_rate_pct:t.tax_rate_pct,share_pct:t.share_pct,platform_share_key:t.platform_share_key||null,valid_from:t.valid_from||null,is_active:t.is_active,note:t.note||null}}),onSuccess:()=>{m.success("Quelle gespeichert."),r.invalidateQueries({queryKey:["bq-report-config"]})},onError:t=>m.error(String(t?.message??t))}),P=j({mutationFn:t=>a({data:{id:t}}),onSuccess:()=>{m.success("Quelle gelöscht."),r.invalidateQueries({queryKey:["bq-report-config"]})},onError:t=>m.error(String(t?.message??t))}),q=j({mutationFn:()=>i(),onSuccess:t=>{m.success(`${t.found} Quellen in BigQuery gefunden, ${t.created} neu angelegt.`),r.invalidateQueries({queryKey:["bq-report-config"]})},onError:t=>m.error(String(t?.message??t))}),x=j({mutationFn:t=>S({data:{date_from:t.settings.date_from,date_to:t.settings.date_to||null,display_currency:t.currency,bq_project:t.settings.bq_project,bq_dataset:t.settings.bq_dataset,bq_table:t.settings.bq_table,sources:t.sources.map(o=>({source:o.source,display_name:o.display_name,currency:o.currency,share_basis:o.share_basis,tax_mode:o.tax_mode,tax_rate_pct:o.tax_rate_pct,share_pct:o.share_pct,is_active:o.is_active}))}}),onError:t=>m.error(String(t?.message??t))});if(s.isError)return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Report-Konfiguration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:String(s.error?.message??"Kein Zugriff.")})]});const y=s.data?.sources??[],F=_.data??[];return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Report-Konfiguration (Umsatz-KPIs)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Grundlage für die BigQuery-Auswertungen. Nur für Administratoren sichtbar."})]}),e.jsx("button",{type:"button",onClick:()=>q.mutate(),disabled:q.isPending,className:"rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:q.isPending?"Suche läuft…":"Quellen aus BigQuery laden"})]}),e.jsx(A,{}),e.jsxs("section",{className:"rounded-lg border border-border p-4",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold",children:"Zeitraum & Grundeinstellungen"}),n?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Von",e.jsx("input",{type:"date",className:c,value:n.date_from,onChange:t=>u({...n,date_from:t.target.value})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Bis (leer = heute)",e.jsx("input",{type:"date",className:c,value:n.date_to??"",onChange:t=>u({...n,date_to:t.target.value||null})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Anzeigewährung",e.jsxs("select",{className:c,value:n.display_currency,onChange:t=>u({...n,display_currency:t.target.value}),children:[e.jsx("option",{value:"EUR",children:"EUR"}),e.jsx("option",{value:"USD",children:"USD"})]})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Standard-MwSt. (%)",e.jsx("input",{type:"number",step:"0.1",className:c,value:n.default_tax_rate_pct,onChange:t=>u({...n,default_tax_rate_pct:Number(t.target.value)})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["BigQuery-Projekt",e.jsx("input",{className:c,value:n.bq_project,onChange:t=>u({...n,bq_project:t.target.value})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Dataset",e.jsx("input",{className:c,value:n.bq_dataset,onChange:t=>u({...n,bq_dataset:t.target.value})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Tabelle",e.jsx("input",{className:c,value:n.bq_table,onChange:t=>u({...n,bq_table:t.target.value})})]}),e.jsx("div",{className:"flex items-end",children:e.jsx("button",{type:"button",onClick:()=>n&&B.mutate(n),disabled:B.isPending,className:"rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:"Speichern"})})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Lädt…"})]}),e.jsxs("section",{className:"rounded-lg border border-border p-4",children:[e.jsxs("h2",{className:"mb-3 text-sm font-semibold",children:["Quellen (",y.length,")"]}),y.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Noch keine Quellen konfiguriert – lade sie über den Button oben aus BigQuery."}):e.jsx("div",{className:"space-y-3",children:y.map(t=>
1e.jsx(I,{row:t,shareKeys:F.map(o=>({key:o.platform_key,pct:o.share_pct})),saving:E.isPending,onSave:o=>E.mutate(o),onDelete:()=>{confirm(`Quelle "${t.source}" wirklich löschen?`)&&P.mutate(t.id)}},t.id))})]}),e.jsxs("section",{className:"rounded-lg border border-border p-4",children:[e.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Vorschau der Umsatz-KPIs (Nur Aktivierung!)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Berechnet mit den aktuell im Formular eingestellten Werten – ohne zu speichern."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:["EUR","USD"].map(t=>e.jsx("button",{type:"button",onClick:()=>{C(t),n&&x.data&&x.mutate({settings:n,sources:y,currency:t})},className:`px-3 py-2 text-sm font-medium ${k===t?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:t},t))}),e.jsx("button",{type:"button",disabled:!n||x.isPending,onClick:()=>n&&x.mutate({settings:n,sources:y,currency:k}),className:"rounded-md border border-border px-3 py-2 text-sm font-medium hover:bg-muted disabled:opacity-50",children:x.isPending?"Berechne…":"Vorschau berechnen"})]})]}),x.data?e.jsx(G,{data:x.data}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Noch keine Vorschau berechnet."})]})]})}function G({data:r}){const d=l=>new Intl.NumberFormat("de-DE",{style:"currency",currency:r.display_currency,maximumFractionDigits:2}).format(l);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Zeitraum ",r.date_from," – ",r.date_to," · Anzeige in"," ",r.display_currency," · Kurs (EZB-Monatsdurchschnitt, gewichtet) 1 EUR = ",r.usd_per_eur.toFixed(4)," USD"]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left text-xs text-muted-foreground",children:[e.jsx("th",{className:"py-2 pr-3",children:"Quelle"}),e.jsx("th",{className:"py-2 pr-3",children:"Währung"}),e.jsx("th",{className:"py-2 pr-3 text-right",children:"Datensätze"}),e.jsx("th",{className:"py-2 pr-3 text-right",children:"Netto 1"}),e.jsx("th",{className:"py-2 pr-3 text-right",children:"Share %"}),e.jsxs("th",{className:"py-2 pr-3 text-right",children:["Share (",r.display_currency,")"]}),e.jsx("th",{className:"py-2 pr-3 text-right",children:"Netto 3 (Revenue)"}),e.jsx("th",{className:"py-2 pr-3 text-right",children:"MwSt."}),e.jsx("th",{className:"py-2 text-right",children:"Brutto"})]})}),e.jsxs("tbody",{children:[r.rows.map(l=>e.jsxs("tr",{className:"border-b border-border/60",children:[e.jsxs("td",{className:"py-1.5 pr-3",children:[l.label,!l.configured&&e.jsx("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"nicht konfiguriert"})]}),e.jsx("td",{className:"py-1.5 pr-3",children:l.currency}),e.jsx("td",{className:"py-1.5 pr-3 text-right tabular-nums",children:l.rows}),e.jsx("td",{className:"py-1.5 pr-3 text-right tabular-nums",children:d(l.net1)}),e.jsxs("td",{className:"py-1.5 pr-3 text-right tabular-nums",children:[l.share_pct,"%"]}),e.jsx("td",{className:"py-1.5 pr-3 text-right tabular-nums",children:d(l.net2)}),e.jsx("td",{className:"py-1.5 pr-3 text-right tabular-nums",children:d(l.net3)}),e.jsx("td",{className:"py-1.5 pr-3 text-right tabular-nums",children:d(l.tax)}),e.jsx("td",{className:"py-1.5 text-right tabular-nums",children:d(l.gross)})]},l.source)),r.rows.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"py-3 text-sm text-muted-foreground",children:"Keine Daten im gewählten Zeitraum."})})]}),e.jsx("tfoot",{children:e.jsxs("tr",{className:"font-medium",children:[e.jsx("td",{className:"py-2 pr-3",children:"Gesamt"}),e.jsx("td",{className:"py-2 pr-3"}),e.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:r.totals.rows}),e.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:d(r.totals.net1)}),e.jsx("td",{className:"py-2 pr-3"}),e.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:d(r.totals.net2)}),e.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:d(r.totals.net3)}),e.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:d(r.totals.tax)}),e.jsx("td",{className:"py-2 text-right tabular-nums",children:d(r.totals.gross)})]})})]})}),r.skipped_inactive.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Ausgeblendet (inaktiv): ",r.skipped_inactive.join(", ")
1]})]})}function I({row:r,shareKeys:d,saving:l,onSave:N,onDelete:v}){const[a,i]=p.useState(r);p.useEffect(()=>i(r),[r]);const S=JSON.stringify(a)!==JSON.stringify(r);return e.jsxs("div",{className:"grid gap-2 rounded-md border border-border p-3 md:grid-cols-6",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("div",{className:"text-sm font-medium",children:a.source}),e.jsx("input",{className:c,placeholder:"Anzeigename",value:a.display_name??"",onChange:s=>i({...a,display_name:s.target.value})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Währung",e.jsxs("select",{className:c,value:a.currency,onChange:s=>i({...a,currency:s.target.value}),children:[e.jsx("option",{value:"EUR",children:"EUR"}),e.jsx("option",{value:"USD",children:"USD"})]})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Steuerregel",e.jsx("select",{className:c,value:a.tax_mode,onChange:s=>i({...a,tax_mode:s.target.value}),children:Object.keys(w).map(s=>e.jsx("option",{value:s,children:w[s]},s))})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["MwSt. (%)",e.jsx("input",{type:"number",step:"0.1",className:c,value:a.tax_rate_pct,onChange:s=>i({...a,tax_rate_pct:Number(s.target.value)})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Share-Basis",e.jsx("select",{className:c,value:a.share_basis,onChange:s=>i({...a,share_basis:s.target.value}),children:Object.keys(R).map(s=>e.jsx("option",{value:s,children:R[s]},s))})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Plattform-Share",e.jsxs("select",{className:c,value:a.platform_share_key??"",onChange:s=>{const _=s.target.value,n=d.find(u=>u.key===_);i({...a,platform_share_key:_||null,share_pct:n?n.pct:a.share_pct})},children:[e.jsx("option",{value:"",children:"— eigener Wert —"}),d.map(s=>e.jsxs("option",{value:s.key,children:[s.key," (",s.pct,"%)"]},s.key))]})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Share (%)",e.jsx("input",{type:"number",step:"0.1",className:c,value:a.share_pct??"",onChange:s=>i({...a,share_pct:s.target.value===""?null:Number(s.target.value)})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Gültig ab",e.jsx("input",{type:"date",className:c,value:a.valid_from??"",onChange:s=>i({...a,valid_from:s.target.value||null})})]}),e.jsxs("label",{className:"text-xs text-muted-foreground",children:["Status",e.jsxs("select",{className:c,value:a.is_active?"1":"0",onChange:s=>i({...a,is_active:s.target.value==="1"}),children:[e.jsx("option",{value:"1",children:"Aktiv"}),e.jsx("option",{value:"0",children:"Inaktiv"})]})]}),e.jsxs("label",{className:"text-xs text-muted-foreground md:col-span-4",children:["Notiz",e.jsx("input",{className:c,value:a.note??"",onChange:s=>i({...a,note:s.target.value})})]}),e.jsxs("div",{className:"flex items-end gap-2 md:col-span-2",children:[e.jsx("button",{type:"button",disabled:!S||l,onClick:()=>N(a),className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:"Speichern"}),e.jsx("button",{type:"button",onClick:v,className:"rounded-md border border-border px-3 py-1.5 text-sm hover:bg-muted",children:"Löschen"})]})]})}export{$ as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.