Files
Rasadyar_FrontEnd/build/assets/PolicyCouncil-GDckcWjH.js

2 lines
4.4 KiB
JavaScript

import{j as t,b8 as C,b as x}from"./mui-vendor-D_SVL-Dx.js";import{L as A,j as d,h as l,e6 as O,G as _,e7 as m,e8 as E,S as I,dI as f,dF as j,dG as g,dH as P,e9 as T,ea as F,eb as N}from"./index-D80MdVQn.js";import{r as c,f as D}from"./react-vendor-CmFgShSM.js";import{a as S,u as h,f as p}from"./redux-vendor-CfkcHgWN.js";import{A as y}from"./AdvancedTable-DF_gMS-x.js";import{B as L}from"./BackButton-Dr-K0JXJ.js";import{R as H}from"./ResponsiveTable-bUYl0qDM.js";import"./index-Eu1ghc4Y.js";import"./Close-J1gH5PMD.js";import"./Search-TgPAjvS8.js";import"./Delete-CIwpNviU.js";import"./FilterAlt-DZsHj-WQ.js";import"./styled-components.browser.esm-gS9mh05b.js";const U=S("POLICY_CHANGE_KILLHOUSE_DIRECT_BUY_SERVICE",async(e,{dispatch:u})=>{try{u(A());const{data:r,status:a}=await d.put("allow_direct_buying/0/",e);return u(l()),{data:r,status:a}}catch(r){return u(l()),{error:r.response.data.result}}}),w=()=>{const e=h(),{provinceGetKillhouses:u}=p(o=>o.provinceSlice),[r,a]=c.useState();return c.useEffect(()=>{e(O())},[]),c.useEffect(()=>{const o=u==null?void 0:u.map(s=>[s.killHouse.name,t.jsx(C,{checked:s.allow,onChange:n=>{e(U({direct_buying_key:s.key,allow:n.target.checked})).then(i=>{e(O())})},name:"checked",color:"primary"},"kkk"),t.jsx(C,{checked:s.exportStatus,onChange:n=>{e(U({direct_buying_key:s.key,export_status:n.target.checked})).then(i=>{e(O())})},name:"checked",color:"primary"},"kkk")]);a(o)},[u]),t.jsxs(_,{container:!0,children:[t.jsx(L,{}),t.jsx(y,{name:"اجازه خرید مستقیم",columns:["کشتارگاه/کشتارکن","خرید مستقیم","صادرات"],data:r})]})},G=S("POLICY_CHANGE_KILLHOUSE_GUILDS_SERVICE",async(e,{dispatch:u})=>{try{u(A());const{data:r,status:a}=await d.put("allow_register_guilds/0/",e);return u(l()),{data:r,status:a}}catch(r){return u(l()),{error:r.response.data.result}}}),Y=()=>{const e=h(),{provinceGetKillhousesGuilds:u}=p(o=>o.provinceSlice),[r,a]=c.useState();return c.useEffect(()=>{e(m())},[]),c.useEffect(()=>{const o=u==null?void 0:u.map((s,n)=>{var i,k;return[(i=s.killHouse)==null?void 0:i.name,(k=s.killHouse)!=null&&k.killer?"کشتارکن":"کشتارگاه",t.jsx(C,{checked:s.allow,onChange:R=>{e(G({register_guilds_key:s.key,allow:R.target.checked})).then(V=>{e(m())})},name:"checked",color:"primary"},n)]});a(o)},[u]),t.jsxs(_,{container:!0,children:[t.jsx(L,{}),t.jsx(H,{paginated:!0,title:"دسترسی به اصناف",columns:["کشتارگاه/کشتارکن","ماهیت","دسترسی"],data:r,customColors:[{name:"ماهیت",color:"green"}]})]})},v=S("POLICY_CHANGE_POULTRY_CHOOSE_SLAUGHTER_SERVICE",async(e,{dispatch:u})=>{try{u(A());const{data:r,status:a}=await d.put("province_allow_poultry_choose_kill_house/0/",e);return u(l()),{data:r,status:a}}catch(r){return u(l()),{error:r.response.data.result}}}),b=()=>{const e=h(),{provinceGetPoultries:u}=p(o=>o.provinceSlice),[r,a]=c.useState();return c.useEffect(()=>{e(E())},[]),c.useEffect(()=>{const o=u==null?void 0:u.map(s=>[s.name,t.jsx(C,{checked:s.allowState,onChange:n=>{e(v({poultry_key:s.key,allow:n.target.checked})).then(()=>{e(E())})},name:"checked",color:"primary"},"kkk")]);a(o)},[u]),t.jsx(_,{container:!0,children:t.jsx(y,{name:"دسترسی مرغداران جهت انتخاب کشتارگاه",columns:["مرغدار","دسترسی"],data:r})})},K=S("POLICY_CHANGE_POULTRY_CHOOSE_SLAUGHTER_SERVICE",async(e,{dispatch:u})=>{try{u(A());const{data:r,status:a}=await d.put("province_allow_poultry_sell_free/0/",e);return u(l()),{data:r,status:a}}catch(r){return u(l()),{error:r.response.data.result}}}),B=()=>{const e=h(),{provinceGetPoultries:u}=p(o=>o.provinceSlice),[r,a]=c.useState();return c.useEffect(()=>{e(E())},[]),c.useEffect(()=>{const o=u==null?void 0:u.map(s=>[s.name,t.jsx(C,{checked:s.allowSellState,onChange:n=>{e(K({poultry_key:s.key,allow:n.target.checked})).then(i=>{e(E())})},name:"checked",color:"primary"},"kkk")]);a(o)},[u]),t.jsxs(_,{container:!0,children:[t.jsx(L,{}),t.jsx(y,{name:"دسترسی مرغداران جهت فروش آزاد",columns:["مرغدار","دسترسی"],data:r})]})},su=()=>{const{pathname:e}=D();return t.jsx(t.Fragment,{children:t.jsx(x,{display:"flex",justifyContent:"center",children:t.jsx(_,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:t.jsx(_,{container:!0,justifyContent:"space-between",gap:I.SMALL,children:t.jsxs(_,{mt:I.SMALL,xs:12,children:[e===f&&t.jsx(b,{}),(e===j||e===g||e===P)&&t.jsx(B,{}),t.jsx(w,{}),(e===T||e===F||e===N)&&t.jsx(Y,{})]})})})})})};export{su as default};