Files
Rasadyar_FrontEnd/build/assets/SlaughterAllocateToGuild-B14VMvtK.js

2 lines
18 KiB
JavaScript
Raw Permalink Normal View History

import{a as Zu,u as Uu}from"./redux-vendor-B7uoacJt.js";import{L as Hu,j as Vu,h as Tu,e8 as E,v as g,A as Xu,X as Ju,fF as Qu,c as Ku,M as ou,fI as Iu,b as gu,u as ue,G as T,W as ee,S as fu,N as Mu,C as te,fH as re}from"./index-Cr86_nOs.js";import{j as t,b as nu,ak as J,I as xu,c6 as se,b0 as ae,aJ as Pu,c7 as le,T as z,C as oe,a3 as X,al as Yu,ag as pu,ah as Au,ai as L,aj as $,aX as ne,aa as Ru,B as Nu}from"./mui-vendor-CkIVaoQP.js";import{r as l}from"./react-vendor-CmFgShSM.js";import{N as yu}from"./NumberFormatCustom-DwWPj40N.js";import{c as ie,s as ce,a as de}from"./slaughter-get-guilds-for-allocate-DTBMr0CE.js";import{I as he,f as Ce}from"./toBase64-CmPKyXM7.js";import{a as me}from"./province-policy-upload-image-DeEToUvt.js";import{L as bu}from"./LabelField-DYohZZRX.js";const je=Zu("SLAUGHTER_INVENTORY_FINAL_SUBMIT_SERVICE",async(y,{dispatch:x})=>{x(Hu());try{const{data:b,status:G}=await Vu.put("steward-allocation/0/",y);return x(Tu()),{data:b,status:G}}catch(b){return x(Tu()),{error:b.response.data.result}}}),ge=({onDateSelect:y,dayData:x={},selectedDate:b=null,label:G="انتخاب تاریخ",className:iu="",disableToday:cu=!1,maxGregorianDate:O=null,customDateFilter:D=null})=>{const[a,n]=l.useState(new E),[M,Q]=l.useState([]),[q,N]=l.useState(null),f=l.useRef(null),K=!!q,I=()=>{N(f.current)},Z=()=>{N(null)},uu=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],P=["ش","ی","د","س","چ","پ","ج"],eu=s=>x[s]||null,k=s=>{const c=s.format("YYYY/MM/DD");if(D)return D(s,c,x);const j=new E,Y=new E().subtract("day",2),w=new E().subtract("day",1),v=j.format("YYYY/MM/DD"),C=Y.format("YYYY/MM/DD"),m=w.format("YYYY/MM/DD"),S=cu?!1:c===v;let _=!1;if(O){const h=s.toDate?s.toDate():new Date;_=g(h).isAfter(g(O),"day")}const W=x[c]!==void 0&&(x[c].active===void 0||x[c].active===!0);return!_&&(S||c===C||c===m||W)};l.useEffect(()=>{(()=>{const c=[],j=a.year(),Y=a.month(),w=a.daysInMonth();let C=new E([j,Y,1]).day();C>=1&&C<=7&&(C=C-1),C=C%7;for(let m=0;m<C;m++)c.push(null);for(let m=1;m<=w;m++){const S=new E([j,Y,m]),_=new E,V=k(S),W=S.format("YYYY/MM/DD"),h=eu(W),au=V&&h&&h.value1===0;c.push({date:S,day:m,formattedDate:W,isToday:S.year()===_.year()&&S.month()===_.month()&&S.date()===_.date(),isEnabled:V,hasZeroValue:au})}Q(c)})()},[a,x]);const tu=s=>{s&&s.isEnabled&&!s.hasZeroValue&&y&&(y(s),Z())},ru=()=>{const s=new E([a.year(),a.month()+1,1]);n(s)},du=()=>{const s=new E([a.year(),a.month()-1,1]);n(s)},U=s=>b&&b===s,su=s=>s==null?"":s.toLocaleString("fa-IR"),hu=()=>{if(!b)return"";const s=M.find(c=>c&&c.formattedDate===b);return s?`${s.day.toLocaleString("fa-IR")} ${uu[s.date.month()-1]}`:b};return t.jsxs(nu,{className:iu,sx:{width:"100%"},children:[t.jsx(J,{ref:f,fullWidth:!0,value:hu(),onClick:I,label:G,placeholder:"انتخاب تاریخ...",size:"medium",InputProps:{readOnly:!0,startAdornment:t.jsx(xu,{size:"small",onClick:I,children:t.jsx(se,{fontSize:"small"})})},sx:{cursor:"pointer",width:"100%",fontSize:{xs:"13px",sm:"16px"}}}),t.jsx(ae,{open:K,anchorEl:q,onClose:Z,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:t.jsxs(Pu,{elevation:3,sx:{p:{xs:1,sm:2},borderRadius:3,backgroundColor:"#fff",maxWidth:500,width:"99%"},children:[t.jsxs(nu,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:{xs:1,sm:2},pb:{xs:1,sm:2},borderBottom:"2px solid #f0f0f0"},children:[t.jsx(xu,{onClick:du,size:"small",children:t.jsx(le,{})}),t.jsxs(z,{variant:"h6",sx:{fontWeight:"bold",color:"#333",fontSize:{xs:"16px",sm:"20px"}},children:[uu[a.month()-1]," ",a.year()]}),t.jsx(xu,{onClick:ru,size:"small",children:t.jsx(oe,{})})]}),t.jsx(X,{container:!0,spacing:{xs:.5,sm:1},sx:{mb:{xs:.5,sm:1}},children:P.map((s,c)=>t.jsx(X,{item:!0,xs:12/7.3,children:t.jsx(nu,{sx:{textAlign:"center",fontWeight:"bold",color:"#666",fontSize:{xs:"12px",sm:"14px"},py:{xs:.5,sm:1}},children:s})},c))}),t.jsx(X,{container:!0,spacing:{xs:.5,sm:1},children:M.map((s,c)=>{if(!s)return t.jsx(X,