Files
Rasadyar_FrontEnd/build/assets/AcessDashboardV2-CBsNkeft.js

18 lines
26 KiB
JavaScript
Raw Normal View History

2026-02-09 09:53:38 +03:30
import{j as e,i as T0,b as g,T as w,ad as V0,bt as M0,af as L0,a5 as d,B as U0,aj as h0,ay as p0,az as C0,aA as f0,aM as A,d as X,I as Q,ct as N0,ap as Y,au as e0,cu as m0,cv as b0}from"./mui-vendor-D_SVL-Dx.js";import{r as f,u as P0,b as t0}from"./react-vendor-CmFgShSM.js";import{f as i0,u as K0}from"./redux-vendor-CfkcHgWN.js";import{iF as W0,iG as B0,iH as G0,iI as J0,f$ as Z0,iJ as $0,iK as q0,iL as X0,r as Q0,j as Y0,A as ee,g as te,iM as r0,iN as s0,iO as j0,iP as M,_ as R,iQ as re,iR as n0,iS as o0,iT as se,ic as u0,ad as a0,iU as ne,iV as oe}from"./index-D80MdVQn.js";import{d as y0}from"./Save-Dna-LSr8.js";const S0=o=>{switch(o){case"BarSquareProvinceJahad":return[{text:"دسترسی ها",icon:e.jsx(Z0,{}),route:W0,disabled:!0},{text:"بنک دارها",icon:e.jsx($0,{}),route:B0,disabled:!0},{text:"تراکنش ها",icon:e.jsx(q0,{}),route:G0},{text:"صنوف",icon:e.jsx(X0,{}),route:J0,disabled:!0}];default:return[]}},v0="dashboard_usage_stats",ue=()=>{try{const o=localStorage.getItem(v0);return o?JSON.parse(o):{}}catch(o){return console.error("Error reading usage stats:",o),{}}},ae=o=>{try{localStorage.setItem(v0,JSON.stringify(o))}catch(i){console.error("Error saving usage stats:",i)}},ie=(o,i)=>{const a=ue();a[o]||(a[o]={}),a[o][i]=(a[o][i]||0)+1,ae(a)},w0="dashboard_custom_order",A0=()=>{try{const o=localStorage.getItem(w0);return o?JSON.parse(o):{}}catch(o){return console.error("Error reading custom orders:",o),{}}},ce=o=>{try{localStorage.setItem(w0,JSON.stringify(o))}catch(i){console.error("Error saving custom orders:",i)}},le=o=>A0()[o]||null,de=(o,i)=>{const a=A0(),h=i.map(l=>l.route);a[o]=h,ce(a)},xe=(o,i)=>{if(!o||!Array.isArray(o))return o;const a=le(i);if(!a||a.length===0)return o;const h=[],l=[...o];for(const p of a){const j=l.findIndex(E=>E.route===p);j!==-1&&(h.push(l[j]),l.splice(j,1))}return h.push(...l),h},ge=(o,i,a)=>{const h=Array.from(o),[l]=h.splice(i,1);return h.splice(a,0,l),h};var c0={},he=T0;Object.defineProperty(c0,"__esModule",{value:!0});var L=c0.default=void 0,pe=he(Q0()),Ce=e;L=c0.default=(0,pe.default)((0,Ce.jsx)("path",{d:"M20 6h-8l-2-2H6.83l14.93 14.93c.15-.28.24-.59.24-.93V8c0-1.1-.9-2-2-2M2.1 2.1.69 3.51l1.56 1.56c-.15.28-.24.59-.24.93L2 18c0 1.1.9 2 2 2h13.17l3.31 3.31 1.41-1.41z"}),"FolderOff");const fe=async()=>{const{data:o}=await Y0.get("kill-house-lock-info/");return o},me="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_9445_66010)'%3e%3cpath%20d='M7.99921%205.39452C9.08338%205.39452%209.9992%205.94413%209.9992%206.59452H10.7992C10.7992%205.5705%209.77244%204.75117%208.39921%204.61601V3.39453H7.59921V4.61601C6.22617%204.75117%205.19922%205.5705%205.19922%206.59452C5.19922%207.71444%206.42929%208.59451%207.99921%208.59451C9.08338%208.59451%209.9992%209.14412%209.9992%209.79451C9.9992%2010.4449%209.08338%2010.9945%207.99921%2010.9945C6.91523%2010.9945%205.99922%2010.4449%205.99922%209.79451H5.19922C5.19922%2010.8183%206.22617%2011.6377%207.59921%2011.7728V12.9945H8.39921V11.7728C9.77244%2011.6377%2010.7992%2010.8183%2010.7992%209.79451C10.7992%208.67439%209.56932%207.79451%207.99921%207.79451C6.91523%207.79451%205.99922%207.24491%205.99922%206.59452C5.99922%205.94413%206.91523%205.39452%207.99921%205.39452Z'%20fill='%23353535'/%3e%3cpath%20d='M22.4007%2011.0346V8.99477C22.4052%207.21196%2021.4936%205.55181%2019.987%204.5985C18.4806%203.64518%2016.5901%203.53229%2014.9808%204.29948C13.0818%200.897731%209.00794%20-0.64074%205.33432%200.656911C1.6609%201.95437%20-0.542999%205.71041%200.115983%209.55004C0.774965%2013.3899%204.10484%2016.1961%208.00072%2016.1947C8.81536%2016.1942%209.62493%2016.0676%2010.4007%2015.8199V21.7947C10.4021%2022.8986%2011.2968%2023.7933%2012.4007%2023.7947H22.0007C23.1048%2023.7933%2023.9995%2022.8986%2024.0007%2021.7947V12.9948C23.9995%2012.0446%2023.3313%2011.226%2022.4007%2011.0346ZM21.6007%208.99477V10.9948H20.8007V8.99477C20.8007%207.0065%2019.189%205.39478%2017.2007%205.39478C15.2126%205.39478%2013.6007%207.0065%2013.6007%2
@keyframes wiggle {
0% { transform: rotate(0deg); }
25% { transform: rotate(-1deg); }
50% { transform: rotate(1.5deg); }
75% { transform: rotate(-1.5deg); }
100% { transform: rotate(0deg); }
}
.wiggle-animation {
animation: wiggle 0.25s ease-in-out infinite;
}
.no-wiggle {
animation: none !important;
}
`}),e.jsxs(g,{sx:{backgroundColor:"#f9f9f9",minHeight:"auto",p:{xs:2,sm:3},borderRadius:"20px",width:"100%",maxWidth:{xs:"100%",sm:"100%"},overflowX:"hidden",position:"relative"},children:[e.jsxs(d,{container:!0,justifyContent:"space-between",alignItems:"center",mb:2,mt:2,gap:1,px:1,children:[e.jsxs(g,{display:"flex",alignItems:"center",gap:1,flexDirection:"row",children:[V.length>1&&e.jsxs(h0,{size:"small",sx:{width:{xs:150,sm:200},backgroundColor:"white",borderRadius:1,"& .MuiOutlinedInput-root":{height:{xs:"38px",lg:"48px"},backgroundColor:"white"}},children:[e.jsx(p0,{children:"نقش"}),e.jsx(C0,{value:l||"",label:"نقش",onChange:async s=>{const t=s.target.value;if(P(t),y(r0(t)),F([]),k(null),y(M([])),["Steward","KillHouse","Guilds"].includes(t)){v(!0);const r=(p==null?void 0:p.key)||(j==null?void 0:j.key);if(r&&t)try{await y(s0({userKey:r,role:t})).unwrap()}catch(C){console.error("Error fetching user role info:",C),v(!1),o({vertical:"top",horizontal:"center",msg:"خطا در دریافت اطلاعات نقش کاربر",severity:"error"})}else v(!1)}},renderValue:s=>R(s),children:V.map(s=>{const t=_0(s);return e.jsx(f0,{value:s,children:e.jsxs(g,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[e.jsx(w,{children:R(s)}),e.jsxs(w,{variant:"caption",sx:{color:"text.secondary",ml:1},children:["(",t,")"]})]})},s)})})]}),D.length>1&&e.jsxs(h0,{size:"small",sx:{width:{xs:150,sm:200},backgroundColor:"white",borderRadius:1,"& .MuiOutlinedInput-root":{height:{xs:"38px",lg:"48px"},backgroundColor:"white"}},children:[e.jsx(p0,{children:l==="Steward"?"مباشر":l==="Guilds"?"صنف":"کشتارگاه"}),e.jsx(C0,{value:(S==null?void 0:S.key)||"",label:"کاربر فرعی",onChange:I0,children:D.map(s=>e.jsx(f0,{value:s.key,children:s.unit},s.key))})]})]}),a&&a.includes("KillHouse")&&e.jsx(je,{})]}),e.jsx(d,{container:!0,justifyContent:"center",alignItems:"center",children:O0()})]})]});function z0(s=a){var c;const t=se(s);return K?q((t==null?void 0:t.length)||1):!t||t.length===0?e.jsx(d,{container:!0,justifyContent:"center",alignItems:"center",children:e.jsxs(A,{elevation:2,sx:{p:{xs:4,sm:6},borderRadius:"12px",backgroundColor:"#fff",boxShadow:"0 2px 6px rgba(0,0,0,0.1)",width:"100%",minHeight:{xs:"300px",sm:"400px"},display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:2},children:[e.jsx(L,{sx:{fontSize:{xs:"4rem",sm:"5rem"},color:"text.secondary"}}),e.jsx(w,{variant:"h6",color:"text.secondary",children:"هیچ دسترسی برای این نقش وجود ندارد"})]})}):e.jsx(d,{container:!0,spacing:{xs:1,sm:3},justifyContent:"center",children:(c=u0(t))==null?void 0:c.map((r,C)=>{var m;return e.jsx(d,{item:!0,xs:12,lg:(t==null?void 0:t.length)===1?12:6,children:e.jsxs(A,{elevation:2,sx:{p:{xs:1,sm:2},borderRadius:"12px",backgroundColor:"#fff",boxShadow:"0 2px 6px rgba(0,0,0,0.1)",position:"relative"},children:[e.jsx(g,{sx:{position:"relative"},children:e.jsx(X,{title:n[r]?"ذخیره ترتیب":"ویرایش و تغییر ترتیب کارت‌ها",children:e.jsx(Q,{onClick:()=>B(r,H(n0(r),r)),sx:{position:"absolute",top:2,right:0,zIndex:10,backgroundColor:n[r]?"success.main":"primary.main",color:"white","&:hover":{backgroundColor:n[r]?"success.dark":"primary.dark"},width:24,height:24},size:"small",children:n[r]?e.jsx(N0,{sx:{fontSize:"14px"}}):e.jsx(a0,{sx:{fontSize:"14px"}})})})}),e.jsx(Y,{sx:{mb:1.5},children:e.jsx(e0,{label:R(r),color:"primary",sx:{fontSize:"0.85rem",fontWeight:"bold",backgroundColor:"primary"}})}),e.jsx(d,{container:!0,spacing:{xs:2,sm:2},justifyContent:"center",pt:1,children:(m=H(n0(r),r))==null?void 0:m.map((b,x)=>e.jsx(d,{item:!0,xs:4,sm:3,md:3,lg:(t==null?void 0:t.length)===1?1.7:4,nlg:(t==null?void 0:t.length)===1?1.3:3,xl:(t==null?void 0:t.length)===1?1.2:3,nxl:(t==null?void 0:t.length)===1?1:2.3,xxl:(t==null?void 0:t.length)===1?1.15:2.3,xxxl:(t==null?void 0:t.length)===1?1:2.3,sx:{display:"flex",justifyContent:"center"},gap:5,children:e.jsxs(A,{elevation:2,draggable:n[r],className:n[r]&&U!==x?"wiggle-a