PageSourceSearch

https://mrchinasupply.de/assets/CsCockpit-BnIxns56.js

js mrchinasupply.de collected 2026-10-07 06:27:08 UTC 4,807 bytes, 1 lines download raw bytes

1import{r as p,j as e}from"./vendor-motion-BHKvfdub.js";import{as as y,B as x,c4 as k,T as v,m as h,Z as g,L as C,u as j}from"./index-BDt3UX3X.js";import{u as w,a as M,C as _}from"./CustomerHealthDetailSheet-BOcemsYu.js";import{C as R,H,r as S}from"./HealthScoreSparkline-BwokfE6L.js";import{t as E}from"./useRenewals-CLWFHb10.js";import{f as A}from"./currency-CJC0pdxg.js";import{R as D}from"./refresh-cw-JOpWxgsN.js";import"./vendor-recharts-DrQ74lLO.js";import"./vendor-supabase-DXfLReh3.js";import"./useEntityQuery-ButkGhoz.js";import"./sheet-aC0bDCjF.js";import"./eye-DWzH4NQZ.js";import"./useEntityMutation-C2P9JrCh.js";import"./useMutation-CBeKYIhq.js";function f(s){return A(s)}function P(){const{t:s,i18n:l}=y(),{data:t}=w(),{data:c=[],refetch:o}=M(),[a,n]=p.useState(null),[d,m]=p.useState(!1),u=c.filter(r=>r.health_risk_level==="at_risk"||r.health_risk_level==="critical").slice(0,10),N=async()=>{m(!0);try{await S(),await E(),j.success(s("csModule.cockpit.toastSuccess")),o()}catch(r){j.error(r instanceof Error?r.message:s("csModule.cockpit.toastError"))}finally{m(!1)}},b=l.language==="en"?"en-US":l.language==="zh"?"zh-CN":"de-DE";return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:s("csModule.cockpit.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("csModule.cockpit.subtitle")})]}),e.jsxs(x,{onClick:N,disabled:d,variant:"outline",children:[e.jsx(D,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),s("csModule.cockpit.refresh")]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(i,{icon:k,label:s("csModule.cockpit.kpi.avgHealth"),value:(t==null?void 0:t.avgHealth)??"—",suffix:"/100",tone:"primary"}),e.jsx(i,{icon:v,label:s("csModule.cockpit.kpi.atRiskCritical"),value:((t==null?void 0:t.atRiskCount)??0)+((t==null?void 0:t.criticalCount)??0),suffix:`/${(t==null?void 0:t.totalCustomers)??0}`,tone:"destructive"}),e.jsx(i,{icon:h,label:s("csModule.cockpit.kpi.openRenewalArr"),value:f((t==null?void 0:t.openRenewalArr)??0),tone:"primary"}),e.jsx(i,{icon:h,label:s("csModule.cockpit.kpi.upcomingRenewals"),value:(t==null?void 0:t.upcomingRenewalCount)??0,tone:"muted"})]}),e.jsxs(g,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"font-semibold",children:s("csModule.cockpit.topAtRisk")}),e.jsx(C,{to:"/mitarbeiter/cs/kunden",className:"text-xs text-primary hover:underline",children:s("csModule.cockpit.allCustomers")})]}),u.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("csModule.cockpit.noCritical")}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-left text-xs text-muted-foreground border-b border-border",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-2 pr-3",children:s("csModule.cockpit.col.customer")}),e.jsx("th",{className:"py-2 pr-3",children:s("csModule.cockpit.col.health")}),e.jsx("th",{className:"py-2 pr-3",children:s("csModule.cockpit.col.trend30d")}),e.jsx("th",{className:"py-2 pr-3 text-right",children:s("csModule.cockpit.col.arr")}),e.jsx("th",{className:"py-2 pr-3",children:s("csModule.cockpit.col.renewal")}),e.jsx("th",{className:"py-2"})]})}),e.jsx("tbody",{children:u.map(r=>e.jsxs("tr",{className:"border-b border-border/50 last:border-0 hover:bg-muted/40",children:[e.jsx("td",{className:"py-2 pr-3 font-medium",children:r.name}),e.jsx("td",{className:"py-2 pr-3",children:e.jsx(R,{score:r.health_score,riskLevel:r.health_risk_level})}),e.jsx("td",{className:"py-2 pr-3",children:e.jsx(H,{companyId:r.id})}),e.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:r.arr_eur?f(Number(r.arr_eur)):"—"}),e.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.next_renewal_date?new Date(r.next_renewal_date).toLocaleDateString(b):"—"}),e.jsx("td",{className:"py-2",children:e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>n({id:r.id,name:r.name}),children:s("csModule.cockpit.details")})})]},r.id))})]})]}),e.jsx(_,{open:!!a,onOpenChange:r=>!r&&n(null),companyId:(a==null?void 0:a.id)??null,companyName:a==null?void 0:a.name})]})}function i({icon:s,label:l,value:t,suffix:c,tone:o}){const a=o==="destructive"?"text-destructive":o==="primary"?"text-primary":"text-muted-foreground";return e.jsxs(g,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-2",children:[e.jsx(s,{className:`h-4 w-4 ${a}`}),l]}),e.jsxs("div",{className:"text-2xl font-semibold tabular-nums",children:[t,c&&e.jsx("span",{className:"text-sm text-muted-foreground ml-1",children:c})]})]})}export{P as default};

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.