chore: add dist folder to .gitignore
- Remove dist/ from version control - Build artifacts should not be tracked in repository - Developers can generate fresh builds locally
This commit is contained in:
parent
a6e59b7c85
commit
e00eb4a160
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
# production
|
# production
|
||||||
/build
|
/build
|
||||||
|
/dist
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{j as a}from"./vendor-query-a3e439f2.js";import{C as s}from"./index-590deac5.js";import{R as r,B as t,b as e,X as o,Y as i,T as d,c as l}from"./vendor-charts-4c310516.js";const n=({data:n,title:c,color:x="#3b82f6"})=>a.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[c&&a.jsx(s,{className:"mb-3 sm:mb-4",children:c}),a.jsx("div",{className:"w-full",children:a.jsx(r,{width:"100%",height:250,minHeight:200,children:a.jsxs(t,{data:n,margin:{top:5,right:5,left:5,bottom:5},children:[a.jsx(e,{strokeDasharray:"3 3",className:"stroke-gray-300 dark:stroke-gray-600"}),a.jsx(o,{dataKey:"name",className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},interval:0,angle:-45,textAnchor:"end",height:60}),a.jsx(i,{className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},width:40}),a.jsx(d,{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:"12px"}}),a.jsx(l,{dataKey:"value",fill:x,radius:[2,2,0,0]})]})})})]});export{n as B};
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{u as s,f as a,r as t}from"./vendor-react-ac1483bd.js";import{h as r,L as n,P as i,F as o,d as c,B as d}from"./index-590deac5.js";import{I as l}from"./Input-dc2009a3.js";import{b as m,c as p,d as u}from"./_hooks-9d916060.js";import{z as x}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";import"./_requests-35c9d4c3.js";const j=()=>{const j=s(),{id:h}=a();r();const f=Boolean(h),[v,y]=t.useState({name:"",description:"",parent_id:null}),{data:g,isLoading:w}=m(h||"0",f),N=p(),b=u();t.useEffect(()=>{g&&f&&y({name:g.name||"",description:g.description||"",parent_id:g.parent_id||null})},[g,f]);const k=(e,s)=>{y(a=>({...a,[e]:s}))},_=()=>{j("/categories")};if(f&&w)return e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsx(n,{})});const C=e.jsxs(d,{variant:"secondary",onClick:_,className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-4 w-4"}),"بازگشت"]});return e.jsxs(i,{className:"max-w-2xl mx-auto",children:[e.jsx(o,{title:f?"ویرایش دستهبندی":"ایجاد دستهبندی جدید",subtitle:f?"ویرایش اطلاعات دستهبندی":"اطلاعات دستهبندی جدید را وارد کنید",backButton:C}),e.jsx("div",{className:"card p-4 sm:p-6",children:e.jsxs("form",{onSubmit:async e=>{e.preventDefault();try{f?await b.mutateAsync({id:parseInt(h),...v}):await N.mutateAsync(v)}catch(s){}},className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"name",children:"نام دستهبندی"}),e.jsx(l,{id:"name",type:"text",value:v.name,onChange:e=>k("name",e.target.value),placeholder:"نام دستهبندی را وارد کنید",required:!0})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"description",children:"توضیحات"}),e.jsx("textarea",{id:"description",value:v.description,onChange:e=>k("description",e.target.value),placeholder:"توضیحات دستهبندی",rows:4,className:"input resize-none"})]}),e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:justify-end sm:space-y-0 sm:space-x-3 sm:space-x-reverse pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(d,{type:"button",variant:"secondary",onClick:_,className:"w-full sm:w-auto",children:"انصراف"}),e.jsx(d,{type:"submit",loading:N.isPending||b.isPending,className:"w-full sm:w-auto",children:f?"ویرایش":"ایجاد"})]})]})})]})};export{j as default};
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{j as r}from"./vendor-query-a3e439f2.js";import{R as e}from"./vendor-react-ac1483bd.js";import{c as a}from"./vendor-ui-8a3c5c7d.js";import{d as s}from"./index-590deac5.js";const t=e.forwardRef(({label:e,error:t,helperText:d,inputSize:o="md",className:i,id:l,...x},n)=>{const c=a("w-full border rounded-lg transition-all duration-200 focus:outline-none focus:ring-2",{sm:"px-3 py-2 text-sm",md:"px-3 py-3 text-base",lg:"px-4 py-4 text-lg"}[o],t?"border-red-300 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-primary-500 focus:ring-primary-500","bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100","placeholder-gray-500 dark:placeholder-gray-400",i);return r.jsxs("div",{className:"space-y-1",children:[e&&r.jsx(s,{htmlFor:l,children:e}),r.jsx("input",{ref:n,id:l,className:c,...x}),d&&!t&&r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d}),t&&r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:t})]})});export{t as I};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{j as t}from"./vendor-query-a3e439f2.js";import{C as a}from"./index-590deac5.js";import{R as r,d as e,b as s,X as o,Y as i,T as d,e as n}from"./vendor-charts-4c310516.js";import"./vendor-react-ac1483bd.js";import"./vendor-toast-598db4db.js";import"./vendor-ui-8a3c5c7d.js";const c=({data:c,title:l,color:m="#10b981"})=>t.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[l&&t.jsx(a,{className:"mb-3 sm:mb-4",children:l}),t.jsx("div",{className:"w-full",children:t.jsx(r,{width:"100%",height:250,minHeight:200,children:t.jsxs(e,{data:c,margin:{top:5,right:5,left:5,bottom:5},children:[t.jsx(s,{strokeDasharray:"3 3",className:"stroke-gray-300 dark:stroke-gray-600"}),t.jsx(o,{dataKey:"name",className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},interval:0,angle:-45,textAnchor:"end",height:60}),t.jsx(i,{className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},width:40}),t.jsx(d,{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:"12px"}}),t.jsx(n,{type:"monotone",dataKey:"value",stroke:m,strokeWidth:2,dot:{r:3,strokeWidth:2},activeDot:{r:5}})]})})})]});export{c as LineChart};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{u as e,j as s}from"./vendor-query-a3e439f2.js";import{u as r,r as t,e as a}from"./vendor-react-ac1483bd.js";import{c as i,a as n,u as d}from"./vendor-forms-f89aa741.js";import{o}from"./yup-bff05cf1.js";import{u as m,B as l}from"./index-590deac5.js";import{I as c}from"./Input-dc2009a3.js";import{Q as x,p as u}from"./_requests-35c9d4c3.js";import{V as p}from"./vendor-toast-598db4db.js";import{i as g,h,E as j,j as y}from"./vendor-ui-8a3c5c7d.js";const f=i({username:n().required("نام کاربری الزامی است").min(3,"نام کاربری باید حداقل ۳ کاراکتر باشد"),password:n().required("رمز عبور الزامی است").min(6,"رمز عبور باید حداقل ۶ کاراکتر باشد")});i({name:n().required("نام الزامی است").min(2,"نام باید حداقل ۲ کاراکتر باشد"),email:n().required("ایمیل الزامی است").email("فرمت ایمیل صحیح نیست"),phone:n().required("شماره تلفن الزامی است").matches(/^09\d{9}$/,"شماره تلفن صحیح نیست"),role:n().required("نقش الزامی است"),password:n().optional().min(6,"رمز عبور باید حداقل ۶ کاراکتر باشد")}),i({siteName:n().required("نام سایت الزامی است"),siteDescription:n().required("توضیحات سایت الزامی است"),adminEmail:n().required("ایمیل مدیر الزامی است").email("فرمت ایمیل صحیح نیست"),language:n().required("زبان الزامی است")});const N=()=>{var i;const{isAuthenticated:n,isLoading:N,restoreSession:b}=m(),v=r(),[k,w]=t.useState(!1),[S,q]=t.useState(""),{mutate:_,isPending:I}=e({mutationKey:[x.ADMIN_LOGIN],mutationFn:e=>u(e),onSuccess:e=>{localStorage.setItem("admin_token",e.tokens.access_token),localStorage.setItem("admin_refresh_token",e.tokens.refresh_token),localStorage.setItem("admin_user",JSON.stringify(e.admin_user)),localStorage.setItem("admin_permissions",JSON.stringify(e.permissions)),p.success("ورود موفقیتآمیز بود")},onError:e=>{p.error((null==e?void 0:e.message)||"خطا در ورود")}}),{register:E,handleSubmit:O,formState:{errors:A,isValid:C}}=d({resolver:o(f),mode:"onChange"});if(N)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600 mx-auto"}),s.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"در حال بارگذاری..."})]})});if(n)return s.jsx(a,{to:"/",replace:!0});return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-md w-full space-y-8",children:[s.jsxs("div",{children:[s.jsx("div",{className:"mx-auto h-12 w-12 bg-primary-600 rounded-lg flex items-center justify-center",children:s.jsx(g,{className:"h-6 w-6 text-white"})}),s.jsx("h2",{className:"mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-gray-100",children:"ورود به پنل مدیریت"}),s.jsx("p",{className:"mt-2 text-center text-sm text-gray-600 dark:text-gray-400",children:"لطفا اطلاعات خود را وارد کنید"})]}),s.jsxs("form",{className:"mt-8 space-y-6",onSubmit:O(async e=>{q(""),_(e,{onSuccess:()=>{b(),v("/")},onError:()=>{q("نام کاربری یا رمز عبور اشتباه است")}})}),children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx(c,{label:"نام کاربری",type:"text",placeholder:"نام کاربری خود را وارد کنید",icon:h,error:null==(i=A.username)?void 0:i.message,...E("username")}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"رمز عبور"}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:s.jsx(g,{className:"h-5 w-5 text-gray-400"})}),s.jsx("input",{type:k?"text":"password",placeholder:"رمز عبور خود را وارد کنید",className:"input pr-10 pl-10 "+(A.password?"border-red-500 dark:border-red-500 focus:ring-red-500":""),...E("password")}),s.jsx("button",{type:"button",className:"absolute inset-y-0 left-0 pl-3 flex items-center",onClick:()=>w(!k),children:k?s.jsx(j,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"}):s.jsx(y,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"})})]}),A.password&&s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:A.password.message})]})]}),S&&s.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 px-4 py-3 rounded-lg text-sm",children:S}),s.jsx(l,{type:"submit",loading:I,disabled:!C,className:"w-full",children:"ورود"})]})]})})};export{N as Login};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{r as s}from"./vendor-react-ac1483bd.js";import{e as r}from"./index-590deac5.js";import{X as t}from"./vendor-ui-8a3c5c7d.js";const n=({isOpen:n,onClose:o,title:a,children:i,size:d="md",showCloseButton:l=!0,actions:c})=>{if(s.useEffect(()=>{const e=e=>{"Escape"===e.key&&o()};return n&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow="unset"}},[n,o]),!n)return null;return e.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:e.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:o}),e.jsxs("div",{className:`\n relative w-full ${{sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"}[d]} \n bg-white dark:bg-gray-800 rounded-lg shadow-xl \n transform transition-all\n `,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 sm:p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsx(r,{children:a}),l&&e.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:e.jsx(t,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"p-4 sm:p-6",children:i}),c&&e.jsx("div",{className:"flex flex-col space-y-2 sm:flex-row sm:justify-end sm:space-y-0 sm:space-x-3 sm:space-x-reverse p-4 sm:p-6 border-t border-gray-200 dark:border-gray-700",children:c})]})]})})};export{n as M};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{r}from"./vendor-react-ac1483bd.js";import{X as t,C as a}from"./vendor-ui-8a3c5c7d.js";const s=({options:s,selectedValues:n,onChange:i,placeholder:d="انتخاب کنید...",label:l,error:o,isLoading:c=!1,disabled:m=!1})=>{const[x,u]=r.useState(!1),[g,p]=r.useState(""),h=r.useRef(null),y=r.useRef(null),f=s.filter(e=>e.title.toLowerCase().includes(g.toLowerCase())||e.description&&e.description.toLowerCase().includes(g.toLowerCase())),v=s.filter(e=>n.includes(e.id));r.useEffect(()=>{const e=e=>{h.current&&!h.current.contains(e.target)&&(u(!1),p(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);return e.jsxs("div",{className:"relative",ref:h,children:[l&&e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l}),e.jsx("div",{className:`\n \n w-full min-h-[42px] px-3 py-2 border rounded-md \n focus-within:outline-none focus-within:ring-1 focus-within:ring-primary-500 \n cursor-pointer\n ${o?"border-red-500":"border-gray-300 dark:border-gray-600"}\n ${m?"bg-gray-100 cursor-not-allowed":"bg-white dark:bg-gray-700"}\n dark:text-gray-100\n `,onClick:()=>{m||(u(!x),x||setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.focus()},100))},children:e.jsxs("div",{className:"flex flex-wrap gap-1 items-center",children:[v.length>0?v.map(r=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary-100 text-primary-800 text-xs rounded-md",children:[r.title,e.jsx("button",{type:"button",onClick:e=>{var t;e.stopPropagation(),t=r.id,i(n.filter(e=>e!==t))},className:"hover:bg-primary-200 rounded-full p-0.5",disabled:m,children:e.jsx(t,{className:"h-3 w-3"})})]},r.id)):e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:d}),e.jsx("div",{className:"flex-1 min-w-[60px]",children:x&&!m&&e.jsx("input",{ref:y,type:"text",value:g,onChange:e=>p(e.target.value),className:"w-full border-none outline-none bg-transparent text-sm",placeholder:"جستجو..."})}),e.jsx(a,{className:"h-4 w-4 transition-transform "+(x?"rotate-180":"")})]})}),x&&!m&&e.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md shadow-lg max-h-60 overflow-auto",children:c?e.jsx("div",{className:"p-3 text-center text-gray-500 dark:text-gray-400",children:"در حال بارگذاری..."}):f.length>0?f.map(r=>e.jsx("div",{className:`\n px-3 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700\n ${n.includes(r.id)?"bg-primary-50 dark:bg-primary-900/80":""}\n `,onClick:()=>{return e=r.id,void(n.includes(e)?i(n.filter(r=>r!==e)):i([...n,e]));var e},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:r.title}),r.description&&e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:r.description})]}),n.includes(r.id)&&e.jsx("div",{className:"text-primary-600 dark:text-primary-400",children:"✓"})]})},r.id)):e.jsx("div",{className:"p-3 text-center text-gray-500 dark:text-gray-400",children:"موردی یافت نشد"})}),o&&e.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:o})]})};export{s as M};
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{B as r}from"./index-590deac5.js";import{w as a,e as s}from"./vendor-ui-8a3c5c7d.js";const t=({currentPage:t,totalPages:d,onPageChange:i,itemsPerPage:n,totalItems:l})=>{const o=(t-1)*n+1,m=Math.min(t*n,l);return d<=1?null:e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 sm:px-6",children:[e.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[e.jsx(r,{variant:"secondary",size:"sm",onClick:()=>i(t-1),disabled:1===t,children:"قبلی"}),e.jsx(r,{variant:"secondary",size:"sm",onClick:()=>i(t+1),disabled:t===d,children:"بعدی"})]}),e.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["نمایش ",e.jsx("span",{className:"font-medium",children:o})," تا"," ",e.jsx("span",{className:"font-medium",children:m})," از"," ",e.jsx("span",{className:"font-medium",children:l})," نتیجه"]})}),e.jsx("div",{children:e.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px",children:[e.jsx("button",{onClick:()=>i(t-1),disabled:1===t,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(a,{className:"h-5 w-5"})}),(()=>{const e=[];if(d<=5)for(let r=1;r<=d;r++)e.push(r);else{const r=Math.max(1,t-2),a=Math.min(d,r+5-1);for(let s=r;s<=a;s++)e.push(s);r>1&&(e.unshift("..."),e.unshift(1)),a<d&&(e.push("..."),e.push(d))}return e})().map((r,a)=>e.jsx("button",{onClick:()=>"number"==typeof r&&i(r),disabled:"..."===r,className:"relative inline-flex items-center px-4 py-2 border text-sm font-medium "+(r===t?"z-10 bg-primary-50 dark:bg-primary-900 border-primary-500 text-primary-600 dark:text-primary-400":"..."===r?"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-default":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600"),children:r},a)),e.jsx("button",{onClick:()=>i(t+1),disabled:t===d,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(s,{className:"h-5 w-5"})})]})})]})]})};export{t as P};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{u as s,f as r,r as i}from"./vendor-react-ac1483bd.js";import{c as t,a,u as o}from"./vendor-forms-f89aa741.js";import{o as d}from"./yup-bff05cf1.js";import{a as n,b as l,c}from"./_hooks-69d4323f.js";import{L as m,P as p,F as u,B as j,d as x}from"./index-590deac5.js";import{I as f}from"./Input-dc2009a3.js";import{z as g}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const b=t({title:a().required("عنوان الزامی است").min(3,"عنوان باید حداقل 3 کاراکتر باشد"),description:a().required("توضیحات الزامی است").min(10,"توضیحات باید حداقل 10 کاراکتر باشد")}),h=()=>{var t;const a=s(),{id:h}=r(),y=!!h,{data:v,isLoading:k}=n(h||"",y),{mutate:N,isPending:E}=l(),{mutate:S,isPending:w}=c(),_=E||w,{register:q,handleSubmit:A,formState:{errors:C,isValid:I},setValue:P}=o({resolver:d(b),mode:"onChange",defaultValues:{title:"",description:""}});i.useEffect(()=>{y&&v&&(P("title",v.title),P("description",v.description))},[y,v,P]);const D=()=>{a("/permissions")};return y&&k?e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsx(m,{})}):e.jsxs(p,{children:[e.jsx(u,{title:y?"ویرایش دسترسی":"ایجاد دسترسی جدید",subtitle:y?"ویرایش اطلاعات دسترسی":"اطلاعات دسترسی جدید را وارد کنید",backButton:e.jsxs(j,{variant:"secondary",onClick:D,className:"flex items-center gap-2",children:[e.jsx(g,{className:"h-4 w-4"}),"بازگشت"]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:e.jsxs("form",{onSubmit:A(e=>{y&&h?S({id:h,permissionData:{id:parseInt(h),title:e.title,description:e.description}},{onSuccess:()=>{a("/permissions")}}):N({title:e.title,description:e.description},{onSuccess:()=>{a("/permissions")}})}),className:"space-y-6",children:[e.jsx(f,{label:"عنوان دسترسی",...q("title"),error:null==(t=C.title)?void 0:t.message,placeholder:"مثال: CREATE_USER, DELETE_POST, MANAGE_ADMIN"}),e.jsxs("div",{children:[e.jsx(x,{htmlFor:"description",children:"توضیحات"}),e.jsx("textarea",{...q("description"),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"توضیح کاملی از این دسترسی ارائه دهید..."}),C.description&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:C.description.message})]}),e.jsxs("div",{className:"flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600",children:[e.jsx(j,{type:"button",variant:"secondary",onClick:D,disabled:_,children:"انصراف"}),e.jsx(j,{type:"submit",loading:_,disabled:!I,children:y?"بهروزرسانی":"ایجاد"})]})]})})]})};export{h as default};
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{L as s,B as a}from"./index-590deac5.js";import{b as r}from"./_hooks-653fd77f.js";import{u as t,f as d}from"./vendor-react-ac1483bd.js";import{z as l,n as i,G as c,I as m,t as x}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";import"./_requests-35c9d4c3.js";const n=()=>{var n;const g=t(),{id:o=""}=d(),{data:h,isLoading:j,error:N}=r(o);return j?e.jsx(s,{}):N?e.jsx("div",{className:"text-red-600",children:"خطا در بارگذاری اطلاعات نقش"}):h?e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(a,{variant:"secondary",onClick:()=>g("/roles"),className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-4 w-4"}),"بازگشت"]}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"جزئیات نقش"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(a,{variant:"primary",onClick:()=>g(`/roles/${o}/permissions`),className:"flex items-center gap-2",children:[e.jsx(i,{className:"h-4 w-4"}),"مدیریت دسترسیها"]}),e.jsxs(a,{variant:"secondary",onClick:()=>g(`/roles/${o}/edit`),className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-4 w-4"}),"ویرایش"]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-6",children:"اطلاعات نقش"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام نقش"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100 font-medium",children:h.title})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"توضیحات"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:h.description})})]})]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"آمار"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد دسترسیها"})]}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:(null==(n=h.permissions)?void 0:n.length)||0})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"اطلاعات زمانی"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(m,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تاریخ ایجاد"})]}),e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(h.created_at).toLocaleDateString("fa-IR")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(x,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"آخرین بهروزرسانی"})]}),e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(h.updated_at).toLocaleDateString("fa-IR")})]})]})]})]})]}),h.permissions&&h.permissions.length>0&&e.jsx("div",{className:"mt-6",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"دسترسیهای تخصیص یافته"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:h.permissions.map(s=>e.jsxs("div",{className:"p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:s.title}),e.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:s.description})]},s.id))})]})})]}):e.jsx("div",{children:"نقش یافت نشد"})};export{n as default};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{u as r,f as s,r as i}from"./vendor-react-ac1483bd.js";import{c as a,a as t,u as o}from"./vendor-forms-f89aa741.js";import{o as d}from"./yup-bff05cf1.js";import{b as n,c,d as l}from"./_hooks-653fd77f.js";import{L as m,P as p,F as u,B as x,d as j}from"./index-590deac5.js";import{I as f}from"./Input-dc2009a3.js";import{z as g}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const h=a({title:t().required("نام نقش الزامی است").min(2,"نام نقش باید حداقل ۲ کاراکتر باشد"),description:t().required("توضیحات الزامی است").min(5,"توضیحات باید حداقل ۵ کاراکتر باشد")}),y=()=>{var a;const t=r(),{id:y}=s(),b=!!y,{data:v,isLoading:N}=n(y||""),{mutate:k,isPending:w}=c(),{mutate:S,isPending:q}=l(),{register:C,handleSubmit:I,formState:{errors:P,isValid:z},reset:F}=o({resolver:d(h),mode:"onChange"});i.useEffect(()=>{b&&v&&F({title:v.title,description:v.description})},[b,v,F]);if(b&&N)return e.jsx(m,{});const L=w||q;return e.jsxs(p,{children:[e.jsx(u,{title:b?"ویرایش نقش":"ایجاد نقش جدید",actions:e.jsxs(x,{variant:"secondary",onClick:()=>t("/roles"),className:"flex items-center gap-2",children:[e.jsx(g,{className:"h-4 w-4"}),"بازگشت"]})}),e.jsx("div",{className:"max-w-2xl",children:e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:e.jsxs("form",{onSubmit:I(e=>{b&&y?S({id:parseInt(y),...e},{onSuccess:()=>{t("/roles")}}):k(e,{onSuccess:()=>{t("/roles")}})}),className:"space-y-6",children:[e.jsx(f,{label:"نام نقش",type:"text",placeholder:"نام نقش را وارد کنید",error:null==(a=P.title)?void 0:a.message,...C("title")}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(j,{htmlFor:"description",children:"توضیحات"}),e.jsx("textarea",{id:"description",placeholder:"توضیحات نقش را وارد کنید",className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 resize-none h-24 ${P.description?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600"} dark:bg-gray-700 dark:text-gray-100`,...C("description")}),P.description&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:P.description.message})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(x,{type:"button",variant:"secondary",onClick:()=>t("/roles"),children:"انصراف"}),e.jsx(x,{type:"submit",variant:"primary",loading:L,disabled:!z,children:b?"بهروزرسانی":"ایجاد"})]})]})})})]})};export{y as default};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{u as s,f as r,r as a}from"./vendor-react-ac1483bd.js";import{b as d,e as i,f as t,g as l,h as n}from"./_hooks-653fd77f.js";import{L as c,B as x}from"./index-590deac5.js";import{M as m}from"./Modal-8110908d.js";import{z as o,y as g,m as j}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const h=()=>{const h=s(),{id:p=""}=r();a.useState(!1);const[y,v]=a.useState(null),{data:N,isLoading:f}=d(p),{data:u,isLoading:b}=i(p),{data:k,isLoading:w}=t(),C=(u||[]).map(e=>e.id),S=(Array.isArray(null==k?void 0:k.permissions)?k.permissions:[]).filter(e=>!C.includes(e.id)),{mutate:I,isPending:L}=l(),{mutate:z,isPending:A}=n();return f||b?e.jsx(c,{}):N?e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(x,{variant:"secondary",onClick:()=>h("/roles"),className:"flex items-center gap-2",children:[e.jsx(o,{className:"h-4 w-4"}),"بازگشت"]}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:["مدیریت دسترسیهای نقش: ",null==N?void 0:N.title]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"تخصیص و حذف دسترسیها برای این نقش"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md",children:[e.jsx("div",{className:"p-6 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:["دسترسیهای تخصیص یافته (",(u||[]).length,")"]})}),e.jsx("div",{className:"p-6",children:b?e.jsx("div",{className:"flex justify-center",children:e.jsx(c,{})}):e.jsx("div",{className:"space-y-3",children:(u||[]).length>0?(u||[]).map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-green-900 dark:text-green-100",children:s.title}),e.jsx("p",{className:"text-sm text-green-700 dark:text-green-300",children:s.description})]}),e.jsxs(x,{size:"sm",variant:"danger",onClick:()=>{return e=s.id,void v(e.toString());var e},className:"flex items-center gap-1 ml-3",children:[e.jsx(g,{className:"h-3 w-3"}),"حذف"]})]},s.id)):e.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"هیچ دسترسی تخصیص داده نشده است"})})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md",children:[e.jsx("div",{className:"p-6 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:["دسترسیهای قابل تخصیص (",S.length,")"]})}),e.jsx("div",{className:"p-6",children:w?e.jsx("div",{className:"flex justify-center",children:e.jsx(c,{})}):e.jsx("div",{className:"space-y-3",children:S.length>0?S.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100",children:s.title}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]}),e.jsxs(x,{size:"sm",variant:"primary",onClick:()=>{return e=s.id,void I({roleId:p,permissionId:e.toString()});var e},className:"flex items-center gap-1 ml-3",loading:L,children:[e.jsx(j,{className:"h-3 w-3"}),"اختصاص"]})]},s.id)):e.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"تمام دسترسیها به این نقش تخصیص داده شده است"})})})]})]}),e.jsx(m,{isOpen:!!y,onClose:()=>v(null),title:"حذف دسترسی",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این دسترسی از نقش اطمینان دارید؟"}),e.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[e.jsx(x,{variant:"secondary",onClick:()=>v(null),disabled:A,children:"انصراف"}),e.jsx(x,{variant:"danger",onClick:()=>{y&&z({roleId:p,permissionId:y},{onSuccess:()=>{v(null)}})},loading:A,children:"حذف"})]})]})})]})}):e.jsx("div",{className:"text-red-600",children:"نقش یافت نشد"})};export{h as default};
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{j as e}from"./vendor-query-a3e439f2.js";import{r as a}from"./vendor-react-ac1483bd.js";import{c as s,s as r,C as d}from"./vendor-ui-8a3c5c7d.js";const c=({columns:c,data:i,loading:t=!1})=>{const[l,x]=a.useState(""),[n,m]=a.useState("asc"),y=[...i].sort((e,a)=>{if(!l)return 0;const s=e[l],r=a[l];return s<r?"asc"===n?-1:1:s>r?"asc"===n?1:-1:0});return t?e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs("div",{className:"card overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-3",children:e.jsx("div",{className:"flex space-x-4",children:c.map((a,s)=>e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded flex-1"},s))})}),[...Array(5)].map((a,s)=>e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"flex space-x-4",children:c.map((a,s)=>e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded flex-1"},s))})},s))]})}),e.jsx("div",{className:"md:hidden space-y-4",children:[...Array(3)].map((a,s)=>e.jsx("div",{className:"card p-4 space-y-3",children:c.map((a,s)=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"h-3 bg-gray-300 dark:bg-gray-600 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-2/3"})]},s))},s))})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block card overflow-hidden",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsx("tr",{children:c.map(a=>e.jsx("th",{className:s("px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",a.sortable&&"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600"),onClick:()=>{return a.sortable&&(e=a.key,void(l===e?m("asc"===n?"desc":"asc"):(x(e),m("asc"))));var e},children:e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx("span",{children:a.label}),a.sortable&&e.jsxs("div",{className:"flex flex-col",children:[e.jsx(r,{className:s("h-3 w-3",l===a.key&&"asc"===n?"text-primary-600":"text-gray-400")}),e.jsx(d,{className:s("h-3 w-3 -mt-1",l===a.key&&"desc"===n?"text-primary-600":"text-gray-400")})]})]})},a.key))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:y.map((a,s)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:c.map(s=>e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100 text-right",children:s.render?s.render(a[s.key],a):a[s.key]},s.key))},s))})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:y.map((a,s)=>e.jsx("div",{className:"card p-4 space-y-3",children:c.map(s=>e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("span",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[s.label,":"]}),e.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100 text-right",children:s.render?s.render(a[s.key],a):a[s.key]})]},s.key))},s))})]})};export{c as T};
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{h as a,A as t,a as e,d as r,b as s,c as o,Q as i}from"./_requests-35c9d4c3.js";import{b as n,c as u,u as c}from"./vendor-query-a3e439f2.js";import{V as d}from"./vendor-toast-598db4db.js";const p=a=>n({queryKey:[i.GET_PRODUCTS,a],queryFn:()=>(async a=>{try{const e={};(null==a?void 0:a.search)&&(e.search=a.search),(null==a?void 0:a.category_id)&&(e.category_id=a.category_id),(null==a?void 0:a.status)&&(e.status=a.status),(null==a?void 0:a.min_price)&&(e.min_price=a.min_price),(null==a?void 0:a.max_price)&&(e.max_price=a.max_price),(null==a?void 0:a.page)&&(e.page=a.page),(null==a?void 0:a.limit)&&(e.limit=a.limit);const s=await o(t(r.GET_PRODUCTS,e));return s.data&&s.data.products&&Array.isArray(s.data.products)?{products:s.data.products,total:s.data.total,page:s.data.page,per_page:s.data.per_page}:{products:[],total:0,page:1,per_page:10}}catch(e){return{products:[],total:0,page:1,per_page:10}}})(a)}),l=(a,e=!0)=>n({queryKey:[i.GET_PRODUCT,a],queryFn:()=>(async a=>(await o(t(r.GET_PRODUCT(a)))).data.product)(a),enabled:e&&!!a}),y=()=>{const e=u();return c({mutationKey:[i.CREATE_PRODUCT],mutationFn:e=>(async e=>(await a(t(r.CREATE_PRODUCT),e)).data.product)(e),onSuccess:()=>{e.invalidateQueries({queryKey:[i.GET_PRODUCTS]}),d.success("محصول با موفقیت ایجاد شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در ایجاد محصول")}})},T=()=>{const a=u();return c({mutationKey:[i.UPDATE_PRODUCT],mutationFn:a=>(async a=>(await e(t(r.UPDATE_PRODUCT(a.id.toString())),a)).data.product)(a),onSuccess:(t,e)=>{a.invalidateQueries({queryKey:[i.GET_PRODUCTS]}),a.invalidateQueries({queryKey:[i.GET_PRODUCT,e.id.toString()]}),d.success("محصول با موفقیت ویرایش شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در ویرایش محصول")}})},_=()=>{const a=u();return c({mutationKey:[i.DELETE_PRODUCT],mutationFn:a=>(async a=>(await s(t(r.DELETE_PRODUCT(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[i.GET_PRODUCTS]}),d.success("محصول با موفقیت حذف شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در حذف محصول")}})};export{_ as a,l as b,y as c,T as d,p as u};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{h as a,A as r,a as e,b as s,c as t,d as n,Q as o}from"./_requests-35c9d4c3.js";import{b as i,c as u,u as E}from"./vendor-query-a3e439f2.js";import{V as d}from"./vendor-toast-598db4db.js";const c=a=>i({queryKey:[o.GET_ROLES,a],queryFn:()=>(async a=>{try{const e={};(null==a?void 0:a.search)&&(e.search=a.search),(null==a?void 0:a.page)&&(e.page=a.page),(null==a?void 0:a.limit)&&(e.limit=a.limit);const s=await t(r(n.GET_ROLES,e));return s.data&&s.data.roles&&Array.isArray(s.data.roles)?s.data.roles:[]}catch(e){return[]}})(a)}),y=a=>i({queryKey:[o.GET_ROLE,a],queryFn:()=>(async a=>{try{const e=await t(r(n.GET_ROLE(a)));if(e.data&&e.data.role)return e.data.role;if(e.data)return e.data;throw new Error("No role data found in response")}catch(e){throw e}})(a),enabled:!!a}),l=()=>{const e=u();return E({mutationFn:e=>(async e=>(await a(r(n.CREATE_ROLE),e)).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:[o.GET_ROLES]}),d.success("نقش با موفقیت ایجاد شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در ایجاد نقش")}})},S=()=>{const a=u();return E({mutationFn:a=>(async(a,s)=>(await e(r(n.UPDATE_ROLE(a)),s)).data)(a.id.toString(),a),onSuccess:r=>{a.invalidateQueries({queryKey:[o.GET_ROLES]}),a.invalidateQueries({queryKey:[o.GET_ROLE,r.id.toString()]}),d.success("نقش با موفقیت بهروزرسانی شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در بهروزرسانی نقش")}})},R=()=>{const a=u();return E({mutationFn:a=>(async a=>(await s(r(n.DELETE_ROLE(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[o.GET_ROLES]}),d.success("نقش با موفقیت حذف شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در حذف نقش")}})},O=a=>i({queryKey:[o.GET_ROLE_PERMISSIONS,a],queryFn:()=>(async a=>{try{const e=await t(r(n.GET_ROLE_PERMISSIONS(a)));return e.data&&e.data.permissions&&Array.isArray(e.data.permissions)?e.data.permissions:[]}catch(e){return[]}})(a),enabled:!!a}),_=()=>{const e=u();return E({mutationFn:({roleId:e,permissionId:s})=>(async(e,s)=>(await a(r(n.ASSIGN_ROLE_PERMISSION(e,s)),{})).data)(e,s),onSuccess:(a,r)=>{e.invalidateQueries({queryKey:[o.GET_ROLE_PERMISSIONS,r.roleId]}),e.invalidateQueries({queryKey:[o.GET_ROLE,r.roleId]}),d.success("دسترسی با موفقیت اختصاص داده شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در اختصاص دسترسی")}})},I=()=>{const a=u();return E({mutationFn:({roleId:a,permissionId:e})=>(async(a,e)=>(await s(r(n.REMOVE_ROLE_PERMISSION(a,e)))).data)(a,e),onSuccess:(r,e)=>{a.invalidateQueries({queryKey:[o.GET_ROLE_PERMISSIONS,e.roleId]}),a.invalidateQueries({queryKey:[o.GET_ROLE,e.roleId]}),d.success("دسترسی با موفقیت حذف شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در حذف دسترسی")}})},m=()=>i({queryKey:[o.GET_PERMISSIONS],queryFn:()=>(async()=>(await t(r(n.GET_PERMISSIONS))).data)()});export{R as a,y as b,l as c,S as d,O as e,m as f,_ as g,I as h,c as u};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{h as r,A as a,d as e,a as s,c as t,Q as i}from"./_requests-35c9d4c3.js";import{b as n,c as o,u}from"./vendor-query-a3e439f2.js";import{V as c}from"./vendor-toast-598db4db.js";const E=r=>n({queryKey:[i.GET_PERMISSIONS,r],queryFn:()=>(async r=>{try{const s={};(null==r?void 0:r.search)&&(s.search=r.search),(null==r?void 0:r.page)&&(s.page=r.page),(null==r?void 0:r.limit)&&(s.limit=r.limit);const i=await t(a(e.GET_PERMISSIONS,s));return i.data&&i.data.permissions&&Array.isArray(i.data.permissions)?i.data.permissions:[]}catch(s){return[]}})(r)}),S=(r,s=!0)=>n({queryKey:[i.GET_PERMISSION,r],queryFn:()=>(async r=>{try{const s=await t(a(e.GET_PERMISSION(r)));if(s.data&&s.data.permission)return s.data.permission;throw new Error("Permission not found")}catch(s){throw s}})(r),enabled:s&&!!r}),d=()=>{const s=o();return u({mutationKey:[i.CREATE_PERMISSION],mutationFn:s=>(async s=>{try{const t=await r(a(e.CREATE_PERMISSION),s);if(t.data&&t.data.permission)return t.data.permission;throw new Error("Failed to create permission")}catch(t){throw t}})(s),onSuccess:r=>{s.invalidateQueries({queryKey:[i.GET_PERMISSIONS]}),s.invalidateQueries({queryKey:[i.GET_ROLE_PERMISSIONS]}),c.success("دسترسی با موفقیت ایجاد شد")},onError:r=>{c.error((null==r?void 0:r.message)||"خطا در ایجاد دسترسی")}})},y=()=>{const r=o();return u({mutationKey:[i.UPDATE_PERMISSION],mutationFn:({id:r,permissionData:t})=>(async(r,t)=>{try{const i=await s(a(e.UPDATE_PERMISSION(r)),t);if(i.data&&i.data.permission)return i.data.permission;throw new Error("Failed to update permission")}catch(i){throw i}})(r,t),onSuccess:(a,e)=>{r.invalidateQueries({queryKey:[i.GET_PERMISSIONS]}),r.invalidateQueries({queryKey:[i.GET_PERMISSION,e.id]}),r.invalidateQueries({queryKey:[i.GET_ROLE_PERMISSIONS]}),c.success("دسترسی با موفقیت بهروزرسانی شد")},onError:r=>{c.error((null==r?void 0:r.message)||"خطا در بهروزرسانی دسترسی")}})};export{S as a,d as b,y as c,E as u};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{h as a,A as t,a as r,d as s,b as e,c as o,Q as n}from"./_requests-35c9d4c3.js";import{b as i,c as u,u as O}from"./vendor-query-a3e439f2.js";import{V as T}from"./vendor-toast-598db4db.js";const c=a=>i({queryKey:[n.GET_PRODUCT_OPTIONS,a],queryFn:()=>(async a=>{try{const r={};(null==a?void 0:a.search)&&(r.search=a.search),(null==a?void 0:a.page)&&(r.page=a.page),(null==a?void 0:a.limit)&&(r.limit=a.limit);const e=await o(t(s.GET_PRODUCT_OPTIONS,r));return e.data&&e.data.product_options&&Array.isArray(e.data.product_options)?e.data.product_options:[]}catch(r){return[]}})(a)}),_=(a,r=!0)=>i({queryKey:[n.GET_PRODUCT_OPTION,a],queryFn:()=>(async a=>(await o(t(s.GET_PRODUCT_OPTION(a)))).data.product_option)(a),enabled:r&&!!a}),d=()=>{const r=u();return O({mutationKey:[n.CREATE_PRODUCT_OPTION],mutationFn:r=>(async r=>(await a(t(s.CREATE_PRODUCT_OPTION),r)).data.product_option)(r),onSuccess:()=>{r.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTIONS]}),T.success("گزینه محصول با موفقیت ایجاد شد")},onError:a=>{T.error((null==a?void 0:a.message)||"خطا در ایجاد گزینه محصول")}})},P=()=>{const a=u();return O({mutationKey:[n.UPDATE_PRODUCT_OPTION],mutationFn:a=>(async a=>(await r(t(s.UPDATE_PRODUCT_OPTION(a.id.toString())),a)).data.product_option)(a),onSuccess:(t,r)=>{a.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTIONS]}),a.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTION,r.id.toString()]}),T.success("گزینه محصول با موفقیت ویرایش شد")},onError:a=>{T.error((null==a?void 0:a.message)||"خطا در ویرایش گزینه محصول")}})},y=()=>{const a=u();return O({mutationKey:[n.DELETE_PRODUCT_OPTION],mutationFn:a=>(async a=>(await e(t(s.DELETE_PRODUCT_OPTION(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTIONS]}),T.success("گزینه محصول با موفقیت حذف شد")},onError:a=>{T.error((null==a?void 0:a.message)||"خطا در حذف گزینه محصول")}})};export{y as a,_ as b,d as c,P as d,c as u};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{h as a,A as e,a as r,d as s,b as t,c as o,Q as i}from"./_requests-35c9d4c3.js";import{b as n,c as E,u as c}from"./vendor-query-a3e439f2.js";import{V as u}from"./vendor-toast-598db4db.js";import{u as y}from"./vendor-react-ac1483bd.js";const T=a=>n({queryKey:[i.GET_CATEGORIES,a],queryFn:()=>(async a=>{try{const r={};(null==a?void 0:a.search)&&(r.search=a.search),(null==a?void 0:a.page)&&(r.page=a.page),(null==a?void 0:a.limit)&&(r.limit=a.limit);const t=await o(e(s.GET_CATEGORIES,r));return t.data&&t.data.categories&&Array.isArray(t.data.categories)?t.data.categories:[]}catch(r){return[]}})(a)}),d=(a,r=!0)=>n({queryKey:[i.GET_CATEGORY,a],queryFn:()=>(async a=>(await o(e(s.GET_CATEGORY(a)))).data.category)(a),enabled:r&&!!a}),G=()=>{const r=E(),t=y();return c({mutationKey:[i.CREATE_CATEGORY],mutationFn:r=>(async r=>(await a(e(s.CREATE_CATEGORY),r)).data.category)(r),onSuccess:()=>{r.invalidateQueries({queryKey:[i.GET_CATEGORIES]}),u.success("دستهبندی با موفقیت ایجاد شد"),t("/categories")},onError:a=>{u.error((null==a?void 0:a.message)||"خطا در ایجاد دستهبندی")}})},A=()=>{const a=E(),t=y();return c({mutationKey:[i.UPDATE_CATEGORY],mutationFn:a=>(async a=>(await r(e(s.UPDATE_CATEGORY(a.id.toString())),a)).data.category)(a),onSuccess:(e,r)=>{a.invalidateQueries({queryKey:[i.GET_CATEGORIES]}),a.invalidateQueries({queryKey:[i.GET_CATEGORY,r.id.toString()]}),u.success("دستهبندی با موفقیت ویرایش شد"),t("/categories")},onError:a=>{u.error((null==a?void 0:a.message)||"خطا در ویرایش دستهبندی")}})},l=()=>{const a=E();return c({mutationKey:[i.DELETE_CATEGORY],mutationFn:a=>(async a=>(await t(e(s.DELETE_CATEGORY(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[i.GET_CATEGORIES]}),u.success("دستهبندی با موفقیت حذف شد")},onError:a=>{u.error((null==a?void 0:a.message)||"خطا در حذف دستهبندی")}})};export{l as a,d as b,G as c,A as d,T as u};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
import{h as a,A as r,d as t,a as e,b as s,c as u,Q as n}from"./_requests-35c9d4c3.js";import{b as i,c as d,u as o}from"./vendor-query-a3e439f2.js";import{V as c}from"./vendor-toast-598db4db.js";const E=a=>i({queryKey:[n.GET_ADMIN_USERS,a],queryFn:()=>(async a=>{try{const e={};(null==a?void 0:a.search)&&(e.search=a.search),(null==a?void 0:a.status)&&(e.status=a.status),(null==a?void 0:a.page)&&(e.page=a.page),(null==a?void 0:a.limit)&&(e.limit=a.limit);const s=r(t.GET_ADMIN_USERS,e),n=await u(s);return n.data&&n.data.admin_users?Array.isArray(n.data.admin_users)?n.data.admin_users:[]:n.data&&n.data.users?Array.isArray(n.data.users)?n.data.users:[]:n.data&&Array.isArray(n.data)?n.data:[]}catch(e){return[]}})(a)}),_=(a,e=!0)=>i({queryKey:[n.GET_ADMIN_USER,a],queryFn:()=>(async a=>{try{const e=await u(r(t.GET_ADMIN_USER(a)));if(e.data&&e.data.admin_user)return e.data.admin_user;if(e.data&&e.data.user)return e.data.user;throw new Error("Failed to get admin user")}catch(e){throw e}})(a),enabled:e&&!!a}),y=()=>{const e=d();return o({mutationKey:[n.CREATE_ADMIN_USER],mutationFn:e=>(async e=>{try{const s=await a(r(t.CREATE_ADMIN_USER),e);if(s.data&&s.data.admin_user)return s.data.admin_user;if(s.data&&s.data.user)return s.data.user;throw new Error("Failed to create admin user")}catch(s){throw s}})(e),onSuccess:a=>{e.invalidateQueries({queryKey:[n.GET_ADMIN_USERS]}),c.success("کاربر ادمین با موفقیت ایجاد شد")},onError:a=>{c.error((null==a?void 0:a.message)||"خطا در ایجاد کاربر ادمین")}})},m=()=>{const a=d();return o({mutationKey:[n.UPDATE_ADMIN_USER],mutationFn:({id:a,userData:s})=>(async(a,s)=>{try{const u=await e(r(t.UPDATE_ADMIN_USER(a)),s);if(u.data&&u.data.admin_user)return u.data.admin_user;if(u.data&&u.data.user)return u.data.user;throw new Error("Failed to update admin user")}catch(u){throw u}})(a,s),onSuccess:(r,t)=>{a.invalidateQueries({queryKey:[n.GET_ADMIN_USERS]}),a.invalidateQueries({queryKey:[n.GET_ADMIN_USER,t.id]}),c.success("کاربر ادمین با موفقیت بهروزرسانی شد")},onError:a=>{c.error((null==a?void 0:a.message)||"خطا در بهروزرسانی کاربر ادمین")}})},l=()=>{const a=d();return o({mutationKey:[n.DELETE_ADMIN_USER],mutationFn:a=>(async a=>{try{return(await s(r(t.DELETE_ADMIN_USER(a)))).data}catch(e){throw e}})(a),onSuccess:()=>{a.invalidateQueries({queryKey:[n.GET_ADMIN_USERS]}),c.success("کاربر ادمین با موفقیت حذف شد")},onError:a=>{c.error((null==a?void 0:a.message)||"خطا در حذف کاربر ادمین")}})};export{l as a,_ as b,y as c,m as d,E as u};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
const o=0,s=1,t=2,a=3,c={[o]:"محصول ساده",[s]:"محصول متغیر",[t]:"محصول گروهی",[a]:"محصول خارجی"};export{c as P};
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
import{o as e,s as t,g as r}from"./vendor-forms-f89aa741.js";function n(n,a,o){return void 0===o&&(o={}),function(s,i,c){try{return Promise.resolve(function(t,r){try{var u=(null!=a&&a.context,Promise.resolve(n["sync"===o.mode?"validateSync":"validate"](s,Object.assign({abortEarly:!1},a,{context:i}))).then(function(t){return c.shouldUseNativeValidation&&e({},c),{values:o.raw?Object.assign({},s):t,errors:{}}}))}catch(l){return r(l)}return u&&u.then?u.then(void 0,r):u}(0,function(e){if(!e.inner)throw e;return{values:{},errors:t((n=e,a=!c.shouldUseNativeValidation&&"all"===c.criteriaMode,(n.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),a){var n=e[t.path].types,o=n&&n[t.type];e[t.path]=r(t.path,a,e,t.type,o?[].concat(o,t.message):t.message)}return e},{})),c)};var n,a}))}catch(u){return Promise.reject(u)}}}export{n as o};
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="fa" dir="rtl">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>پنل مدیریت</title>
|
|
||||||
<script type="module" crossorigin src="/assets/index-590deac5.js"></script>
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/vendor-react-ac1483bd.js">
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/vendor-query-a3e439f2.js">
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/vendor-toast-598db4db.js">
|
|
||||||
<link rel="modulepreload" crossorigin href="/assets/vendor-ui-8a3c5c7d.js">
|
|
||||||
<link rel="stylesheet" href="/assets/index-268bb46f.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="root"></div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Loading…
Reference in New Issue