1 line
30 KiB
JavaScript
1 line
30 KiB
JavaScript
"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[1504],{1367:(e,t,n)=>{n.d(t,{A:()=>c});var i=n(89379),s=(n(9950),n(16491)),l=n(93230),a=n(82053),r=n(44414);const c=e=>{let{sx:t,title:n,children:c,starticon:o}=e;return(0,r.jsx)(s.A,{sx:(0,i.A)({},t),children:(0,r.jsxs)(l.A,{direction:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:1,children:[(0,r.jsxs)(l.A,{children:[o&&o,(0,r.jsx)(a.A,{variant:"h3",children:n})]}),c]})})}},56311:(e,t,n)=>{n.d(t,{A:()=>A});var i=n(89379),s=n(9950),l=n(2660),a=n(2046),r=n(83274),c=n(25333),o=n(97125),d=n(7762),x=n(52097),h=n(44414);const A=e=>{let{value:t,onChange:n,onDebouncedChange:A,debounceTime:p=500,placeholder:u="Search (ctrl+k)",sx:m}=e;const g=(0,s.useRef)(null),[j]=(0,x.d7)(t,p);return(0,s.useEffect)((()=>{A&&A(j)}),[j,A]),(0,s.useEffect)((()=>{const e=e=>{var t;"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),null===(t=g.current)||void 0===t||t.focus());"Escape"===e.key&&document.activeElement===g.current&&g.current.blur()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[]),(0,h.jsx)(l.A,{sx:(0,i.A)({},m),inputRef:g,placeholder:u,autoComplete:"off",value:t,fullWidth:!0,onChange:e=>n(e.target.value),startAdornment:(0,h.jsx)(a.A,{position:"start",sx:{mr:-.5},children:(0,h.jsx)(o.A,{})}),endAdornment:(0,h.jsx)(r.A,{title:"Clear",children:(0,h.jsx)(c.A,{sx:{visibility:t?"visible":"hidden"},onClick:()=>n(""),children:(0,h.jsx)(d.A,{})})})})}},59212:(e,t,n)=>{n.d(t,{A:()=>o});var i=n(89379),s=n(9950),l=n(77922),a=n(29925),r=n(26910),c=n(44414);const o=(0,s.forwardRef)(((e,t)=>{let{setAppId:n,setLocoName:o,setPage:d,sx:x,textfeildSx:h}=e;const[A,p]=(0,s.useState)(JSON.parse(localStorage.getItem("applocations")||"[]"));return(0,s.useEffect)((()=>{0===A.length&&(async()=>{try{const e=localStorage.getItem("userid");if(!e)return;const t=await r.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)),p(e)}}catch(e){console.error("Error fetching locations in LocationAutocomplete:",e)}})()}),[A.length]),(0,c.jsx)(l.A,{id:"location-autocomplete",options:A||[],getOptionLabel:e=>{var t;return null!==(t=null===e||void 0===e?void 0:e.locationname)&&void 0!==t?t:""},sx:(0,i.A)({},x),onChange:(e,t,i)=>{"clear"===i?(null===n||void 0===n||n(0),null===o||void 0===o||o(""),null===d||void 0===d||d(0)):t&&(null===n||void 0===n||n(t.applocationid),null===o||void 0===o||o(t.locationname),null===d||void 0===d||d(0))},renderInput:e=>(0,c.jsx)(a.A,(0,i.A)((0,i.A)({},e),{},{inputRef:t,label:"Select Zones",sx:(0,i.A)({},h)}))})}))},71504:(e,t,n)=>{n.r(t),n.d(t,{default:()=>pe});var i=n(89379),s=n(9950),l=n(1367),a=n(50027),r=n(26910),c=n(14857),o=n(52351),d=n(13838),x=n(4159),h=n.n(x),A=n(8881),p=n(99459),u=n(28217),m=n(55471),g=n.n(m),j=n(21209),y=n(93230),f=n(48159),v=n(84142),b=n(25277),S=n(82917),C=n(1320),w=n(15769),W=n(69780),k=n(9213),z=n(21671),I=n(34075),P=n(82053),M=n(25333),_=n(83274),E=n(33738),L=n(60899),D=n(48089),Y=n(16491),O=n(82223),K=n(50704),T=n(29925),R=n(77922),q=n(25713),N=n(74745),F=n(6258),H=n(96583),V=n(40033),B=n(28170),J=n(29277),U=n(79739),X=n(9083),Z=n(8203),G=n(4729),Q=n(12678),$=n(24513),ee=n(37476),te=n(54826),ne=n(63057),ie=n(85527),se=n(74930),le=n(31222),ae=n(21636),re=n(39174),ce=n(59212),oe=n(56311),de=n(36150),xe=n(81425),he=n(96646),Ae=n(44414);const pe=()=>{const e=(0,s.useRef)(null),[t,n]=(0,s.useState)(""),[x,m]=(0,s.useState)(""),[pe,ue]=s.useState(10),me=(0,c.A)(),[ge,je]=(0,s.useState)(!1),[ye,fe]=(0,s.useState)(0),[ve,be]=(0,s.useState)(""),[Se]=(0,s.useState)("All"),[Ce,we]=s.useState(null),[We,ke]=(0,s.useState)(0),[ze,Ie]=(0,s.useState)(0),[Pe,Me]=(0,s.useState)(0),[_e,Ee]=(0,s.useState)(null),[Le,De]=(0,s.useState)([]),[Ye,Oe]=(0,s.useState)("active"),[Ke,Te]=(0,s.useState)({}),[Re,qe]=(0,s.useState)(!1),[Ne,Fe]=(0,s.useState)([]),[He,Ve]=(0,s.useState)({}),[Be,Je]=(0,s.useState)(!0),[Ue,Xe]=(0,s.useState)(""),[Ze,Ge]=(0,s.useState)(""),[Qe,$e]=(0,s.useState)(""),[et,tt]=(0,s.useState)({}),[nt,it]=(0,s.useState)({}),[st,lt]=(0,s.useState)(0),[at,rt]=(0,s.useState)("Active"),ct=()=>{qe(!1)},ot=(e,t)=>{console.log("newValue1",t),Ie(t)},dt=(e,t)=>{console.log("newValue2",t),Me(t)},[xt,ht]=(0,s.useState)(null),[At,pt]=(0,s.useState)(null);(0,s.useEffect)((()=>{console.log("selectedCustomer",Ke)}),[Ke]),(0,s.useEffect)((()=>{ht(-1),pt(-1)}),[We]);const ut=(e,t,n)=>{(0,A.M8)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n})};const mt={current:null},[gt,jt]=(0,s.useState)(""),[yt,ft]=(0,s.useState)([]),vt=(0,s.useRef)(!1);"undefined"===typeof window||vt.current||(document.querySelector("#google-maps")||function(e,t,n){if(!t)return;const i=document.createElement("script");i.setAttribute("async",""),i.setAttribute("id",n),i.src=e,t.appendChild(i)}("https://maps.googleapis.com/maps/api/js?key=".concat("AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8","&libraries=places"),document.querySelector("head"),"google-maps"),vt.current=!0);const bt=(0,s.useMemo)((()=>(0,j.A)(((e,t)=>{mt.current.getPlacePredictions(e,t)}),400)),[]);(0,s.useEffect)((()=>{let e=!0;if(!mt.current&&window.google&&(mt.current=new window.google.maps.places.AutocompleteService),mt.current){if(""!==gt)return bt({input:gt},(t=>{if(e){let e=[];Ce&&(e=[Ce]),t&&(e=[...e,...t]),ft(e)}})),()=>{e=!1};ft(Ce?[Ce]:[])}}),[Ce,gt,bt]),p.A.setApiKey("AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8"),(0,s.useEffect)((()=>{try{console.log("selected address =>",Ue),p.A.fromAddress(Ue).then((e=>{if(console.log("lat long response =>",e.results[0]),"OK"==e.status){const{lat:t,lng:n}=e.results[0].geometry.location;if(tt({lat:t,lng:n}),it((0,i.A)((0,i.A)({},nt),{},{latitude:t.toString(),longitude:n.toString()})),e.results[0].address_components){let t,n,s,l,a=e.results[0];for(let e=0;e<a.address_components.length;e++)for(let i=0;i<a.address_components[e].types.length;i++)switch(a.address_components[e].types[i]){case"locality":t=a.address_components[e].long_name;break;case"administrative_area_level_1":s=a.address_components[e].long_name;break;case"postal_code":n=a.address_components[e].long_name;break;case"sublocality":l=a.address_components[e].long_name}Ge(t||""),setState(s||""),$e(n||""),setSuburb(l||""),it((0,i.A)((0,i.A)({},nt),{},{city:t||"",state:s||"",postcode:Qe||"",suburb:l||""}))}}}),(e=>{console.log(e)}))}catch(e){console.log(e)}}),[Ue]),(0,s.useEffect)((()=>{Ke&&tt({lat:Ke.latitude,lng:Ke.longitude})}),[Ke]),(0,s.useEffect)((()=>{const t=t=>{"k"===t.key&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.current.focus()),"Escape"===t.key&&document.activeElement===e.current&&e.current.blur()};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}),[]);const{data:St,isLoading:Ct,refetch:wt}=(0,de.I)({queryKey:["tenantList",ye,x,Ye,st,pe],queryFn:xe.ry}),{data:Wt=[],isLoading:kt,refetch:zt}=(0,de.I)({queryKey:["gettenantsummary",ye,Ye],queryFn:xe.bd}),It=async()=>{await r.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/getpricinglist/?tenantid=").concat(_e)).then((e=>{console.log("getpricinglist",e),e.data.status&&De(e.data.details)})).catch((e=>{console.log(e)}))};(0,s.useEffect)((()=>{_e&&It()}),[_e]);(0,s.useEffect)((()=>{_e&&(async e=>{try{let t=await r.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)}})(_e)}),[_e]);const Pt=async e=>{let t;je(!0),t=-1==e?{tenantid:_e,approved:1}:{tenantid:e,status:"active"===Ye?"InActive":"Active"},await r.A.put("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/update"),t).then((e=>{e.data.status&&(ut(0==We?"Inactivated Successfully":1==We?"Approved Successfully":"Activate Successfully","success",2e3),wt(),zt(),je(!1))})).catch((e=>{console.log(e),ut(e.message,"error",1500),je(!1)}))},Mt=async e=>{console.log("id",e);try{let t=await r.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapppricing/?applocationid=").concat(e));console.log("appPricingRes",t.data.details),Fe(t.data.details)}catch(t){console.log("appPricingRes",t)}},_t=async()=>{je(!0),await r.A.post("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/createpricing"),{tenantpricingid:0,applocationid:ye,pricingid:He.pricingid,tenantid:_e,pricingdate:h()().format("YYYY-MM-DD HH:mm:ss"),configid:He.configid,pricingtypeid:He.pricingtypeid,slab:He.slab,baseprice:+He.baseprice,priceperkm:+He.priceperkm,minkm:+He.minkm,maxkm:+He.maxkm,orders:+He.minorder,othercharges:0}).then((e=>{e.data.status&&((0,A.M8)("Price Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),ct(),Ve({}),Pt(-1),It())})).catch((e=>{console.log(e)}))};return(0,Ae.jsxs)("div",{children:[(Ct||kt||ge)&&(0,Ae.jsx)(o.A,{}),(0,Ae.jsx)(l.A,{title:"Tenants ",children:(0,Ae.jsx)(ce.A,{locations:Se,locaName:ve,setAppId:fe,setLocoName:be,setPage:lt,sx:{width:{xs:"100%",custom450:300},zIndex:"100"}})}),(0,Ae.jsxs)(a.A,{content:!1,sx:{mt:2},title:(0,Ae.jsxs)(y.A,{minWidth:"100%",flexDirection:{xs:"row",sm:"row"},sx:{p:1.5,display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap-reverse",gap:1},children:[(0,Ae.jsxs)(f.A,{value:We,onChange:(e,t)=>{rt(0==t?"Active":1==t?"Pending":"InActive"),ke(t),n(""),lt(0)},"aria-label":"basic tabs example",children:[(0,Ae.jsx)(v.A,{label:"Active",sx:{ml:-1},onClick:()=>{Oe("active")},icon:(0,Ae.jsx)(b.A,{label:kt?(0,Ae.jsx)(S.A,{variant:"text",width:15,height:10}):(null===Wt||void 0===Wt?void 0:Wt.active)||0,color:"primary",variant:"light",sx:{minWidth:32,justifyContent:"center"},size:"small"}),iconPosition:"end"}),(0,Ae.jsx)(v.A,{label:"Pending",onClick:()=>{Oe("pending")},icon:(0,Ae.jsx)(b.A,{label:kt?(0,Ae.jsx)(S.A,{variant:"text",width:15,height:10}):(null===Wt||void 0===Wt?void 0:Wt.pending)||0,color:"primary",variant:"light",sx:{minWidth:32,justifyContent:"center"},size:"small"}),iconPosition:"end"}),(0,Ae.jsx)(v.A,{label:"Inactive",onClick:()=>{Oe("inactive")},icon:(0,Ae.jsx)(b.A,{label:kt?(0,Ae.jsx)(S.A,{variant:"text",width:15,height:10}):(null===Wt||void 0===Wt?void 0:Wt.inactive)||0,color:"primary",variant:"light",sx:{minWidth:32,justifyContent:"center"},size:"small"}),iconPosition:"end"})]}),(0,Ae.jsx)(oe.A,{value:t,onChange:n,onDebouncedChange:m,sx:{width:{xs:"100%",custom600:275},m:0}})]}),children:[(0,Ae.jsx)(C.A,{sx:{maxHeight:"calc(100vh - 300px)"},children:(0,Ae.jsxs)(w.A,{stickyHeader:!0,children:[(0,Ae.jsx)(W.A,{children:(0,Ae.jsxs)(k.A,{children:[(0,Ae.jsx)(z.A,{sx:{position:"sticky !important",bgcolor:"#e1bee7!important"},children:"S.No"}),(0,Ae.jsx)(z.A,{sx:{position:"sticky !important",bgcolor:"#e1bee7!important"},children:"Client"}),(0,Ae.jsx)(z.A,{sx:{position:"sticky !important",bgcolor:"#e1bee7!important"},children:"Contact"}),(0,Ae.jsx)(z.A,{sx:{position:"sticky !important",bgcolor:"#e1bee7!important"},children:"Address"}),(0,Ae.jsx)(z.A,{sx:{position:"sticky !important",bgcolor:"#e1bee7!important"},align:"center",children:"Actions"})]})}),(0,Ae.jsxs)(I.A,{children:[Ct&&(0,Ae.jsx)(he.r,{}),0!=(null===St||void 0===St?void 0:St.length)||ge?null===St||void 0===St?void 0:St.map(((e,t)=>(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(k.A,{children:[(0,Ae.jsx)(z.A,{children:t+1+st*pe}),(0,Ae.jsx)(z.A,{children:(0,Ae.jsxs)(y.A,{children:[(0,Ae.jsx)(P.A,{variant:"subtitle1",sx:{whiteSpace:"nowrap"},children:e.tenantname}),(0,Ae.jsxs)(P.A,{variant:"body2",children:["Id : ",e.tenantid]})]})}),(0,Ae.jsxs)(z.A,{children:[(0,Ae.jsx)(P.A,{children:e.primarycontact}),(0,Ae.jsx)(P.A,{color:"secondary",children:e.primaryemail})]}),(0,Ae.jsx)(z.A,{sx:{whiteSpace:"wrap"},children:e.address}),(0,Ae.jsx)(z.A,{align:"center",children:(0,Ae.jsxs)(y.A,{direction:"row",children:[(0,Ae.jsx)(M.A,{sx:{color:1==We?me.palette.primary.main:me.palette.success.main},children:(0,Ae.jsx)(_.A,{title:0==We?"Inactive":1==Ce?"Approve":"Active",placement:"top",children:0==We?(0,Ae.jsx)(X.A,{style:{color:"red"},onClick:()=>{Te(e),Ee(e.tenantid),fe(e.applocationid),setClientstatus(e.approved),setTimeout((()=>{Pt(e.tenantid)}),100)}}):1==We?(0,Ae.jsx)(Z.A,{onClick:()=>{Te(e),qe(!0),Ee(e.tenantid),fe(e.applocationid),Mt(e.applolcationid)}}):(0,Ae.jsx)(te.yjt,{onClick:()=>{Te(e),Ee(e.tenantid),fe(e.applocationid),setTimeout((()=>{Pt(e.tenantid)}),100)}})})}),(0,Ae.jsx)(M.A,{"aria-label":"expand row",size:"medium",onClick:()=>{var n;Te(e),n=t,ht((e=>e===n?null:n)),pt(-1),Ee(e.tenantid)},sx:{color:xt===t?me.palette.error.main:me.palette.primary.main},children:xt===t?(0,Ae.jsx)(G.A,{}):(0,Ae.jsx)(Q.A,{})}),1!==We&&(0,Ae.jsx)(M.A,{"aria-label":"expand row",size:"medium",onClick:()=>{var n;Te(e),n=t,pt((e=>e===n?null:n)),ht(-1),Ee(e.tenantid),fe(e.applocationid)},sx:{color:At===t?me.palette.error.main:me.palette.primary.main},children:(0,Ae.jsx)(_.A,{title:At===t?"Close":"Edit",placement:"top",children:At===t?(0,Ae.jsx)(CloseOutlined,{}):(0,Ae.jsx)($.A,{})})})]})})]},t),xt===t&&(0,Ae.jsx)(k.A,{children:(0,Ae.jsx)(z.A,{sx:{"&:hover":{backgroundColor:"white !important"}},colSpan:15,children:(0,Ae.jsx)(E.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,Ae.jsxs)(a.A,{content:!1,sx:{transform:open?"translateY(0)":"translateY(-8px)",opacity:open?1:0},title:(0,Ae.jsxs)(f.A,{sx:{bgcolor:"primary.lighter"},value:ze,onChange:ot,"aria-label":"basic tabs example",children:[(0,Ae.jsx)(v.A,{label:" Details",icon:(0,Ae.jsx)(ne.gA5,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"}}),(0,Ae.jsx)(v.A,{label:"Pricing",icon:(0,Ae.jsx)(ie.FA6,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"}})]}),children:[0==ze&&(0,Ae.jsxs)(L.Ay,{container:!0,sx:{m:1},spacing:2.5,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(se.JXP,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",children:e.tenantname}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"Tenant"})]})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(se.JXP,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",children:e.firstname}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"Contact Person"})]})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(se.wnV,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",children:e.primarycontact}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"Phone"})]})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(ae.h2r,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",children:e.primaryemail}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"E-Mail"})]})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(te.Y9o,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",children:e.address}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"Address"})]})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(ie.BUW,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",children:e.city}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"City"})]}),(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(le.kci,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",variant:"subtitle1",children:e.postcode}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"PostCode"})]})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(TbWorldLatitude,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",children:e.latitude}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"Latitude"})]}),(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(ne.u3h,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:[(0,Ae.jsx)(P.A,{align:"left",variant:"subtitle1",children:e.longitude}),(0,Ae.jsx)(P.A,{align:"left",variant:"caption",color:"secondary",children:"Longitude"})]})]})})]}),1==ze&&(0,Ae.jsx)(D.A,{variant:"outlined",sx:{},children:(0,Ae.jsx)(C.A,{children:(0,Ae.jsxs)(w.A,{children:[(0,Ae.jsx)(W.A,{children:(0,Ae.jsxs)(k.A,{children:[(0,Ae.jsx)(z.A,{children:"#"}),(0,Ae.jsx)(z.A,{children:"Date"}),(0,Ae.jsx)(z.A,{children:"Slab"}),(0,Ae.jsx)(z.A,{children:"Base Price"}),(0,Ae.jsx)(z.A,{children:"Min Kms"}),(0,Ae.jsx)(z.A,{children:"Price/Km"}),(0,Ae.jsx)(z.A,{children:"Other Charges"})]})}),(0,Ae.jsx)(I.A,{children:0===(null===Le||void 0===Le?void 0:Le.length)?(0,Ae.jsx)(k.A,{children:(0,Ae.jsx)(z.A,{colSpan:7,align:"center",children:(0,Ae.jsx)(d.A,{description:"No Pricing List"})})}):Le.map(((e,t)=>(0,Ae.jsxs)(k.A,{sx:{bgcolor:"white"},children:[(0,Ae.jsx)(z.A,{children:t+1}),(0,Ae.jsx)(z.A,{children:h()(e.pricingdate).format("DD-MM-YYYY")}),(0,Ae.jsx)(z.A,{children:e.slab}),(0,Ae.jsx)(z.A,{children:e.baseprice}),(0,Ae.jsx)(z.A,{children:e.minkm}),(0,Ae.jsx)(z.A,{children:e.priceperkm}),(0,Ae.jsx)(z.A,{children:e.othercharges})]},e.id||t)))})]})})},"left - card")]})})})}),At===t&&(0,Ae.jsx)(k.A,{children:(0,Ae.jsx)(z.A,{sx:{backgroundColor:"white!important","&:hover":{backgroundColor:"white!important"}},colSpan:15,children:(0,Ae.jsxs)(a.A,{content:!1,title:(0,Ae.jsxs)(Y.A,{sx:{bgcolor:"primary.lighter",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,Ae.jsxs)(f.A,{value:Pe,onChange:dt,"aria-label":"basic tabs example",children:[(0,Ae.jsx)(v.A,{label:"Edit Details",icon:(0,Ae.jsx)(ne.gA5,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"}}),1!==We&&(0,Ae.jsx)(v.A,{label:"Edit Pricing",icon:(0,Ae.jsx)(ie.FA6,{style:{marginRight:5,fontSize:"20px",marginBottom:-1}}),sx:{alignItems:"center",flexDirection:"row"},onClick:()=>{Mt(Ke.applolcationid)}})]}),1==Pe&&(0,Ae.jsx)(O.A,{variant:"contained",color:"error",size:"smaller",startIcon:(0,Ae.jsx)($.A,{size:"small"}),sx:{mr:1.8,height:"30px"},onClick:()=>{qe(!0)},children:"Add Pricing"})]}),children:[0==Pe&&(0,Ae.jsx)(D.A,{variant:"outlined",sx:{m:2},children:(0,Ae.jsx)(L.Ay,{container:!0,spacing:0,children:(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(D.A,{variant:"outlined",children:[(0,Ae.jsx)(K.A,{children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:2.5,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(re.PY8,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{fullWidth:!0,id:"outlined-basic",label:"Tenant Name",defaultValue:Ke.tenantname,variant:"outlined",onChange:e=>{it((0,i.A)((0,i.A)({},nt),{},{tenantname:e.target.value}))},sx:{mt:2}})})]})})," ",(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(se.JXP,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{fullWidth:!0,id:"outlined-basic",label:"Contact Person",defaultValue:e.firstname,variant:"outlined",onChange:e=>{it((0,i.A)((0,i.A)({},nt),{},{firstname:e.target.value}))},sx:{mt:2}})})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(se.wnV,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{inputProps:{maxLength:10},fullWidth:!0,id:"outlined-basic",label:"Contact Number",defaultValue:Ke.primarycontact,variant:"outlined",onChange:e=>{it((0,i.A)((0,i.A)({},nt),{},{primarycontact:e.target.value}))},sx:{mt:2}})})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:6,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(ae.h2r,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{fullWidth:!0,id:"outlined-basic",label:"E-Mail",defaultValue:Ke.primaryemail,variant:"outlined",onChange:e=>{it((0,i.A)((0,i.A)({},nt),{},{primaryemail:e.target.value}))},sx:{mt:2}})})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(te.Y9o,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(R.A,{id:"google-map-demo",sx:{},fullWidth:!0,label:"Address",getOptionLabel:e=>"string"===typeof e?e:e.description,filterOptions:e=>e,options:yt,autoComplete:!0,includeInputInList:!0,filterSelectedOptions:!0,defaultValue:Ke.address,noOptionsText:"No locations",onChange:(e,t)=>{ft(t?[t,...yt]:yt),we(t||""),console.log("newValue",t),Xe((null===t||void 0===t?void 0:t.description)||""),it((0,i.A)((0,i.A)({},nt),{},{address:(null===t||void 0===t?void 0:t.description)||""}))},onInputChange:(e,t)=>{jt(t)},renderInput:e=>(0,Ae.jsx)(T.A,(0,i.A)((0,i.A)({},e),{},{fullWidth:!0,label:"Address",variant:"outlined"})),renderOption:(e,t)=>{const n=t.structured_formatting.main_text_matched_substrings||[],s=g()(t.structured_formatting.main_text,n.map((e=>[e.offset,e.offset+e.length])));return(0,Ae.jsx)("li",(0,i.A)((0,i.A)({},e),{},{children:(0,Ae.jsxs)(L.Ay,{container:!0,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,sx:{display:"flex",width:44},children:(0,Ae.jsx)(u.A,{sx:{color:"text.secondary"}})}),(0,Ae.jsxs)(L.Ay,{item:!0,sx:{width:"calc(100% - 44px)",wordWrap:"break-word"},children:[s.map(((e,t)=>(0,Ae.jsx)(Y.A,{component:"span",sx:{fontWeight:e.highlight?"bold":"regular"},children:e.text},t))),(0,Ae.jsx)(P.A,{variant:"body2",color:"text.secondary",children:t.structured_formatting.secondary_text})]})]})}))}})})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(ie.BUW,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{fullWidth:!0,required:!0,id:"outlined-required",label:"City",onChange:e=>{it((0,i.A)((0,i.A)({},nt),{},{city:e.target.value}))},value:""==Ze?Ke.city:Ze})}),(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(le.kci,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{fullWidth:!0,required:!0,label:" PostCode",id:"outlined-required",onChange:e=>{it((0,i.A)((0,i.A)({},nt),{},{postcode:e.target.value}))},value:""==Qe?Ke.postcode:Qe})})]})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:4,alignItems:"center",children:[(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(TbWorldLatitude,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{variant:"outlined",readonly:!0,label:"Latitude",fullWidth:!0,value:et.lat,sx:{cursor:"not-allowed"}})}),(0,Ae.jsx)(L.Ay,{item:!0,children:(0,Ae.jsx)(ne.u3h,{style:{fontSize:"20px",fontWeight:"lighter"}})}),(0,Ae.jsx)(L.Ay,{item:!0,xs:!0,zeroMinWidth:!0,children:(0,Ae.jsx)(T.A,{label:"Longitude",readonly:!0,variant:"outlined",fullWidth:!0,value:et.lng})})]})})]})}),(0,Ae.jsx)(q.A,{sx:{display:"flex",justifyContent:"end",mr:3,mb:2},children:(0,Ae.jsx)(O.A,{variant:"contained",size:"medium",onClick:()=>{(async()=>{try{const e=(0,i.A)((0,i.A)({},nt),{},{tenantid:_e});console.log("updateClient",e);const t=await r.A.put("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/update"),e);console.log("updateClient",t.data.message),t.data.status&&ut(t.data.message,"success",1500),wt(),zt()}catch(e){console.log("updateClient",e)}})()},children:"Update Client"})})]})})})},"left - card"),1==Pe&&(0,Ae.jsx)(D.A,{variant:"outlined",sx:{},children:(0,Ae.jsx)(C.A,{children:(0,Ae.jsxs)(w.A,{children:[(0,Ae.jsx)(W.A,{children:(0,Ae.jsxs)(k.A,{children:[(0,Ae.jsx)(z.A,{children:"#"}),(0,Ae.jsx)(z.A,{children:"Date"}),(0,Ae.jsx)(z.A,{children:"Slab"}),(0,Ae.jsx)(z.A,{children:"Base Price"}),(0,Ae.jsx)(z.A,{children:"Min Kms"}),(0,Ae.jsx)(z.A,{children:"Price/Km"}),(0,Ae.jsx)(z.A,{children:"Other Charges"})]})}),(0,Ae.jsx)(I.A,{children:0===(null===Le||void 0===Le?void 0:Le.length)?(0,Ae.jsx)(k.A,{children:(0,Ae.jsx)(z.A,{colSpan:7,align:"center",children:(0,Ae.jsx)(d.A,{})})}):Le.map(((e,t)=>(0,Ae.jsxs)(k.A,{sx:{bgcolor:"white"},children:[(0,Ae.jsx)(z.A,{children:t+1}),(0,Ae.jsx)(z.A,{children:h()(e.pricingdate).format("DD-MM-YYYY")}),(0,Ae.jsx)(z.A,{children:e.slab}),(0,Ae.jsx)(z.A,{children:e.baseprice}),(0,Ae.jsx)(z.A,{children:e.minkm}),(0,Ae.jsx)(z.A,{children:e.priceperkm}),(0,Ae.jsx)(z.A,{children:e.othercharges})]},e.id||t)))})]})})},"left - card")]})})})]}))):(0,Ae.jsx)(k.A,{children:(0,Ae.jsx)(z.A,{colSpan:6,children:(0,Ae.jsx)(y.A,{width:"100%",direction:"row",justifyContent:"center",children:(0,Ae.jsx)(d.A,{description:"No ".concat(at," Tenants"),styles:{description:{color:me.palette.error.main}}})})})})]})]})}),(0,Ae.jsx)(N.A,{}),!t&&(null===St||void 0===St?void 0:St.length)>0&&(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(N.A,{}),(0,Ae.jsx)(F.A,{rowsPerPageOptions:[5,10,25,50,100],component:"div",count:0==We?null===Wt||void 0===Wt?void 0:Wt.active:1==We?null===Wt||void 0===Wt?void 0:Wt.pending:2==We?null===Wt||void 0===Wt?void 0:Wt.inactive:0,rowsPerPage:pe,page:st,onPageChange:(e,t)=>{lt(t)},onRowsPerPageChange:e=>{ue(parseInt(e.target.value,10)),lt(0)}})]})]}),(0,Ae.jsxs)(H.A,{fullWidth:!0,open:Re,onClose:ct,scroll:"paper",maxWidth:"sm",TransitionComponent:ee.s,children:[(0,Ae.jsx)(V.A,{sx:{bgcolor:"#662582",color:"#fff",fontSize:"20px"},children:"Client Pricing - (".concat(Ke.tenantname,")")}),(0,Ae.jsx)(B.A,{dividers:!0,children:(0,Ae.jsx)(a.A,{sx:{height:"100%"},children:(0,Ae.jsxs)(L.Ay,{container:!0,spacing:2.5,alignItems:"center",children:[(0,Ae.jsxs)(L.Ay,{item:!0,xs:12,sm:6,children:[(0,Ae.jsx)(J.A,{children:"Select Slab"}),(0,Ae.jsx)(R.A,{disablePortal:!0,id:"combo-box-demo",options:Ne,getOptionLabel:e=>"".concat(e.slab),fullWidth:!0,selectOnFocus:!0,renderInput:e=>(0,Ae.jsx)(T.A,(0,i.A)((0,i.A)({},e),{},{label:"Slab"})),onChange:(e,t,n)=>{Ve(t),console.log("pricing",t),Je(!1),"clear"===n&&Je(!0)}})]}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:12,sm:6,children:[(0,Ae.jsx)(J.A,{children:"Base Price"}),(0,Ae.jsx)(T.A,{type:"number",fullWidth:!0,value:Be?0:He.baseprice,onChange:e=>{Ve((0,i.A)((0,i.A)({},He),{},{baseprice:e.target.value}))}})]}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:12,sm:6,children:[(0,Ae.jsx)(J.A,{children:"Price/Km"}),(0,Ae.jsx)(T.A,{type:"number",fullWidth:!0,value:Be?0:He.priceperkm,onChange:e=>{Ve((0,i.A)((0,i.A)({},He),{},{priceperkm:e.target.value}))}})]}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:12,sm:6,children:[(0,Ae.jsx)(J.A,{children:"Min Kms"}),(0,Ae.jsx)(T.A,{type:"number",fullWidth:!0,value:Be?0:He.minkm,onChange:e=>{Ve((0,i.A)((0,i.A)({},He),{},{minkm:e.target.value}))}})]}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:12,sm:6,children:[(0,Ae.jsx)(J.A,{children:"Max Kms"}),(0,Ae.jsx)(T.A,{type:"number",fullWidth:!0,value:Be?0:He.maxkm,onChange:e=>{Ve((0,i.A)((0,i.A)({},He),{},{maxkm:e.target.value}))}})]}),(0,Ae.jsxs)(L.Ay,{item:!0,xs:12,sm:6,children:[(0,Ae.jsx)(J.A,{children:"Min Orders"}),(0,Ae.jsx)(T.A,{type:"number",fullWidth:!0,value:Be?0:He.minorder,onChange:e=>{Ve((0,i.A)((0,i.A)({},He),{},{minorder:e.target.value}))}})]})]})})}),(0,Ae.jsx)(U.A,{children:(0,Ae.jsx)(L.Ay,{container:!0,children:(0,Ae.jsx)(L.Ay,{item:!0,xs:12,children:(0,Ae.jsxs)(y.A,{direction:"row",justifyContent:"flex-end",spacing:2,sx:{p:2},children:[1==Pe&&(0,Ae.jsx)(O.A,{disabled:Be,variant:"contained",onClick:()=>{_t()},children:"Update Pricing"}),1==We&&(0,Ae.jsx)(O.A,{disabled:Be,variant:"contained",onClick:()=>{_t()},children:"Save"}),(0,Ae.jsx)(O.A,{variant:"contained",onClick:()=>{Je(!0),setTimeout((()=>{ct()}),100),Ve({})},color:"error",children:"Cancel"})]})})})})]})]})}},96646:(e,t,n)=>{n.d(t,{r:()=>c});var i=n(9213),s=n(21671),l=n(82917),a=n(93230),r=n(44414);const c=e=>{let{rowsPerPage:t=5,col:n=1}=e;return(0,r.jsx)(r.Fragment,{children:Array.from(new Array(t)).map(((e,t)=>(0,r.jsxs)(i.A,{children:[(0,r.jsx)(s.A,{children:(0,r.jsx)(l.A,{variant:"circular",width:24,height:24})}),(0,r.jsx)(s.A,{children:(0,r.jsx)(l.A,{variant:"text",width:30})}),Array.from({length:n}).map(((e,t)=>(0,r.jsx)(s.A,{children:(0,r.jsxs)(a.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)(s.A,{children:(0,r.jsx)(l.A,{variant:"text",width:150})}),(0,r.jsx)(s.A,{children:(0,r.jsx)(l.A,{variant:"rounded",width:60,height:24})}),(0,r.jsx)(s.A,{align:"center",children:(0,r.jsxs)(a.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)))})}}}]); |