2 lines
6.1 KiB
JavaScript
2 lines
6.1 KiB
JavaScript
import{j as e,T as t,am as n,aL as g,aM as F,aN as f,ak as v,aa as E,B as S}from"./mui-vendor-CkIVaoQP.js";import{j as k,r as s}from"./react-vendor-CmFgShSM.js";import{L as w,j as P,h as _,u as D,c as T,b as L,G as r,l as N,k as B,O as G}from"./index-Cr86_nOs.js";import{N as O}from"./num2persian-BIYy8amq.js";import{a as W,u as M}from"./redux-vendor-B7uoacJt.js";import{S as R}from"./SlaughterPayFeesGateway-Y8nHlZfV.js";import{S as V}from"./SimpleTable-CWlU9uE0.js";import"./index-IuzvFnSU.js";import"./Close-C8iZ2Qr6.js";import"./Search-DLgMQCPC.js";import"./Delete-CTUmuli-.js";const $=W("WAGE_PAYMENT_GET_USER_INFO",async(i,{dispatch:l})=>{l(w());const{data:u,status:y}=await P.get(`https://${i.province}backend.rasadyar.com/get-payer-info/?${i.key}`);return l(_()),{data:u,status:y}}),uu=()=>{var m,h,p,b;const{key:i,province:l}=k(),[u,y]=s.useState(),x=M(),a=D({initialValues:{offer:0},validationSchema:T({offer:L().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!").min(2e5,"حداقل بیست هزار تومان وارد کنید")})});s.useEffect(()=>{i&&x($({province:l,key:`user_gate_way_id=${i}`})).then(o=>{var d,c;y(o.payload.data),((c=(d=o.payload)==null?void 0:d.data)==null?void 0:c.totalAmount)>2e9?a.setFieldValue("offer",2e9):a.setFieldValue("offer",parseInt(Math.ceil(o.payload.data.totalAmount/1e4)*1e4))})},[]),s.useEffect(()=>{a.validateForm()},[]);const[j,C]=s.useState([]);return s.useEffect(()=>{var o;if((u==null?void 0:u.role)==="Poultry"||(u==null?void 0:u.role)==="buyer"){const d=(o=u==null?void 0:u.orderCode)==null?void 0:o.map((c,A)=>[A+1,c]);C(d)}},[u]),e.jsx(r,{container:!0,justifyContent:"center",alignItems:"center",mt:2,children:e.jsxs(r,{xs:12,sm:8,md:4,style:{borderStyle:"solid",borderWidth:"1px",borderRadius:"30px",borderColor:"gray",boxShadow:"0px 5px 10px rgba(0, 0, 0, 0.1)",padding:"20px"},children:[e.jsx(r,{xs:12,children:e.jsx("img",{alt:"logo",src:N,style:{width:"100px",height:"100px",userSelect:"none"}})}),e.jsx(t,{variant:"body1",color:"primary",mb:1,children:"سامانه رصدیار"}),e.jsx(t,{variant:"body1",color:"secondary",mb:2,children:"پنل پرداخت تعرفه"}),e.jsx(n,{}),e.jsxs(r,{container:!0,justifyContent:"space-between",mt:2,mb:2,children:[e.jsx(t,{variant:"body1",color:"primary",children:"نام و نام خانوادگی:"}),e.jsxs(r,{children:[e.jsx(t,{variant:"body1",color:"gray",children:u==null?void 0:u.fullname}),e.jsx(n,{}),e.jsx(t,{variant:"body1",color:"gray",children:u==null?void 0:u.mobile})]})]}),e.jsx(n,{}),(u==null?void 0:u.role)==="Poultry"&&e.jsxs(e.Fragment,{children:[(u==null?void 0:u.orderCode)&&e.jsxs(r,{container:!0,justifyContent:"space-between",mt:2,mb:2,children:[e.jsx(t,{variant:"body1",color:"secondary",children:"کد سفارش:"}),e.jsx(t,{variant:"body1",color:"gray",children:(m=u==null?void 0:u.orderCode)==null?void 0:m.toLocaleString()})]}),e.jsxs(r,{container:!0,justifyContent:"space-between",mt:2,mb:2,children:[e.jsx(t,{variant:"body1",color:"secondary",children:"تعداد سفارشات:"}),e.jsx(t,{variant:"body1",color:"gray",children:(h=u==null?void 0:u.numberOfRequests)==null?void 0:h.toLocaleString()})]}),e.jsxs(r,{container:!0,justifyContent:"space-between",mt:2,mb:2,children:[e.jsx(t,{variant:"body1",color:"secondary",children:"حجم سفارشات:"}),e.jsxs(t,{variant:"body1",color:"gray",children:[(p=u==null?void 0:u.totalQuantity)==null?void 0:p.toLocaleString()," قطعه"]})]}),e.jsxs(r,{container:!0,justifyContent:"space-between",mt:2,mb:2,children:[e.jsx(t,{variant:"body1",color:"secondary",children:"وزن سفارشات:"}),e.jsxs(t,{variant:"body1",color:"gray",children:[(b=u==null?void 0:u.totalWeight)==null?void 0:b.toLocaleString()," کیلوگرم"]})]})]}),((u==null?void 0:u.role)==="Poultry"||(u==null?void 0:u.role)==="buyer")&&e.jsxs(g,{my:2,sx:{borderRadius:"8px",boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",backgroundColor:"#f5f5f5","&:before":{display:"none"}},children:[e.jsx(F,{expandIcon:e.jsx(B,{sx:{color:"#1976d2"}}),"aria-controls":"panel1a-content",sx:{backgroundColor:"#fff"},children:e.jsx(t,{sx:{color:"#1976d2",fontWeight:"bold"},children:"مشاهده سفارشات"})}),e.jsx(f,{sx:{backgroundColor:"#f9f9f9",borderTop:"1px solid #e0e0e0",padding:"8px",transition:"all 0.3s ease-in-out"},children:e.jsx(r,{children:e.jsx(V,{columns:["ردیف","کد سفارش"],data:j})})})]}),e.jsxs(r,{container:!0,justifyContent:"space-between",mt:2,mb:2,style:{fontWeight:"bolder"},children:[e.jsx(t,{variant:"body1",color:"primary",children:"جمع بدهی:"}),e.jsxs(t,{variant:"body1",style:{color:"red",fontWeight:"bolder"},children:[parseInt(Math.ceil((u==null?void 0:u.totalAmount)/1e4)*1e4).toLocaleString()," ","ریال"]})]}),e.jsx(n,{}),e.jsxs(r,{container:!0,justifyContent:"space-between",mt:2,mb:2,children:[e.jsx(t,{variant:"body1",color:"primary",children:"مبلغ تراکنش:"}),e.jsxs(t,{variant:"body1",color:"gray",children:[parseInt(Math.ceil(a.values.offer/1e4)*1e4).toLocaleString()," ","ریال"]})]}),e.jsx(n,{}),e.jsxs(r,{container:!0,justifyContent:"center",mt:2,mb:2,gap:2,children:[e.jsx(v,{id:"offer",label:(u==null?void 0:u.role)==="Poultry"||(u==null?void 0:u.role)==="Buyer"?"مبلغ":"ویرایش مبلغ",InputProps:{endAdornment:e.jsx(E,{position:"end",children:"ریال"}),readOnly:(u==null?void 0:u.role)==="Poultry"||(u==null?void 0:u.role)==="Buyer"},variant:"outlined",sx:{width:"100%"},value:a.values.offer,error:a.touched.offer?!!a.errors.offer:null,onChange:a.handleChange,onBlur:a.handleBlur,helperText:a.touched.offer&&a.errors.offer?a.errors.offer:null}),e.jsxs(t,{variant:"body1",mb:2,sx:{color:"darkcyan"},children:["معادل ",O(a.values.offer/10)," تومان"]}),e.jsx(S,{variant:"contained",fullWidth:!0,disabled:!a.isValid,onClick:()=>{x(G({title:"پرداخت تعرفه از طریق درگاه پرداخت",content:e.jsx(R,{backend:l,isPayment:!0,isPaymentData:{order_codes:u!=null&&u.orderCode?u==null?void 0:u.orderCode:null,role:u==null?void 0:u.role,user_key:u!=null&&u.userKey?u==null?void 0:u.userKey:null,total_amount:a.values.offer}})}))},children:"پرداخت تعرفه - درگاه پرداخت"})]})]})})};export{uu as default};
|