Files
Express_console_build/build/static/js/4793.1834efdf.chunk.js
2026-05-25 16:32:21 +05:30

1 line
15 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[4793],{20466:(e,t,a)=>{a.d(t,{k:()=>n});var o=a(8881);const n=(e,t,a)=>(0,o.M8)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:a||2e3})},23266:(e,t,a)=>{a.d(t,{A:()=>w});var o=a(98587),n=a(58168),s=a(9950),i=a(72004),l=a(3484),r=a(99269),c=a(59254),d=a(19608),u=a(18463),p=a(13372),m=a(24184),g=a(79044),h=a(31506),A=a(40777),v=a(92455),x=a(88543),y=a(45558),f=a(1614);function b(e){return(0,f.Ay)("MuiMenuItem",e)}const j=(0,y.A)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var C=a(44414);const _=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],S=(0,c.Ay)(m.A,{shouldForwardProp:e=>(0,d.A)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,a.dense&&t.dense,a.divider&&t.divider,!a.disableGutters&&t.gutters]}})((e=>{let{theme:t,ownerState:a}=e;return(0,n.A)({},t.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!a.disableGutters&&{paddingLeft:16,paddingRight:16},a.divider&&{borderBottom:"1px solid ".concat((t.vars||t).palette.divider),backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(t.vars||t).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},["&.".concat(j.selected)]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / ").concat(t.vars.palette.action.selectedOpacity,")"):(0,r.X4)(t.palette.primary.main,t.palette.action.selectedOpacity),["&.".concat(j.focusVisible)]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / calc(").concat(t.vars.palette.action.selectedOpacity," + ").concat(t.vars.palette.action.focusOpacity,"))"):(0,r.X4)(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.focusOpacity)}},["&.".concat(j.selected,":hover")]:{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / calc(").concat(t.vars.palette.action.selectedOpacity," + ").concat(t.vars.palette.action.hoverOpacity,"))"):(0,r.X4)(t.palette.primary.main,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:t.vars?"rgba(".concat(t.vars.palette.primary.mainChannel," / ").concat(t.vars.palette.action.selectedOpacity,")"):(0,r.X4)(t.palette.primary.main,t.palette.action.selectedOpacity)}},["&.".concat(j.focusVisible)]:{backgroundColor:(t.vars||t).palette.action.focus},["&.".concat(j.disabled)]:{opacity:(t.vars||t).palette.action.disabledOpacity},["& + .".concat(A.A.root)]:{marginTop:t.spacing(1),marginBottom:t.spacing(1)},["& + .".concat(A.A.inset)]:{marginLeft:52},["& .".concat(x.A.root)]:{marginTop:0,marginBottom:0},["& .".concat(x.A.inset)]:{paddingLeft:36},["& .".concat(v.A.root)]:{minWidth:36}},!a.dense&&{[t.breakpoints.up("sm")]:{minHeight:"auto"}},a.dense&&(0,n.A)({minHeight:32,paddingTop:4,paddingBottom:4},t.typography.body2,{["& .".concat(v.A.root," svg")]:{fontSize:"1.25rem"}}))})),w=s.forwardRef((function(e,t){const a=(0,u.b)({props:e,name:"MuiMenuItem"}),{autoFocus:r=!1,component:c="li",dense:d=!1,divider:m=!1,disableGutters:A=!1,focusVisibleClassName:v,role:x="menuitem",tabIndex:y,className:f}=a,j=(0,o.A)(a,_),w=s.useContext(p.A),k=s.useMemo((()=>({dense:d||w.dense||!1,disableGutters:A})),[w.dense,d,A]),I=s.useRef(null);(0,g.A)((()=>{r&&I.current&&I.current.focus()}),[r]);const O=(0,n.A)({},a,{dense:k.dense,divider:m,disableGutters:A}),N=(e=>{const{disabled:t,dense:a,divider:o,disableGutters:s,selected:i,classes:r}=e,c={root:["root",a&&"dense",t&&"disabled",!s&&"gutters",o&&"divider",i&&"selected"]},d=(0,l.A)(c,b,r);return(0,n.A)({},r,d)})(a),E=(0,h.A)(I,t);let L;return a.disabled||(L=void 0!==y?y:-1),(0,C.jsx)(p.A.Provider,{value:k,children:(0,C.jsx)(S,(0,n.A)({ref:E,role:x,tabIndex:L,component:c,focusVisibleClassName:(0,i.A)(N.focusVisible,v),className:(0,i.A)(N.root,f)},j,{ownerState:O,classes:N}))})}))},59212:(e,t,a)=>{a.d(t,{A:()=>c});var o=a(89379),n=a(9950),s=a(77922),i=a(29925),l=a(26910),r=a(44414);const c=(0,n.forwardRef)(((e,t)=>{let{setAppId:a,setLocoName:c,setPage:d,sx:u,textfeildSx:p}=e;const[m,g]=(0,n.useState)(JSON.parse(localStorage.getItem("applocations")||"[]"));return(0,n.useEffect)((()=>{0===m.length&&(async()=>{try{const e=localStorage.getItem("userid");if(!e)return;const t=await l.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)),g(e)}}catch(e){console.error("Error fetching locations in LocationAutocomplete:",e)}})()}),[m.length]),(0,r.jsx)(s.A,{id:"location-autocomplete",options:m||[],getOptionLabel:e=>{var t;return null!==(t=null===e||void 0===e?void 0:e.locationname)&&void 0!==t?t:""},sx:(0,o.A)({},u),onChange:(e,t,o)=>{"clear"===o?(null===a||void 0===a||a(0),null===c||void 0===c||c(""),null===d||void 0===d||d(0)):t&&(null===a||void 0===a||a(t.applocationid),null===c||void 0===c||c(t.locationname),null===d||void 0===d||d(0))},renderInput:e=>(0,r.jsx)(i.A,(0,o.A)((0,o.A)({},e),{},{inputRef:t,label:"Select Zones",sx:(0,o.A)({},p)}))})}))},94793:(e,t,a)=>{a.r(t),a.d(t,{default:()=>S});var o=a(89379),n=a(9950),s=a(60899),i=a(93230),l=a(82053),r=a(77922),c=a(29925),d=a(19647),u=a(70006),p=a(23266),m=a(25333),g=a(82223),h=a(50027),A=a(26910),v=a(52351),x=a(99459),y=a(8881),f=a(28429),b=a(96319),j=a(59212),C=a(20466),_=a(44414);const S=()=>{const[e,t]=(0,n.useState)(0),a=(0,n.useRef)(null),[S,w]=(0,n.useState)(""),[k,I]=(0,n.useState)(""),[O,N]=(0,n.useState)(""),[E,L]=(0,n.useState)(""),[M,F]=(0,n.useState)(""),[z,W]=(0,n.useState)(""),[H,P]=(0,n.useState)(""),[D,B]=(0,n.useState)(),[R,V]=(0,n.useState)(),[G,T]=(0,n.useState)(),[X,Z]=(0,n.useState)("Select Location"),[J,K]=(0,n.useState)([]),[Y,q]=(0,n.useState)(0),[Q,U]=(0,n.useState)({}),[$,ee]=(0,n.useState)({latitude:0,longitude:0}),[te,ae]=(0,n.useState)(!1),oe=(0,f.Zp)();x.A.setApiKey("AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8"),(0,n.useEffect)((()=>{if(H){const e=document.getElementById("addressAuto1"),t=new window.google.maps.places.Autocomplete(e,{strictBounds:!0,bounds:new window.google.maps.Circle({center:new window.google.maps.LatLng(D,R),radius:1e3*G}).getBounds()});t.addListener("place_changed",(()=>{const e=t.getPlace();P("".concat(e.name,", ").concat(e.formatted_address)),console.log("new place",e),console.log(" pick (new place) lat lng",{lat:e.geometry.location.lat(),lng:e.geometry.location.lng()}),ee({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),N("".concat(e.name," ").concat(e.formatted_address)),U((0,o.A)((0,o.A)({},Q),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));const a={address:"".concat(e.name," ").concat(e.formatted_address),street_number:"",route:"",locality:"",sublocality_level_1:"",administrative_area_level_3:"",administrative_area_level_1:"",country:"",postal_code:""};e.address_components.forEach((e=>{e.types.forEach((t=>{switch(t){case"street_number":a.street_number=e.long_name;break;case"route":a.route=e.long_name;break;case"locality":a.locality=e.long_name;break;case"sublocality_level_1":a.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":a.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":a.administrative_area_level_1=e.long_name;break;case"country":a.country=e.long_name;break;case"postal_code":a.postal_code=e.long_name}}))})),U((0,o.A)((0,o.A)({},Q),{},{address:a.address,doorno:"".concat(a.street_number," ").concat(a.route),suburb:a.administrative_area_level_3,city:a.locality,state:a.administrative_area_level_1,postcode:a.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()})),console.log("Pick Address:",a)}))}}),[H]);(0,n.useEffect)((()=>{e&&(async()=>{ae(!0),await A.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(e)).then((e=>{console.log("getapplocations",e);const{latitude:t,longitude:a,radius:o}=e.data.details[0];e.data.status&&(B(t),V(a),T(o),console.log("radius",o)),ae(!1)})).catch((e=>{console.log(e),ae(!1)}))})()}),[e]);(0,n.useEffect)((()=>{e&&(async e=>{ae(!0),await A.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenants/?applocationid=").concat(e,"&status=active")).then((e=>{if(console.log(e),e.data.status){let t=[];e.data.details.map((e=>{t.push((0,o.A)((0,o.A)({},e),{},{label:"".concat(e.tenantname)}))})),K(t)}ae(!1)})).catch((e=>{console.log(e),ae(!1)}))})(e)}),[e]);const ne=e=>{(0,y.M8)(e,{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})};return(0,_.jsxs)(_.Fragment,{children:[te&&(0,_.jsx)(v.A,{}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sx:{mb:2},children:(0,_.jsx)(i.A,{direction:"row",justifyContent:"space-between",alignItems:"center",children:(0,_.jsx)(l.A,{variant:"h3",children:"Create Customer"})})}),(0,_.jsx)(h.A,{children:(0,_.jsxs)(s.Ay,{container:!0,spacing:3,children:[(0,_.jsx)(s.Ay,{item:!0,xs:12,children:(0,_.jsxs)(s.Ay,{container:!0,spacing:3,children:[(0,_.jsx)(s.Ay,{item:!0,xs:12,md:6,children:(0,_.jsx)(j.A,{ref:a,locaName:X,setAppId:t,setLocoName:Z,sx:{}})}),(0,_.jsxs)(s.Ay,{item:!0,xs:12,md:6,children:[(0,_.jsx)(r.A,{fullWidth:!0,disabled:0==e,id:"free-solo-demo",sx:{},options:J||[],renderInput:e=>(0,_.jsx)(c.A,(0,o.A)((0,o.A)({},e),{},{label:"Choose Client",focused:!0})),onChange:(e,t,a)=>{t?(console.log("Client",t),(async e=>{try{const t=await A.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(e));console.log("gettenantlocations",t.data.details),t.data.details.length}catch(t){console.log("gettenantlocations",t)}})(t.tenantid),q(t.tenantid)):(setClientinfo({}),setTenantid(""))}})," "]}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-last-name",children:"Name"}),(0,_.jsx)(c.A,{fullWidth:!0,id:"personal-last-name",placeholder:"Name",onChange:e=>L(e.target.value),value:E,autoComplete:"off"})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-phone",children:"Phone Number"}),(0,_.jsxs)(i.A,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[(0,_.jsx)(u.A,{defaultValue:"+1",disabled:!0,sx:{cursor:"not-allowed"},children:(0,_.jsx)(p.A,{value:"+1",children:"+91"})}),(0,_.jsx)(c.A,{type:"number",id:"personal-phone",fullWidth:!0,placeholder:"Phone Number",onChange:e=>{e.target.value.toString().length<=10&&w(e.target.value)},value:S,autoComplete:"off",sx:{cursor:"not-allowed"}})]})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-email",children:"Email "}),(0,_.jsx)(c.A,{type:"email",fullWidth:!0,id:"personal-email",placeholder:"Email ",onChange:e=>I(e.target.value),value:k,autoComplete:"off"})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-location",children:"Door No"}),(0,_.jsx)(c.A,{fullWidth:!0,id:"personal-location",placeholder:"Door No",onChange:e=>F(e.target.value),value:M,autoComplete:"off"})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-email",children:" Address"}),(0,_.jsx)(c.A,{variant:"outlined",id:"addressAuto1",fullWidth:!0,value:H,onChange:t=>{e?e&&P(t.target.value):(0,C.k)("Select Location First","warning",3e3)},InputProps:{endAdornment:(0,_.jsx)(m.A,{onClick:()=>{P(""),U((0,o.A)((0,o.A)({},Q),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ee({latitude:0,longitude:0})},size:"small",children:(0,_.jsx)(b.A,{})})}})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-location",children:"Location"}),(0,_.jsx)(c.A,{fullWidth:!0,id:"personal-location",placeholder:"Location",onChange:e=>U((0,o.A)((0,o.A)({},Q),{},{suburb:e.target.value})),value:Q.suburb,autoComplete:"off"})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-zipcode",children:"City"}),(0,_.jsx)(c.A,{fullWidth:!0,id:"personal-zipcode",placeholder:"City",onChange:e=>U((0,o.A)((0,o.A)({},Q),{},{city:e.target.value})),value:Q.city,autoComplete:"off"})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-location",children:"State"}),(0,_.jsx)(c.A,{fullWidth:!0,id:"personal-location",placeholder:"State",onChange:e=>U((0,o.A)((0,o.A)({},Q),{},{state:e.target.value})),value:Q.state,autoComplete:"off"})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,sm:6,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-zipcode",children:"Post Code"}),(0,_.jsx)(c.A,{fullWidth:!0,type:"number",id:"personal-zipcode",placeholder:"Zipcode",onChange:e=>U((0,o.A)((0,o.A)({},Q),{},{postcode:e.target.value})),value:Q.postcode,autoComplete:"off"})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,children:(0,_.jsxs)(i.A,{spacing:1.25,children:[(0,_.jsx)(d.A,{htmlFor:"personal-email",children:"Landmark"}),(0,_.jsx)(c.A,{type:"email",fullWidth:!0,id:"personal-email",placeholder:"Landmark",onChange:e=>W(e.target.value),value:z,autoComplete:"off"})]})})]})}),(0,_.jsx)(s.Ay,{item:!0,xs:12,children:(0,_.jsx)(i.A,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:2,children:(0,_.jsx)(g.A,{variant:"contained",onClick:()=>{""===e?ne("Select Applocation "):""===Y?ne("Select Tenant"):""===E?ne("Enter Name"):""===S?ne("Enter Mobile Number "):""===O?ne("Enter Address "):""===Q.city?ne("Enter City "):""===Q.state?ne("Enter State "):""===Q.suburb?ne("Enter location "):""===Q.postcode?ne("Enter Post Code "):""===z?ne("Enter Land Mark "):""===Q.latitude?ne("Invalid latitude "):""===Q.longitude?ne("Invaiid Longitude "):(async()=>{let t={applocationid:+e,tenantid:+Y,customerid:0,configid:1,firstname:E,dialcode:"+91",contactno:S,email:k,doorno:M,address:Q.address,suburb:Q.suburb,city:Q.city,state:Q.state,postcode:Q.postcode,landmark:z,latitude:$.latitude.toString(),longitude:$.longitude.toString(),profileimage:"",devicetype:"",deviceid:"",customertoken:"",primaryaddress:1};console.log(t),ae(!0);try{await A.A.post("".concat("https://jupiter.nearle.app/live/api/v1","/customers/create"),t).then((e=>{console.log(e),e.data.status?((0,y.M8)(" Created Successfully ",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),oe("/nearle/customers")):"Customer Already available"==e.data.message&&(0,y.M8)("Customer Already available",{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),ae(!1)})).catch((e=>{console.log(e),ae(!1),(0,y.M8)(e.message,{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})}))}catch(a){console.log(a),ae(!1)}})()},children:"Create"})})})]})})]})}}}]);