import{j as u,T as C,d as g,I as F,b as H}from"./mui-vendor-CkIVaoQP.js";import{G as t,S as o,dG as v,dH as y,dF as N,X as s,dJ as B,dK as V,dI as x,dD as z,dE as k,dC as L,c0 as Y,c1 as b,b$ as j,dR as K,dS as Q,dQ as m,dy as $,dz as G,dB as q,dA as M,dX as R,dY as l,dZ as c,af as w,d_ as J,d$ as Z,e0 as W,e1 as uu,e2 as eu,e3 as su}from"./index-Cr86_nOs.js";import{S as ru}from"./SlaughterActiveRequests-BvIFy16T.js";import{B as tu}from"./BackButton-7Uc4b2uz.js";import{N as n}from"./NavLink-D2GD_ItM.js";import{L as i}from"./LinkItem-Tk56BMy7.js";import{V as _,e as nu,b as iu,f as ou}from"./index.esm-CjWvmHks.js";import{I as Eu}from"./index.esm-fCjAhNPc.js";import{f as S,u as au,r as A}from"./react-vendor-CmFgShSM.js";import{d as _u}from"./Visibility-DGGnwazK.js";import{u as Au,f as Cu}from"./redux-vendor-B7uoacJt.js";import{R as Ru}from"./ResponsiveTable-Dua7tTwQ.js";import"./AdvancedTable-BvRVoK6m.js";import"./index-IuzvFnSU.js";import"./Close-C8iZ2Qr6.js";import"./Search-DLgMQCPC.js";import"./Delete-CTUmuli-.js";import"./Plagiarism-DvlRWu4f.js";import"./iconBase-BEJYyZsk.js";import"./FilterAlt-RwhTl5ac.js";import"./styled-components.browser.esm-gS9mh05b.js";const lu=()=>{const{pathname:e}=S();return u.jsxs(t,{container:!0,gap:o.SMALL,p:o.SMALL,direction:{xs:"column",md:"row"},justifyContent:"center",alignItems:"center",children:[u.jsx(n,{to:s()==="SuperAdmin"?v:s()==="AdminX"?y:N,active:e===N?"true":null,children:u.jsx(i,{icon:u.jsx(_,{size:30,color:"#244CCC"}),title:"خریداران"})}),(s()==="SuperAdmin"||s()==="AdminX")&&u.jsx(n,{to:s()==="SuperAdmin"?B:s()==="AdminX"?V:x,active:e===x?"true":null,children:u.jsx(i,{icon:u.jsx(_,{size:30,color:"#244CCC"}),title:"مجوز خرید"})}),u.jsx(n,{to:s()==="SuperAdmin"?z:s()==="AdminX"?k:L,active:e===L?"true":null,children:u.jsx(i,{icon:u.jsx(_,{size:30,color:"#244CCC"}),title:"دسترسی خودرو"})}),u.jsx(n,{to:s()==="SuperAdmin"?Y:s()==="AdminX"?b:j,active:e===j?"true":null,children:u.jsx(i,{icon:u.jsx(Eu,{size:30,color:"#244CCC"}),title:"مجوزهای توزیع"})}),u.jsx(n,{to:s()==="SuperAdmin"?K:s()==="AdminX"?Q:m,active:e===m?"true":null,children:u.jsx(i,{icon:u.jsx(_,{size:30,color:"#244CCC"}),title:"مجوز ثبت صنف به کشتارگاه ها"})}),(s()==="AdminX"||s()==="SuperAdmin")&&u.jsx(n,{to:s()==="SuperAdmin"?$:G,active:e===G?"true":null,children:u.jsx(i,{icon:u.jsx(nu,{size:30,color:"#244CCC"}),title:"پنل معاملاتی"})}),(s()==="AdminX"||s()==="SuperAdmin")&&u.jsx(n,{to:s()==="SuperAdmin"?q:M,active:e===M?"true":null,children:u.jsx(i,{icon:u.jsx(iu,{size:30,color:"#244CCC"}),title:"مدیریت توزیع"})}),(s()==="AdminX"||s()==="SuperAdmin")&&u.jsx(n,{to:s()==="SuperAdmin"?R:s()==="AdminX"?l:s()==="ProvinceOperator"?c:null,active:e===R||e===l||e===c?"true":null,children:u.jsx(i,{icon:u.jsx(ou,{size:30,color:"#244CCC"}),title:"پایش خریداران"})})]})};function cu(){const e=Au(),U=au(),{pathname:O}=S(),[P,f]=A.useState(),{slaughterGetKillerKillhouses:E}=Cu(a=>a.slaughterSlice),h=()=>O.split("/").filter(Boolean)[0]||"";return A.useEffect(()=>{e(w())},[e]),A.useEffect(()=>{const a=E==null?void 0:E.map((r,D)=>{var d,T,I,p;const X=h();return[D+1,r!=null&&r.killer?"کشتارکن":"کشتارگاه",u.jsx(t,{alignItems:"center",justifyContent:"center",children:u.jsx(C,{variant:"caption",children:r==null?void 0:r.name})},r.key),u.jsx(t,{container:!0,alignItems:"center",justifyContent:"center",children:u.jsxs(C,{variant:"caption",children:[(T=(d=r==null?void 0:r.killHouseOperator)==null?void 0:d.user)==null?void 0:T.fullname," (",(p=(I=r==null?void 0:r.killHouseOperator)==null?void 0:I.user)==null?void 0:p.mobile,")"]})},r.key),(r==null?void 0:r.uniqueIdentifier)&&u.jsx(g,{title:"مشاهده جزییات",children:u.jsx(F,{size:"small",color:"primary",onClick:()=>{U(`/${X}/poultries/${r.uniqueIdentifier}?from=KillHouse`)},children:u.jsx(_u,{fontSize:"small"})})},r.key)]});f(a)},[E,U,O]),u.jsx(t,{mt:o.SMALL,children:u.jsx(Ru,{paginated:!0,title:"خریداران",columns:["ردیف","ماهیت","نام واحد","نام و نام خانوادگی (تلفن)","مشاهده جزییات"],data:P})})}const Hu=()=>{const{pathname:e}=S();return u.jsx(u.Fragment,{children:u.jsx(H,{display:"flex",justifyContent:"center",children:u.jsxs(t,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:[e===J||e===Z||e===W?u.jsxs(t,{justifyContent:"center",my:o.MEDIUM,children:[u.jsx(t,{children:u.jsx(C,{variant:"h6",children:"مدیریت خریداران"})}),u.jsx(lu,{})]}):u.jsx(tu,{}),u.jsx(t,{container:!0,justifyContent:"space-between",gap:o.SMALL,children:u.jsxs(t,{xs:12,children:[(e===uu||e===eu||e===su)&&u.jsx(ru,{}),(e===c||e===R||e===l)&&u.jsx(cu,{})]})})]})})})};export{Hu as default};
