1import{al as w,u as y,p as C,j as e,B as m,_ as k,h as r,q as t,t as l,v as i,ac as h,U as v,T,N as j,i as x,aT as D,aU as P,aV as R,aW as u,a3 as B}from"./index-fv-DcFj2.js";import{T as $,a as A,b as p,c as d,d as E,e as c}from"./table-DnR6nq5e.js";import{C as L,a as U}from"./CorporateProtectedRoute-DcswNVLp.js";import{C as f}from"./circle-check-big-DM76MPOQ.js";import{D as K}from"./dollar-sign-1vEoHWeW.js";import{R as S,C as M,T as q}from"./generateCategoricalChart-BjlvB7sb.js";import{P as z,a as F}from"./PieChart-BcHbb-mH.js";import{C as G}from"./circle-x-tWP4SICN.js";import{E as H}from"./ellipsis-vertical-CWtH1Xvi.js";import{S as I}from"./square-pen-Bl_pOzua.js";import"./bot-cj9iMBIo.js";import"./download-0hBx8loX.js";import"./refresh-cw-BVXqOcoU.js";import"./file-text-B-p_mHJ5.js";import"./copy-D3em1Ffa.js";import"./shield-BUA05YDv.js";import"./settings-7xK5zRHi.js";import"./log-out-DR0uZRAb.js";import"./index-BvDIT34L.js";function me(){const[_,o]=w();y();const{data:a,isLoading:g,error:O}=C({queryKey:["/api/corporate/dashboard/stats"],refetchInterval:3e4}),N={starter:"#10b981",professional:"#3b82f6",enterprise:"#8b5cf6",custom:"#f59e0b"},b=s=>new Intl.NumberFormat("tr-TR",{style:"currency",currency:"TRY",minimumFractionDigits:0}).format(s);return e.jsx(L,{children:e.jsx(U,{children: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-3xl font-bold text-gray-900",children:"Dashboard"}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Kurumsal yönetim paneli özeti"})]}),e.jsxs(m,{onClick:()=>o("/kurumsal-admin/sirketler"),"data-testid":"button-add-company",children:[e.jsx(k,{className:"h-4 w-4 mr-2"}),"Åirket Ekle"]})]}),g?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[...Array(4)].map((s,n)=>e.jsxs(r,{children:[e.jsx(t,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:e.jsx(l,{className:"text-sm font-medium",children:e.jsx("div",{className:"h-4 w-24 bg-gray-200 rounded animate-pulse"})})}),e.jsx(i,{children:e.jsx("div",{className:"h-8 w-32 bg-gray-200 rounded animate-pulse"})})]},n))}):a?e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(r,{children:[e.jsxs(t,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(l,{className:"text-sm font-medium",children:"Toplam Åirket"}),e.jsx(h,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(i,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-total-companies",children:a.totalCompanies}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Kayıtlı Åirket sayısı"})]})]}),e.jsxs(r,{children:[e.jsxs(t,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(l,{className:"text-sm font-medium",children:"Aktif Åirket"}),e.jsx(f,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(i,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-active-companies",children:a.activeCompanies}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["%",(a.activeCompanies/a.totalCompanies*100).toFixed(0)," aktif"]})]})]}),e.jsxs(r,{children:[e.jsxs(t,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(l,{className:"text-sm font-medium",children:"Toplam Kullanıcı"}),e.jsx(v,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(i,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-total-users",children:a.totalUsers}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Kurumsal kullanıcı"})]})]}),e.jsxs(r,{children:[e.jsxs(t,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(l,{className:"text-sm font-medium",children:"Aylık Gelir"}),e.jsx(K,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(i,{children:[e.jsx("div",{className:"text-2xl font-bold","data-testid":"text-monthly-revenue",children:b(a.monthlyRevenue)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx(T,{className:"h-3 w-3 inline mr-1"}),"Geçen aya göre +12%"]})]})]})]}):null,e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(r,{children:[e.jsxs(t,{children:[e.jsx(l,{children:"Abonelik DaÄılımı"}),e.jsx(j,{children:"Plan türlerine göre Åirket daÄılımı"})]}),e.jsx(i,{children:(a==null?void 0:a.subscriptionBreakdown)&&e.jsx(S,{width:"100%",height:"300",children:e.jsxs(z,{children:[e.jsx(F,{data:a.subscriptionBreakdown,cx:"50%",cy:"50%",labelLine:!1,label:({plan:s,count:n})=>`${s}: ${n}`,outerRadius:80,fill:"#8884d8",dataKey:"count",children:a.subscriptionBreakdown.map((s,n)=>e.jsx(M,{fill:N[s.plan]||"#94a3b8"},`cell-${n}`))}),e.jsx(q,{formatter:s=>[`${s} Åirket`,"Sayı"]})]})})})]}),e.jsxs(r,{children:[e.jsxs(t,{children:[e.jsx(l,{children:"Son Eklenen Åirketler"}),e.jsx(j,{children:"En son kayıt olan Åirketler"})]}),e.jsx(i,{children:e.jsxs($,{children:[e.jsx(A,{children:e.jsxs(p,{children:[e.jsx(d,{children:"Åirket"}),e.jsx(d,{children:"Plan"}),e.jsx(d,{children:"Durum"}),e.jsx(d,{className:"w-[50px]"})]})}),e.jsx(E,{children:a==null?void 0:a.recentCompanies.map(s=>e.jsxs(p,{"data-testid":`row-company-${s.id}`,children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center space-x-2",children:[s.logoUrl?e.jsx("img",{src:s.logoUrl,alt:s.name,className:"h-8 w-8 rounded-full object-cover"}):e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(h,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsxs("div",{className:"text-xs text-gray-500",children:[s.employeeCount," çalıÅan"]})]})]})}),e.jsx(c,{children:e.jsx(x,{variant:s.plan==="enterprise"?"default":"secondary",children:s.plan})}),e.jsx(c,{children:s.isActive?e.jsxs(x,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(f,{className:"h-3 w-3 mr-1"}),"Aktif"]}):e.jsxs(x,{variant:"outline",className:"text-red-600 border-red-600",children:[e.jsx(G,{className:"h-3 w-3 mr-1"}),"Pasif"]})}),e.jsx(c,{children:e.jsxs(D,{children:[e.jsx(P,{asChild:!0,children:e.jsx(m,{variant:"ghost",size:"icon","data-testid":`button-menu-${s.id}`,children:e.jsx(H,{className:"h-4 w-4"})})}),e.jsxs(R,{align:"end",children:[e.jsxs(u,{onClick:()=>o(`/kurumsal-admin/sirketler/${s.slug}`),children:[e.jsx(B,{className:"h-4 w-4 mr-2"}),"Görüntüle"]}),e.jsxs(u,{onClick:()=>o(`/kurumsal-admin/sirketler/${s.slug}/edit`),children:[e.jsx(I,{className:"h-4 w-4 mr-2"}),"Düzenle"]})]})]})})]},s.id))})]})})]})]})]})})})}export{me 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.