2 lines
6.8 KiB
JavaScript
2 lines
6.8 KiB
JavaScript
import{j as e,_ as s}from"./vendor-query-a3e439f2.js";import{S as a,a as l,C as r,P as t,b as i,c as n,B as c}from"./index-590deac5.js";import{T as d,k as m,l as o,m as x,n as h,D as g,o as p}from"./vendor-ui-8a3c5c7d.js";import{B as j}from"./BarChart-2cf7731f.js";import{r as u}from"./vendor-react-ac1483bd.js";import{R as b,P as f,a as v,C as y,T as N,L as w}from"./vendor-charts-4c310516.js";import{T as k}from"./Table-2d8d22e8.js";import"./vendor-toast-598db4db.js";const C=({title:s,value:r,change:t,icon:i,color:n="blue"})=>{const c={blue:"bg-blue-500",green:"bg-green-500",yellow:"bg-yellow-500",red:"bg-red-500",purple:"bg-purple-500"},o=t&&t>0,x=t&&t<0;return e.jsx("div",{className:"card p-3 sm:p-4 lg:p-6 animate-fade-in",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:`p-2 sm:p-3 rounded-lg ${c[n]||c.blue}`,children:e.jsx(i,{className:"h-5 w-5 sm:h-6 sm:w-6 text-white"})})}),e.jsx("div",{className:"mr-3 sm:mr-5 w-0 flex-1 min-w-0",children:e.jsxs("dl",{children:[e.jsx(a,{className:"truncate",children:s}),e.jsxs("dd",{className:"flex items-baseline",children:[e.jsx(l,{className:"truncate",children:"number"==typeof r?r.toLocaleString():r}),void 0!==t&&e.jsxs("div",{className:"mr-1 sm:mr-2 flex items-baseline text-xs sm:text-sm font-semibold "+(o?"text-green-600":x?"text-red-600":"text-gray-500"),children:[o&&e.jsx(d,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0 self-center ml-1"}),x&&e.jsx(m,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0 self-center ml-1"}),e.jsx("span",{className:"sr-only",children:o?"افزایش":"کاهش"}),e.jsxs("span",{className:"truncate",children:[Math.abs(t),"%"]})]})]})]})})]})})},S=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6"],z=({data:s,title:a,colors:l=S})=>{const t=s=>{const{payload:a}=s;return e.jsx("div",{className:"flex flex-wrap justify-center gap-2 mt-3",children:a.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm",children:[e.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:s.color}}),e.jsxs("span",{className:"text-gray-700 dark:text-gray-300 whitespace-nowrap",children:[s.value,": ",s.payload.value]})]},a))})};return e.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[a&&e.jsx(r,{className:"mb-3 sm:mb-4 text-center",children:a}),e.jsx("div",{className:"w-full",children:e.jsx(b,{width:"100%",height:280,minHeight:220,children:e.jsxs(f,{children:[e.jsx(v,{data:s,cx:"50%",cy:"45%",labelLine:!1,label:!1,outerRadius:"65%",fill:"#8884d8",dataKey:"value",children:s.map((s,a)=>e.jsx(y,{fill:l[a%l.length]},`cell-${a}`))}),e.jsx(N,{contentStyle:{backgroundColor:"var(--toast-bg)",color:"var(--toast-color)",border:"none",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",fontSize:"14px"},formatter:(e,s)=>[`${e}`,s]}),e.jsx(w,{content:e.jsx(t,{}),wrapperStyle:{paddingTop:"10px"}})]})})})]})},A=u.lazy(()=>s(()=>import("./LineChart-c9934470.js"),["assets/LineChart-c9934470.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/index-590deac5.js","assets/vendor-toast-598db4db.js","assets/vendor-ui-8a3c5c7d.js","assets/index-268bb46f.css","assets/vendor-charts-4c310516.js"]).then(e=>({default:e.LineChart}))),L=[{title:"کل کاربران",value:1247,change:12,icon:h,color:"blue"},{title:"فروش ماهانه",value:"۲۴,۵۶۷,۰۰۰",change:8.5,icon:g,color:"green"},{title:"کل سفارشات",value:356,change:-2.3,icon:p,color:"yellow"},{title:"رشد فروش",value:"۲۳.۵%",change:15.2,icon:d,color:"purple"}],T=[{name:"فروردین",value:4e3},{name:"اردیبهشت",value:3e3},{name:"خرداد",value:5e3},{name:"تیر",value:4500},{name:"مرداد",value:6e3},{name:"شهریور",value:5500}],_=[{name:"دسکتاپ",value:45},{name:"موبایل",value:35},{name:"تبلت",value:20}],R=[{id:1,name:"علی احمدی",email:"ali@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۵"},{id:2,name:"فاطمه حسینی",email:"fateme@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۴"},{id:3,name:"محمد رضایی",email:"mohammad@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۱۳"},{id:4,name:"زهرا کریمی",email:"zahra@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۲"}],B=[{key:"name",label:"نام",sortable:!0},{key:"email",label:"ایمیل"},{key:"role",label:"نقش"},{key:"status",label:"وضعیت",render:s=>e.jsx("span",{className:"px-2 py-1 rounded-full text-xs font-medium "+("فعال"===s?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"),children:s})},{key:"createdAt",label:"تاریخ عضویت"},{key:"actions",label:"عملیات",render:()=>e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(c,{size:"sm",variant:"secondary",children:"ویرایش"}),e.jsx(n,{permission:22,children:e.jsx(c,{size:"sm",variant:"danger",children:"حذف"})})]})}],P=()=>e.jsxs(t,{children:[e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[e.jsx(i,{children:"داشبورد"}),e.jsxs("div",{className:"flex justify-start gap-3",children:[e.jsx("button",{className:"flex items-center justify-center w-12 h-12 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-full transition-colors duration-200 text-gray-600 dark:text-gray-300",title:"گزارشگیری",children:e.jsx(o,{className:"h-5 w-5"})}),e.jsx(n,{permission:25,children:e.jsx("button",{className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"اضافه کردن",children:e.jsx(x,{className:"h-5 w-5"})})})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4 lg:gap-6",children:L.map((s,a)=>e.jsx(C,{...s},a))}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 sm:gap-6",children:[e.jsx("div",{className:"min-w-0",children:e.jsx(j,{data:T,title:"فروش ماهانه",color:"#3b82f6"})}),e.jsx("div",{className:"min-w-0",children:e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"card p-6 animate-pulse bg-gray-100 dark:bg-gray-800 h-64"}),children:e.jsx(A,{data:T,title:"روند رشد",color:"#10b981"})})})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6",children:[e.jsx("div",{className:"xl:col-span-2 min-w-0",children:e.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[e.jsx(r,{className:"mb-3 sm:mb-4",children:"کاربران اخیر"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(k,{columns:B,data:R})})]})}),e.jsx("div",{className:"min-w-0",children:e.jsx(z,{data:_,title:"دستگاههای کاربری",colors:["#3b82f6","#10b981","#f59e0b"]})})]})]});export{P as Dashboard};
|