Files
Express_console_build/build/static/js/4263.640b9077.chunk.js

1 line
10 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[4263],{14263:(e,t,r)=>{r.r(t),r.d(t,{default:()=>T});var i=r(9950),n=r(14857),o=r(47223),s=r(16491),l=r(71525),a=r(249),c=r(26050),d=r(38614),h=r(93038),x=r(83563),u=r(74745),p=r(82917),g=r(93230),v=r(82053),m=r(88060),A=r(83239),j=r(25333),f=r(82223),w=r(99624),y=r(89379),b=r(25979),k=r(2660),C=r(2046),S=r(33425),Y=r(7762),z=r(44414);const W=e=>{let{value:t,onChange:r,sx:o,placeholder:s="Search (Ctrl + K)",delay:l=300}=e;const a=(0,n.A)(),c=(0,i.useRef)(null),[d,h]=(0,i.useState)(t||"");return(0,i.useEffect)((()=>{h(t||"")}),[t]),(0,i.useEffect)((()=>{const e=setTimeout((()=>{d!==t&&r({target:{value:d}})}),l);return()=>clearTimeout(e)}),[d]),(0,i.useEffect)((()=>{const e=e=>{var t;"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),null===(t=c.current)||void 0===t||t.focus());"Escape"===e.key&&document.activeElement===c.current&&c.current.blur()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[]),(0,z.jsx)(b.A,{fullWidth:!0,children:(0,z.jsx)(k.A,{inputRef:c,placeholder:s,sx:(0,y.A)({borderRadius:0},o),value:d,onChange:e=>h(e.target.value),autoComplete:"off",size:"large",startAdornment:(0,z.jsx)(C.A,{position:"start",sx:{mr:-.5,color:a.palette.secondary.main},children:(0,z.jsx)(S.A,{})}),endAdornment:(0,z.jsx)(j.A,{sx:{visibility:d?"visible":"hidden"},onClick:()=>h(""),children:(0,z.jsx)(Y.A,{style:{fontSize:"large",color:a.palette.primary.main}})})})})};var E=r(36150),I=r(81425),M=r(10523);const R={width:"100%",height:"calc(100vh - 150px)"};function L(e){var t,r;let{riderLocations:i}=e;console.log("riderLocations",i);const n={lat:Number((null===i||void 0===i||null===(t=i[0])||void 0===t?void 0:t.latitude)||11.0056),lng:Number((null===i||void 0===i||null===(r=i[0])||void 0===r?void 0:r.longitude)||76.9661)},o={url:"https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",scaledSize:new window.google.maps.Size(25,41),anchor:new window.google.maps.Point(12,41)},s={url:"https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png",scaledSize:new window.google.maps.Size(25,41),anchor:new window.google.maps.Point(12,41)};return(0,z.jsx)(M.BH,{googleMapsApiKey:"AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8",children:(0,z.jsx)(M.u6,{mapContainerStyle:R,zoom:12,center:n,children:i&&(null===i||void 0===i?void 0:i.map(((e,t)=>{const r=Number(e.latitude),i=Number(e.longitude);return(0,z.jsxs)("div",{children:[(0,z.jsx)(M.pH,{position:{lat:r,lng:i},icon:"active"==e.status?o:s,label:{fontSize:"14px",fontWeight:"bold"}}),(0,z.jsx)(M.i3,{position:{lat:r,lng:i},mapPaneName:M.i3.OVERLAY_LAYER,children:(0,z.jsx)("div",{style:{background:"none",color:"green",padding:"2px 8px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",transform:"translate(-50%, -140%)",pointerEvents:"none",ml:20},children:(0,z.jsxs)(f.A,{variant:"contained",color:"primary",size:"small",children:[" ".concat(e.username," "),(0,z.jsx)("br",{}),"(".concat(e.orderid||"",") ")]})})})]},t)})))})})}var D=r(50027),F=r(23787),H=r(4159),K=r.n(H),_=r(96088);const N=350,T=()=>{const e=(0,n.A)(),t=(0,o.A)("(min-width:900px)"),r=(0,o.A)(e.breakpoints.down("md")),[y,b]=(0,i.useState)(!1),[k,C]=(0,i.useState)([]),[S,Y]=(0,i.useState)(""),{data:M,isLoading:R,isFetching:H,refetch:T,error:G}=(0,E.I)({queryKey:[1,K()().format("YYYY-MM-DD"),S],queryFn:I.zb,refetchInterval:3e5});return(0,i.useEffect)((()=>{C(M)}),[M]),(0,i.useEffect)((()=>{console.log("selectedRiders",k)}),[k]),(0,i.useEffect)((()=>{b(t)}),[t]),(0,z.jsx)(D.A,{content:!1,children:(0,z.jsxs)(s.A,{sx:{display:"flex",width:"100%",height:"100%",position:"relative"},children:[(0,z.jsxs)(l.Ay,{variant:t?"persistent":"temporary",open:y,onClose:()=>!t&&b(!1),ModalProps:{keepMounted:!0},sx:{"& .MuiDrawer-paper":{width:r?"100vw":N,maxWidth:r?"100vw":N,position:"absolute",left:0,top:0,height:"100%",overflowY:"auto",transition:"transform 0.35s ease-in-out",zIndex:13}},children:[(0,z.jsxs)(s.A,{sx:{position:"sticky",top:0,zIndex:1},children:[(0,z.jsx)(W,{value:S,placeholder:"Search Rider",onChange:e=>Y(e.target.value),sx:{height:60,bgcolor:"white","& .MuiOutlinedInput-notchedOutline":{borderBottom:"1px solid",borderColor:e.palette.secondary.light}}}),(0,z.jsxs)(a.A,{children:[(0,z.jsxs)(c.Ay,{sx:{cursor:"pointer","&:hover":{bgcolor:e.palette.secondary.lighter},bgcolor:"white",mt:-1},children:[(0,z.jsx)(d.A,{children:(0,z.jsx)(h.A,{checked:(null===M||void 0===M?void 0:M.length)==(null===k||void 0===k?void 0:k.length),onChange:e=>{e.target.checked&&C(M)}})}),(0,z.jsx)(x.A,{primary:"All"})]}),(0,z.jsx)(u.A,{})]})]}),(0,z.jsx)(a.A,{children:R||H?Array.from({length:10}).map(((e,t)=>(0,z.jsxs)(i.Fragment,{children:[(0,z.jsxs)(c.Ay,{sx:{py:1.5,px:2},children:[(0,z.jsx)(d.A,{children:(0,z.jsx)(p.A,{variant:"circular",width:24,height:24})}),(0,z.jsx)(x.A,{primary:(0,z.jsx)(p.A,{variant:"text",width:"60%",height:22}),secondary:(0,z.jsx)(p.A,{variant:"text",width:"40%",height:18})}),(0,z.jsxs)(g.A,{spacing:.5,textAlign:"right",children:[(0,z.jsx)(p.A,{variant:"text",width:50,height:18}),(0,z.jsx)(p.A,{variant:"text",width:80,height:16})]})]}),(0,z.jsx)(u.A,{})]},t))):!r&&(null===M||void 0===M?void 0:M.map((t=>{var r,n,o;return(0,z.jsxs)(i.Fragment,{children:[(0,z.jsxs)(c.Ay,{sx:{cursor:"pointer",py:1,px:2,borderRadius:1,"&:hover":{bgcolor:e.palette.secondary.lighter}},secondaryAction:(0,z.jsxs)(g.A,{textAlign:"right",spacing:.5,children:[(0,z.jsx)(v.A,{variant:"body2",noWrap:!0,sx:{color:"active"==t.status?"success.main":"error.main"},children:t.userid}),(0,z.jsx)(v.A,{variant:"caption",color:"text.secondary",noWrap:!0,children:K()(t.logdate).format("DD/MM/YYYY hh:mm A")})]}),children:[(0,z.jsx)(d.A,{children:(0,z.jsx)(h.A,{sx:{color:"active"==t.status?"green":"red","&.Mui-checked":{color:"active"==t.status?"green":"red"}},checked:1===(null===k||void 0===k?void 0:k.length)&&(null===(r=k[0])||void 0===r?void 0:r.userid)===(null===t||void 0===t?void 0:t.userid),onChange:e=>{e.target.checked?C([t]):C(M)}})}),(0,z.jsx)(x.A,{primary:(0,z.jsxs)(v.A,{noWrap:!0,children:[(null===(n=t.username)||void 0===n?void 0:n.slice(0,25))||"",(null===(o=t.username)||void 0===o?void 0:o.length)>25&&"..."]}),secondary:(0,z.jsx)(v.A,{variant:"caption",color:"text.secondary",noWrap:!0,children:t.contactno||"##########"})})]}),(0,z.jsx)(u.A,{})]},t.userid)})))}),r&&!R&&!H&&(0,z.jsx)(F.nV,{children:null===M||void 0===M?void 0:M.map((e=>{var t,r,i;const n="active"==e.status,o=1===(null===k||void 0===k?void 0:k.length)&&(null===(t=k[0])||void 0===t?void 0:t.userid)===(null===e||void 0===e?void 0:e.userid);return(0,z.jsx)(F.pg,{accent:n?"#10b981":"#ef4444",selected:o,header:(0,z.jsxs)(g.A,{direction:"row",alignItems:"flex-start",spacing:1,children:[(0,z.jsx)(h.A,{sx:{p:.5,color:n?"green":"red","&.Mui-checked":{color:n?"green":"red"}},checked:o,onChange:t=>{t.target.checked?C([e]):C(M)}}),(0,z.jsxs)(s.A,{sx:{minWidth:0,flexGrow:1},children:[(0,z.jsxs)(v.A,{noWrap:!0,sx:{fontWeight:600},children:[(null===(r=e.username)||void 0===r?void 0:r.slice(0,25))||"",(null===(i=e.username)||void 0===i?void 0:i.length)>25&&"..."]}),(0,z.jsx)(v.A,{variant:"caption",color:"text.secondary",noWrap:!0,children:e.contactno||"##########"})]})]}),children:(0,z.jsxs)(F.FG,{children:[(0,z.jsx)(F.pY,{label:"User ID",children:(0,z.jsx)(v.A,{sx:{fontSize:13,fontWeight:600,color:n?"success.main":"error.main"},noWrap:!0,children:e.userid})}),(0,z.jsx)(F.pY,{label:"Status",value:n?"Active":"Inactive"}),(0,z.jsx)(F.pY,{label:"Last Log",value:K()(e.logdate).format("DD/MM/YYYY hh:mm A"),full:!0})]})},e.userid)}))})]}),(0,z.jsx)(m.A,{elevation:0,position:"absolute",sx:{top:0,left:y&&t?"".concat(N,"px"):0,width:y&&t?"calc(100% - ".concat(N,"px)"):"100%",transition:"left 0.3s ease, width 0.3s ease",backgroundColor:"white",borderBottom:"1px solid",borderColor:e.palette.secondary.light},children:(0,z.jsx)(A.A,{children:(0,z.jsxs)(g.A,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{width:"100%"},children:[(0,z.jsxs)(g.A,{direction:"row",alignItems:"center",children:[(0,z.jsx)(j.A,{color:"primary",onClick:()=>b(!y),children:(0,z.jsx)(w.A,{})}),(0,z.jsx)(v.A,{variant:"h5",color:"primary",sx:{ml:2},children:"Riders Locations"})]}),(0,z.jsx)(f.A,{variant:"outlined",color:"primary",onClick:()=>{T()},children:"Refresh"})]})})}),(0,z.jsxs)(s.A,{sx:{flexGrow:1,overflow:"auto",pt:"64px",pl:y&&t?"".concat(N,"px"):0,transition:"padding-left 0.3s ease",minHeight:"80vh"},children:[(R||H)&&(0,z.jsx)(s.A,{position:"relative",width:"100%",height:"80vh",display:"grid",placeItems:"center",children:(0,z.jsx)(p.A,{variant:"rectangular",width:"100%",height:"100%",animation:"wave",sx:{position:"absolute",top:0,left:0,borderRadius:1,zIndex:1}})}),(null===k||void 0===k?void 0:k.length)>0&&(0,z.jsx)(L,{riderLocations:k}),G&&(0,z.jsx)(s.A,{sx:{width:"100% ",height:"100%"},children:(0,z.jsx)("img",{src:_,alt:"mantis",style:{height:"100%",width:"100%"}})})]})]})})}},23787:(e,t,r)=>{r.d(t,{FG:()=>u,nV:()=>h,pY:()=>p,pg:()=>x});var i=r(89379),n=r(80045),o=r(93230),s=r(2235),l=r(16491),a=r(82053),c=r(44414);const d=["children","scroll","onScroll","sx"],h=e=>{let{children:t,scroll:r=!1,onScroll:s,sx:l}=e,a=(0,n.A)(e,d);return(0,c.jsx)(o.A,(0,i.A)((0,i.A)({spacing:1.25,onScroll:s,sx:(0,i.A)((0,i.A)({p:1.5},r&&{maxHeight:"calc(100vh - 220px)",overflowY:"auto",overflowX:"hidden"}),l)},a),{},{children:t}))},x=e=>{let{accent:t="#662582",header:r,footer:n,selected:o=!1,onClick:a,children:d,sx:h}=e;return(0,c.jsxs)(s.A,{elevation:0,onClick:a,sx:(0,i.A)({position:"relative",overflow:"hidden",flexShrink:0,borderRadius:2.5,border:"1px solid",borderColor:o?t:"#e2e8f0",background:o?"".concat(t,"0a"):"#fff",boxShadow:"0 4px 14px rgba(15,23,42,0.05)",transition:"border-color 0.15s, box-shadow 0.15s"},h),children:[(0,c.jsx)(l.A,{sx:{position:"absolute",left:0,top:0,bottom:0,width:3,bgcolor:t}}),(0,c.jsxs)(l.A,{sx:{p:1.5,pl:2},children:[r,d,n]})]})},u=e=>{let{children:t,columns:r=2,sx:n}=e;return(0,c.jsx)(l.A,{sx:(0,i.A)({display:"grid",gridTemplateColumns:"repeat(".concat(r,", minmax(0, 1fr))"),gap:1,mt:1.25},n),children:t})},p=e=>{let{label:t,value:r,children:i,full:n=!1,align:o="left"}=e;return(0,c.jsxs)(l.A,{sx:{gridColumn:n?"1 / -1":"auto",minWidth:0,textAlign:o},children:[(0,c.jsx)(a.A,{sx:{fontSize:9.5,fontWeight:800,letterSpacing:.5,textTransform:"uppercase",color:"#94a3b8",lineHeight:1.4},children:t}),(0,c.jsx)(l.A,{sx:{mt:.25,minWidth:0},children:void 0!==i?i:(0,c.jsx)(a.A,{sx:{fontSize:13,fontWeight:600,color:"#0f172a"},noWrap:!0,children:null!==r&&void 0!==r?r:"\u2014"})})]})}},96088:(e,t,r)=>{e.exports=r.p+"static/media/Error500.1619a596c73d5cce4899.png"}}]);