Files
Rasadyar_FrontEnd/build/assets/CityUserFile-CYGthkZG.js

2 lines
7.9 KiB
JavaScript

import{j as t,T as B,I as T,d as K,ai as X,b5 as Z,B as I,b as v}from"./mui-vendor-CkIVaoQP.js";import{L as V,e4 as U,h as $,Q as uu,N as S,G as r,S as d,i$ as au}from"./index-N50kY0pn.js";import{j as tu,u as eu,r as D,f as lu}from"./react-vendor-CmFgShSM.js";import{d as ru}from"./NavigateNext-BfYfqq00.js";import{u as su,f as ou}from"./redux-vendor-B7uoacJt.js";import{d as Y}from"./Edit-D7uewMTe.js";import{d as nu}from"./Info-DI6VvAD-.js";import{I as du,b as iu,a as Cu}from"./InspectorEditAviculture-CLqFukmj.js";import{S as N}from"./SimpleTable-CB4BAAR3.js";import{C as cu}from"./CitySubmitTenantForm-Cn1iCmw-.js";import"./city-get-city-CgKsRB3e.js";import"./index-Cyn2oTqg.js";import"./Close-Cnq7tLoz.js";import"./Search-DJS_LN_I.js";import"./Delete-CiVJBR3T.js";const yu=()=>{var L;const{userid:E}=tu(),l=su(),Q=eu(),[z,J]=D.useState([]),{provinceUserInfo:u}=ou(a=>a.provinceSlice);return D.useEffect(()=>{l(V()),l(U(E)).then(()=>{l($())})},[]),D.useEffect(()=>{var C,c,y,A,m,h,b,x,p,P,j;const a=(C=u==null?void 0:u.profile.role)==null?void 0:C.map((o,n)=>{let e="";switch(o){case"ProvinceOperator":e="اپراتور تخصیص استان";break;case"CityOperator":e="اپراتور شهرستان";break;case"KillHouseVet":e="دامپزشک کشتارگاه";break;case"VetFarm":e="دامپزشک";break;case"Poultry":e="مرغدار";break;case"KillHouse":e="کشتارگاه";break;case"Vet":e="دامپزشک";break;case"ProvinceInspector":e="بازرس استان";break;case"ProvinceFinancial":e="اپراتور مالی";break;case"Driver":e="راننده";break;case"Admin":e="ادمین";break;default:e="کاربر پایه";break}return t.jsx("div",{children:e},n)}),s=((c=u==null?void 0:u.profile)==null?void 0:c.image)>5?t.jsx("a",{href:u==null?void 0:u.profile.image,children:t.jsx("img",{width:"80",height:"80",alt:"img",src:u==null?void 0:u.profile.image})}):"موجود نیست",w=[[(y=u==null?void 0:u.profile)!=null&&y.fullname?(A=u==null?void 0:u.profile)==null?void 0:A.fullname:((m=u==null?void 0:u.profile)==null?void 0:m.firstName)+" "+((h=u==null?void 0:u.profile)==null?void 0:h.lastName),a,(b=u==null?void 0:u.profile)==null?void 0:b.mobile,(x=u==null?void 0:u.profile)!=null&&x.birthday?uu(new Date((p=u==null?void 0:u.profile)==null?void 0:p.birthday),"yyyy/MM/dd"):"نامشخص",(P=u==null?void 0:u.profile)==null?void 0:P.city,t.jsx(B,{variant:"caption",children:(j=u==null?void 0:u.profile)==null?void 0:j.password},"password"),s,t.jsx(T,{"aria-label":"delete",color:"primary",className:"avicultureActiveRequestsBtn",onClick:()=>{var o,n,e,F,k,f,i,g;l(S({title:"ویرایش پروفایل کاربر",right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:t.jsx(du,{id:(o=u==null?void 0:u.profile)==null?void 0:o.key,birthday:(n=u==null?void 0:u.profile)==null?void 0:n.birthday,nationalCode:(e=u==null?void 0:u.profile)==null?void 0:e.nationalCode,nationalId:(F=u==null?void 0:u.profile)==null?void 0:F.nationalId,firstName:(k=u==null?void 0:u.profile)==null?void 0:k.firstName,lastName:(f=u==null?void 0:u.profile)==null?void 0:f.lastName,password:(i=u==null?void 0:u.profile)==null?void 0:i.password,phone:(g=u==null?void 0:u.profile)==null?void 0:g.mobile})}))},children:t.jsx(Y,{})},u)]];J(w)},[u]),t.jsxs(t.Fragment,{children:[t.jsx(r,{container:!0,alignItems:"center",mt:d.SMALL,children:t.jsxs(T,{"aria-label":"delete",color:"primary",onClick:()=>Q(-1),children:[t.jsx(ru,{}),t.jsx(B,{children:"بازگشت"})]})}),t.jsx(r,{container:!0,xs:12,alignItems:"start",gap:d.SMALL,direction:"column",children:t.jsx(r,{width:"100%",container:!0,alignItems:"center",justifyContent:"space-between",children:t.jsxs(r,{width:"100%",className:"second",children:[t.jsx(N,{name:"اطلاعات پایه کاربر",columns:["نام کامل","نوع کاربری","شمار تلفن","تاریخ تولد","شهر","کلمه عبور","تصویر پروفایل","ویرایش"],data:z}),(L=u==null?void 0:u.rolesData)==null?void 0:L.map((a,s)=>{var w,C,c,y,A,m,h,b,x,p,P,j,o,n,e,F,k,f;return Object.keys(a).includes("Poultry")?t.jsxs(t.Fragment,{children:[t.jsx(N,{name:"اطلاعات مرغدار",columns:["نام فارم","آدرس","استان","شهر","کد پستی","موبایل","شناسه یکتا","کد اقتصادی","کد اپیدمیولوژیک","تعداد سالن","ویرایش","وضعیت"],data:[[(w=a.Poultry)==null?void 0:w.unitName,(C=a.Poultry.address)==null?void 0:C.address,(y=(c=a.Poultry.address)==null?void 0:c.province)==null?void 0:y.name,(m=(A=a.Poultry.address)==null?void 0:A.city)==null?void 0:m.name,Number((h=a.Poultry.address)==null?void 0:h.postalCode),(b=a.Poultry.address)==null?void 0:b.phone,a.Poultry.breedingUniqueId,a.Poultry.economicCode,a.Poultry.epidemiologicalCode,a.Poultry.numberOfHalls,t.jsx(K,{title:"ویرایش کاربر",placement:"bottom-start",children:t.jsx(T,{"aria-label":"delete",color:"primary",className:"avicultureActiveRequestsBtn",onClick:()=>{var i,g,_,O,M,R,W,q,G,H;l(S({title:"ویرایش اطلاعات مرغدار",right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:t.jsx(iu,{farmName:(i=a.Poultry)==null?void 0:i.unitName,id:u==null?void 0:u.profile.key,type:"Poultry",uniqueId:(g=a.Poultry)==null?void 0:g.breedingUniqueId,address:(_=a.Poultry.address)==null?void 0:_.address,poultry:(O=a.Poultry)==null?void 0:O.key,halls:a.Poultry.numberOfHalls,postal:Number((M=a.Poultry.address)==null?void 0:M.postalCode),accountHolder:(R=a.Poultry.userBankInfo)==null?void 0:R.nameOfBankUser,card:(W=a.Poultry.userBankInfo)==null?void 0:W.card,shaba:(q=a.Poultry.userBankInfo)==null?void 0:q.shaba,account:(G=a.Poultry.userBankInfo)==null?void 0:G.account,name_of_bank_user:(H=a.Poultry.userBankInfo)==null?void 0:H.bankName})}))},children:t.jsx(Y,{})})},s),t.jsx(K,{title:a.Poultry.trash===!0?"فعالسازی کاربر":"غیر فعال کردن کاربر",placement:"bottom-start",children:t.jsx(X,{label:a.Poultry.trash===!0?"غیرفعال":" فعال",control:t.jsx(Z,{checked:!a.Poultry.trash,onClick:()=>{l(V()),l(Cu({type:a.Poultry.trash===!0?"Activate":"Deactivate",role_data_key:a.Poultry.key,role:"Poultry"})).then(i=>{l($()),window.location.reload(!1)})}})})},s)]]},s),t.jsx(N,{name:"اطلاعات بانکی مرغدار",expandable:!0,columns:["نام صاحب حساب","نام بانک","شماره حساب","شماره کارت","شماره شبا"],data:[[(x=a.Poultry.userBankInfo)==null?void 0:x.nameOfBankUser,(p=a.Poultry.userBankInfo)==null?void 0:p.bankName,Number((P=a.Poultry.userBankInfo)==null?void 0:P.account),Number((j=a.Poultry.userBankInfo)==null?void 0:j.card),(o=a.Poultry.userBankInfo)==null?void 0:o.shaba]]},s),Object.keys((n=a.Poultry)==null?void 0:n.poultryTenant).length>0?t.jsx(N,{name:"اطلاعات مستاجر مرغدار",expandable:!0,columns:["شناسه یکتا","نام کامل","تلفن همراه","کد ملی"],data:[[(e=a.Poultry.poultryTenant)==null?void 0:e.breedingUniqueId,(F=a.Poultry.poultryTenant)==null?void 0:F.fullName,(k=a.Poultry.poultryTenant)==null?void 0:k.mobile,(f=a.Poultry.poultryTenant)==null?void 0:f.nationalId]]},s):!a.Poultry.poultryOwner.length>0&&t.jsxs(r,{display:"flex",mt:d.MEDIUM,gap:d.SMALL,alignItems:"center",mb:d.MEDIUM,children:[t.jsxs(r,{display:"flex",gap:d.TINY,children:[t.jsx(nu,{color:"primary"}),t.jsx(B,{children:"مرغدار مستاجر ندارد"})]}),t.jsx(I,{variant:"outlined",onClick:()=>{l(S({right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,title:"ایجاد مستاجر جدید",content:t.jsx(cu,{id:a.Poultry.key,userid:E})}))},children:"افزودن مستاجر"})]})]}):null})]})})})]})},Bu=()=>{const{pathname:E}=lu();return t.jsx(t.Fragment,{children:t.jsx(v,{display:"flex",justifyContent:"center",children:t.jsx(r,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:t.jsx(r,{container:!0,justifyContent:"space-between",gap:d.SMALL,children:t.jsx(r,{xs:12,children:E.includes(au)&&t.jsx(yu,{})})})})})})};export{Bu as default};