text: (this.webpackJsonpdailymilkfresh=this.webpackJsonpdailymilkfresh||[]).push([[0],{152:function(e,t,s){},199:function(e,t,s){},286:function(e,t,s){},288:function(e,t,s){},297:function(e,t,s){},298:function(e,t,s){},356:function(e,t,s){},357:function(e,t,s){},362:function(e,t){},364:function(e,t){},379:function(e,t){},381:function(e,t){},409:function(e,t){},411:function(e,t){},412:function(e,t){},417:function(e,t){},419:function(e,t){},425:function(e,t){},427:function(e,t){},446:function(e,t){},458:function(e,t){},461:function(e,t){},500:function(e,t,s){},524:function(e,t,s){},525:function(e,t,s){},530:function(e,t,s){},531:function(e,t,s){},532:function(e,t,s){},533:function(e,t,s){},534:function(e,t,s){"use strict";s.r(t);var n=s(0),a=s.n(n),c=s(69),r=s.n(c),i=(s(356),s(4)),l=(s(357),s(50)),o=s(26),d=s(1);function u(){return JSON.parse(localStorage.getItem("loggedIn"))?Object(d.jsx)(o.b,{}):Object(d.jsx)(o.a,{to:"/login"})}var j=a.a.createContext(),b=s(613),O=s(83),h=s.n(O),m=s(136),f=s(303),v=s.n(f),p=Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}).REACT_APP_HOSTNAME||"https://dailyorganicfresh.dailyfresh.farm",_=v.a.create({baseURL:p,timeout:1e4}),g=function(e){var t=e.queryKey;return _({method:"POST",url:"/user/listUsers",data:{type_of_user:t[0]},headers:{access_token:t[1]}})},x=function(e){return _({method:"POST",url:"/user/register/",data:e.user,headers:{access_token:e.access_token}})},y=function(e){return _({method:"GET",url:"/user/".concat(e.verify_code,"/verify/").concat(e.otp)})},N=s.p+"static/media/eye_close.73573ab2.svg",w=s.p+"static/media/eye_open.e5325192.svg",S=(s(286),s.p+"static/media/logo.9631ecf8.png");function k(e){var t=Object(n.useState)(""),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(""),l=Object(i.a)(r,2),o=l[0],u=l[1],j=Object(n.useState)(null),b=Object(i.a)(j,2),O=b[0],m=b[1],f=function(t){var s;t.preventDefault(),e.setClickOnce(!0),(s=e.username,_({method:"POST",url:"user/forgot",data:{phone_no:s}})).then((function(t){m(t.data.code),e.setClickOnce(!1)})).catch((function(t){e.setapiresponse(t.response.message),e.setClickOnce(!1)}))},v=function(t){t.preventDefault();var s=h.a.sign({data:o,timestamp:(new Date).toISOString()},"xeo9tcj5xyvqoghxm6wtbh6hfiamm3ji7ain02oa9lzu51");(function(e){return _({method:"POST",url:"user/".concat(e.code,"/password"),data:{pin:1234,npassword:e.newpassword}})})({code:O,otp:a,newpassword:s}).then((function(t){e.setapiresponse(t.data.message),setTimeout((function(){e.setResetPassword(!1),e.setapiresponse(null)}),3e3)})).catch((function(t){e.setapiresponse(t.response.data.message)}))};return Object(d.jsxs)("form",{className:"Login__sub-container",children:[Object(d.jsx)("div",{className:"Login__login-header",children:"Forgot Password"}),e.apiresponsemessage?Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("span",{className:"Login__success-password",children:e.apiresponsemessage})}):null,O?Object(d.jsxs)(d.Fragment,{children:[Object(d.jsxs)("div",{className:"Login__col-3",children:[Object(d.jsx)("input",{className:"Login__input-focus-effect",type:"text",placeholder:"New Password",onChange:function(e){return u(e.target.value)},value:o}),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[Object(d.jsx)("input",{className:"Login__input-focus-effect",type:"text",placeholder:"Enter OTP",onChange:function(e){return c(e.target.value)},value:a}),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{onClick:function(e){return v(e)},disabled:o.length<3||a.length<3||e.clickedonce,type:"submit",value:"Change Password",className:o.length<3||a.length<3||e.clickedonce?"Login__submit Login__submit-disabled":"Login__submit"})})]}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsxs)("div",{className:"Login__col-3",children:[Object(d.jsx)("input",{className:"Login__input-focus-effect",type:"text",placeholder:"Phone Number",onChange:function(t){return e.setUsername(t.target.value)},value:e.username}),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{onClick:function(e){return f(e)},type:"submit",value:"Request OTP",disabled:10!==e.username.length||e.clickedonce,className:10!==e.username.length||e.clickedonce?"Login__submit Login__submit-disabled":"Login__submit"})})]})]})}function D(){var e=Object(n.useState)(!1),t=Object(i.a)(e,2),s=t[0],a=t[1],c=Object(n.useState)(!1),r=Object(i.a)(c,2),l=r[0],u=r[1],O=Object(n.useState)(!1),f=Object(i.a)(O,2),v=f[0],p=f[1],g=Object(n.useState)(""),x=Object(i.a)(g,2),y=x[0],D=x[1],C=Object(n.useState)(""),A=Object(i.a)(C,2),P=A[0],L=A[1],U=Object(n.useState)(null),T=Object(i.a)(U,2),E=T[0],I=T[1],z=Object(o.h)(),q=Object(n.useContext)(j),M=q.isLoggedIn;Object(n.useEffect)((function(){M&&z("/")}),[M,z]);var F=function(){u(!l)};function R(){return y.length>3&&P.length>3}var H=function(e){(function(e){return _({method:"POST",url:"oauth/token",headers:{grant_type:"code",code:e}})})(e).then((function(e){V(e.data.access_token,e.data.refresh_token)})).catch((function(e){I(e.response.data.message),console.log("error in request",e)}))},V=function(e,t){(function(e){return _({method:"GET",url:"user/details",headers:{access_token:e}})})(e).then((function(s){return 1===s.data.data.user_type?(q.setIsLoggedIn(!0),q.setAccessToken(e),q.setIsAdmin(!0),q.setRefreshToken(t),q.saveuserDetails(s.data.data),z("/")):2===s.data.data.user_type?(q.setIsLoggedIn(!0),q.setAccessToken(e),q.setIsAdmin(!1),q.setRefreshToken(t),q.saveuserDetails(s.data.data),z("/")):void I("Un Authorized User")}))};return Object(d.jsx)("div",{className:"Login__main-container",children:Object(d.jsxs)("div",{className:"Login__paper",children:[Object(d.jsx)("img",{className:"Login__logo-image",src:S,alt:"this is logo"}),s?Object(d.jsx)(k,{username:y,setUsername:D,setResetPassword:a,apiresponsemessage:E,setapiresponse:I,clickedonce:v,setClickOnce:p}):Object(d.jsxs)("form",{className:"Login__sub-container",children:[Object(d.jsx)("div",{className:"Login__login-header",children:" Sign in - Admin Panel "}),E?Object(d.jsx)("div",{className:"Login__wrong-password",children:E}):null,Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)(m.a,{error:Boolean(E),id:"username",label:"Phone Number",fullWidth:!0,size:"small",value:y,onChange:function(e){return D(e.target.value)}})}),Object(d.jsxs)("div",{className:"Login__col-3",children:[Object(d.jsx)(m.a,{type:l?"text":"password",error:Boolean(E),id:"password",label:"Password",fullWidth:!0,size:"small",value:P,onChange:function(e){return L(e.target.value)}}),l?Object(d.jsx)("span",{onClick:F,className:"Login__show-password",children:Object(d.jsx)("img",{className:"",src:N,alt:"closeeye"})}):Object(d.jsx)("span",{onClick:F,className:"Login__show-password",children:Object(d.jsx)("img",{className:"",src:w,alt:"closeeye"})})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{onClick:function(e){e.preventDefault(),p(!0);var t=h.a.sign({data:P,timestamp:(new Date).toISOString()},"xeo9tcj5xyvqoghxm6wtbh6hfiamm3ji7ain02oa9lzu51"),s={phone_no:y,password:t,app_token:Object(b.a)()};q.setIsLoggedIn(!1),q.setAccessToken(null),q.setIsAdmin(!1),q.setRefreshToken(null),function(e){return _({method:"POST",url:"user/login",data:e})}(s).then((function(e){H(e.data.code),p(!1)})).catch((function(e){I(e&&e.response&&e.response.data.message),p(!1),console.log("error in request",e)}))},disabled:!R()||v,type:"submit",value:"Log In",className:R()?"Login__submit":"Login__submit Login__submit-disabled"})}),Object(d.jsx)("div",{className:"Login__signup",onClick:function(e){return function(e){e.preventDefault(),a(!0),I(null)}(e)},children:Object(d.jsx)("span",{className:"Login__forgot",children:" Forgot your password ? "})})]})]})})}var C=s(12),A=s(320),P=s.p+"static/media/location.5861c711.gif";function L(e){return Object(d.jsx)("div",{className:"Orders__card-container",children:e.orders.map((function(t,s){return Object(d.jsxs)(A.a,{className:"Orders__order",elevation:2,children:[Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsxs)("div",{className:"Orders__cust-id",children:[Object(d.jsx)("span",{children:Object(d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",className:"bi bi-person",viewBox:"0 0 16 16",children:Object(d.jsx)("path",{d:"M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"})})}),"\xa0 ",t.id]}),Object(d.jsx)("div",{onClick:function(s){return function(t,s){t.preventDefault(),e.currentUserSelection(s)}(s,t.delivery_id)},className:"Orders__status "+(n=t.delivery_status.toString(),"booked"===n?"Orders__blue":"delivered_morning"===n||"delivered_evening"===n?"Orders__green":"cancelled"===n?"Orders__red":"intransit"===n?"Orders__orange":"pickedup"===n?"Orders__yellow":"Orders__grey"),children:t.delivery_status})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Customer"}),Object(d.jsx)("div",{className:"cust-idnumber",children:t.user_name})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Agent"}),Object(d.jsx)("div",{className:"cust-idnumber",children:t.agent_name})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Delivery Type"}),Object(d.jsx)("div",{className:"cust-idnumber",children:t.delivery_type})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Price "}),Object(d.jsxs)("div",{className:"cust-idnumber",children:["\u20b9 ",t.price,"/-"]})]}),Object(d.jsxs)("div",{className:"Orders__products-row",children:[Object(d.jsx)("div",{className:"Orders__product-id",children:"Products"}),Object(d.jsxs)("div",{className:"Orders__product",children:[t.product," - ",t.quantity]})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Google Location"}),Object(d.jsx)("div",{className:"Orders__status",onClick:function(e){return function(e,t,s){e.preventDefault();var n="https://www.google.com/maps/search/?api=1&query= ".concat(t," , ").concat(s),a=window.open(n,"_blank","noopener,noreferrer");a&&(a.opener=null)}(e,t.lat,t.lng)},children:Object(d.jsxs)("span",{children:[Object(d.jsx)("img",{height:"40px",width:"40px",src:P,alt:"Daily"})," "]})})]})]},s);var n}))})}function U(e){return Object(d.jsxs)("div",{children:["Cancel order Delivery id: ",e.order,Object(d.jsx)(m.a,{id:"frdate",label:"From Date",type:"date",defaultValue:(new Date).toLocaleDateString("fr-CA"),InputLabelProps:{shrink:!0}}),Object(d.jsx)(m.a,{id:"todate",label:"From Date",type:"date",defaultValue:(new Date).toLocaleDateString("fr-CA"),onChange:function(e){console.log(e.target.value)},InputLabelProps:{shrink:!0}})]})}var T,E;s(500);function I(e){return Object(d.jsx)("div",{className:"MiniNavbar__main",children:e.isVisible?Object(d.jsxs)("div",{onClick:function(t){return function(t){t.preventDefault(),e.clearCurrentUser()}(t)},className:"MiniNavbar__flexcenter",children:[Object(d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",viewBox:"0 0 16 16",children:Object(d.jsx)("path",{fillRule:"evenodd",d:"M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8zm15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-4.5-.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H11.5z"})})," ",Object(d.jsx)("span",{children:" \xa0 Back"})]}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsxs)("div",{onClick:function(t){return function(t){t.preventDefault(),e.sortByName()}(t)},className:"MiniNavbar__flexcenter",children:[Object(d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",viewBox:"0 0 16 16",children:[Object(d.jsx)("path",{fillRule:"evenodd",d:"M10.082 5.629 9.664 7H8.598l1.789-5.332h1.234L13.402 7h-1.12l-.419-1.371h-1.781zm1.57-.785L11 2.687h-.047l-.652 2.157h1.351z"}),Object(d.jsx)("path",{d:"M12.96 14H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645V14zm-8.46-.5a.5.5 0 0 1-1 0V3.707L2.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.498.498 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L4.5 3.707V13.5z"})]})," ",Object(d.jsx)("span",{children:"Name"})]}),Object(d.jsxs)("div",{onClick:function(t){return function(t){t.preventDefault(),e.sortByAgent()}(t)},className:"MiniNavbar__flexcenter",children:[Object(d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",viewBox:"0 0 16 16",children:[Object(d.jsx)("path",{fillRule:"evenodd",d:"M10.082 5.629 9.664 7H8.598l1.789-5.332h1.234L13.402 7h-1.12l-.419-1.371h-1.781zm1.57-.785L11 2.687h-.047l-.652 2.157h1.351z"}),Object(d.jsx)("path",{d:"M12.96 14H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.645V14zm-8.46-.5a.5.5 0 0 1-1 0V3.707L2.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.498.498 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L4.5 3.707V13.5z"})]}),Object(d.jsx)("span",{children:"Agent Name"})]}),Object(d.jsxs)("div",{onClick:function(t){return function(t){t.preventDefault(),e.sortByProduct()}(t)},className:"MiniNavbar__flexcenter",children:[Object(d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",viewBox:"0 0 16 16",children:[Object(d.jsx)("path",{d:"M12.438 1.668V7H11.39V2.684h-.051l-1.211.859v-.969l1.262-.906h1.046z"}),Object(d.jsx)("path",{fillRule:"evenodd",d:"M11.36 14.098c-1.137 0-1.708-.657-1.762-1.278h1.004c.058.223.343.45.773.45.824 0 1.164-.829 1.133-1.856h-.059c-.148.39-.57.742-1.261.742-.91 0-1.72-.613-1.72-1.758 0-1.148.848-1.835 1.973-1.835 1.09 0 2.063.636 2.063 2.687 0 1.867-.723 2.848-2.145 2.848zm.062-2.735c.504 0 .933-.336.933-.972 0-.633-.398-1.008-.94-1.008-.52 0-.927.375-.927 1 0 .64.418.98.934.98z"}),Object(d.jsx)("path",{d:"M4.5 13.5a.5.5 0 0 1-1 0V3.707L2.354 4.854a.5.5 0 1 1-.708-.708l2-1.999.007-.007a.498.498 0 0 1 .7.006l2 2a.5.5 0 1 1-.707.708L4.5 3.707V13.5z"})]}),Object(d.jsx)("span",{children:"Product"})]})]})})}var z=["title","titleId"];function q(){return q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},q.apply(this,arguments)}function M(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function F(e,t){var s=e.title,a=e.titleId,c=M(e,z);return n.createElement("svg",q({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-bag-check",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,T||(T=n.createElement("path",{fillRule:"evenodd",d:"M10.854 8.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 0 1 .708-.708L7.5 10.793l2.646-2.647a.5.5 0 0 1 .708 0z"})),E||(E=n.createElement("path",{d:"M8 1a2.5 2.5 0 0 1 2.5 2.5V4h-5v-.5A2.5 2.5 0 0 1 8 1zm3.5 3v-.5a3.5 3.5 0 1 0-7 0V4H1v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-3.5zM2 5h12v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5z"})))}var R=n.forwardRef(F),H=(s.p,s(610)),V=s(607),B=s(615),G=s(552);function Q(e){return Object(d.jsx)("div",{children:Object(d.jsx)(B.a,{sx:{color:"#fff",zIndex:function(e){return e.zIndex.drawer+1}},open:!0,children:Object(d.jsx)(G.a,{color:"inherit"})})})}var W=s(617),J=function(e,t){return _({method:"POST",url:"product/get",data:{availability:e},headers:{access_token:t}})},K=function(e){return _({method:"GET",url:"deliverytype/listdeliverytypes",headers:{access_token:e}})},Z=function(e,t){return _({method:"POST",url:"/agent/delivery",headers:{access_token:t},data:e})},$=function(e,t){return _({method:"POST",url:"/history/getHistory",headers:{access_token:e},data:t})},Y=s(73);function X(e){var t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(0),l=Object(i.a)(r,2),o=l[0],u=l[1],j=Object(n.useState)(0),b=Object(i.a)(j,2),O=b[0],h=b[1],m=Object(n.useRef)(null);Object(n.useEffect)((function(){e.orders.forEach((function(e){u((function(t){return parseInt(t)+e.price})),h((function(t){return parseInt(t)+e.quantity}))}))}),[e.orders]);return Object(n.useEffect)((function(){console.info(a,"export_page number")}),[a]),Object(d.jsx)("div",{style:{height:600,width:"100%"},children:Object(d.jsx)(Y.a,{nodeRef:m,rows:e.orders,columns:[{field:"id",headerName:"ID",width:90},{field:"user_name",headerName:"Customer name",width:200,editable:!1},{field:"agent_name",headerName:"Agent name",width:200,editable:!1},{field:"product",headerName:"Product Type",width:140,editable:!1},{field:"delivery_type",headerName:"Delivery Type",description:"Delivery Type.",width:120},{field:"delivery_status",headerName:"Delivery Status",description:"Delivery Status.",width:160},{field:"quantity",headerName:"Quantity",description:"Delivery Type.",width:100},{field:"price",headerName:"Price",description:"Price.",width:100,editable:!0},{field:"modified_at",headerName:"Modified",description:"Delivery Type.",width:200}],pageSize:e.orders.length>30?30:10,rowsPerPageOptions:[10],onSelectionModelChange:function(e){c(e.selectionModel)},disableSelectionOnClick:!0,components:{Toolbar:function(){return Object(d.jsxs)(Y.b,{className:Y.d.toolbarContainer,children:[Object(d.jsx)(Y.c,{}),Object(d.jsxs)("div",{children:[" ","(Total Amount is ",o," for ",O," items)"]})]})}}})})}s(288);var ee=s(55);function te(){var e=Object(n.useContext)(j),t=Object(n.useState)(null),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(!1),l=Object(i.a)(r,2),o=l[0],u=l[1],b=Object(n.useState)(!1),O=Object(i.a)(b,2),h=O[0],m=O[1],f=Object(n.useState)(!1),v=Object(i.a)(f,2),p=v[0],x=v[1],y=Object(n.useState)(!1),N=Object(i.a)(y,2),w=N[0],S=N[1],k=Object(n.useState)(1),D=Object(i.a)(k,2),P=D[0],T=D[1],E=Object(n.useState)([]),z=Object(i.a)(E,2),q=z[0],M=z[1],F=Object(n.useState)([]),B=Object(i.a)(F,2),G=B[0],Z=B[1],$=Object(n.useState)([]),Y=Object(i.a)($,2),te=Y[0],se=Y[1],ne=Object(n.useState)([]),ae=Object(i.a)(ne,2),ce=ae[0],re=ae[1],ie=Object(n.useState)(!0),le=Object(i.a)(ie,2),oe=le[0],de=le[1],ue=Object(n.useState)([]),je=Object(i.a)(ue,2),be=je[0],Oe=je[1],he=Object(n.useState)([]),me=Object(i.a)(he,2),fe=me[0],ve=me[1],pe=e.access_token,_e=e.refreshAccessToken,ge=Object(ee.useQuery)([null,pe],g,{onSuccess:function(e){(null===e||void 0===e?void 0:e.data)&&re(e.data.data),console.log(ge)},onError:function(e){e&&e.response&&401===e.response.status&&_e()}}).isLoading;Object(n.useEffect)((function(){de(!0),K(pe).then((function(e){ve(e.data.data)})).catch((function(e){console.log(e),e&&e.response&&401===e.response.status&&_e()})),J(null,pe).then((function(e){Oe(e.data.data)})).catch((function(e){console.log(e),e&&e.response&&401===e.response.status&&_e()})),function(e,t){return _({method:"POST",url:"/agentuser/listAgentUsers",headers:{access_token:e},data:t})}(pe).then((function(e){M(e.data.data)})).catch((function(e){console.log(e),e&&e.response&&401===e.response.status&&_e()})),de(!1)}),[pe,_e]);var xe=Object(n.useCallback)((function(e,t){e&&e.preventDefault(),T(t);var s=G.slice(6*(t-1),6*t);se(s)}),[G]),ye=Object(n.useCallback)((function(){var e=["booked","delivered_morning","delivered_evening","cancelled","intransit","pickedup"],t=function(t){var s=e[t];return s||"Not Available"},s=function(e){var t=ce.find((function(t){return t.user_id===e}));return null===t||void 0===t?void 0:t.name},n=function(e){var t=fe.find((function(t){return t.delivery_type===e}));return t&&t.name},a=function(e){var t=be.find((function(t){return t.product_type===e}));return t&&t.name};Z([]),q.forEach((function(e){var c,r={user_id:e.user_id,delivery_id:e.delivery_id,user_name:s(e.user_id),agent_name:s(e.agent_id),delivery_type:n(e.delivery_type),product:a(e.product_type),delivery_status:t(e.delivery_status),quantity:e.quantity,price:e.price,lat:e.lat,lng:e.long,id:e.id,modified_at:(c=e.modified_at,new Date(c).toLocaleString("en-Gb"))};Z((function(e){return[].concat(Object(C.a)(e),[r])}))}))}),[q,fe,be,ce]);return Object(n.useEffect)((function(){xe(null,1)}),[G,xe]),Object(n.useEffect)((function(){ye()}),[q,ye]),Object(d.jsx)("div",{className:"main-container",children:oe?Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsxs)("div",{className:"Orders__main-heading",children:[Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(R,{})," ","  "," My Orders"]}),Object(d.jsx)("div",{children:Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(e){return m(!h)},children:h?"Back to Orders":"Export current data"})})]}),h?Object(d.jsx)(A.a,{children:Object(d.jsx)(X,{users:ce,deliveryTypes:fe,products:be,orders:G})}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)(I,{isVisible:a,clearCurrentUser:function(){c(null)},sortByName:function(){p?(se(te.sort((function(e,t){return e.user_name.localeCompare(t.user_name)}))),x(!p)):(se(te.sort((function(e,t){return t.user_name.localeCompare(e.user_name)}))),x(!p))},sortByProduct:function(e){o?(se(te.sort((function(e,t){return e.product.localeCompare(t.product)}))),u(!o)):(se(te.sort((function(e,t){return t.product.localeCompare(e.product)}))),u(!o))},sortByAgent:function(){w?(se(te.sort((function(e,t){return e.agent_name.localeCompare(t.agent_name)}))),S(!w)):(se(te.sort((function(e,t){return t.agent_name.localeCompare(e.agent_name)}))),S(!w))}}),a?Object(d.jsx)(U,{order:a}):Object(d.jsxs)("div",{children:[Object(d.jsx)(L,{currentUserSelection:function(e){c(e)},orders:te}),Object(d.jsx)("div",{className:"Orders__pagination",children:Object(d.jsx)(V.a,{spacing:2,children:Object(d.jsx)(H.a,{onChange:function(e,t){return xe(e,t)},variant:"outlined",color:"primary",boundaryCount:2,count:q.length%6===0?q.length/6:Math.floor(q.length/6)+1,page:P})})})]})]})]})})}var se=s.p+"static/media/singlePerson.5b613f1e.svg";function ne(e){var t=Object(o.h)();return Object(d.jsx)("div",{className:"Users__card-container",children:e.users.map((function(e,s){return Object(d.jsxs)(A.a,{onClick:function(s){return function(e,s){e.preventDefault(),t("/users/".concat(s))}(s,e.user_id)},className:"Users__order",elevation:2,children:[Object(d.jsxs)("div",{className:"Users__customername",children:[Object(d.jsxs)("div",{className:"Users__cust-id",children:[Object(d.jsx)("span",{children:Object(d.jsx)("img",{src:se,alt:"user"})}),"\xa0 User Type"]}),Object(d.jsx)("div",{className:"Users__status ",children:"User"})]}),Object(d.jsxs)("div",{className:"Users__products-row",children:[Object(d.jsx)("div",{className:"Users__cust-heading",children:"Customer Name"}),Object(d.jsx)("div",{className:"Users__right-column",children:e.name})]}),Object(d.jsxs)("div",{className:"Users__products-row",children:[Object(d.jsx)("div",{className:"Users__date",children:"Phone"}),Object(d.jsx)("div",{className:"Users__right-column",children:e.phone_no})]}),Object(d.jsxs)("div",{className:"Users__products-row",children:[Object(d.jsx)("div",{className:"Users__product-id",children:"Email"}),Object(d.jsx)("div",{className:"Users__right-column",children:e.email_id})]}),Object(d.jsxs)("div",{className:"Users__products-row",children:[Object(d.jsx)("div",{className:"Users__date",children:"Address"}),Object(d.jsx)("div",{className:"Users__right-column",children:e.address})]}),Object(d.jsxs)("div",{className:"Users__date-address-row",children:[Object(d.jsx)("div",{className:"Users__date",children:"Joined Date"}),Object(d.jsx)("div",{className:"Users__right-column",children:new Date(e.created_at).toLocaleString()})]})]},s)}))})}var ae=s(13),ce=s(38),re=s(17),ie=s.n(re),le=s(114),oe=s(616),de=s(90);function ue(e){var t=Object(n.useState)(Boolean(e.message)),s=Object(i.a)(t,2),a=s[0],c=s[1];return Object(n.useEffect)((function(){c(!0)}),[e.message]),Object(d.jsx)("div",{children:Object(d.jsx)(oe.a,{anchorOrigin:{vertical:"bottom",horizontal:"left"},open:a,autoHideDuration:2e3,message:e.message,action:Object(d.jsx)(d.Fragment,{children:Object(d.jsx)(de.a,{onClick:function(e){return function(e){e.preventDefault(),c(!1)}(e)},size:"small","aria-label":"close",color:"inherit",children:"x"})})})})}var je;s(152);function be(e){var t=Object(n.useState)({name:"",email_id:"",phone_no:"",password:"",address:"",user_type:"3",app_token:Object(b.a)()}),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(null),l=Object(i.a)(r,2),o=l[0],u=l[1],j=Object(n.useState)(null),O=Object(i.a)(j,2),m=O[0],f=O[1],v=function(){var e=Object(ce.a)(ie.a.mark((function e(t){var s,n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=h.a.sign({data:t.password,timestamp:(new Date).toISOString()},"xeo9tcj5xyvqoghxm6wtbh6hfiamm3ji7ain02oa9lzu51"),t.password=s,n=Object.assign(a,t),e.next=5,c(Object(ae.a)({},n));case 5:if(!g.length){e.next=7;break}return e.abrupt("return");case 7:w();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),p=Object(le.a)(),_=p.register,g=p.formState.errors,N=p.handleSubmit,w=function(){var t={user:a,access_token:e.access_token};x(t).then((function(e){u(e.data.code)})).catch((function(e){console.log("Failed",e.response),f("Failed")}))},S=function(t){var s={verify_code:o,otp:t.otp};y(s).then((function(t){f("successfully saved"),setTimeout((function(){e.addUserClicked()}),1e3)})).catch((function(e){f("Failed to saved"),console.log(e.response)}))};return Object(d.jsxs)("div",{className:"Users__sub-container",children:[o?Object(d.jsx)(d.Fragment,{children:Object(d.jsxs)("form",{onSubmit:N((function(e){g.length||S(e)})),children:[Object(d.jsxs)("div",{className:"Login__col-3",children:[Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"number",placeholder:"Enter OTP"},_("otp",{required:"required",minLength:{value:4,message:"Please enter a valid password min 8 char"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{className:g.length?"Users__refresh-button Users__refresh-button-disabled":"Users__refresh-button",type:"submit",value:"Submit"})})]})}):Object(d.jsx)("div",{children:Object(d.jsxs)("form",{onSubmit:N(v),children:[Object(d.jsxs)("div",{className:"Login__col-3",children:[g.name&&Object(d.jsx)("div",{className:"Users__errors",children:"Name needs to be at least 5 characters"}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Name"},_("name",{required:!0,min:5}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.email_id&&Object(d.jsx)("span",{className:"Users__errors",children:g.email_id.message}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Email"},_("email_id",{required:"required",pattern:{value:/\S+@\S+\.\S+/,message:"Entered value does not match email format"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.phone_no&&Object(d.jsx)("span",{className:"Users__errors",children:"Please enter phone number"}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",placeholder:"Phone Number",type:"number"},_("phone_no",{required:!0,pattern:/^[6789]\d{9}$/}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.address&&Object(d.jsx)("span",{className:"Users__errors",children:g.address.message}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Address"},_("address",{required:"required",minLength:{value:8,message:"Please enter full address"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.password&&Object(d.jsx)("span",{className:"Users__errors",children:g.password.message}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Password"},_("password",{required:"required",minLength:{value:8,message:"Please enter a valid password min 8 char"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{disabled:o,className:g.length?"Users__refresh-button Users__refresh-button-disabled":"Users__refresh-button",type:"submit",value:"Add New User"})})]})}),m&&Object(d.jsx)(ue,{message:m})]})}var Oe=["title","titleId"];function he(){return he=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},he.apply(this,arguments)}function me(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function fe(e,t){var s=e.title,a=e.titleId,c=me(e,Oe);return n.createElement("svg",he({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-people",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,je||(je=n.createElement("path",{d:"M15 14s1 0 1-1-1-4-5-4-5 3-5 4 1 1 1 1h8zm-7.978-1A.261.261 0 0 1 7 12.996c.001-.264.167-1.03.76-1.72C8.312 10.629 9.282 10 11 10c1.717 0 2.687.63 3.24 1.276.593.69.758 1.457.76 1.72l-.008.002a.274.274 0 0 1-.014.002H7.022zM11 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm3-2a3 3 0 1 1-6 0 3 3 0 0 1 6 0zM6.936 9.28a5.88 5.88 0 0 0-1.23-.247A7.35 7.35 0 0 0 5 9c-4 0-5 3-5 4 0 .667.333 1 1 1h4.216A2.238 2.238 0 0 1 5 13c0-1.01.377-2.042 1.09-2.904.243-.294.526-.569.846-.816zM4.92 10A5.493 5.493 0 0 0 4 13H1c0-.26.164-1.03.76-1.724.545-.636 1.492-1.256 3.16-1.275zM1.5 5.5a3 3 0 1 1 6 0 3 3 0 0 1-6 0zm3-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"})))}var ve=n.forwardRef(fe);s.p;function pe(){var e=Object(n.useContext)(j),t=Object(n.useState)(!0),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)([]),l=Object(i.a)(r,2),o=l[0],u=l[1],b=Object(n.useState)(!1),O=Object(i.a)(b,2),h=O[0],m=O[1],f=Object(n.useState)(1),v=Object(i.a)(f,2),p=v[0],_=v[1],x=Object(n.useState)([]),y=Object(i.a)(x,2),N=y[0],w=y[1],S=Object(ee.useQuery)([3,e.access_token],g,{onSuccess:function(e){(null===e||void 0===e?void 0:e.data)&&u(e.data.data),c(!1)},onError:function(t){t&&t.response&&401===t.response.status&&(c(!0),e.refreshAccessToken())}}).refetch,k=Object(n.useCallback)((function(e,t){e&&e.preventDefault(),_(t);var s=o.slice(6*(t-1),6*t);return w(s)}),[o]);Object(n.useEffect)((function(){k(null,1)}),[o,k]);var D=function(e){e&&e.preventDefault(),m(!h),!0===h&&S()};return Object(d.jsxs)("div",{className:"main-container",children:[Object(d.jsxs)("div",{className:"Orders__main-heading",children:[Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(ve,{})," ","  "," Users"]}),Object(d.jsx)("div",{children:Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(e){return D(e)},children:h?"Cancel Adding":"Add new User"})})]}),a?Object(d.jsxs)("div",{className:"Users__spinners",children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsx)("div",{children:h?Object(d.jsx)(be,{addUserClicked:D,access_token:e.access_token}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)(ne,{users:N}),Object(d.jsx)("div",{className:"Orders__pagination",children:Object(d.jsx)(V.a,{spacing:2,children:Object(d.jsx)(H.a,{onChange:function(e,t){return k(e,t)},variant:"outlined",color:"primary",boundaryCount:2,count:o.length%6===0?o.length/6:Math.floor(o.length/6)+1,page:p})})})]})})]})}var _e=s(308),ge=s.n(_e);function xe(e){var t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(0),l=Object(i.a)(r,2),o=l[0],u=l[1],j=Object(n.useState)(0),b=Object(i.a)(j,2),O=b[0],h=b[1],m=Object(n.useRef)(null);Object(n.useEffect)((function(){e.historyData.forEach((function(e){u((function(t){return parseInt(t)+e.price})),h((function(t){return parseInt(t)+e.quantity}))}))}),[e.historyData]);return Object(n.useEffect)((function(){console.info(a,"export_page number")}),[a]),Object(d.jsx)("div",{style:{height:600,width:"100%"},children:Object(d.jsx)(Y.a,{nodeRef:m,rows:e.historyData,columns:[{field:"id",headerName:"ID",width:90},{field:"user_name",headerName:"Customer name",width:200},{field:"product",headerName:"Product",width:140},{field:"delivery_type",headerName:"Delivery Type",description:"Delivery Type.",width:120},{field:"quantity",headerName:"Quantity",description:"Delivery Type.",width:100},{field:"price",headerName:"Price",description:"Price.",width:100,editable:!0},{field:"delivered_at",headerName:"Delivered",description:"Delivery Time.",width:200}],pageSize:30,rowsPerPageOptions:[10],onSelectionModelChange:function(e){c(e.selectionModel)},disableSelectionOnClick:!0,components:{Toolbar:function(){return Object(d.jsxs)(Y.b,{className:Y.d.toolbarContainer,children:[Object(d.jsx)(Y.c,{}),Object(d.jsxs)("div",{children:[" ","(Total Amount is ",o," for ",O," items)"]})]})}}})})}function ye(){var e=Object(n.useContext)(j),t=Object(n.useState)(!1),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)([]),l=Object(i.a)(r,2),o=l[0],u=l[1],b=e.access_token,O=Object(n.useState)(new Date(Date.now()-864e5).toISOString()),h=Object(i.a)(O,2),f=h[0],v=h[1],p=Object(n.useState)(null),_=Object(i.a)(p,2),g=_[0],x=_[1],y=Object(n.useState)((new Date).toISOString()),N=Object(i.a)(y,2),w=N[0],S=N[1],k=Object(n.useState)(""),D=Object(i.a)(k,2),P=D[0],L=D[1];Object(n.useEffect)((function(){var e=function(){var e=Object(ce.a)(ie.a.mark((function e(){var t,s,n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t={errorCorrectionLevel:"H",type:"image/jpeg",quality:1,margin:1,color:{dark:"#000",light:"#FFF"}},s=window.location.pathname.split("/")[2],e.next=5,ge.a.toDataURL(s,t);case 5:n=e.sent,L(n),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),console.log(e.t0);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}();e()}),[]);var U=function(e){e.forEach((function(e,t){var s={id:t+1,user_name:e.UserDetail.name,delivery_type:e.DeliveryType.name,product:e.Product.name,quantity:e.quantity,price:e.price,delivered_at:new Date(e.delivered_at).toLocaleString("en-Gb")};u((function(e){return[].concat(Object(C.a)(e),[s])}))}))};return Object(d.jsxs)("div",{className:"main-container",children:[a?Object(d.jsxs)("div",{className:"Agents__spinners",children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsxs)(A.a,{className:"AssignUsers__sub",elevation:2,children:["Customer Unique Scan Code",P?Object(d.jsx)("a",{href:P,children:Object(d.jsx)("img",{width:"350px",height:"350px",src:P,alt:"img"})}):null]}),Object(d.jsxs)(A.a,{className:"Users__top",children:["Customer History Data",Object(d.jsx)("div",{className:"Users__fromdate",children:Object(d.jsx)(m.a,{id:"fromdate",label:"From Date",type:"date",onChange:function(e){return function(e){e.preventDefault();var t=new Date(e.target.value).toISOString();v(t)}(e)},defaultValue:(new Date).toLocaleDateString("fr-CA"),InputLabelProps:{shrink:!0}})}),Object(d.jsx)("div",{className:"Users__fromdate",children:Object(d.jsx)(m.a,{id:"todate",label:"To Date",type:"date",onChange:function(e){return function(e){e.preventDefault();var t=new Date(e.target.value).toISOString();S(t)}(e)},defaultValue:(new Date).toLocaleDateString("fr-CA"),InputLabelProps:{shrink:!0,max:(new Date).toLocaleDateString("fr-CA")}})}),Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(t){return function(t){u([]),c(!0),t.preventDefault();var s=window.location.pathname.split("/")[2];s&&$(b,{customer_user_id:[s],from:f,to:w}).then((function(e){U(e.data.data),c(!1),x("Data Fetched")})).catch((function(t){t&&t.response&&401===t.response.status&&(c(!0),x("Refreshing"),e.refreshAccessToken()),c(!1),x("No Data Available for Dates ")}))}(t)},children:"Submit"})," "]}),Object(d.jsx)(A.a,{children:Object(d.jsx)(xe,{historyData:o})})]}),g&&Object(d.jsx)(ue,{message:g})]})}function Ne(){return Object(d.jsxs)("div",{children:[" ","dskdsd",Object(d.jsx)("p",{children:"dsds"})]})}function we(e){var t,s=Object(n.useState)(e.products),a=Object(i.a)(s,2),c=a[0],r=a[1],l=Object(o.h)(),u=function(t){var s=0===c.availability?1:0;t.preventDefault(),r(Object(ae.a)(Object(ae.a)({},c),{},{availability:s}));var n={availability:s.toString()};!function(e,t,s){_({method:"POST",url:"/product/".concat(t,"/update"),data:s,headers:{access_token:e}})}(e.access_token,c.id,n)};return Object(d.jsx)("div",{className:"Products__card-box",children:Object(d.jsxs)(A.a,{className:"Products__order",elevation:2,children:[Object(d.jsxs)("div",{className:"Products__customername",children:[Object(d.jsx)("div",{onClick:function(e){return u(e)},className:"Products__status "+(t=c.availability,1===t?"Products__available":0===t?"Orders__yellow":"Orders__grey"),children:1===c.availability?"Available":"Not available"}),Object(d.jsx)("div",{onClick:function(e){return function(e,t){e.preventDefault(),l("/products/".concat(t))}(e,c.id)},className:"Products__status Products__edit-product",children:"Edit Product"})]}),Object(d.jsxs)("div",{className:"Products__products-row",children:[Object(d.jsx)("div",{className:"Products__cust-heading",children:"Name"}),Object(d.jsx)("div",{className:"Products__right-column",children:c.name})]}),Object(d.jsxs)("div",{className:"Products__products-row",children:[Object(d.jsx)("div",{className:"Products__date",children:"Description"}),Object(d.jsx)("div",{className:"Products__right-column",children:c.description})]}),Object(d.jsxs)("div",{className:"Products__products-row",children:[Object(d.jsx)("div",{className:"Products__product-id",children:"Price"}),Object(d.jsx)("div",{className:"Products__right-column",children:c.price})]}),Object(d.jsxs)("div",{className:"Products__products-row",children:[Object(d.jsx)("div",{className:"Products__product-id",children:"Measurement"}),Object(d.jsx)("div",{className:"Products__right-column",children:c.measurement||"packet"})]}),Object(d.jsxs)("div",{className:"Products__products-row",children:[Object(d.jsx)("div",{className:"Products__date",children:"Product Type"}),Object(d.jsx)("div",{className:"Products__right-column",children:c.product_type})]})]})})}var Se,ke;s(199);function De(e){var t=Object(n.useState)({name:"",description:"",price:"",measurement:""}),s=Object(i.a)(t,2),a=s[0],c=s[1],r=function(){var e=Object(ce.a)(ie.a.mark((function e(t){var s;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=Object.assign(a,t),c(Object(ae.a)({},s)),!u.length){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,b();case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),l=Object(le.a)(),o=l.register,u=l.formState.errors,j=l.handleSubmit,b=function(){(function(e){return _({method:"POST",url:"product/add",data:e.product,headers:{access_token:e.access_token}})})({product:a,access_token:e.access_token}).then((function(t){alert("success"),setTimeout((function(){e.toggleAddProduct(!1)}),2e3)})).catch((function(e){console.log("Failed",e.response),alert("Failed")}))};return Object(d.jsx)("div",{className:"Products__sub-container",children:Object(d.jsxs)("form",{onSubmit:j(r),children:[Object(d.jsxs)("div",{className:"Login__col-3",children:[u.name&&Object(d.jsx)("div",{className:"Users__errors",children:"Name needs to be at least 3 characters"}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Name"},o("name",{required:"required",minLength:{value:3,message:"Please enter a valid password min 8 char"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[u.price&&Object(d.jsx)("div",{className:"Users__errors",children:"This field is required"}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",placeholder:"Price",type:"number"},o("price",{required:"required",min:1}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[u.description&&Object(d.jsx)("div",{className:"Users__errors",children:'Please enter a valid description min 8 char"'}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"description",placeholder:"Description"},o("description",{required:"required",min:5}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[u.measurement&&Object(d.jsx)("div",{className:"Users__errors",children:'Please enter a valid measurement Kg/packet/Litre"'}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"measurement",placeholder:"measurement"},o("measurement",{required:"required",min:5}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{className:u.length?"Users__refresh-button Users__refresh-button-disabled":"Users__refresh-button",type:"submit",value:"Add New Product"})})]})})}var Ce=["title","titleId"];function Ae(){return Ae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},Ae.apply(this,arguments)}function Pe(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function Le(e,t){var s=e.title,a=e.titleId,c=Pe(e,Ce);return n.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-card-checklist",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,Se||(Se=n.createElement("path",{d:"M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h13zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13z"})),ke||(ke=n.createElement("path",{d:"M7 5.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm-1.496-.854a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0zM7 9.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm-1.496-.854a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 0 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0z"})))}var Ue=n.forwardRef(Le);s.p;function Te(){var e=Object(n.useContext)(j),t=Object(n.useState)(!1),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)([]),l=Object(i.a)(r,2),o=l[0],u=l[1],b=Object(n.useState)(!1),O=Object(i.a)(b,2),h=O[0],m=O[1],f=Object(n.useState)(1),v=Object(i.a)(f,1)[0];Object(n.useEffect)((function(){c(!0),J(null,e.access_token).then((function(e){u(e.data.data),c(!1)})).catch((function(t){var s,n=null===t||void 0===t||null===(s=t.response)||void 0===s?void 0:s.status;n&401===n&&(e.refreshAccessToken(),c(!1))}))}),[e.access_token,e,h]);return Object(d.jsxs)("div",{className:"main-container",children:[Object(d.jsxs)("div",{className:"Orders__main-heading",children:[Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(Ue,{})," ","  "," Products"]}),Object(d.jsx)("div",{children:Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(e){return function(e){e&&e.preventDefault(),m(!h)}(e)},children:h?"Cancel Adding":"Add new Product"})})]}),a?Object(d.jsxs)("div",{className:"Products__spinners",children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)("div",{className:"Products__card-container",children:h?Object(d.jsx)(De,{toggleAddProduct:m,access_token:e.access_token}):Object(d.jsx)(d.Fragment,{children:o.map((function(t,s){return Object(d.jsx)(we,{access_token:e.access_token,products:t},s)}))})}),Object(d.jsx)("div",{className:h?"Orders__pagination Orders__pagination-none":"Orders__pagination",children:Object(d.jsx)(V.a,{spacing:2,children:Object(d.jsx)(H.a,{variant:"outlined",color:"primary",boundaryCount:2,count:o.length%2===0?o.length/2:Math.floor(o.length/2)+1,page:v})})})]})]})}function Ee(){var e=Object(o.h)(),t=Object(n.useContext)(j),s=Object(n.useState)(!1),a=Object(i.a)(s,2),c=a[0],r=a[1],l=Object(n.useState)([]),u=Object(i.a)(l,2),b=u[0],O=u[1],h=Object(n.useState)(),m=Object(i.a)(h,2),f=(m[0],m[1]);Object(n.useEffect)((function(){r(!0),J(null,t.access_token).then((function(e){O(e.data.data),v(),r(!1)})).catch((function(e){var s,n=null===e||void 0===e||null===(s=e.response)||void 0===s?void 0:s.status;n&401===n&&(t.refreshAccessToken(),r(!1))}))}),[t.access_token]);var v=function(){var e=window.location.pathname.split("/")[2];if(e){var t=b.find((function(t){return t.id==e}));f(t)}};return Object(d.jsxs)("div",{className:"main-container",children:[Object(d.jsxs)("div",{className:"Orders__main-heading",children:[Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(Ue,{})," ","  "," Edit Product"]}),Object(d.jsx)("div",{children:Object(d.jsxs)("button",{className:"Users__refresh-button",onClick:function(t){return function(t){t.preventDefault(),e("/products")}(t)},children:[" ","Back to Products"]})})]}),c?Object(d.jsxs)("div",{className:"Products__spinners",children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsx)("div",{children:"fdffdfdf"})]})}function Ie(e){var t=Object(o.h)();return Object(d.jsx)("div",{className:"Agents__card-container",children:e.agents.map((function(e,s){return Object(d.jsxs)(A.a,{onClick:function(s){return function(e,s){e.preventDefault(),t("/agents/".concat(s))}(s,e.user_id)},className:"Agents__order",elevation:2,children:[Object(d.jsxs)("div",{className:"Agents__customername",children:[Object(d.jsxs)("div",{className:"Agents__cust-id",children:[Object(d.jsx)("span",{children:Object(d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",className:"bi bi-person",viewBox:"0 0 16 16",children:Object(d.jsx)("path",{d:"M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"})})}),"\xa0 User Type"]}),Object(d.jsx)("div",{className:"Agents__status ",children:"Agent"})]}),Object(d.jsxs)("div",{className:"Agents__products-row",children:[Object(d.jsx)("div",{className:"Agents__cust-heading",children:"Agent Name"}),Object(d.jsx)("div",{className:"Agents__right-column",children:e.name})]}),Object(d.jsxs)("div",{className:"Agents__products-row",children:[Object(d.jsx)("div",{className:"Agents__date",children:"Phone"}),Object(d.jsx)("div",{className:"Agents__right-column",children:e.phone_no})]}),Object(d.jsxs)("div",{className:"Agents__products-row",children:[Object(d.jsx)("div",{className:"Agents__product-id",children:"Email"}),Object(d.jsx)("div",{className:"Agents__right-column",children:e.email_id})]}),Object(d.jsxs)("div",{className:"Agents__products-row",children:[Object(d.jsx)("div",{className:"Agents__date",children:"Address"}),Object(d.jsx)("div",{className:"Agents__right-column",children:e.address})]}),Object(d.jsxs)("div",{className:"Agents__date-address-row",children:[Object(d.jsx)("div",{className:"Agents__date",children:"Joined Date"}),Object(d.jsx)("div",{className:"Agents__right-column",children:new Date(e.created_at).toLocaleString()})]})]},s)}))})}var ze,qe;s(297);function Me(e){var t=Object(n.useState)({name:"",email_id:"",phone_no:"",password:"",address:"",user_type:"2",app_token:Object(b.a)()}),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(null),l=Object(i.a)(r,2),o=l[0],u=l[1],j=Object(n.useState)(null),O=Object(i.a)(j,2),m=O[0],f=O[1],v=function(){var e=Object(ce.a)(ie.a.mark((function e(t){var s,n;return ie.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=h.a.sign({data:t.password,timestamp:(new Date).toISOString()},"xeo9tcj5xyvqoghxm6wtbh6hfiamm3ji7ain02oa9lzu51"),t.password=s,n=Object.assign(a,t),e.next=5,c(Object(ae.a)({},n));case 5:if(!g.length){e.next=7;break}return e.abrupt("return");case 7:w();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),p=Object(le.a)(),_=p.register,g=p.formState.errors,N=p.handleSubmit,w=function(){var t={user:a,access_token:e.access_token};x(t).then((function(e){u(e.data.code)})).catch((function(e){console.log("Failed",e.response),f("Failed")}))},S=function(t){var s={verify_code:o,otp:t.otp};y(s).then((function(t){f("successfully saved"),setTimeout((function(){e.addAgentClicked()}),2e3)})).catch((function(e){f("Failed to saved"),console.log(e.response)}))};return Object(d.jsxs)("div",{className:"Users__sub-container",children:[o?Object(d.jsx)(d.Fragment,{children:Object(d.jsxs)("form",{onSubmit:N((function(e){g.length||S(e)})),children:[Object(d.jsxs)("div",{className:"Login__col-3",children:[Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"number",placeholder:"Enter OTP"},_("otp",{required:"required",minLength:{value:4,message:"Please enter a valid password min 8 char"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{className:g.length?"Users__refresh-button Users__refresh-button-disabled":"Users__refresh-button",type:"submit",value:"Submit"})})]})}):Object(d.jsx)("div",{children:Object(d.jsxs)("form",{onSubmit:N(v),children:[Object(d.jsxs)("div",{className:"Login__col-3",children:[g.name&&Object(d.jsx)("div",{className:"Users__errors",children:"Name needs to be at least 5 characters"}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Name"},_("name",{required:!0,min:5}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.email_id&&Object(d.jsx)("span",{className:"Users__errors",children:g.email_id.message}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Email"},_("email_id",{required:"required",pattern:{value:/\S+@\S+\.\S+/,message:"Entered value does not match email format"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.phone_no&&Object(d.jsx)("span",{className:"Users__errors",children:"Please enter phone number"}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",placeholder:"Phone Number",type:"number"},_("phone_no",{required:!0,pattern:/^[6789]\d{9}$/}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.address&&Object(d.jsx)("span",{className:"Users__errors",children:g.address.message}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Address"},_("address",{required:"required",minLength:{value:8,message:"Please enter full address"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsxs)("div",{className:"Login__col-3",children:[g.password&&Object(d.jsx)("span",{className:"Users__errors",children:g.password.message}),Object(d.jsx)("input",Object(ae.a)({className:"Login__input-focus-effect",type:"text",placeholder:"Password"},_("password",{required:"required",minLength:{value:8,message:"Please enter a valid password min 8 char"}}))),Object(d.jsx)("span",{className:"focus-border"})]}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{disabled:o,className:g.length?"Users__refresh-button Users__refresh-button-disabled":"Users__refresh-button",type:"submit",value:"Add New User"})})]})}),m&&Object(d.jsx)(ue,{message:m})]})}var Fe=["title","titleId"];function Re(){return Re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},Re.apply(this,arguments)}function He(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function Ve(e,t){var s=e.title,a=e.titleId,c=He(e,Fe);return n.createElement("svg",Re({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",className:"bi bi-person-square",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,ze||(ze=n.createElement("path",{d:"M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"})),qe||(qe=n.createElement("path",{d:"M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm12 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1v-1c0-1-1-4-6-4s-6 3-6 4v1a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12z"})))}var Be=n.forwardRef(Ve);s.p;function Ge(){var e=Object(n.useContext)(j),t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(!1),l=Object(i.a)(r,2),o=l[0],u=l[1],b=Object(n.useState)(!0),O=Object(i.a)(b,2),h=O[0],m=O[1],f=Object(n.useState)(1),v=Object(i.a)(f,1)[0],p=Object(ee.useQuery)([2,e.access_token],g,{onSuccess:function(e){(null===e||void 0===e?void 0:e.data)&&c(e.data.data),m(!1)},onError:function(t){t&&t.response&&401===t.response.status&&(m(!0),e.refreshAccessToken())}}).refetch,_=function(e){e&&e.preventDefault(),u(!o),!0===o&&p()};return Object(d.jsxs)("div",{className:"main-container",children:[Object(d.jsxs)("div",{className:"Orders__main-heading",children:[Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(Be,{})," ","  "," Agents"]}),Object(d.jsx)("div",{children:Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(e){return _(e)},children:o?"Cancel Adding":"Add new Agent"})})]}),h?Object(d.jsxs)("div",{className:"Agents__spinners",children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsx)("div",{children:o?Object(d.jsx)(Me,{addAgentClicked:_,access_token:e.access_token}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)(Ie,{agents:a}),Object(d.jsx)("div",{className:"Orders__pagination",children:Object(d.jsx)(V.a,{spacing:2,children:Object(d.jsx)(H.a,{variant:"outlined",color:"primary",boundaryCount:2,count:a.length%6===0?a.length/6:Math.floor(a.length/6)+1,page:v})})})]})})]})}function Qe(){var e=Object(n.useContext)(j),t=Object(n.useState)(!1),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)([]),l=Object(i.a)(r,2),o=l[0],u=l[1],b=e.access_token,O=Object(n.useState)(new Date(Date.now()-864e5).toISOString()),h=Object(i.a)(O,2),f=h[0],v=h[1],p=Object(n.useState)(null),_=Object(i.a)(p,2),g=_[0],x=_[1],y=Object(n.useState)((new Date).toISOString()),N=Object(i.a)(y,2),w=N[0],S=N[1],k=function(e){e.forEach((function(e,t){var s={id:t+1,user_name:e.UserDetail.name,delivery_type:e.DeliveryType.name,product:e.Product.name,quantity:e.quantity,price:e.price,delivered_at:new Date(e.delivered_at).toLocaleString("en-Gb")};u((function(e){return[].concat(Object(C.a)(e),[s])}))}))};return Object(d.jsxs)("div",{className:"main-container",children:[a?Object(d.jsxs)("div",{className:"Agents__spinners",children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsxs)(A.a,{className:"Users__top",children:["Agent History Data",Object(d.jsx)("div",{className:"Users__fromdate",children:Object(d.jsx)(m.a,{id:"fromdate",label:"From Date",type:"date",onChange:function(e){return function(e){e.preventDefault();var t=new Date(e.target.value).toISOString();v(t)}(e)},defaultValue:(new Date).toLocaleDateString("fr-CA"),InputLabelProps:{shrink:!0}})}),Object(d.jsx)("div",{className:"Users__fromdate",children:Object(d.jsx)(m.a,{id:"todate",label:"To Date",type:"date",onChange:function(e){return function(e){e.preventDefault();var t=new Date(e.target.value).toISOString();S(t)}(e)},defaultValue:(new Date).toLocaleDateString("fr-CA"),InputLabelProps:{shrink:!0,max:(new Date).toLocaleDateString("fr-CA")}})}),Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(t){return function(t){u([]),c(!0),t.preventDefault();var s=window.location.pathname.split("/")[2];s&&$(b,{agent_id:[s],from:f,to:w}).then((function(e){k(e.data.data),c(!1),x("Data Fetched")})).catch((function(t){t&&t.response&&401===t.response.status&&(c(!0),x("Refreshing"),e.refreshAccessToken()),c(!1),x("No Data Available for Dates ")}))}(t)},children:"Submit"})," "]}),Object(d.jsx)(A.a,{children:Object(d.jsx)(xe,{historyData:o})})]}),g&&Object(d.jsx)(ue,{message:g})]})}s(524);function We(){var e=Object(n.useContext)(j),t=Object(n.useState)(!0),s=Object(i.a)(t,2),a=s[0],c=s[1],r=e.access_token,l=e.userDetails,o=Object(n.useState)({name:"",email_id:"",phone_no:"",address:""}),u=Object(i.a)(o,2),b=u[0],O=u[1],h=function(e){e.preventDefault(),c(!a)};Object(n.useEffect)((function(){O((function(e){return Object(ae.a)(Object(ae.a)({},e),l)}))}),[l]);var m=function(e,t){e.preventDefault(),e.persist(),a||("name"===t&&O(Object(ae.a)(Object(ae.a)({},b),{},{name:e.target.value})),"email"===t&&O(Object(ae.a)(Object(ae.a)({},b),{},{email_id:e.target.value})))},f=function(t){(function(e){return _({method:"POST",url:"user/update",data:{name:e.name,email_id:e.email_id},headers:{access_token:e.access_token}})})({name:b.name,email_id:b.email_id,access_token:r}).then((function(t){e.saveuserDetails(t.data),alert("Successfully saved")}))};return Object(d.jsxs)("div",{className:"Settings__main-container",children:[Object(d.jsxs)("div",{className:"Settings__heading-container",children:[Object(d.jsx)("div",{onClick:function(e){return h(e)},className:a?"Settings__heading-left Settings__heading-left-selected":"Settings__heading-left",children:"Profile"}),Object(d.jsx)("div",{onClick:function(e){return h(e)},className:a?"Settings__heading-right":"Settings__heading-right Settings__heading-right-selected",children:"Edit Profile"})]}),Object(d.jsxs)("div",{className:"Settings__field-container",children:[Object(d.jsx)("label",{className:"Settings__label",children:"Name"}),Object(d.jsx)("input",{value:b.name,onChange:function(e){return m(e,"name")},className:"Settings__firstname",type:"text",placeholder:"Name",name:"firstName"})]}),Object(d.jsxs)("div",{className:"Settings__field-container",children:[Object(d.jsx)("label",{className:"Settings__label",children:"Email"}),Object(d.jsx)("input",{onChange:function(e){return m(e,"email")},value:b.email_id,type:"text",className:"Settings__firstname"})]}),a&&Object(d.jsxs)("div",{children:[Object(d.jsxs)("div",{className:"Settings__field-container",children:[Object(d.jsx)("label",{className:"Settings__label",children:"Phone"}),Object(d.jsx)("input",{readOnly:!0,value:b.phone_no,type:"text",className:"Settings__email"})]}),Object(d.jsxs)("div",{className:"Settings__field-container",children:[Object(d.jsx)("label",{className:"Settings__label",children:"Address"}),Object(d.jsx)("input",{onChange:function(e){return m(e,"email")},value:b.address||"",type:"text",className:"Settings__firstname"})]})]}),!a&&Object(d.jsx)("div",{children:Object(d.jsx)("div",{className:"Settings__field-container",children:Object(d.jsx)("input",{onClick:function(e){return f()},value:"Save",type:"submit",className:"Settings__submit"})})})]})}var Je,Ke=s(162),Ze=(s(525),["title","titleId"]);function $e(){return $e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},$e.apply(this,arguments)}function Ye(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function Xe(e,t){var s=e.title,a=e.titleId,c=Ye(e,Ze);return n.createElement("svg",$e({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-graph-up-arrow",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,Je||(Je=n.createElement("path",{fillRule:"evenodd",d:"M0 0h1v15h15v1H0V0Zm10 3.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V4.9l-3.613 4.417a.5.5 0 0 1-.74.037L7.06 6.767l-3.656 5.027a.5.5 0 0 1-.808-.588l4-5.5a.5.5 0 0 1 .758-.06l2.609 2.61L13.445 4H10.5a.5.5 0 0 1-.5-.5Z"})))}var et=n.forwardRef(Xe),tt=(s.p,{type:"bar",data:{labels:["25th","26th","27th","28th","29th","30th"],datasets:[{label:"# of Votes",data:[22,23,23,25,21,28],backgroundColor:["rgba(255, 99, 132, 0.2)","rgba(54, 162, 235, 0.2)","rgba(255, 206, 86, 0.2)","rgba(75, 192, 192, 0.2)","rgba(153, 102, 255, 0.2)","rgba(255, 159, 64, 0.2)"],borderColor:["rgba(255, 99, 132, 1)","rgba(54, 162, 235, 1)","rgba(255, 206, 86, 1)","rgba(75, 192, 192, 1)","rgba(153, 102, 255, 1)","rgba(255, 159, 64, 1)"],borderWidth:1}]},options:{scales:{y:{min:16}},barThickness:30,barPercentage:.5,borderRadius:5}}),st={type:"bar",data:{labels:["cow","buffallo","Ghee"],datasets:[{label:"# of Votes",data:[122,99,23],backgroundColor:["rgba(255, 99, 132, 0.2)","rgba(54, 162, 235, 0.2)","rgba(255, 206, 86, 0.2)"],borderColor:["rgba(255, 99, 132, 1)","rgba(54, 162, 235, 1)","rgba(255, 206, 86, 1)"],borderWidth:1}]},options:{scales:{y:{min:19}},barThickness:50,barPercentage:.8,borderRadius:5}},nt={type:"doughnut",data:{labels:["agent 1","agent 2","agent 3","agent 4"],datasets:[{label:"Dataset 1",data:[5,23,10,6],backgroundColor:["red","orange","yellow","green"].map((function(e){return e}))}]},options:{cutout:"80%",responsive:!0,plugins:{legend:{position:"top"},title:{display:!0,text:"Chart.js Pie Chart"}}}};function at(){var e=Object(n.useState)(null),t=Object(i.a)(e,2),s=t[0],a=t[1],c=Object(n.useRef)(null),r=Object(n.useRef)(null),l=Object(n.useRef)(null),o=function(e,t){s.data.datasets[e].data=t,s.update()};return Object(n.useEffect)((function(){c&&c.current&&new Ke.a(c.current,nt)}),[c]),Object(n.useEffect)((function(){if(r&&r.current){var e=new Ke.a(r.current,tt);a(e)}}),[r]),Object(n.useEffect)((function(){if(l&&l.current){var e=new Ke.a(l.current,st);a(e)}}),[l]),Object(d.jsxs)("div",{className:"Statistics__main-container main-container",children:[Object(d.jsxs)("div",{className:"Orders__main-heading",children:[Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(et,{})," ","  "," Admin Panel"]}),Object(d.jsx)("div",{})]}),Object(d.jsx)("form",{className:"",noValidate:!0,children:Object(d.jsx)(m.a,{id:"date",label:"Date ",type:"date",defaultValue:(new Date).toLocaleDateString("fr-CA"),InputLabelProps:{shrink:!0}})}),Object(d.jsxs)("div",{children:[Object(d.jsxs)("div",{onClick:function(e){o(0,[15,39,13,5,2,38])},children:[Object(d.jsx)("br",{}),"Daily Milk Delivery Quantity (total delivered on this date)",Object(d.jsx)("canvas",{ref:r})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("br",{}),Object(d.jsx)("br",{}),Object(d.jsx)("br",{}),Object(d.jsx)("br",{}),"Per Agent Milk Delivery Quantity (total delivered by selected Agent today/any day selection from Calender drop down)"]}),Object(d.jsx)("div",{className:"Statistics__donough",children:Object(d.jsx)("canvas",{ref:c})}),Object(d.jsxs)("div",{children:[Object(d.jsx)("br",{}),Object(d.jsx)("br",{}),Object(d.jsx)("br",{}),Object(d.jsx)("br",{})," Daily Milk Delivery Quantity by Type last month (cow/buffallo / ghee)"]}),Object(d.jsx)("canvas",{ref:l})]})]})}var ct=s(624),rt=s(625),it=s(626),lt=s(618),ot=s(309),dt=s.n(ot),ut=s(609),jt=s(319),bt=s.p+"static/media/unchecked.3fb05906.svg",Ot=s.p+"static/media/checked.4f7f3053.svg",ht=Object(d.jsx)("img",{src:bt,alt:"dsd",fontSize:"small"}),mt=Object(d.jsx)("img",{src:Ot,alt:"dsds",fontSize:"small"});function ft(e){var t=Array(100).fill().map((function(e,t){return t+1}));return Object(d.jsx)("div",{className:"AssignUsers__main",children:Object(d.jsx)(ut.a,{id:"checkboxes-tags-demo",onChange:function(t,s){return e.handleData(t,s,"quantity")},options:t,getOptionLabel:function(e){return e.toString()},renderOption:function(e,t,s){var n=s.selected;return Object(d.jsxs)("li",Object(ae.a)(Object(ae.a)({},e),{},{children:[Object(d.jsx)(jt.a,{icon:ht,checkedIcon:mt,style:{marginRight:8},checked:n}),t]}))},renderInput:function(e){return Object(d.jsx)(m.a,Object(ae.a)(Object(ae.a)({},e),{},{label:"Select quantity",placeholder:"quantity"}))}})})}s(530);function vt(e){var t=Object(o.h)(),s=Object(n.useState)(null),a=Object(i.a)(s,2),c=a[0],r=a[1],l=Object(n.useState)(""),u=Object(i.a)(l,2),b=u[0],O=u[1],h=Object(n.useContext)(j),m=Object(n.useState)(!1),f=Object(i.a)(m,2),v=f[0],p=f[1],g=h.access_token,x=Object(n.useState)({lat:0,long:0}),y=Object(i.a)(x,2),N=y[0],w=y[1],S=function(){var s=Object(ce.a)(ie.a.mark((function s(n){var a;return ie.a.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(n){s.next=2;break}return s.abrupt("return");case 2:if(p(!0),n!==e.currentUser.user_id){s.next=12;break}return a={listDeliveries:[{delivery_id:e.currentUser.delivery_id||"na",delivery_type:e.currentUser.del_type||"na",product_type:e.currentUser.product_type,quantity:c||e.currentUser.quantity,user_id:n,delivery_date:(new Date).toISOString()}]},s.next=7,O(n);case 7:return s.next=9,Z(a,g).then((function(s){alert("success"),e.clearCurrentUser(),t("/")})).catch((function(e){alert("failed")}));case 9:p(!1),s.next=14;break;case 12:alert("Wrong User Selected"),p(!1);case 14:case"end":return s.stop()}}),s)})));return function(e){return s.apply(this,arguments)}}(),k=function(t){t.preventDefault();navigator.geolocation.getCurrentPosition((function(e){var t=e.coords;w({lat:t.latitude,long:t.longitude}),console.log("Your current position is:"),console.log("Latitude : ".concat(t.latitude)),console.log("Longitude: ".concat(t.longitude)),console.log("More or less ".concat(t.accuracy," meters."))}),(function(e){console.warn("ERROR(".concat(e.code,"): ").concat(e.message))}),{enableHighAccuracy:!0,timeout:5e3,maximumAge:0}),function(e,t,s){return _({method:"POST",url:"agentuser/".concat(s,"/updatedUserDeliveryDetails"),data:t,headers:{access_token:e}})}(g,N,e.currentUser.delivery_id).then((function(e){console.log("user location updated")})).catch((function(e){console.log(e)}))};return Object(d.jsx)(d.Fragment,{children:v?Object(d.jsxs)("div",{className:"Agents__spinners",children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsx)(ct.a,{className:"container",children:Object(d.jsxs)(rt.a,{children:[Object(d.jsx)("div",{className:"QRScanner__heading",children:"For change in quantity select here"}),Object(d.jsx)(ft,{handleData:function(e,t){e.preventDefault(),r(t)}}),Object(d.jsx)("div",{onClick:function(e){return k(e)},className:"QRScanner__location",children:"Click Here to Update Location"}),Object(d.jsx)(it.a,{children:Object(d.jsx)(lt.a,{container:!0,spacing:2,children:Object(d.jsxs)(lt.a,{item:!0,xl:4,lg:4,md:6,sm:12,xs:12,children:[Object(d.jsx)("h3",{children:"Qr Code Scan by Camera"}),Object(d.jsx)(dt.a,{delay:300,style:{width:"100%"},onError:function(e){console.log(e)},onScan:S}),Object(d.jsxs)("h3",{children:["User ID: ",b]})]})})})]})})})}function pt(e){var t=["booked","delivered_morning","delivered_evening","cancelled","intransit","pickedup"],s=function(e){var s=t[e];return s||"Not Available"},n=function(t){var s=e.deliveryTypes.find((function(e){return e.delivery_type===t}));return s&&s.name};return Object(d.jsx)(d.Fragment,{children:e.products.map((function(t,a){return Object(d.jsx)("div",{children:"booked"===s(t.delivery_status)?Object(d.jsxs)("div",{children:[" ",Object(d.jsxs)("div",{className:"Deliveries__products-row",children:[Object(d.jsx)("div",{className:"Orders__product-id",children:"Delivery Status"}),Object(d.jsx)("div",{onClick:function(s){return function(t,s,n,a,c,r){t.preventDefault(),e.setCurrentUser({delivery_id:s,user_id:n,quantity:a,del_type:c,product_type:r})}(s,e.delivery_id,e.user_id,t.quantity,t.delivery_type,t.product_type)},className:"Orders__status "+(c=s(t.delivery_status),"booked"===c?"Orders__blue":"delivered_morning"===c||"delivered_evening"===c?"Orders__green":"cancelled"===c?"Orders__red":"intransit"===c?"Orders__orange":"pickedup"===c?"Orders__yellow":"Orders__grey"),children:s(t.delivery_status)})]}),Object(d.jsxs)("div",{className:"Orders__products-row",children:[Object(d.jsx)("div",{className:"Orders__product-id",children:"Products"}),Object(d.jsxs)("div",{className:"Orders__product",children:[t.name," - ",t.quantity]})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Price "}),Object(d.jsxs)("div",{className:"cust-idnumber",children:[" ","\u20b9 ",t.price,"/-"," "]})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Delivery Type"}),Object(d.jsx)("div",{className:"cust-idnumber",children:n(t.delivery_type)})]})]}):Object(d.jsx)("div",{className:"Deliveries__products-row",children:"Already Delivered"})},a);var c}))})}function _t(e){var t=Object(n.useState)(null),s=Object(i.a)(t,2),a=s[0],c=s[1],r=function(){c(null)};return Object(d.jsx)(d.Fragment,{children:a?Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)(I,{isVisible:a,clearCurrentUser:r}),Object(d.jsx)(vt,{currentUser:a,clearCurrentUser:r})]}):Object(d.jsx)("div",{className:"Orders__card-container",children:e.deliveries.map((function(t,s){return Object(d.jsxs)(A.a,{className:"Orders__order",elevation:2,children:[Object(d.jsxs)("div",{className:"Orders__cust-id Orders__date-address-row",children:[Object(d.jsx)("span",{children:Object(d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"currentColor",className:"bi bi-person",viewBox:"0 0 16 16",children:Object(d.jsx)("path",{d:"M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"})})}),"\xa0 ",t.id]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Customer"}),Object(d.jsx)("div",{className:"cust-idnumber",children:t.UserDetail.name})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Customer Ph"}),Object(d.jsx)("div",{className:"cust-idnumber",children:t.UserDetail.phone_no})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Address"}),Object(d.jsx)("div",{className:"Orders__address",children:t.UserDetail.address})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Google Location"}),Object(d.jsx)("div",{onClick:function(e){return function(e,t,s){e.preventDefault();var n="https://www.google.com/maps/search/?api=1&query= ".concat(t," , ").concat(s),a=window.open(n,"_blank","noopener,noreferrer");a&&(a.opener=null)}(e,t.lat,t.long)},className:"cust-idnumber Deliveries__status",children:"Click Here - Maps"})]}),Object(d.jsxs)("div",{className:"Orders__customername",children:[Object(d.jsx)("div",{className:"Orders__cust-heading",children:"Ring Bell"}),Object(d.jsx)("div",{className:"Deliveries__status "+(n=Boolean(t.ring_bell).toString(),"true"===n?"Orders__green":"false"===n?"Orders__red":void 0),children:Boolean(t.ring_bell).toString()})]}),Object(d.jsx)(pt,{products:t.products,delivery_id:t.delivery_id,user_id:t.user_id,deliveryTypes:e.deliveryTypes,setCurrentUser:c})]},s);var n}))})})}s(298);function gt(){var e=Object(n.useContext)(j),t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=e.access_token,l=e.userDetails,o=e.refreshAccessToken,u=Object(n.useState)([]),b=Object(i.a)(u,2),O=b[0],h=b[1],m=Object(n.useState)(!1),f=Object(i.a)(m,2),v=f[0],p=f[1];return Object(n.useEffect)((function(){p(!0),function(e,t){return _({method:"GET",url:"agent/".concat(e,"/listDeliveries"),headers:{access_token:t}})}(l.user_id,r).then((function(e){c(e.data.data)})).catch((function(e){p(!0),e&&e.response&&401===e.response.status&&o()})),K(r).then((function(e){h(e.data.data),p(!1)})).catch((function(e){p(!0)}))}),[l.user_id,r,o]),Object(d.jsxs)("div",{className:"main-container",children:[Object(d.jsx)("div",{className:"Orders__main-heading",children:Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(R,{})," ","  "," Agent Deliveries"]})}),Object(d.jsx)("div",{children:v&&!a.length?Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})]}):Object(d.jsx)(_t,{agent:e.userDetails.name,deliveryTypes:O,deliveries:a})})]})}var xt=s.p+"static/media/cancel.c228d75b.svg",yt=s.p+"static/media/pencil.0c835751.svg",Nt=s.p+"static/media/save.f8c222ed.svg";function wt(e){var t=Object(n.useState)(e.deliverytype),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(!1),l=Object(i.a)(r,2),o=l[0],u=l[1],j=function(e,t){switch(e.preventDefault(),t){case 1:return c(Object(ae.a)(Object(ae.a)({},a),{},{name:e.target.value}));case 2:return c(Object(ae.a)(Object(ae.a)({},a),{},{description:e.target.value}));default:return}},b=function(t){t.preventDefault();var s,n,c,r={name:a.name,description:a.description};s=e.access_token,n=r,c=a.id,_({method:"POST",url:"deliverytype/".concat(c,"/updatedeliverytype"),headers:{access_token:s},data:n}),u(!1)};return Object(d.jsxs)(A.a,{className:"Deliveries__types-container",elevation:2,children:[o===a.id?Object(d.jsxs)("div",{children:[Object(d.jsx)("input",{className:"Deliveries__edit-input",onChange:function(e){return j(e,1)},value:a.name}),Object(d.jsx)("input",{className:"Deliveries__edit-input",onChange:function(e){return j(e,2)},value:a.description})]}):Object(d.jsxs)("div",{className:"Deliveries__types-container",children:[a.name," : ",a.description]}),Object(d.jsx)("div",{className:"Deliveries__types-container-img",children:o===a.id?Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)("img",{className:"Deliveries__types-svg",src:Nt,alt:"save",onClick:function(e){return b(e)}}),Object(d.jsx)("img",{className:"Deliveries__types-svg",src:xt,alt:"cancel",onClick:function(t){return function(t){t.preventDefault(),c(e.deliverytype),u(!1)}(t)}})]}):Object(d.jsx)(d.Fragment,{children:Object(d.jsx)("img",{className:"Deliveries__types-svg",onClick:function(e){return function(e,t){e.preventDefault(),u(t)}(e,a.id)},src:yt,alt:"delete"})})})]})}function St(){var e=Object(n.useContext)(j),t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(!1),l=Object(i.a)(r,2),o=l[0],u=l[1],b=Object(n.useState)(null),O=Object(i.a)(b,2),h=O[0],m=O[1],f=Object(n.useState)(null),v=Object(i.a)(f,2),p=v[0],g=v[1];Object(n.useEffect)((function(){e.access_token&&K(e.access_token).then((function(e){c(e.data.data)})).catch((function(t){console.log(t),t&&t.response&&401===t.response.status&&e.refreshAccessToken()}))}),[e.access_token,e,o]);var x=function(t){if(t.preventDefault(),h&&p){var s={name:h,description:p};(function(e,t){return _({method:"POST",url:"deliverytype/adddeliverytype",data:t,headers:{access_token:e}})})(e.access_token,s).then((function(e){(e.status=200)&&u(!o),m(""),g("")}))}};return Object(d.jsxs)("div",{className:"main-container",children:[Object(d.jsxs)("div",{className:"Orders__main-heading",children:[Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(Be,{})," ","  "," Delivery Types"]}),Object(d.jsx)("div",{children:Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(e){return function(e){e.preventDefault(),u(!o)}(e)},children:o?"Cancel Adding":"Add new Delivery Type"})})]}),o?Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{className:"Login__input-focus-effect",placeholder:"name",type:"text",value:h,onChange:function(e){return m(e.target.value)}})}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("input",{className:"Login__input-focus-effect",placeholder:"description",type:"text",value:p,onChange:function(e){return g(e.target.value)}})}),Object(d.jsx)("div",{className:"Login__col-3",children:Object(d.jsx)("button",{className:"Users__refresh-button",onClick:function(e){return x(e)},children:"Submit"})})]}):a.map((function(t,s){return Object(d.jsx)(wt,{access_token:e.access_token,deliverytype:t},s)}))]})}var kt=s(614),Dt=s(620),Ct=s(612),At=s(102),Pt=s(619),Lt=(s(531),Object(d.jsx)("img",{src:bt,alt:"dsd",fontSize:"small"})),Ut=Object(d.jsx)("img",{src:Ot,alt:"dsds",fontSize:"small"});function Tt(e){var t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=e.access_token,l=e.refreshAccessToken,o=e.handlePData;return Object(n.useEffect)((function(){J(1,r).then((function(e){c(e.data.data)})).catch((function(e){e&&e.response&&401===e.response.status&&l()}))}),[r,l]),Object(d.jsx)("div",{className:"AssignUsers__main",children:Object(d.jsx)(ut.a,{id:"checkboxes-tags-demo",onChange:function(e,t){return o(e,t)},options:a,getOptionLabel:function(e){return e.name},renderOption:function(e,t,s){var n=s.selected;return Object(d.jsxs)("li",Object(ae.a)(Object(ae.a)({},e),{},{children:[Object(d.jsx)(jt.a,{icon:Lt,checkedIcon:Ut,style:{marginRight:8},checked:n}),t.name]}))},renderInput:function(e){return Object(d.jsx)(m.a,Object(ae.a)(Object(ae.a)({},e),{},{label:"Select Products",placeholder:"products"}))}})})}var Et=Object(d.jsx)("img",{src:bt,alt:"dsd",fontSize:"small"}),It=Object(d.jsx)("img",{src:Ot,alt:"dsds",fontSize:"small"});function zt(e){var t=e.access_token,s=e.refreshAccessToken,a=Object(n.useState)([]),c=Object(i.a)(a,2),r=c[0],l=c[1],o=Object(ee.useQuery)([3,t],g,{onSuccess:function(e){(null===e||void 0===e?void 0:e.data)&&l(e.data.data),console.log(o)},onError:function(e){e&&e.response&&401===e.response.status&&s()}}).isLoading;return Object(d.jsx)("div",{className:"AssignUsers__main",children:Object(d.jsx)(ut.a,{multiple:!0,id:"checkboxes-tags-demo",onChange:function(t,s){return e.handleData(t,s,"user")},options:r,getOptionLabel:function(e){return e.name},renderOption:function(e,t,s){var n=s.selected;return Object(d.jsxs)("li",Object(ae.a)(Object(ae.a)({},e),{},{children:[Object(d.jsx)(jt.a,{icon:Et,checkedIcon:It,style:{marginRight:8},checked:n}),t.name]}))},renderInput:function(e){return Object(d.jsx)(m.a,Object(ae.a)(Object(ae.a)({},e),{},{label:"Select Users",placeholder:"Users"}))}})})}var qt=Object(d.jsx)("img",{src:bt,alt:"dsd",fontSize:"small"}),Mt=Object(d.jsx)("img",{src:Ot,alt:"dsds",fontSize:"small"});function Ft(e){var t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=e.access_token,l=e.refreshAccessToken,o=Object(ee.useQuery)([2,r],g,{onSuccess:function(e){(null===e||void 0===e?void 0:e.data)&&c(e.data.data),console.log(o)},onError:function(e){e&&e.response&&401===e.response.status&&l()}}).isLoading;return Object(d.jsx)("div",{className:"AssignUsers__main",children:Object(d.jsx)(ut.a,{onChange:function(t,s){return e.handleData(t,s.user_id,"agent")},id:"checkboxes-tags-demo",options:a,getOptionLabel:function(e){return e.name},renderOption:function(e,t,s){var n=s.selected;return Object(d.jsxs)("li",Object(ae.a)(Object(ae.a)({},e),{},{children:[Object(d.jsx)(jt.a,{icon:qt,checkedIcon:Mt,style:{marginRight:8},checked:n}),t.name]}))},renderInput:function(e){return Object(d.jsx)(m.a,Object(ae.a)(Object(ae.a)({},e),{},{label:"Select Agents",placeholder:"Agents"}))}})})}var Rt=Object(d.jsx)("img",{src:bt,alt:"dsd",fontSize:"small"}),Ht=Object(d.jsx)("img",{src:Ot,alt:"dsds",fontSize:"small"});function Vt(e){var t=Object(n.useState)([]),s=Object(i.a)(t,2),a=s[0],c=s[1],r=e.access_token,l=e.refreshAccessToken;return Object(n.useEffect)((function(){K(r).then((function(e){c(e.data.data)})).catch((function(e){e&&e.response&&401===e.response.status&&l()}))}),[r,l]),Object(d.jsx)("div",{className:"AssignUsers__main",children:Object(d.jsx)(ut.a,{id:"checkboxes-tags-demo",onChange:function(t,s){return e.handleData(t,s.delivery_type,"delivery_type")},options:a,getOptionLabel:function(e){return e.name},renderOption:function(e,t,s){var n=s.selected;return Object(d.jsxs)("li",Object(ae.a)(Object(ae.a)({},e),{},{children:[Object(d.jsx)(jt.a,{icon:Rt,checkedIcon:Ht,style:{marginRight:8},checked:n}),t.name]}))},renderInput:function(e){return Object(d.jsx)(m.a,Object(ae.a)(Object(ae.a)({},e),{},{label:"Select deliver type",placeholder:"delivery_type"}))}})})}function Bt(){var e=Object(n.useContext)(j),t=Object(n.useState)(!1),s=Object(i.a)(t,2),a=s[0],c=s[1],r=Object(n.useState)(!1),l=Object(i.a)(r,2),o=l[0],u=l[1],b=Object(n.useState)(0),O=Object(i.a)(b,2),h=O[0],m=O[1],f=Object(n.useState)({agent_id:"",users:"",quantity:"",delivery_type:"",product_type:"",price:""}),v=Object(i.a)(f,2),p=v[0],g=v[1],x=["Select Agent","Select User","Select Product","Select Quantity","Select Delivery type"],y=function(t){t.preventDefault(),c(!0);var s=p.users.map((function(e){return e.user_id})),n=[];s.map((function(e){return n.push({user_id:e,quantity:p.quantity,delivery_type:p.delivery_type,product_type:p.product_type,price:p.price})}));var a,r,i={agent_id:p.agent_id,assignlist:n};(a=e.access_token,r=i,_({method:"POST",url:"/agentuser/assignUser",headers:{access_token:a},data:r})).then((function(e){g({agent_id:"",users:"",quantity:"",delivery_type:"",product_type:"",price:""}),m(0),c(!1),alert("successfully saved")})).catch((function(e){c(!1),alert("Please try again")}))};var N=function(e,t,s){e&&e.preventDefault(),"agent"===s&&g(Object(ae.a)(Object(ae.a)({},p),{},{agent_id:t})),"user"===s&&g(Object(ae.a)(Object(ae.a)({},p),{},{users:t})),"delivery_type"===s&&g(Object(ae.a)(Object(ae.a)({},p),{},{delivery_type:t})),"quantity"===s&&g(Object(ae.a)(Object(ae.a)({},p),{},{quantity:t})),u(!0)},w=function(e,t){e.preventDefault(),g(Object(ae.a)(Object(ae.a)({},p),{},{price:t.price,product_type:t.product_type})),u(!0)};return Object(d.jsxs)("div",{className:"main-container",children:[Object(d.jsx)("div",{className:"Orders__main-heading",children:Object(d.jsxs)("div",{className:"General-main-heading",children:[Object(d.jsx)(ve,{})," ","  "," Assign Users to Agents"]})}),a?Object(d.jsxs)(d.Fragment,{children:[" ",Object(d.jsx)(Q,{}),Object(d.jsx)(W.a,{animation:"wave",height:100,width:"80%"}),Object(d.jsx)(W.a,{variant:"rectangular",animation:"wave",width:210,height:118})," "]}):Object(d.jsxs)(A.a,{className:"AssignUsers__sub",elevation:2,children:[Object(d.jsx)(kt.a,{alternativeLabel:!0,activeStep:h,children:x.map((function(e,t){return Object(n.createElement)(Dt.a,Object(ae.a)(Object(ae.a)({},{}),{},{key:t}),Object(d.jsx)(Ct.a,Object(ae.a)(Object(ae.a)({},{}),{},{children:e})))}))}),h===x.length?Object(d.jsx)(Pt.a,{variant:"h4",align:"center",children:"Agent Assigned to User Successfully"}):Object(d.jsxs)(d.Fragment,{children:[Object(d.jsx)("form",{children:function(t){switch(t){case 0:return Object(d.jsx)(d.Fragment,{children:Object(d.jsx)(Ft,{access_token:e.access_token,refreshAccessToken:e.refreshAccessToken,handleData:N})});case 1:return Object(d.jsx)(d.Fragment,{children:Object(d.jsx)(zt,{handleData:N,refreshAccessToken:e.refreshAccessToken,access_token:e.access_token})});case 2:return Object(d.jsx)(d.Fragment,{children:Object(d.jsx)(Tt,{handlePData:w,refreshAccessToken:e.refreshAccessToken,access_token:e.access_token})});case 3:return Object(d.jsx)(d.Fragment,{children:Object(d.jsx)(ft,{handleData:N,refreshAccessToken:e.refreshAccessToken,access_token:e.access_token})});case 4:return Object(d.jsx)(d.Fragment,{children:Object(d.jsx)(Vt,{handleData:N,refreshAccessToken:e.refreshAccessToken,access_token:e.access_token})});default:return"unknown step"}}(h)}),Object(d.jsx)(At.a,{disabled:0===h,onClick:function(){m(h-1)},children:"Back"}),Object(d.jsx)(At.a,{className:"",variant:"contained",disabled:!o,color:"primary",onClick:function(e){return h===x.length-1?y(e):(o&&m(h+1),void u(!1))},children:h===x.length-1?"Submit":"Next"})]})]})]})}s(532);var Gt,Qt=["title","titleId"];function Wt(){return Wt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},Wt.apply(this,arguments)}function Jt(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function Kt(e,t){var s=e.title,a=e.titleId,c=Jt(e,Qt);return n.createElement("svg",Wt({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-gear-wide-connected",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,Gt||(Gt=n.createElement("path",{d:"M7.068.727c.243-.97 1.62-.97 1.864 0l.071.286a.96.96 0 0 0 1.622.434l.205-.211c.695-.719 1.888-.03 1.613.931l-.08.284a.96.96 0 0 0 1.187 1.187l.283-.081c.96-.275 1.65.918.931 1.613l-.211.205a.96.96 0 0 0 .434 1.622l.286.071c.97.243.97 1.62 0 1.864l-.286.071a.96.96 0 0 0-.434 1.622l.211.205c.719.695.03 1.888-.931 1.613l-.284-.08a.96.96 0 0 0-1.187 1.187l.081.283c.275.96-.918 1.65-1.613.931l-.205-.211a.96.96 0 0 0-1.622.434l-.071.286c-.243.97-1.62.97-1.864 0l-.071-.286a.96.96 0 0 0-1.622-.434l-.205.211c-.695.719-1.888.03-1.613-.931l.08-.284a.96.96 0 0 0-1.186-1.187l-.284.081c-.96.275-1.65-.918-.931-1.613l.211-.205a.96.96 0 0 0-.434-1.622l-.286-.071c-.97-.243-.97-1.62 0-1.864l.286-.071a.96.96 0 0 0 .434-1.622l-.211-.205c-.719-.695-.03-1.888.931-1.613l.284.08a.96.96 0 0 0 1.187-1.186l-.081-.284c-.275-.96.918-1.65 1.613-.931l.205.211a.96.96 0 0 0 1.622-.434l.071-.286zM12.973 8.5H8.25l-2.834 3.779A4.998 4.998 0 0 0 12.973 8.5zm0-1a4.998 4.998 0 0 0-7.557-3.779l2.834 3.78h4.723zM5.048 3.967c-.03.021-.058.043-.087.065l.087-.065zm-.431.355A4.984 4.984 0 0 0 3.002 8c0 1.455.622 2.765 1.615 3.678L7.375 8 4.617 4.322zm.344 7.646.087.065-.087-.065z"})))}var Zt,$t=n.forwardRef(Kt),Yt=(s.p,["title","titleId"]);function Xt(){return Xt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},Xt.apply(this,arguments)}function es(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function ts(e,t){var s=e.title,a=e.titleId,c=es(e,Yt);return n.createElement("svg",Xt({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-truck",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,Zt||(Zt=n.createElement("path",{d:"M0 3.5A1.5 1.5 0 0 1 1.5 2h9A1.5 1.5 0 0 1 12 3.5V5h1.02a1.5 1.5 0 0 1 1.17.563l1.481 1.85a1.5 1.5 0 0 1 .329.938V10.5a1.5 1.5 0 0 1-1.5 1.5H14a2 2 0 1 1-4 0H5a2 2 0 1 1-3.998-.085A1.5 1.5 0 0 1 0 10.5v-7zm1.294 7.456A1.999 1.999 0 0 1 4.732 11h5.536a2.01 2.01 0 0 1 .732-.732V3.5a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5v7a.5.5 0 0 0 .294.456zM12 10a2 2 0 0 1 1.732 1h.768a.5.5 0 0 0 .5-.5V8.35a.5.5 0 0 0-.11-.312l-1.48-1.85A.5.5 0 0 0 13.02 6H12v4zm-9 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm9 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})))}var ss,ns,as=n.forwardRef(ts),cs=(s.p,["title","titleId"]);function rs(){return rs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},rs.apply(this,arguments)}function is(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function ls(e,t){var s=e.title,a=e.titleId,c=is(e,cs);return n.createElement("svg",rs({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-person-plus",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,ss||(ss=n.createElement("path",{d:"M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H1s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C9.516 10.68 8.289 10 6 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"})),ns||(ns=n.createElement("path",{fillRule:"evenodd",d:"M13.5 5a.5.5 0 0 1 .5.5V7h1.5a.5.5 0 0 1 0 1H14v1.5a.5.5 0 0 1-1 0V8h-1.5a.5.5 0 0 1 0-1H13V5.5a.5.5 0 0 1 .5-.5z"})))}var os=n.forwardRef(ls);s.p;function ds(e){var t,s=Object(n.useContext)(j),a=Object(n.useState)([{title:"Orders",value:"orders"},{title:"Users",value:"users"},{title:"Agents",value:"agents"},{title:"Products",value:"products"},{value:"assign_users",title:"Assign Users"},{value:"delivery_type",title:"Delivery Types"},{value:"settings",title:"Account"}]),c=Object(i.a)(a,1)[0],r=Object(n.useState)([{title:"Deliveries",value:"deliveries"},{title:"settings",value:"settings"}]),l=Object(i.a)(r,1)[0],u=Object(o.h)(),b=Object(n.useRef)(),O=Object(n.useState)(Boolean(window.innerWidth>1025)),h=Object(i.a)(O,1)[0],m=Object(n.useRef)(null);t=m,Object(n.useEffect)((function(){function e(e){h||!t.current||t.current.contains(e.target)||(b.current.checked=!1)}return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[t]);var f=function(e){switch(e.toString()){case"1":return Object(d.jsx)(R,{style:{color:"white"}});case"2":return Object(d.jsx)(ve,{style:{color:"white"}});case"3":return Object(d.jsx)(Be,{style:{color:"white"}});case"4":return Object(d.jsx)(Ue,{style:{color:"white"}});case"5":return Object(d.jsx)(os,{style:{color:"white"}});case"6":return Object(d.jsx)(as,{style:{color:"white"}});default:return Object(d.jsx)($t,{style:{color:"white"}})}},v=s.isAdmin?c:l;return Object(d.jsxs)("div",{ref:m,className:"Navbar__header",children:[Object(d.jsxs)("div",{children:[Object(d.jsx)("input",{type:"checkbox",defaultChecked:h,ref:b,className:"openSidebarMenu",id:"openSidebarMenu"}),Object(d.jsxs)("label",{htmlFor:"openSidebarMenu",className:"Navbar__sidebarIconToggle",children:[Object(d.jsx)("div",{className:"spinner diagonal part-1"}),Object(d.jsx)("div",{className:"spinner horizontal"}),Object(d.jsx)("div",{className:"spinner diagonal part-2"})]}),Object(d.jsxs)("div",{id:"sidebarMenu",className:"Navbar__sidebarMenu",children:[Object(d.jsxs)("div",{className:"Navbar__sidebarMenu-header",children:[s.isAdmin?"Admin":"Agent"," Dashboard ",Object(d.jsx)("br",{}),Object(d.jsx)("span",{children:"Have a Happy Day "})]}),Object(d.jsx)("ul",{className:"Navbar__sidebarMenu-inner",children:v.map((function(e,t){return Object(d.jsx)("li",{onClick:function(t){return function(e,t){e.preventDefault(),u(t),h||(b.current.checked=!1)}(t,e.value)},children:Object(d.jsxs)("div",{className:"Navbar__sideMenu-icons",children:[s.isAdmin?f(t+1):(n=t+1,"1"===n.toString()?Object(d.jsx)(as,{style:{color:"white"}}):Object(d.jsx)($t,{style:{color:"white"}})),Object(d.jsx)("span",{className:"Navbar__sideMenu-icons-img",children:e.title})]})},t);var n}))})]})]}),Object(d.jsx)("div",{onClick:function(e){return function(e){return e.preventDefault(),u("/")}(e)},className:"Navbar__component-name",children:Object(d.jsx)("img",{height:"80px",width:"150px",src:S,alt:"Daily"})}),Object(d.jsxs)("div",{onClick:function(e){return e.preventDefault(),localStorage.clear(),sessionStorage.clear(),s.setIsLoggedIn(!1),s.setAccessToken(null),s.setIsAdmin(!1),s.setRefreshToken(null),u("/")},className:"Navbar__logout-container",children:[Object(d.jsx)("div",{className:"Navbar__logout-image",children:Object(d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",fill:"white",className:"bi bi-person-circle",viewBox:"0 0 16 16",children:[Object(d.jsx)("path",{d:"M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"}),Object(d.jsx)("path",{fillRule:"evenodd",d:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"})]})}),Object(d.jsx)("div",{className:"Navbar__logout-text",children:"LOGOUT"})]})]})}var us,js=s(551),bs=s(608),Os=s(621),hs=s(622),ms=["title","titleId"];function fs(){return fs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},fs.apply(this,arguments)}function vs(e,t){if(null==e)return{};var s,n,a=function(e,t){if(null==e)return{};var s,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)s=c[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function ps(e,t){var s=e.title,a=e.titleId,c=vs(e,ms);return n.createElement("svg",fs({xmlns:"http://www.w3.org/2000/svg",width:25,height:25,fill:"currentColor",className:"bi bi-house-door",viewBox:"0 0 16 16",ref:t,"aria-labelledby":a},c),s?n.createElement("title",{id:a},s):null,us||(us=n.createElement("path",{d:"M8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4.5a.5.5 0 0 0 .5-.5v-4h2v4a.5.5 0 0 0 .5.5H14a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146zM2.5 14V7.707l5.5-5.5 5.5 5.5V14H10v-4a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v4H2.5z"})))}var _s=n.forwardRef(ps);s.p;function gs(e){var t=Object(n.useContext)(j),s=Object(n.useState)(0),a=Object(i.a)(s,2),c=a[0],r=a[1],l=Object(o.h)(),u=Object(n.useRef)(null),b=function(e,s){switch(e.preventDefault(),s.toString()){case"0":default:return l("/");case"1":return t.isAdmin?l("orders"):l("deliveries");case"2":return l("settings")}};return Object(d.jsxs)(js.a,{sx:{pb:7},ref:u,children:[Object(d.jsx)(bs.a,{}),Object(d.jsx)(A.a,{sx:{position:"fixed",bottom:0,left:0,right:0},elevation:3,children:Object(d.jsxs)(Os.a,{showLabels:!0,value:c,onChange:function(e,t){b(e,t),r(t)},children:[Object(d.jsx)(hs.a,{label:"Home",icon:Object(d.jsx)(_s,{style:{color:"#90a0ee"}})}),Object(d.jsx)(hs.a,{label:"Deliveries",icon:Object(d.jsx)(as,{style:{color:"#90a0ee"}})}),Object(d.jsx)(hs.a,{label:"Account",icon:Object(d.jsx)($t,{style:{color:"#90a0ee"}})})]})})]})}s(533);function xs(){var e=Object(n.useContext)(j);return Object(d.jsx)("div",{children:e.isAdmin?Object(d.jsx)(o.a,{to:"/statistics"}):Object(d.jsx)(o.a,{to:"/deliveries"})})}var ys=s.p+"static/media/404.0c2be578.gif";function Ns(){return Object(d.jsxs)("div",{className:"main-container",children:["Not found",Object(d.jsx)(l.b,{to:"/",children:"Home"}),Object(d.jsx)("img",{height:"500px",width:"400px",src:ys,alt:"Daily"})," "]})}var ws=s(311);function Ss(){var e=JSON.parse(localStorage.getItem("loggedIn")),t=JSON.parse(localStorage.getItem("isAdmin")),s=sessionStorage.getItem("access_token"),a=localStorage.getItem("refresh_token"),c=JSON.parse(localStorage.getItem("userDetails")),r=Object(n.useState)(c||{}),b=Object(i.a)(r,2),O=b[0],h=b[1],m=Object(n.useState)(e||!1),f=Object(i.a)(m,2),v=f[0],p=f[1],g=Object(n.useState)(t||!1),x=Object(i.a)(g,2),y=x[0],N=x[1],w=Object(n.useState)(s||null),S=Object(i.a)(w,2),k=S[0],C=S[1],A=Object(n.useState)(a||null),P=Object(i.a)(A,2),L=P[0],U=P[1];Object(n.useEffect)((function(){if(!k)return localStorage.setItem("loggedIn",Boolean(!1));localStorage.setItem("loggedIn",Boolean(v))}),[v,k]),Object(n.useEffect)((function(){if(!k)return localStorage.setItem("loggedIn",Boolean(!1));localStorage.setItem("isAdmin",Boolean(y))}),[y,k]),Object(n.useEffect)((function(){localStorage.setItem("userDetails",JSON.stringify(O))}),[O]),Object(n.useEffect)((function(){sessionStorage.setItem("access_token",k)}),[k]),Object(n.useEffect)((function(){localStorage.setItem("refresh_token",L)}),[L]);var T={isLoggedIn:v,access_token:k,refresh_token:L,isAdmin:y,userDetails:O,refreshAccessToken:function(){var e;(e=L,_({method:"POST",url:"oauth/token",headers:{grant_type:"refresh",refresh_token:e}})).then((function(e){C(e.data.access_token)}))},setIsLoggedIn:p,setAccessToken:C,setIsAdmin:N,setRefreshToken:U,saveuserDetails:function(e){h(e)}};return Object(d.jsxs)(l.a,{children:[Object(d.jsxs)(j.Provider,{value:T,children:[v?Object(d.jsx)(ds,{}):Object(d.jsx)(d.Fragment,{children:" "}),Object(d.jsxs)(o.e,{children:[Object(d.jsxs)(o.c,{exact:!0,path:"/",element:Object(d.jsx)(u,{}),children:[Object(d.jsx)(o.c,{exact:!0,path:"/",element:Object(d.jsx)(xs,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/users",element:Object(d.jsx)(pe,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/users/:id",element:Object(d.jsx)(ye,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/orders",element:Object(d.jsx)(te,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/orders/:id",element:Object(d.jsx)(Ne,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/agents",element:Object(d.jsx)(Ge,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/agents/:id",element:Object(d.jsx)(Qe,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/products",element:Object(d.jsx)(Te,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/products/:id",element:Object(d.jsx)(Ee,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/assign_users",element:Object(d.jsx)(Bt,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/delivery_type",element:Object(d.jsx)(St,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/settings",element:Object(d.jsx)(We,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/deliveries",element:Object(d.jsx)(gt,{})}),Object(d.jsx)(o.c,{exact:!0,path:"/statistics",element:Object(d.jsx)(at,{})})]}),Object(d.jsx)(o.c,{exact:!0,path:"/login",element:Object(d.jsx)(D,{})}),Object(d.jsx)(o.c,{path:"*",element:Object(d.jsx)(Ns,{})})]}),v?Object(d.jsx)(gs,{}):Object(d.jsx)(d.Fragment,{children:" "})]}),Object(d.jsx)(ws.ReactQueryDevtools,{})]})}var ks=function(e){e&&e instanceof Function&&s.e(3).then(s.bind(null,627)).then((function(t){var s=t.getCLS,n=t.getFID,a=t.getFCP,c=t.getLCP,r=t.getTTFB;s(e),n(e),a(e),c(e),r(e)}))},Ds=new ee.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!0,refetchOnmount:!0,refetchOnReconnect:!0,retry:!0}}});r.a.render(Object(d.jsx)(ee.QueryClientProvider,{client:Ds,children:Object(d.jsx)(a.a.StrictMode,{children:Object(d.jsx)(Ss,{})})}),document.getElementById("root")),ks()}},[[534,1,2]]]);
  //# sourceMappingURL=main.4e288522.chunk.js.map