1 line
45 KiB
JavaScript
1 line
45 KiB
JavaScript
"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[1504],{5303:(e,t,i)=>{i.d(t,{Ay:()=>g,ft:()=>u});var n=i(22555),o=i(85672),l=i(17488),s=i(86270),r=i(12010),a=i(56691),c=i(65908);const d="https://nominatim.openstreetmap.org/search",x=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=[],i=(e,i)=>{e&&t.push({long_name:e,short_name:e,types:i})};return i(e.house_number,["street_number"]),i(e.road||e.pedestrian,["route"]),i(e.suburb||e.neighbourhood||e.quarter,["sublocality_level_1","sublocality"]),i(e.city_district||e.county,["administrative_area_level_3"]),i(e.city||e.town||e.village,["locality"]),i(e.state,["administrative_area_level_1"]),i(e.country,["country"]),i(e.postcode,["postal_code"]),t},h=e=>{var t;return{formatted_address:e.display_name,name:(null===(t=e.display_name)||void 0===t?void 0:t.split(",")[0])||"",geometry:{location:{lat:()=>parseFloat(e.lat),lng:()=>parseFloat(e.lon)}},address_components:x(e.address)}},p=(e,t)=>{const i=new URLSearchParams({q:e,format:"json",addressdetails:"1",limit:"5"});if(null!==t&&void 0!==t&&t.lat&&null!==t&&void 0!==t&&t.lng){const e=.5;i.set("viewbox","".concat(t.lng-e,",").concat(t.lat+e,",").concat(t.lng+e,",").concat(t.lat-e))}return i};async function u(e){let{bias:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;try{const i=p(e,t);i.set("limit","1");const n=await fetch("".concat(d,"?").concat(i.toString()),{headers:{Accept:"application/json"}});if(!n.ok)return null;const o=await n.json();return null!==o&&void 0!==o&&o.length?h(o[0]):null}catch(i){return console.error("geocodeAddress error:",i),null}}const g=e=>{let{id:t,label:i,placeholder:x="Search address",value:u,onChange:g,onPlaceSelected:A,bias:j,sx:m,textFieldSx:f,fullWidth:b=!0,disabled:v,inputRef:y,TextFieldProps:S={}}=e;const[w,C]=(0,o.useState)(u||""),[k,z]=(0,o.useState)([]),[W,I]=(0,o.useState)(!1);(0,o.useEffect)((()=>{void 0!==u&&u!==w&&C(u||"")}),[u]);const P=(0,o.useMemo)((()=>(0,a.A)(((e,t,i)=>{if(!e)return void i([]);const n=p(e,t);fetch("".concat(d,"?").concat(n.toString()),{headers:{Accept:"application/json"}}).then((e=>e.ok?e.json():[])).then((e=>i(e||[]))).catch((()=>i([])))}),500)),[]);return(0,o.useEffect)((()=>{let e=!0;return w?(I(!0),P(w,j,(t=>{e&&(I(!1),z(t))})),()=>{e=!1}):(z([]),void I(!1))}),[w,null===j||void 0===j?void 0:j.lat,null===j||void 0===j?void 0:j.lng,P]),(0,c.jsx)(l.A,{id:t,freeSolo:!0,fullWidth:b,disabled:v,sx:m,options:k,filterOptions:e=>e,getOptionLabel:e=>"string"===typeof e?e:e.display_name||"",isOptionEqualToValue:(e,t)=>e.place_id===(null===t||void 0===t?void 0:t.place_id),inputValue:w,onInputChange:(e,t)=>{C(t),null===g||void 0===g||g(t)},onChange:(e,t)=>{t&&"string"!==typeof t&&(C(t.display_name||""),null===A||void 0===A||A(h(t)))},renderInput:e=>{var t,o,l,a;return(0,c.jsx)(s.A,(0,n.A)((0,n.A)((0,n.A)({},e),S),{},{inputRef:y,label:i,placeholder:x,sx:f,autoComplete:"off",InputProps:(0,n.A)((0,n.A)((0,n.A)({},e.InputProps),S.InputProps),{},{startAdornment:null!==(t=null===(o=S.InputProps)||void 0===o?void 0:o.startAdornment)&&void 0!==t?t:e.InputProps.startAdornment,endAdornment:(0,c.jsxs)(c.Fragment,{children:[W?(0,c.jsx)(r.A,{color:"inherit",size:16}):null,null!==(l=null===(a=S.InputProps)||void 0===a?void 0:a.endAdornment)&&void 0!==l?l:e.InputProps.endAdornment]})})}))}})}},23787:(e,t,i)=>{i.d(t,{FG:()=>p,nV:()=>x,pY:()=>u,pg:()=>h});var n=i(22555),o=i(53986),l=i(71392),s=i(55235),r=i(48738),a=i(2866),c=i(65908);const d=["children","scroll","onScroll","sx"],x=e=>{let{children:t,scroll:i=!1,onScroll:s,sx:r}=e,a=(0,o.A)(e,d);return(0,c.jsx)(l.A,(0,n.A)((0,n.A)({spacing:1.25,onScroll:s,sx:(0,n.A)((0,n.A)({p:1.5},i&&{maxHeight:"calc(100vh - 220px)",overflowY:"auto",overflowX:"hidden"}),r)},a),{},{children:t}))},h=e=>{let{accent:t="#662582",header:i,footer:o,selected:l=!1,onClick:a,children:d,sx:x}=e;return(0,c.jsxs)(s.A,{elevation:0,onClick:a,sx:(0,n.A)({position:"relative",overflow:"hidden",flexShrink:0,borderRadius:2.5,border:"1px solid",borderColor:l?t:"#e2e8f0",background:l?"".concat(t,"0a"):"#fff",boxShadow:"0 4px 14px rgba(15,23,42,0.05)",transition:"border-color 0.15s, box-shadow 0.15s"},x),children:[(0,c.jsx)(r.A,{sx:{position:"absolute",left:0,top:0,bottom:0,width:3,bgcolor:t}}),(0,c.jsxs)(r.A,{sx:{p:1.5,pl:2},children:[i,d,o]})]})},p=e=>{let{children:t,columns:i=2,sx:o}=e;return(0,c.jsx)(r.A,{sx:(0,n.A)({display:"grid",gridTemplateColumns:"repeat(".concat(i,", minmax(0, 1fr))"),gap:1,mt:1.25},o),children:t})},u=e=>{let{label:t,value:i,children:n,full:o=!1,align:l="left"}=e;return(0,c.jsxs)(r.A,{sx:{gridColumn:o?"1 / -1":"auto",minWidth:0,textAlign:l},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)(r.A,{sx:{mt:.25,minWidth:0},children:void 0!==n?n:(0,c.jsx)(a.A,{sx:{fontSize:13,fontWeight:600,color:"#0f172a"},noWrap:!0,children:null!==i&&void 0!==i?i:"\u2014"})})]})}},27001:(e,t,i)=>{i.d(t,{A:()=>r});var n=i(71392),o=i(48738),l=i(2866),s=i(65908);function r(e){let{title:t,subtitle:i,live:r=!1,action:a}=e;return(0,s.jsxs)(n.A,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},spacing:1.5,sx:{mb:{xs:2,md:2.5}},children:[(0,s.jsxs)(o.A,{sx:{minWidth:0},children:[(0,s.jsx)(l.A,{variant:"h3",sx:{fontWeight:700,letterSpacing:"-0.02em",color:"grey.800"},children:t}),i&&(0,s.jsxs)(n.A,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[r&&(0,s.jsx)(o.A,{sx:{width:7,height:7,borderRadius:"50%",bgcolor:"success.main",boxShadow:"0 0 0 3px rgba(16,185,129,0.18)"}}),(0,s.jsx)(l.A,{variant:"caption",sx:{color:"text.secondary",fontWeight:500},children:i})]})]}),a&&(0,s.jsx)(o.A,{sx:{flexShrink:0,width:{xs:"100%",sm:"auto"}},children:a})]})}},36803:(e,t,i)=>{i.d(t,{A:()=>x});var n=i(84007),o=i(75953),l=i(71392),s=i(48738),r=i(2866),a=i(91834),c=i(97043),d=i(65908);function x(e){let{title:t,value:i,icon:x,color:h="#662582",caption:p,loading:u=!1}=e;return(0,d.jsx)(n.A,{sx:{height:"100%"},children:(0,d.jsx)(o.A,{sx:{p:{xs:1.75,md:2},"&:last-child":{pb:{xs:1.75,md:2}}},children:(0,d.jsxs)(l.A,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,children:[(0,d.jsxs)(s.A,{sx:{minWidth:0,flex:1},children:[(0,d.jsx)(r.A,{variant:"body2",sx:{fontWeight:500,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),u?(0,d.jsx)(a.A,{variant:"rounded",sx:{width:72,height:30,mt:.5},animation:"wave"}):(0,d.jsx)(r.A,{sx:{mt:.25,fontWeight:700,letterSpacing:"-0.015em",color:"grey.800",lineHeight:1.15,fontSize:{xs:"1.375rem",md:"1.5rem"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i}),p&&(0,d.jsx)(r.A,{variant:"caption",sx:{display:"block",mt:.5,color:"text.secondary"},children:p})]}),x&&(0,d.jsx)(c.A,{variant:"rounded",sx:{width:42,height:42,borderRadius:2,bgcolor:"".concat(h,"14"),color:h,flexShrink:0},children:x})]})})})}},56311:(e,t,i)=>{i.d(t,{A:()=>p});var n=i(22555),o=i(85672),l=i(29776),s=i(43318),r=i(23440),a=i(11969),c=i(80795),d=i(51808),x=i(93811),h=i(65908);const p=e=>{let{value:t,onChange:i,onDebouncedChange:p,debounceTime:u=500,placeholder:g="Search (ctrl+k)",sx:A}=e;const j=(0,o.useRef)(null),[m]=(0,x.d7)(t,u);return(0,o.useEffect)((()=>{p&&p(m)}),[m,p]),(0,o.useEffect)((()=>{const e=e=>{var t;"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),null===(t=j.current)||void 0===t||t.focus());"Escape"===e.key&&document.activeElement===j.current&&j.current.blur()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[]),(0,h.jsx)(l.A,{sx:(0,n.A)({},A),inputRef:j,placeholder:g,autoComplete:"off",value:t,fullWidth:!0,onChange:e=>i(e.target.value),startAdornment:(0,h.jsx)(s.A,{position:"start",sx:{mr:-.5},children:(0,h.jsx)(c.A,{})}),endAdornment:(0,h.jsx)(r.A,{title:"Clear",children:(0,h.jsx)(a.A,{sx:{visibility:t?"visible":"hidden"},onClick:()=>i(""),children:(0,h.jsx)(d.A,{})})})})}},59212:(e,t,i)=>{i.d(t,{A:()=>h});var n=i(22555),o=i(85672),l=i(71392),s=i(97043),r=i(17488),a=i(86270),c=i(66157),d=i(48952),x=i(65908);const h=(0,o.forwardRef)(((e,t)=>{let{setAppId:i,setLocoName:h,setPage:p,sx:u,textfeildSx:g,textfieldSx:A,pill:j=!1,accentColor:m="#6366f1",icon:f,placeholder:b="Select Zone",paperComponent:v}=e;const[y,S]=(0,o.useState)(JSON.parse(localStorage.getItem("applocations")||"[]"));(0,o.useEffect)((()=>{0===y.length&&(async()=>{try{const e=localStorage.getItem("userid");if(!e)return;const t=await c.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/partners/getlocations/?userid=").concat(e));if(t.data.status){const e=[...t.data.details,{locationname:"All",applocationid:0}];localStorage.setItem("applocations",JSON.stringify(e)),S(e)}}catch(e){console.error("Error fetching locations in LocationAutocomplete:",e)}})()}),[y.length]);const w=e=>"".concat(m).concat(e),C=w("26"),k=w("18"),z=j?{cursor:"pointer","& .MuiOutlinedInput-root":{borderRadius:"10px",bgcolor:"#ffffff",fontWeight:600,color:"#0f172a",paddingRight:"8px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s","& fieldset":{borderColor:"#e2e8f0",borderWidth:1},"&:hover fieldset":{borderColor:"#cbd5e1"},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(C)},"&.Mui-focused fieldset":{borderColor:m,borderWidth:1.5}},"& .MuiAutocomplete-endAdornment .MuiSvgIcon-root":{color:"#94a3b8"}}:{},W=j&&(0,x.jsx)(l.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,x.jsx)(s.A,{sx:{width:24,height:24,bgcolor:k,color:m,transition:"background-color 0.15s, color 0.15s"},children:f||(0,x.jsx)(d.HPi,{size:14})})});return(0,x.jsx)(r.A,{id:"location-autocomplete",options:y||[],getOptionLabel:e=>{var t;return null!==(t=null===e||void 0===e?void 0:e.locationname)&&void 0!==t?t:""},PaperComponent:v,sx:(0,n.A)({},u),onChange:(e,t,n)=>{"clear"===n?(null===i||void 0===i||i(0),null===h||void 0===h||h(""),null===p||void 0===p||p(0)):t&&(null===i||void 0===i||i(t.applocationid),null===h||void 0===h||h(t.locationname),null===p||void 0===p||p(0))},renderInput:e=>j?(0,x.jsx)(a.A,(0,n.A)((0,n.A)({},e),{},{inputRef:t,placeholder:b,InputProps:(0,n.A)((0,n.A)({},e.InputProps),{},{startAdornment:W}),sx:(0,n.A)((0,n.A)({},z),A||g||{})})):(0,x.jsx)(a.A,(0,n.A)((0,n.A)({},e),{},{inputRef:t,label:"Select Zones",sx:(0,n.A)({},A||g||{})}))})}))},71504:(e,t,i)=>{i.r(t),i.d(t,{default:()=>_e});var n=i(22555),o=i(85672),l=i(59008),s=i(66157),r=i(69039),a=i(52351),c=i(38464),d=i(46077),x=i.n(d),h=i(13659),p=i(5303),u=i(55235),g=i(97043),A=i(76264),j=i(1939),m=i(48738),f=i(71392),b=i(2866),v=i(91834),y=i(83209),S=i(72486),w=i(54016),C=i(50755),k=i(1596),z=i(81802),W=i(23440),I=i(11969),P=i(1150),M=i(93977),R=i(13420),_=i(84007),E=i(80911),L=i(75953),Y=i(86270),T=i(78754),K=i(58571),D=i(67677),O=i(58689),F=i(19619),B=i(5670),H=i(35935),V=i(17488),q=i(17450),N=i(23787),X=i(16957),J=i(46114),U=i(88999),G=i(51142),Z=i(36563),Q=i(20077),$=i(37476),ee=i(81600),te=i(90215),ie=i(20605),ne=i(70168),oe=i(48952),le=i(76550),se=i(61660),re=i(59212),ae=i(56311),ce=i(27001),de=i(36803),xe=i(68320),he=i(81425),pe=i(96646),ue=i(65908);const ge=14,Ae="0 12px 32px rgba(15, 23, 42, 0.12)",je="#0f172a",me="#64748b",fe="#94a3b8",be="#e2e8f0",ve="#f1f5f9",ye="#f8fafc",Se=(e,t)=>"".concat(e).concat(t),we=e=>Se(e,"08"),Ce=e=>Se(e,"18"),ke=e=>Se(e,"26"),ze=e=>Se(e,"55"),We={active:{label:"Active",color:"#10b981",icon:oe.mU9,statusKey:"active"},pending:{label:"Pending",color:"#f59e0b",icon:oe.tX0,statusKey:"pending"},inactive:{label:"Inactive",color:"#ef4444",icon:oe.uDv,statusKey:"inactive"}},Ie=[{status:"active",countKey:"active",tabStatus:"Active"},{status:"pending",countKey:"pending",tabStatus:"Pending"},{status:"inactive",countKey:"inactive",tabStatus:"InActive"}],Pe=[{key:"active",label:"Active Tenants",color:"#10b981",icon:oe.cAP,countKey:"active"},{key:"pending",label:"Pending Approval",color:"#f59e0b",icon:oe.G6c,countKey:"pending"},{key:"inactive",label:"Inactive Tenants",color:"#ef4444",icon:oe.qiG,countKey:"inactive"}],Me=e=>(0,ue.jsx)(u.A,(0,n.A)((0,n.A)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:Ae,border:"1px solid",borderColor:"divider",overflow:"hidden"}})),Re=e=>{let{color:t,selected:i,size:n=24,children:o}=e;return(0,ue.jsx)(g.A,{sx:{width:n,height:n,bgcolor:i?t:Ce(t),color:i?"#fff":t,transition:"background-color 0.15s, color 0.15s"},children:o})},_e=()=>{var e;const t=(0,o.useRef)(null),[i,d]=(0,o.useState)(""),[Ae,Se]=(0,o.useState)(""),[_e,Ee]=o.useState(10),Le=(0,r.A)(),Ye=(0,A.A)(Le.breakpoints.down("md")),[Te,Ke]=(0,o.useState)(!1),[De,Oe]=(0,o.useState)(0),[Fe,Be]=(0,o.useState)(""),[He]=(0,o.useState)("All"),[Ve,qe]=(0,o.useState)(0),[Ne,Xe]=(0,o.useState)(0),[Je,Ue]=(0,o.useState)(0),[Ge,Ze]=(0,o.useState)(null),[Qe,$e]=(0,o.useState)([]),[et,tt]=(0,o.useState)("active"),[it,nt]=(0,o.useState)({}),[ot,lt]=(0,o.useState)(!1),[st,rt]=(0,o.useState)([]),[at,ct]=(0,o.useState)({}),[dt,xt]=(0,o.useState)(!0),[ht,pt]=(0,o.useState)(""),[ut,gt]=(0,o.useState)(""),[At,jt]=(0,o.useState)({}),[mt,ft]=(0,o.useState)({}),[bt,vt]=(0,o.useState)(0),[yt,St]=(0,o.useState)("Active"),wt=()=>{lt(!1)},Ct=(e,t)=>{St(0==t?"Active":1==t?"Pending":"InActive"),qe(t),d(""),vt(0)},kt=(e,t)=>{console.log("newValue1",t),Xe(t)},zt=(e,t)=>{console.log("newValue2",t),Ue(t)},[Wt,It]=(0,o.useState)(null),[Pt,Mt]=(0,o.useState)(null),Rt=e=>{It((t=>t===e?null:e))};(0,o.useEffect)((()=>{console.log("selectedCustomer",it)}),[it]),(0,o.useEffect)((()=>{It(-1),Mt(-1)}),[Ve]);const _t=(e,t,i)=>{(0,h.M8)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:i})},Et=e=>{const t=e.geometry.location.lat(),i=e.geometry.location.lng();let o,l,s,r;jt({lat:t,lng:i}),ft((o=>(0,n.A)((0,n.A)({},o),{},{address:e.formatted_address,latitude:t.toString(),longitude:i.toString()}))),e.address_components.forEach((e=>{e.types.forEach((t=>{switch(t){case"locality":o=e.long_name;break;case"administrative_area_level_1":s=e.long_name;break;case"postal_code":l=e.long_name;break;case"sublocality":case"sublocality_level_1":r=e.long_name}}))})),pt(o||""),setState(s||""),gt(l||""),setSuburb(r||""),ft((e=>(0,n.A)((0,n.A)({},e),{},{city:o||"",state:s||"",postcode:l||"",suburb:r||""})))};(0,o.useEffect)((()=>{it&&jt({lat:it.latitude,lng:it.longitude})}),[it]),(0,o.useEffect)((()=>{const e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t.current.focus()),"Escape"===e.key&&document.activeElement===t.current&&t.current.blur()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[]);const{data:Lt,isLoading:Yt,refetch:Tt}=(0,xe.I)({queryKey:["tenantList",De,Ae,et,bt,_e],queryFn:he.ry}),{data:Kt=[],isLoading:Dt,refetch:Ot}=(0,xe.I)({queryKey:["gettenantsummary",De,et],queryFn:he.bd}),Ft=async()=>{await s.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/getpricinglist/?tenantid=").concat(Ge)).then((e=>{console.log("getpricinglist",e),e.data.status&&$e(e.data.details)})).catch((e=>{console.log(e)}))};(0,o.useEffect)((()=>{Ge&&Ft()}),[Ge]);(0,o.useEffect)((()=>{Ge&&(async e=>{try{let t=await s.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(e));console.log("tenantPricing",t.data.details),setTenanatPricing(t.data.details)}catch(t){console.log("fetchTenanatPricing",t)}})(Ge)}),[Ge]);const Bt=async e=>{let t;Ke(!0),t=-1==e?{tenantid:Ge,approved:1}:{tenantid:e,status:"active"===et?"InActive":"Active"},await s.A.put("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/update"),t).then((e=>{e.data.status&&(_t(0==Ve?"Inactivated Successfully":1==Ve?"Approved Successfully":"Activate Successfully","success",2e3),Tt(),Ot(),Ke(!1))})).catch((e=>{console.log(e),_t(e.message,"error",1500),Ke(!1)}))},Ht=async e=>{console.log("id",e);try{let t=await s.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapppricing/?applocationid=").concat(e));console.log("appPricingRes",t.data.details),rt(t.data.details)}catch(t){console.log("appPricingRes",t)}},Vt=async()=>{Ke(!0),await s.A.post("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/createpricing"),{tenantpricingid:0,applocationid:De,pricingid:at.pricingid,tenantid:Ge,pricingdate:x()().format("YYYY-MM-DD HH:mm:ss"),configid:at.configid,pricingtypeid:at.pricingtypeid,slab:at.slab,baseprice:+at.baseprice,priceperkm:+at.priceperkm,minkm:+at.minkm,maxkm:+at.maxkm,orders:+at.minorder,othercharges:0}).then((e=>{e.data.status&&((0,h.M8)("Price Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),wt(),ct({}),Bt(-1),Ft())})).catch((e=>{console.log(e)}))},qt=We[null===(e=Ie[Ve])||void 0===e?void 0:e.status]||We.active;return(0,ue.jsxs)(ue.Fragment,{children:[(Yt||Dt||Te)&&(0,ue.jsx)(a.A,{}),(0,ue.jsx)(ce.A,{title:"Tenants",subtitle:"Live \xb7 ".concat(Fe||"All Zones"),live:!0,action:(0,ue.jsx)(re.A,{locations:He,locaName:Fe,setAppId:Oe,setLocoName:Be,setPage:vt,pill:!0,accentColor:"#662582",icon:(0,ue.jsx)(oe.HPi,{size:14}),placeholder:"Select Zone",paperComponent:Me,sx:{width:{xs:"100%",sm:280},zIndex:100}})}),(0,ue.jsx)(j.Ay,{container:!0,spacing:{xs:2,md:2.5},sx:{mb:{xs:1.5,md:2}},children:Pe.map(((e,t)=>{var i;const n=e.icon,o=null!==(i=null===Kt||void 0===Kt?void 0:Kt[e.countKey])&&void 0!==i?i:0;return(0,ue.jsx)(j.Ay,{item:!0,xs:12,sm:4,children:(0,ue.jsx)(m.A,{onClick:()=>{t>=0&&Ct(0,t)},sx:{cursor:"pointer",height:"100%"},children:(0,ue.jsx)(de.A,{title:e.label,value:null!==o&&void 0!==o?o:0,icon:(0,ue.jsx)(n,{size:20}),color:0===t?"#662582":e.color,loading:Dt})})},e.key)}))}),(0,ue.jsx)(u.A,{elevation:0,sx:{mt:{xs:1.5,md:2},p:{xs:1,md:1.5},borderTopLeftRadius:ge/8,borderTopRightRadius:ge/8,borderBottomLeftRadius:0,borderBottomRightRadius:0,border:"1px solid",borderColor:be,borderBottom:0,background:"#fff"},children:(0,ue.jsxs)(f.A,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1.5,sx:{flexWrap:"wrap-reverse"},children:[(0,ue.jsx)(f.A,{direction:"row",spacing:.75,sx:{flex:1,overflowX:"auto",py:.5,px:.25,"&::-webkit-scrollbar":{height:6},"&::-webkit-scrollbar-thumb":{backgroundColor:be,borderRadius:4}},children:Ie.map(((e,t)=>{var i;const n=We[e.status],o=n.icon,l=Ve===t,s=null!==(i=null===Kt||void 0===Kt?void 0:Kt[e.countKey])&&void 0!==i?i:0;return(0,ue.jsxs)(m.A,{onClick:()=>{tt(e.status),Ct(0,t)},sx:{display:"inline-flex",alignItems:"center",gap:{xs:.625,md:.875},pl:.5,pr:{xs:1,md:1.25},py:.5,flexShrink:0,cursor:"pointer",borderRadius:"10px",border:"1px solid ".concat(l?n.color:"#e2e8f0"),bgcolor:l?n.color:"#fff",color:l?"#fff":"#64748b",fontWeight:600,boxShadow:"none",transition:"background-color 0.15s, border-color 0.15s, color 0.15s","&:hover":{borderColor:l?n.color:"#cbd5e1",bgcolor:l?n.color:"#f8fafc"}},children:[(0,ue.jsx)(g.A,{sx:{width:{xs:22,md:26},height:{xs:22,md:26},bgcolor:l?"rgba(255,255,255,0.22)":Ce(n.color),color:l?"#fff":n.color},children:(0,ue.jsx)(o,{size:13})}),(0,ue.jsx)(b.A,{variant:"caption",sx:{fontWeight:600,fontSize:{xs:11.5,md:13},lineHeight:1},children:n.label}),(0,ue.jsx)(m.A,{sx:{minWidth:{xs:22,md:26},height:{xs:18,md:22},px:.625,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:999,fontSize:{xs:10,md:11},fontWeight:700,bgcolor:l?"rgba(255,255,255,0.22)":"#f8fafc",color:l?"#fff":"#64748b",border:"none"},children:Dt?(0,ue.jsx)(v.A,{variant:"text",width:14,height:10}):s})]},e.status)}))}),(0,ue.jsx)(m.A,{sx:{width:{xs:"100%",sm:240,lg:280},flex:{xs:"1 1 100%",sm:"0 0 auto"}},children:(0,ue.jsx)(ae.A,{value:i,onChange:d,onDebouncedChange:Se,sx:{m:0,width:"100%",borderRadius:999,bgcolor:we("#662582"),"& fieldset":{borderColor:ze("#662582"),borderWidth:1.5},"&:hover fieldset":{borderColor:"#662582"},"&.Mui-focused fieldset":{borderColor:"#662582",borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ke("#662582"))}}})})]})}),(0,ue.jsxs)(u.A,{elevation:0,sx:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:ge/8,borderBottomRightRadius:ge/8,border:"1px solid",borderColor:be,overflow:"hidden",background:"#fff"},children:[(0,ue.jsx)(y.A,{sx:{display:{xs:"none",md:"block"},maxHeight:{xs:"calc(100vh - 220px)",md:"calc(100vh - 190px)"},"&::-webkit-scrollbar":{width:"10px",height:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:ze("#662582"),borderRadius:"8px","&:hover":{backgroundColor:"#662582"}},"&::-webkit-scrollbar-track":{backgroundColor:ye}},children:(0,ue.jsxs)(S.A,{stickyHeader:!0,sx:{minWidth:{xs:720,md:960}},children:[(0,ue.jsx)(w.A,{children:(0,ue.jsxs)(C.A,{sx:{"& th":{backgroundColor:ye,color:me,fontSize:{xs:10,md:11},fontWeight:800,letterSpacing:.6,textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid ".concat(be),py:{xs:1,md:1.25},px:{xs:1,md:2}}},children:[(0,ue.jsx)(k.A,{children:"#"}),(0,ue.jsx)(k.A,{children:"Status"}),(0,ue.jsx)(k.A,{children:"Client"}),(0,ue.jsx)(k.A,{children:"Contact"}),(0,ue.jsx)(k.A,{children:"Address"}),(0,ue.jsx)(k.A,{align:"right",children:"Actions"})]})}),(0,ue.jsxs)(z.A,{children:[Yt&&(0,ue.jsx)(pe.r,{}),0!=(null===Lt||void 0===Lt?void 0:Lt.length)||Te?null===Lt||void 0===Lt?void 0:Lt.map(((e,t)=>{var i,r,a;const d=We[0===Ve?"active":1===Ve?"pending":"inactive"],h=d.icon;return(0,ue.jsxs)(o.Fragment,{children:[(0,ue.jsxs)(C.A,{sx:{cursor:"pointer",transition:"background-color 0.15s","& td":{borderBottom:"1px solid ".concat(ve),py:{xs:1,md:1.5},px:{xs:1,md:2}},"&:hover":{backgroundColor:ye}},children:[(0,ue.jsx)(k.A,{children:(0,ue.jsx)(b.A,{variant:"caption",sx:{fontWeight:700,color:fe},children:String(t+1+bt*_e).padStart(2,"0")})}),(0,ue.jsx)(k.A,{children:(0,ue.jsxs)(f.A,{direction:"row",alignItems:"center",spacing:.5,sx:{display:"inline-flex",pl:.5,pr:1,py:.25,borderRadius:999,bgcolor:we(d.color),border:"1px solid ".concat(ze(d.color)),color:d.color},children:[(0,ue.jsx)(Re,{color:d.color,size:20,children:(0,ue.jsx)(h,{size:12})}),(0,ue.jsx)(b.A,{variant:"caption",sx:{fontWeight:800,fontSize:11,lineHeight:1},children:d.label})]})}),(0,ue.jsx)(k.A,{children:(0,ue.jsxs)(f.A,{direction:"row",alignItems:"center",spacing:1,children:[(0,ue.jsx)(Re,{color:"#662582",size:32,children:(0,ue.jsx)(oe.Azs,{size:16})}),(0,ue.jsxs)(f.A,{children:[(0,ue.jsx)(b.A,{variant:"subtitle2",sx:{fontWeight:700,color:je,whiteSpace:"nowrap"},children:e.tenantname}),(0,ue.jsxs)(b.A,{variant:"caption",sx:{color:me},children:["ID #",e.tenantid]})]})]})}),(0,ue.jsx)(k.A,{children:(0,ue.jsxs)(f.A,{children:[(0,ue.jsx)(b.A,{variant:"subtitle2",sx:{fontWeight:700,color:je,whiteSpace:"nowrap"},children:e.primarycontact||"\u2014"}),(0,ue.jsx)(b.A,{variant:"caption",sx:{color:me},children:e.primaryemail||"\u2014"})]})}),(0,ue.jsx)(k.A,{sx:{maxWidth:280},children:(0,ue.jsx)(W.A,{title:e.address||"",placement:"top",children:(0,ue.jsx)(b.A,{variant:"caption",sx:{color:me,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.address||"\u2014"})})}),(0,ue.jsx)(k.A,{align:"right",children:(0,ue.jsxs)(f.A,{direction:"row",spacing:.75,justifyContent:"flex-end",children:[0==Ve&&(0,ue.jsx)(W.A,{title:"Inactivate",placement:"top",children:(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Ce("#ef4444"),color:"#ef4444",border:"1px solid ".concat(ze("#ef4444")),"&:hover":{bgcolor:"#ef4444",color:"#fff"}},onClick:()=>{nt(e),Ze(e.tenantid),Oe(e.applocationid),setTimeout((()=>{Bt(e.tenantid)}),100)},children:(0,ue.jsx)(X.A,{style:{fontSize:14}})})}),1==Ve&&(0,ue.jsx)(W.A,{title:"Approve",placement:"top",children:(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Ce("#f59e0b"),color:"#f59e0b",border:"1px solid ".concat(ze("#f59e0b")),"&:hover":{bgcolor:"#f59e0b",color:"#fff"}},onClick:()=>{nt(e),lt(!0),Ze(e.tenantid),Oe(e.applocationid),Ht(e.applolcationid)},children:(0,ue.jsx)(J.A,{style:{fontSize:14}})})}),2==Ve&&(0,ue.jsx)(W.A,{title:"Activate",placement:"top",children:(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Ce("#10b981"),color:"#10b981",border:"1px solid ".concat(ze("#10b981")),"&:hover":{bgcolor:"#10b981",color:"#fff"}},onClick:()=>{nt(e),Ze(e.tenantid),Oe(e.applocationid),setTimeout((()=>{Bt(e.tenantid)}),100)},children:(0,ue.jsx)(ee.yjt,{style:{fontSize:14}})})}),(0,ue.jsx)(W.A,{title:Wt===t?"Hide details":"View details",placement:"top",children:(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Wt===t?"#662582":Ce("#662582"),color:Wt===t?"#fff":"#662582",border:"1px solid ".concat(ze("#662582")),"&:hover":{bgcolor:"#662582",color:"#fff"}},onClick:()=>{nt(e),Rt(t),Mt(-1),Ze(e.tenantid)},children:Wt===t?(0,ue.jsx)(U.A,{style:{fontSize:14}}):(0,ue.jsx)(G.A,{style:{fontSize:14}})})}),1!==Ve&&(0,ue.jsx)(W.A,{title:Pt===t?"Close":"Edit",placement:"top",children:(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Pt===t?"#8b5cf6":Ce("#8b5cf6"),color:Pt===t?"#fff":"#8b5cf6",border:"1px solid ".concat(ze("#8b5cf6")),"&:hover":{bgcolor:"#8b5cf6",color:"#fff"}},onClick:()=>{var i;nt(e),i=t,Mt((e=>e===i?null:i)),It(-1),Ze(e.tenantid),Oe(e.applocationid)},children:Pt===t?(0,ue.jsx)(Z.A,{style:{fontSize:14}}):(0,ue.jsx)(Q.A,{style:{fontSize:14}})})})]})})]}),Wt===t&&(0,ue.jsx)(C.A,{children:(0,ue.jsx)(k.A,{sx:{"&:hover":{backgroundColor:"white !important"}},colSpan:15,children:(0,ue.jsx)(P.A,{in:open,timeout:800,easing:"ease-in-out",mountOnEnter:!0,unmountOnExit:!1,sx:{"& .MuiCollapse-wrapperInner":{transition:"transform 800ms ease, opacity 800ms ease"}},children:(0,ue.jsxs)(l.A,{content:!1,sx:{transform:open?"translateY(0)":"translateY(-8px)",opacity:open?1:0},title:(0,ue.jsxs)(M.A,{sx:{bgcolor:"primary.lighter"},value:Ne,onChange:kt,"aria-label":"basic tabs example",children:[(0,ue.jsx)(R.A,{label:" Details",icon:(0,ue.jsx)(te.gA5,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"}}),(0,ue.jsx)(R.A,{label:"Pricing",icon:(0,ue.jsx)(ie.FA6,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"}})]}),children:[0==Ne&&(0,ue.jsxs)(j.Ay,{container:!0,sx:{m:1},spacing:2.5,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ne.JXP,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",children:e.tenantname}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"Tenant"})]})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ne.JXP,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",children:e.firstname}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"Contact Person"})]})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ne.wnV,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",children:e.primarycontact}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"Phone"})]})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(le.h2r,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",children:e.primaryemail}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"E-Mail"})]})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ee.Y9o,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",children:e.address}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"Address"})]})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ie.BUW,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",children:e.city}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"City"})]}),(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(oe.kci,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",variant:"subtitle1",children:e.postcode}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"PostCode"})]})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(te.J0X,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",children:e.latitude}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"Latitude"})]}),(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(te.u3h,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsxs)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,ue.jsx)(b.A,{align:"left",variant:"subtitle1",children:e.longitude}),(0,ue.jsx)(b.A,{align:"left",variant:"caption",color:"secondary",children:"Longitude"})]})]})})]}),1==Ne&&(0,ue.jsx)(_.A,{variant:"outlined",sx:{},children:(0,ue.jsx)(y.A,{children:(0,ue.jsxs)(S.A,{children:[(0,ue.jsx)(w.A,{children:(0,ue.jsxs)(C.A,{children:[(0,ue.jsx)(k.A,{children:"#"}),(0,ue.jsx)(k.A,{children:"Date"}),(0,ue.jsx)(k.A,{children:"Slab"}),(0,ue.jsx)(k.A,{children:"Base Price"}),(0,ue.jsx)(k.A,{children:"Min Kms"}),(0,ue.jsx)(k.A,{children:"Price/Km"}),(0,ue.jsx)(k.A,{children:"Other Charges"})]})}),(0,ue.jsx)(z.A,{children:0===(null===Qe||void 0===Qe?void 0:Qe.length)?(0,ue.jsx)(C.A,{children:(0,ue.jsx)(k.A,{colSpan:7,align:"center",children:(0,ue.jsx)(c.A,{description:"No Pricing List"})})}):Qe.map(((e,t)=>(0,ue.jsxs)(C.A,{sx:{bgcolor:"white"},children:[(0,ue.jsx)(k.A,{children:t+1}),(0,ue.jsx)(k.A,{children:x()(e.pricingdate).format("DD-MM-YYYY")}),(0,ue.jsx)(k.A,{children:e.slab}),(0,ue.jsx)(k.A,{children:e.baseprice}),(0,ue.jsx)(k.A,{children:e.minkm}),(0,ue.jsx)(k.A,{children:e.priceperkm}),(0,ue.jsx)(k.A,{children:e.othercharges})]},e.id||t)))})]})})},"left - card")]})})})}),Pt===t&&(0,ue.jsx)(C.A,{children:(0,ue.jsx)(k.A,{sx:{backgroundColor:"white!important","&:hover":{backgroundColor:"white!important"}},colSpan:15,children:(0,ue.jsxs)(l.A,{content:!1,title:(0,ue.jsxs)(m.A,{sx:{bgcolor:"primary.lighter",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,ue.jsxs)(M.A,{value:Je,onChange:zt,"aria-label":"basic tabs example",children:[(0,ue.jsx)(R.A,{label:"Edit Details",icon:(0,ue.jsx)(te.gA5,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"}}),1!==Ve&&(0,ue.jsx)(R.A,{label:"Edit Pricing",icon:(0,ue.jsx)(ie.FA6,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"},onClick:()=>{Ht(it.applolcationid)}})]}),1==Je&&(0,ue.jsx)(E.A,{variant:"contained",color:"error",size:"smaller",startIcon:(0,ue.jsx)(Q.A,{size:"small"}),sx:{mr:1.8,height:"30px"},onClick:()=>{lt(!0)},children:"Add Pricing"})]}),children:[0==Je&&(0,ue.jsx)(_.A,{variant:"outlined",sx:{m:2},children:(0,ue.jsx)(j.Ay,{container:!0,spacing:0,children:(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(_.A,{variant:"outlined",children:[(0,ue.jsx)(L.A,{children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:2.5,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(se.PY8,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{fullWidth:!0,id:"outlined-basic",label:"Tenant Name",defaultValue:it.tenantname,variant:"outlined",onChange:e=>{ft((0,n.A)((0,n.A)({},mt),{},{tenantname:e.target.value}))},sx:{mt:2}})})]})})," ",(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ne.JXP,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{fullWidth:!0,id:"outlined-basic",label:"Contact Person",defaultValue:e.firstname,variant:"outlined",onChange:e=>{ft((0,n.A)((0,n.A)({},mt),{},{firstname:e.target.value}))},sx:{mt:2}})})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ne.wnV,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{inputProps:{maxLength:10},fullWidth:!0,id:"outlined-basic",label:"Contact Number",defaultValue:it.primarycontact,variant:"outlined",onChange:e=>{ft((0,n.A)((0,n.A)({},mt),{},{primarycontact:e.target.value}))},sx:{mt:2}})})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:6,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(le.h2r,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{fullWidth:!0,id:"outlined-basic",label:"E-Mail",defaultValue:it.primaryemail,variant:"outlined",onChange:e=>{ft((0,n.A)((0,n.A)({},mt),{},{primaryemail:e.target.value}))},sx:{mt:2}})})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ee.Y9o,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(p.Ay,{id:"address-autocomplete",fullWidth:!0,label:"Address",value:null!==(r=null!==(a=null===mt||void 0===mt?void 0:mt.address)&&void 0!==a?a:it.address)&&void 0!==r?r:"",onChange:e=>ft((t=>(0,n.A)((0,n.A)({},t),{},{address:e}))),onPlaceSelected:Et,TextFieldProps:{variant:"outlined"}})})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(ie.BUW,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{fullWidth:!0,required:!0,id:"outlined-required",label:"City",onChange:e=>{ft((0,n.A)((0,n.A)({},mt),{},{city:e.target.value}))},value:""==ht?it.city:ht})}),(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(oe.kci,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{fullWidth:!0,required:!0,label:" PostCode",id:"outlined-required",onChange:e=>{ft((0,n.A)((0,n.A)({},mt),{},{postcode:e.target.value}))},value:""==ut?it.postcode:ut})})]})}),(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(te.J0X,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{variant:"outlined",readonly:!0,label:"Latitude",fullWidth:!0,value:At.lat,sx:{cursor:"not-allowed"}})}),(0,ue.jsx)(j.Ay,{item:!0,children:(0,ue.jsx)(te.u3h,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,ue.jsx)(j.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,ue.jsx)(Y.A,{label:"Longitude",readonly:!0,variant:"outlined",fullWidth:!0,value:At.lng})})]})})]})}),(0,ue.jsx)(T.A,{sx:{display:"flex",justifyContent:"end",mr:3,mb:2},children:(0,ue.jsx)(E.A,{variant:"contained",size:"medium",onClick:()=>{(async()=>{try{const e=(0,n.A)((0,n.A)({},mt),{},{tenantid:Ge});console.log("updateClient",e);const t=await s.A.put("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/update"),e);console.log("updateClient",t.data.message),t.data.status&&_t(t.data.message,"success",1500),Tt(),Ot()}catch(e){console.log("updateClient",e)}})()},children:"Update Client"})})]})})})},"left - card"),1==Je&&(0,ue.jsx)(_.A,{variant:"outlined",sx:{},children:(0,ue.jsx)(y.A,{children:(0,ue.jsxs)(S.A,{children:[(0,ue.jsx)(w.A,{children:(0,ue.jsxs)(C.A,{children:[(0,ue.jsx)(k.A,{children:"#"}),(0,ue.jsx)(k.A,{children:"Date"}),(0,ue.jsx)(k.A,{children:"Slab"}),(0,ue.jsx)(k.A,{children:"Base Price"}),(0,ue.jsx)(k.A,{children:"Min Kms"}),(0,ue.jsx)(k.A,{children:"Price/Km"}),(0,ue.jsx)(k.A,{children:"Other Charges"})]})}),(0,ue.jsx)(z.A,{children:0===(null===Qe||void 0===Qe?void 0:Qe.length)?(0,ue.jsx)(C.A,{children:(0,ue.jsx)(k.A,{colSpan:7,align:"center",children:(0,ue.jsx)(c.A,{})})}):Qe.map(((e,t)=>(0,ue.jsxs)(C.A,{sx:{bgcolor:"white"},children:[(0,ue.jsx)(k.A,{children:t+1}),(0,ue.jsx)(k.A,{children:x()(e.pricingdate).format("DD-MM-YYYY")}),(0,ue.jsx)(k.A,{children:e.slab}),(0,ue.jsx)(k.A,{children:e.baseprice}),(0,ue.jsx)(k.A,{children:e.minkm}),(0,ue.jsx)(k.A,{children:e.priceperkm}),(0,ue.jsx)(k.A,{children:e.othercharges})]},e.id||t)))})]})})},"left - card")]})})})]},null!==(i=e.tenantid)&&void 0!==i?i:t)})):(0,ue.jsx)(C.A,{children:(0,ue.jsx)(k.A,{colSpan:6,sx:{py:6},children:(0,ue.jsxs)(f.A,{alignItems:"center",spacing:1.5,children:[(0,ue.jsx)(g.A,{sx:{width:64,height:64,bgcolor:Ce("#94a3b8"),color:fe},children:(0,ue.jsx)(oe.Itr,{size:28})}),(0,ue.jsx)(b.A,{variant:"subtitle1",sx:{fontWeight:700,color:je},children:"No tenants to show"}),(0,ue.jsx)(b.A,{variant:"caption",sx:{color:me},children:"No ".concat(qt.label.toLowerCase()," tenants for this filter.")})]})})})]})]})}),Ye&&(0,ue.jsxs)(N.nV,{scroll:!0,sx:{display:{xs:"flex",md:"none"}},children:[Yt&&(0,ue.jsxs)(f.A,{alignItems:"center",sx:{py:4},children:[(0,ue.jsx)(v.A,{variant:"rounded",width:"100%",height:96,animation:"wave"}),(0,ue.jsx)(v.A,{variant:"rounded",width:"100%",height:96,animation:"wave",sx:{mt:1.25}})]}),0!=(null===Lt||void 0===Lt?void 0:Lt.length)||Te?null===Lt||void 0===Lt?void 0:Lt.map(((e,t)=>{var i;const n=We[0===Ve?"active":1===Ve?"pending":"inactive"],o=n.icon,l=Wt===t;return(0,ue.jsxs)(N.pg,{accent:n.color,header:(0,ue.jsxs)(f.A,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1,children:[(0,ue.jsxs)(f.A,{direction:"row",alignItems:"center",spacing:1,sx:{minWidth:0},children:[(0,ue.jsx)(Re,{color:"#662582",size:36,children:(0,ue.jsx)(oe.Azs,{size:18})}),(0,ue.jsxs)(f.A,{sx:{minWidth:0},children:[(0,ue.jsx)(b.A,{variant:"subtitle2",sx:{fontWeight:800,color:je},noWrap:!0,children:e.tenantname}),(0,ue.jsxs)(f.A,{direction:"row",alignItems:"center",spacing:.5,sx:{display:"inline-flex",mt:.25,pl:.25,pr:.875,py:.125,borderRadius:999,bgcolor:we(n.color),border:"1px solid ".concat(ze(n.color)),color:n.color,alignSelf:"flex-start"},children:[(0,ue.jsx)(Re,{color:n.color,size:16,children:(0,ue.jsx)(o,{size:10})}),(0,ue.jsx)(b.A,{sx:{fontWeight:800,fontSize:10,lineHeight:1},children:n.label})]})]})]}),(0,ue.jsxs)(f.A,{direction:"row",spacing:.5,sx:{flexShrink:0},children:[0==Ve&&(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Ce("#ef4444"),color:"#ef4444",border:"1px solid ".concat(ze("#ef4444")),"&:hover":{bgcolor:"#ef4444",color:"#fff"}},onClick:()=>{nt(e),Ze(e.tenantid),Oe(e.applocationid),setTimeout((()=>{Bt(e.tenantid)}),100)},children:(0,ue.jsx)(X.A,{style:{fontSize:14}})}),1==Ve&&(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Ce("#f59e0b"),color:"#f59e0b",border:"1px solid ".concat(ze("#f59e0b")),"&:hover":{bgcolor:"#f59e0b",color:"#fff"}},onClick:()=>{nt(e),lt(!0),Ze(e.tenantid),Oe(e.applocationid),Ht(e.applolcationid)},children:(0,ue.jsx)(J.A,{style:{fontSize:14}})}),2==Ve&&(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Ce("#10b981"),color:"#10b981",border:"1px solid ".concat(ze("#10b981")),"&:hover":{bgcolor:"#10b981",color:"#fff"}},onClick:()=>{nt(e),Ze(e.tenantid),Oe(e.applocationid),setTimeout((()=>{Bt(e.tenantid)}),100)},children:(0,ue.jsx)(ee.yjt,{style:{fontSize:14}})}),(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:l?"#662582":Ce("#662582"),color:l?"#fff":"#662582",border:"1px solid ".concat(ze("#662582")),"&:hover":{bgcolor:"#662582",color:"#fff"}},onClick:()=>{nt(e),Rt(t),Mt(-1),Ze(e.tenantid)},children:l?(0,ue.jsx)(U.A,{style:{fontSize:14}}):(0,ue.jsx)(G.A,{style:{fontSize:14}})}),1!==Ve&&(0,ue.jsx)(I.A,{size:"small",sx:{bgcolor:Ce("#8b5cf6"),color:"#8b5cf6",border:"1px solid ".concat(ze("#8b5cf6")),"&:hover":{bgcolor:"#8b5cf6",color:"#fff"}},onClick:()=>{nt(e),Ze(e.tenantid),Oe(e.applocationid),Ht(e.applolcationid),lt(!0)},children:(0,ue.jsx)(Q.A,{style:{fontSize:14}})})]})]}),children:[(0,ue.jsxs)(N.FG,{children:[(0,ue.jsx)(N.pY,{label:"Tenant ID",value:"#".concat(e.tenantid)}),(0,ue.jsx)(N.pY,{label:"Contact",value:e.primarycontact||"\u2014"}),(0,ue.jsx)(N.pY,{label:"Email",value:e.primaryemail||"\u2014",full:!0}),(0,ue.jsx)(N.pY,{label:"Address",full:!0,children:(0,ue.jsx)(b.A,{sx:{fontSize:13,fontWeight:600,color:je},children:e.address||"\u2014"})})]}),l&&(0,ue.jsx)(m.A,{sx:{mt:1.25,pt:1.25,borderTop:"1px solid ".concat(ve)},children:(0,ue.jsxs)(N.FG,{children:[(0,ue.jsx)(N.pY,{label:"Contact Person",value:e.firstname||"\u2014"}),(0,ue.jsx)(N.pY,{label:"City",value:e.city||"\u2014"}),(0,ue.jsx)(N.pY,{label:"Postcode",value:e.postcode||"\u2014"}),(0,ue.jsx)(N.pY,{label:"Latitude",value:e.latitude||"\u2014"}),(0,ue.jsx)(N.pY,{label:"Longitude",value:e.longitude||"\u2014"})]})})]},null!==(i=e.tenantid)&&void 0!==i?i:t)})):(0,ue.jsxs)(f.A,{alignItems:"center",spacing:1.5,sx:{py:6},children:[(0,ue.jsx)(g.A,{sx:{width:64,height:64,bgcolor:Ce("#94a3b8"),color:fe},children:(0,ue.jsx)(oe.Itr,{size:28})}),(0,ue.jsx)(b.A,{variant:"subtitle1",sx:{fontWeight:700,color:je},children:"No tenants to show"}),(0,ue.jsx)(b.A,{variant:"caption",sx:{color:me,textAlign:"center"},children:"No ".concat(qt.label.toLowerCase()," tenants for this filter.")})]})]}),!i&&(null===Lt||void 0===Lt?void 0:Lt.length)>0&&(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(K.A,{sx:{borderColor:be}}),(0,ue.jsx)(D.A,{rowsPerPageOptions:[5,10,25,50,100],component:"div",count:0==Ve?null===Kt||void 0===Kt?void 0:Kt.active:1==Ve?null===Kt||void 0===Kt?void 0:Kt.pending:2==Ve?null===Kt||void 0===Kt?void 0:Kt.inactive:0,rowsPerPage:_e,page:bt,onPageChange:(e,t)=>{vt(t)},onRowsPerPageChange:e=>{Ee(parseInt(e.target.value,10)),vt(0)}})]})]}),(0,ue.jsxs)(O.A,{fullWidth:!0,fullScreen:Ye,open:ot,onClose:wt,scroll:"paper",maxWidth:"sm",TransitionComponent:$.s,PaperProps:{sx:{borderRadius:{xs:0,sm:3}}},children:[(0,ue.jsx)(F.A,{sx:{bgcolor:"#662582",color:"#fff",fontSize:"20px"},children:"Client Pricing - (".concat(it.tenantname,")")}),(0,ue.jsx)(B.A,{dividers:!0,children:(0,ue.jsx)(l.A,{sx:{height:"100%"},children:(0,ue.jsxs)(j.Ay,{container:!0,spacing:2.5,alignItems:"center",children:[(0,ue.jsxs)(j.Ay,{item:!0,xs:12,sm:6,children:[(0,ue.jsx)(H.A,{children:"Select Slab"}),(0,ue.jsx)(V.A,{disablePortal:!0,id:"combo-box-demo",options:st,getOptionLabel:e=>"".concat(e.slab),fullWidth:!0,selectOnFocus:!0,renderInput:e=>(0,ue.jsx)(Y.A,(0,n.A)((0,n.A)({},e),{},{label:"Slab"})),onChange:(e,t,i)=>{ct(t),console.log("pricing",t),xt(!1),"clear"===i&&xt(!0)}})]}),(0,ue.jsxs)(j.Ay,{item:!0,xs:12,sm:6,children:[(0,ue.jsx)(H.A,{children:"Base Price"}),(0,ue.jsx)(Y.A,{type:"number",fullWidth:!0,value:dt?0:at.baseprice,onChange:e=>{ct((0,n.A)((0,n.A)({},at),{},{baseprice:e.target.value}))}})]}),(0,ue.jsxs)(j.Ay,{item:!0,xs:12,sm:6,children:[(0,ue.jsx)(H.A,{children:"Price/Km"}),(0,ue.jsx)(Y.A,{type:"number",fullWidth:!0,value:dt?0:at.priceperkm,onChange:e=>{ct((0,n.A)((0,n.A)({},at),{},{priceperkm:e.target.value}))}})]}),(0,ue.jsxs)(j.Ay,{item:!0,xs:12,sm:6,children:[(0,ue.jsx)(H.A,{children:"Min Kms"}),(0,ue.jsx)(Y.A,{type:"number",fullWidth:!0,value:dt?0:at.minkm,onChange:e=>{ct((0,n.A)((0,n.A)({},at),{},{minkm:e.target.value}))}})]}),(0,ue.jsxs)(j.Ay,{item:!0,xs:12,sm:6,children:[(0,ue.jsx)(H.A,{children:"Max Kms"}),(0,ue.jsx)(Y.A,{type:"number",fullWidth:!0,value:dt?0:at.maxkm,onChange:e=>{ct((0,n.A)((0,n.A)({},at),{},{maxkm:e.target.value}))}})]}),(0,ue.jsxs)(j.Ay,{item:!0,xs:12,sm:6,children:[(0,ue.jsx)(H.A,{children:"Min Orders"}),(0,ue.jsx)(Y.A,{type:"number",fullWidth:!0,value:dt?0:at.minorder,onChange:e=>{ct((0,n.A)((0,n.A)({},at),{},{minorder:e.target.value}))}})]})]})})}),(0,ue.jsx)(q.A,{children:(0,ue.jsx)(j.Ay,{container:!0,children:(0,ue.jsx)(j.Ay,{item:!0,xs:12,children:(0,ue.jsxs)(f.A,{direction:"row",justifyContent:"flex-end",spacing:2,sx:{p:2},children:[1==Je&&(0,ue.jsx)(E.A,{disabled:dt,variant:"contained",onClick:()=>{Vt()},children:"Update Pricing"}),1==Ve&&(0,ue.jsx)(E.A,{disabled:dt,variant:"contained",onClick:()=>{Vt()},children:"Save"}),(0,ue.jsx)(E.A,{variant:"contained",onClick:()=>{xt(!0),setTimeout((()=>{wt()}),100),ct({})},color:"error",children:"Cancel"})]})})})})]})]})}},96646:(e,t,i)=>{i.d(t,{r:()=>a});var n=i(50755),o=i(1596),l=i(91834),s=i(71392),r=i(65908);const a=e=>{let{rowsPerPage:t=5,col:i=1}=e;return(0,r.jsx)(r.Fragment,{children:Array.from(new Array(t)).map(((e,t)=>(0,r.jsxs)(n.A,{children:[(0,r.jsx)(o.A,{children:(0,r.jsx)(l.A,{variant:"circular",width:24,height:24})}),(0,r.jsx)(o.A,{children:(0,r.jsx)(l.A,{variant:"text",width:30})}),Array.from({length:i}).map(((e,t)=>(0,r.jsx)(o.A,{children:(0,r.jsxs)(s.A,{spacing:.5,children:[(0,r.jsx)(l.A,{variant:"text",width:100}),(0,r.jsx)(l.A,{variant:"text",width:80})]})},t))),(0,r.jsx)(o.A,{children:(0,r.jsx)(l.A,{variant:"text",width:150})}),(0,r.jsx)(o.A,{children:(0,r.jsx)(l.A,{variant:"rounded",width:60,height:24})}),(0,r.jsx)(o.A,{align:"center",children:(0,r.jsxs)(s.A,{direction:"row",spacing:1,justifyContent:"flex-end",children:[(0,r.jsx)(l.A,{variant:"circular",width:28,height:28}),(0,r.jsx)(l.A,{variant:"circular",width:28,height:28})]})})]},t)))})}}}]); |