1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3],{64633:function(e,s,t){Promise.resolve().then(t.bind(t,27987))},27987:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return U}});var a=t(57437),r=t(11713),n=t(66070),l=t(35974);t(2265);var i=t(77796),d=t(94508);function c(e){let{className:s,value:t,...r}=e;return(0,a.jsx)(i.fC,{"data-slot":"progress",className:(0,d.cn)("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",s),...r,children:(0,a.jsx)(i.z$,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:"translateX(-".concat(100-(t||0),"%)")}})})}var o=t(49322),x=t(95805),m=t(31047),h=t(70525),u=t(95252),f=t(53113),j=t(91723),p=t(41671),g=t(99388),b=t(17689),v=t(47625),N=t(21156),w=t(56940),y=t(97059),Z=t(62994),k=t(8147),O=t(54061),Y=t(75169),A=t(3574),C=t(20407),z=t(77031),M=t(31699);function _(){let{data:e,isLoading:s}=(0,r.a)({queryKey:["dashboard-stats"],queryFn:async()=>{let e=await fetch("/api/admin/stats");if(!e.ok)throw Error("Failed to fetch stats");return e.json()},refetchInterval:3e4});if(s)return(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:Array.from({length:8}).map((e,s)=>(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)(n.Ol,{className:"animate-pulse",children:(0,a.jsx)("div",{className:"h-4 bg-gray-200 rounded w-3/4"})}),(0,a.jsx)(n.aY,{className:"animate-pulse",children:(0,a.jsx)("div",{className:"h-8 bg-gray-200 rounded w-1/2"})})]},s))});if(!e)return(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)(o.Z,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"Failed to load dashboard statistics"})]});let t=e.appointments.thisMonth>0?(e.appointments.thisMonth-e.appointments.lastMonth)/e.appointments.lastMonth*100:0,i=e.artists.total>0?e.artists.active/e.artists.total*100:0;return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Total Artists"}),(0,a.jsx)(x.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)(n.aY,{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:e.artists.total}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{children:[e.artists.active," active"]}),(0,a.jsx)(c,{value:i,className:"w-16 h-1"})]})]})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Total Appointments"}),(0,a.jsx)(m.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)(n.aY,{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:e.appointments.total}),(0,a.jsxs)("div",{className:"flex items-center space-x-1 text-xs",children:[(0,a.jsx)(h.Z,{className:"h-3 w-3 ".concat(t>=0?"text-green-500":"text-red-500")}),(0,a.jsxs)("span",{className:t>=0?"text-green-500":"text-red-500",children:[t>=0?"+":"",t.toFixed(1),"%"]}),(0,a.jsx)("span",{className:"text-muted-foreground",children:"from last month"})]})]})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Monthly Revenue"}),(0,a.jsx)(u.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)(n.aY,{children:[(0,a.jsxs)("div",{className:"text-2xl font-bold",children:["$",e.appointments.revenue.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["From ",e.appointments.thisMonth," appointments this month"]})]})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Portfolio Images"}),(0,a.jsx)(f.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)(n.aY,{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:e.portfolio.totalImages}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.portfolio.recentUploads," uploaded this week"]})]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4",children:[(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Pending"}),(0,a.jsx)(j.Z,{className:"h-4 w-4 text-yellow-500"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("div",{className:"text-2xl font-bold text-yellow-600",children:e.appointments.pending})})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Confirmed"}),(0,a.jsx)(p.Z,{className:"h-4 w-4 text-blue-500"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("div",{className:"text-2xl font-bold text-blue-600",children:e.appointments.confirmed})})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"In Progress"}),(0,a.jsx)(o.Z,{className:"h-4 w-4 text-green-500"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("div",{className:"text-2xl font-bold text-green-600",children:e.appointments.inProgress})})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Completed"}),(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-500"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("div",{className:"text-2xl font-bold text-gray-600",children:e.appointments.completed})})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Cancelled"}),(0,a.jsx)(g.Z,{className:"h-4 w-4 text-red-500"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("div",{className:"text-2xl font-bold text-red-600",children:e.appointments.cancelled})})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)(n.Ol,{children:(0,a.jsx)(n.ll,{children:"Monthly Appointments"})}),(0,a.jsx)(n.aY,{children:(0,a.jsx)(v.h,{width:"100%",height:300,children:(0,a.jsxs)(N.w,{data:e.monthlyData,children:[(0,a.jsx)(w.q,{strokeDasharray:"3 3"}),(0,a.jsx)(y.K,{dataKey:"month"}),(0,a.jsx)(Z.B,{}),(0,a.jsx)(k.u,{}),(0,a.jsx)(O.x,{type:"monotone",dataKey:"appointments",stroke:"#3b82f6",strokeWidth:2,dot:{fill:"#3b82f6"}})]})})})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)(n.Ol,{children:(0,a.jsx)(n.ll,{children:"Appointment Status Distribution"})}),(0,a.jsx)(n.aY,{children:(0,a.jsx)(v.h,{width:"100%",height:300,children:(0,a.jsxs)(Y.u,{children:[(0,a.jsx)(A.b,{data:e.statusData,cx:"50%",cy:"50%",labelLine:!1,label:e=>{let{name:s,percent:t}=e;return"".concat(s," ").concat((100*t).toFixed(0),"%")},outerRadius:80,fill:"#8884d8",dataKey:"value",children:e.statusData.map((e,s)=>(0,a.jsx)(C.b,{fill:e.color},"cell-".concat(s)))}),(0,a.jsx)(k.u,{})]})})})]})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)(n.Ol,{children:(0,a.jsx)(n.ll,{children:"Monthly Revenue Trend"})}),(0,a.jsx)(n.aY,{children:(0,a.jsx)(v.h,{width:"100%",height:300,children:(0,a.jsxs)(z.v,{data:e.monthlyData,children:[(0,a.jsx)(w.q,{strokeDasharray:"3 3"}),(0,a.jsx)(y.K,{dataKey:"month"}),(0,a.jsx)(Z.B,{}),(0,a.jsx)(k.u,{formatter:e=>["$".concat(e),"Revenue"]}),(0,a.jsx)(M.$,{dataKey:"revenue",fill:"#10b981"})]})})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Total Files"}),(0,a.jsx)(b.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)(n.aY,{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:e.files.totalUploads}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.files.recentUploads," uploaded this week"]})]})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Storage Used"}),(0,a.jsx)(b.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)(n.aY,{children:[(0,a.jsxs)("div",{className:"text-2xl font-bold",children:[(e.files.totalSize/1048576).toFixed(1)," MB"]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Across all uploads"})]})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Active Artists"}),(0,a.jsx)(x.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)(n.aY,{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:e.artists.active}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{children:["of ",e.artists.total," total"]}),(0,a.jsxs)(l.C,{variant:"secondary",children:[i.toFixed(0),"%"]})]})]})]})]})]})}var F=t(62869),S=t(99397),D=t(98728),K=t(96215),P=t(27648);function U(){return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold",children:"Admin Dashboard"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"Welcome to United Tattoo Studio admin panel"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(P.default,{href:"/admin/artists/new",children:(0,a.jsxs)(F.z,{children:[(0,a.jsx)(S.Z,{className:"h-4 w-4 mr-2"}),"Add Artist"]})}),(0,a.jsx)(P.default,{href:"/admin/calendar",children:(0,a.jsxs)(F.z,{variant:"outline",children:[(0,a.jsx)(m.Z,{className:"h-4 w-4 mr-2"}),"Schedule"]})})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsx)(P.default,{href:"/admin/artists",children:(0,a.jsxs)(n.Zb,{className:"hover:shadow-md transition-shadow cursor-pointer",children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Manage Artists"}),(0,a.jsx)(x.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add, edit, and manage artist profiles and portfolios"})})]})}),(0,a.jsx)(P.default,{href:"/admin/calendar",children:(0,a.jsxs)(n.Zb,{className:"hover:shadow-md transition-shadow cursor-pointer",children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Appointments"}),(0,a.jsx)(m.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"View and manage studio appointments and scheduling"})})]})}),(0,a.jsx)(P.default,{href:"/admin/uploads",children:(0,a.jsxs)(n.Zb,{className:"hover:shadow-md transition-shadow cursor-pointer",children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"File Manager"}),(0,a.jsx)(b.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload and manage portfolio images and files"})})]})}),(0,a.jsx)(P.default,{href:"/admin/settings",children:(0,a.jsxs)(n.Zb,{className:"hover:shadow-md transition-shadow cursor-pointer",children:[(0,a.jsxs)(n.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Studio Settings"}),(0,a.jsx)(D.Z,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsx)(n.aY,{children:(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Configure studio information and preferences"})})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(K.Z,{className:"h-5 w-5"}),(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Analytics & Statistics"})]}),(0,a.jsx)(_,{})]}),(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)(n.Ol,{children:(0,a.jsx)(n.ll,{children:"Recent Activity"})}),(0,a.jsx)(n.aY,{children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between py-2 border-b",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,a.jsx)("span",{className:"text-sm",children:"New appointment scheduled"})]}),(0,a.jsx)(l.C,{variant:"secondary",children:"2 min ago"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between py-2 border-b",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,a.jsx)("span",{className:"text-sm",children:"Portfolio image uploaded"})]}),(0,a.jsx)(l.C,{variant:"secondary",children:"15 min ago"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between py-2 border-b",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-yellow-500 rounded-full"}),(0,a.jsx)("span",{className:"text-sm",children:"Artist profile updated"})]}),(0,a.jsx)(l.C,{variant:"secondary",children:"1 hour ago"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between py-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,a.jsx)("span",{className:"text-sm",children:"New client registered"})]}),(0,a.jsx)(l.C,{variant:"secondary",children:"3 hours ago"})]})]})})]})]})}},35974:function(e,s,t){"use strict";t.d(s,{C:function(){return d}});var a=t(57437);t(2265);var r=t(37053),n=t(90535),l=t(94508);let i=(0,n.j)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function d(e){let{className:s,variant:t,asChild:n=!1,...d}=e,c=n?r.g7:"span";return(0,a.jsx)(c,{"data-slot":"badge",className:(0,l.cn)(i({variant:t}),s),...d})}},62869:function(e,s,t){"use strict";t.d(s,{d:function(){return i},z:function(){return d}});var a=t(57437);t(2265);var r=t(37053),n=t(90535),l=t(94508);let i=(0,n.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function d(e){let{className:s,variant:t,size:n,asChild:d=!1,...c}=e,o=d?r.g7:"button";return(0,a.jsx)(o,{"data-slot":"button",className:(0,l.cn)(i({variant:t,size:n,className:s})),...c})}},66070:function(e,s,t){"use strict";t.d(s,{Ol:function(){return l},SZ:function(){return d},Zb:function(){return n},aY:function(){return c},eW:function(){return o},ll:function(){return i}});var a=t(57437);t(2265);var r=t(94508);function n(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,r.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",s),...t})}function l(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,r.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",s),...t})}function i(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("leading-none font-semibold",s),...t})}function d(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,r.cn)("text-muted-foreground text-sm",s),...t})}function c(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-6",s),...t})}function o(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"card-footer",className:(0,r.cn)("flex items-center px-6 [.border-t]:pt-6",s),...t})}},94508:function(e,s,t){"use strict";t.d(s,{cn:function(){return n}});var a=t(61994),r=t(53335);function n(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return(0,r.m6)((0,a.W)(s))}}},function(e){e.O(0,[6137,9480,9763,8115,1061,2971,2117,1744],function(){return e(e.s=64633)}),_N_E=e.O()}]); |