PageSourceSearch

https://skiplyn.com/_next/static/chunks/pages/admin-eec931272a474b02.js

js skiplyn.com collected 2026-10-02 00:33:21 UTC 54,002 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6964],{84730:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin",function(){return t(29921)}])},7652:function(e,n,t){"use strict";t.d(n,{s:function(){return i}});var r=t(14251),a=t(50837),i=function(e){return(0,a.Z)((0,r.Z)({path:"/api/restaurant/models/restaurantCategory/list"},e))}},89522:function(e,n,t){"use strict";t.d(n,{Z:function(){return h}});var r=t(14251),a=t(52875),i=t(44747),s=t(85893),c=(t(67294),t(51353)),o=t(41120),l=t(39803),d=t(63957),u=t(95477),m=(0,o.Z)((function(e){return{root:{"& > * + *":{marginTop:e.spacing(3)},marginBottom:"5px"},tag:{fontSize:"14px",backgroundColor:"rgb(250, 250, 250)",border:"1px solid rgb(232, 232, 232)"},option:{"& > span":{flexGrow:1},"& > svg":{color:"transparent"},"&[aria-selected=true]":{backgroundColor:"#fafafa","& > svg":{color:"#1890ff"}},"&[data-focus=true]":{backgroundColor:"#e6f7ff",cursor:"pointer","& > svg":{color:"#000"}}}}}));function h(e){var n=e.label,t=e.options,o=e.loading,h=(0,i.Z)(e,["label","options","loading"]),x=m();return(0,s.jsx)("div",{className:x.root,children:(0,s.jsx)(c.ZP,(0,r.Z)({classes:{option:x.option,tag:x.tag},multiple:!0,id:"tags-outlined",options:t,getOptionLabel:function(e){return e},filterSelectedOptions:!0,renderInput:function(e){return(0,s.jsx)(l.Z,(0,a.Z)((0,r.Z)({},e),{variant:"outlined",label:n,InputLabelProps:{style:{fontFamily:"AvenirNextLTPro,Arial,Roboto,-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Open Sans,Icons16,sans-serif"}},InputProps:(0,a.Z)((0,r.Z)({},e.InputProps),{endAdornment:(0,s.jsxs)(s.Fragment,{children:[o?(0,s.jsx)(u.Z,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})}))},renderOption:function(e){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:e}),(0,s.jsx)(d.Z,{fontSize:"small"})]})},loading:o},h))})}},79323:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(14251),a=t(44747),i=t(85893),s=(t(67294),t(89522)),c=t(32923);function o(e){var n=e.form,t=e.field,c=(0,a.Z)(e,["form","field"]),o=n.setFieldValue,l=t.name,d=t.value;return(0,i.jsx)(s.Z,(0,r.Z)({value:d,onChange:function(e,n){o(l,n)}},c))}function l(e){var n=e.name,t=(0,a.Z)(e,["name"]);return(0,i.jsx)(c.gN,(0,r.Z)({name:n,component:o},t))}},44909:function(e,n,t){"use strict";t.d(n,{Z:function(){return d}});var r=t(85893),a=(t(67294),t(32923)),i=t(64436),s=t(96394),c=t(94924),o=t(85639),l=t(30585);function d(e){var n=e.items,t=e.name,d=e.label,u=e.invalid,m="".concat(t,"-label");return(0,r.jsxs)(i.Z,{variant:"outlined",fullWidth:!0,error:u,children:[(0,r.jsx)(s.Z,{id:m,children:d}),(0,r.jsx)(a.gN,{autoComplete:"off",labelId:m,id:t,variant:"outlined",as:c.Z,name:t,label:d,type:"select",children:n.map((function(e){return(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value)}))}),(0,r.jsx)(l.Z,{children:(0,r.jsx)(a.Bc,{name:t})})]})}},74296:function(e,n,t){"use strict";t.d(n,{Bp:function(){return p},En:function(){return d},F4:function(){return g},I6:function(){return x},LD:function(){return c},Oj:function(){return s},Qe:function(){return m},R6:function(){return i},a1:function(){return f},b7:function(){return l},eM:function(){return j},eg:function(){return v},hD:function(){return a},jK:function(){return u},mP:function(){return Z},rO:function(){return h}});var r=t(32089),a=/^[A-Za-z ]{0,160}$/,i=/^[\d.]{0,10}$/,s=/^[(]{0,1}[0-9]{3}[)]{0,1}[-\s]{0,1}[0-9]{3}[-\s]{0,1}[0-9]{4}$/,c=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,o=/^[1-9][0-9.]{0,10}$/,l=function(e){return e.replace(/\w\S*/g,(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}))},d=function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},u=function(e){return e.replace(/  +/g," ").replace(/^\s+|\s+$/gm,"")},m=function(e){return e.replace(/(^\w{1}|\.\s*\w{1})/g,(function(e){return e.replace(/([a-z])/,(function(e){return e.toUpperCase()}))}))},h=r.Ry().shape({foodName:r.Z_().max(60,"Food name must be less than 60 characters").required("Required field"),foodPrice:r.Z_().matches(i,"Number only allowed").max(5,"Price allowed 5 characters only").required("Required field"),foodDescription:r.Z_().max(160,"Food description must be 160 characters or less")}),x=r.Ry().shape({categories:r.Z_().max(50,"Categories name must be less than 50 characters").required("Please fillout form")}),f=r.Ry().shape({modifierGroupName:r.Z_().required("Required"),exactItem:r.Z_().matches(o,"positive number").max(2,"max 2 character"),rangeTo:r.Z_().matches(o,"positive number").max(2,"max 2 character"),choiceName:r.IX().of(r.Ry().shape({name:r.Z_().required("Required"),price:r.Z_().matches(i,"positive number").max(5,"max 5 character").required("Required ")}))}),p=r.Ry().shape({name:r.Z_().max(50,"It's too long").required("Required"),firstName:r.Z_().max(25,"It's too long").required("Required "),lastName:r.Z_().max(25,"It's too long").required("Required "),address:r.Z_().required("Required"),email:r.Z_().email("Enter valid email").required("Required"),phone:r.Rx().typeError("Enter valid Phone number").required("Required"),tax:r.Z_().matches(i,"Must be positive").max(5,"It's too long").required("Required"),select:r.Z_().required("Required ")}),j=r.Ry().shape({phone:r.Z_().matches(s,"Enter a valid Phone number").required("Required")}),g=r.Ry().shape({validationCode:r.Z_().matches(i,"Number only").max(6,"6 digit number").min(6,"6 digit number").required("Required")}),v=r.Ry().shape({phone:r.Z_().matches(s,"Enter a valid Phone number").required("Required"),firstName:r.Z_().matches(a,"alphabet number").max(25,"It's too long").required("Required "),lastName:r.Z_().matches(a,"alphabet number").max(25,"It's too long").required("Required ")}),Z=r.Ry().shape({rewardsPoints:r.Z_().matches(i,"Must be positive").max(5,"It's too long").required("Required"),expirationDay:r.Z_().matches(i,"Must be positive").max(5,"It's too long").required("Required")})},26465:function(e,n,t){"use strict";t.d(n,{Z:function(){return s}});var r=t(85893),a=(t(67294),t(32923)),i=t(39803);function s(e){var n=e.name,t=e.type,s=e.label,c=e.style,o=e.fullWidth,l=e.invalid;return(0,r.jsx)("div",{children:(0,r.jsx)(a.gN,{autoComplete:"off",id:"outlined-basic",variant:"outlined",as:i.Z,label:s,name:n,type:t,style:c,fullWidth:o,step:"any",helperText:(0,r.jsx)(a.Bc,{name:n}),error:l})})}},37137:function(e,n,t){"use strict";t.d(n,{aG:function(){return u},hR:function(){return d},tp:function(){return l}});var r=t(37399),a="https://api.tomtom.com",i="".concat(a,"/search/2"),s="".concat(a,"/routing/1"),c="37.8272",o="-122.2913",l=function(e){return"".concat(i,"/geocode/").concat(e,".json?lat=").concat(c,"&lon=").concat(o,"&key=").concat(r.Wr,"&countrySet=US")},d=function(e,n){return"".concat(s,"/calculateRoute/").concat(e.lat,",").concat(e.lon,":").concat(n.lat,",").concat(n.lon,"/json?routeType=").concat("fastest","&avoid=unpavedRoads&key=").concat(r.Wr)},u=function(e){return"".concat(i,"/reverseGeocode/").concat(e.lat,",").concat(e.lon,".json?key=").concat(r.Wr)}},29921:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Je}});var r=t(85893),a=t(67294),i=t(14416),s=t(34727),c=t(70655),o=t(39803),l=t(282),d=t(98595),u=t(10267),m=t(51252),h=t(72132),x=t(94044),f=t(84669),p=t(29525),j=t(41120),g=(0,j.Z)({container:{height:"100vh"}},{name:"sa-Login"}),v=t(86010),Z=t(74296);function y(){var e=(0,a.useState)(""),n=e[0],t=e[1],j=(0,a.useState)(""),y=j[0],b=j[1],N=(0,a.useState)(!1),P=N[0],S=N[1],w=(0,i.v9)((function(e){return e.error.local})),k=w.errorMessage,C=w.errorCode,I=(0,i.I0)(),F=g(),A=function(){var e=(0,s.Z)((function(){var e;return(0,c.__generator)(this,(function(t){return S(!0),h.Am.dismiss(),(n&&y?n.match(Z.LD)||(h.Am.error("   email is not val
1id"),0):(h.Am.error("Please fillout all fields"),0))?(h.Am.dismiss(),e={email:n,password:y},I((0,x.I)(e)),S(!1),[2]):[2]}))}));return function(){return e.apply(this,arguments)}}();return C===p.wH&&(h.Am.error(k),console.log(k),I((0,f.sp)())),(0,r.jsx)(d.Z,{className:(0,v.Z)("d-flex","justify-content-center","align-items-center",F.container),children:(0,r.jsx)(u.Z,{children:(0,r.jsx)(m.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)("h1",{className:"text-center",children:"Admin Login"}),(0,r.jsx)(o.Z,{fullWidth:!0,label:"Email",value:n,onChange:function(e){t(e.target.value),S(!1)}}),(0,r.jsx)(o.Z,{label:"Password",type:"password",fullWidth:!0,value:y,onChange:function(e){b(e.target.value),S(!1)}}),(0,r.jsx)(l.Z,{variant:"contained",style:{width:"100%",marginTop:"20px"},onClick:A,disabled:P,children:"Login"})]})})})})}var b=t(67573),N=t(97975),P=t(69779),S=t(32923),w=t(45258),k=t(28358),C=t(17812),I=t(56847),F=t(79895),A=t(82302),R=t(83750),_=t(57394),T=t(88222),q=t(80797),z=t(99613),D=t(72221),L=t(45046),U=t(10684),O=t(14251),E=t(26429),M=function(e){return(0,E.Z)((0,O.Z)({path:"/api/admin/restaurant/getnewsignuprequest"},e))},B=t(26465),W=t(54705);function H(e){var n=e.isOpen,t=e.toggle,o=e.selectedUsers,d=(0,i.v9)((function(e){return e.admin.auth})).token,u=(0,a.useState)(!1),m=u[0],x=u[1],f=(0,i.I0)(),p=function(){var e=(0,s.Z)((function(e){var n,r;return(0,c.__generator)(this,(function(a){switch(a.label){case 0:n=o.map((function(n){return{name:n.firstName,email:n.email,phone:n.phone,rewardPoints:e.rewardsPoints,expirationDate:(t=e.expirationDay,Date.now()+24*t*60*60*1e3)};var t})),a.label=1;case 1:return a.trys.push([1,3,,4]),x(!0),[4,(i={body:{customers:n},options:(0,W.zl)(d),dispatch:f},(0,E.Z)((0,O.Z)({path:"/api/admin/models/promotionalreward/issuerewards"},i)))];case 2:return a.sent(),x(!1),h.Am.success("Successfully sent the rewards"),t(),[3,4];case 3:return r=a.sent(),console.log(r),h.Am.error("Sorry, customer has promotional reward"),[3,4];case 4:return[2]}var i}))}));return function(n){return e.apply(this,arguments)}}();return(0,r.jsx)(L.Z,{isOpen:n,toggle:t,children:(0,r.jsx)(U.Z,{style:{padding:"45px",border:"3px solid #3f51b5"},children:(0,r.jsx)(S.J9,{initialValues:{rewardsPoints:500,expirationDay:15},onSubmit:function(e){p(e)},validationSchema:Z.mP,children:function(e){var n=e.errors,a=e.touched;return(0,r.jsx)(S.l0,{children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)("div",{children:(0,r.jsx)(B.Z,{name:"rewardsPoints",type:"number",label:"Reward",invalid:!(!n.rewardsPoints||!a.rewardsPoints),style:{marginBottom:"15px"}})}),(0,r.jsx)("div",{children:(0,r.jsx)(B.Z,{label:"Expiration Day",type:"number",name:"expirationDay",invalid:!(!n.expirationDay||!a.expirationDay),style:{marginBottom:"15px"}})}),(0,r.jsx)(l.Z,{variant:"contained",color:"primary",className:"mr-2",type:"submit",disabled:m,children:"Issue Point"}),(0,r.jsx)(l.Z,{variant:"contained",onClick:function(){return t()},children:"Cancel"})]})})}})})})}var $=(0,j.Z)({signUpText:{fontWeight:600,textAlign:"center",fontFamily:"math, serif, ui-monospace",fontSize:"x-large",padding:10,borderBottom:"1px solid black",marginBottom:10},tableHead:{background:"#00586e !important"},tableFont:{fontWeight:"800 !important",fontSize:"medium !important",fontFamily:"math !important",color:"#d5d5d5 !important"}},{name:"ts-DisplayTable"});function V(){var e=(0,a.useState)([]),n=e[0],t=e[1],o=(0,a.useState)(null),l=o[0],d=o[1],u=(0,a.useState)({email:""}),m=u[0],x=u[1],f=(0,a.useState)([]),p=f[0],j=f[1],g=(0,a.useState)(!1),v=g[0],Z=g[1],y=(0,a.useState)(!0),b=y[0],L=y[1],U=(0,a.useState)(1),M=U[0],V=U[1],X=(0,a.useState)(0),G=X[0],J=X[1],Q=(0,a.useState)(25)[0],K=(0,i.v9)((function(e){return e.admin.auth})).token,Y=(0,i.I0)(),ee=$();(0,a.useEffect)((function(){var e=function(){var e=(0,s.Z)((function(){var e;return(0,c.__generator)(this,(function(r){switch(r.label){case 0:return[4,(a={body:{page:G},options:(0,W.zl)(K),dispatch:Y},(0,E.Z)((0,O.Z)({path:"/api/admin/models/promotionalreward/geteligiblecustomers"},a)))];case 1:return(e=r.sent()).data.length?t(n.concat(e.data)):h.Am.warning("No more Users "),L(!1),[2]}var a}))}));return function(){return e.apply(this,arguments)}}();try{e()}catch(r){console.log(r),h.Am.error("Todo: errorMessage")}}),[Y,K,G]);var ne=function(){Z(!v)},te=function(e){if(e.target.checked){var t=n.map((function(e){return e}));j(t)}else j([])},re=function(e){var n=e.numSelected;return(0,r.jsx)(r.Fragment,{children:n>0&&(0,r.jsx)(w.Z,{position:"static",children:(0,r.jsxs)(k.Z,{children:[(0,r.jsxs)(C.Z,{edge:"start",className:ee.menuButton,color:"inherit","aria-label":"menu",children:[n," Selected"]}),(0,r.jsx)("div",{className:"d-flex",children:(0,r.jsx)(N.Z,{color:"success",size:"sm",className:"mr-2",onClick:ne,children:"Issue Points"})})]})})})},ae=function(){d(null)},ie=function(e){var r={email:e.email},a=(0,P.Z)(n);a[n.findIndex((function(e){return e._id===l}))].email=r.email,t(a),d(null)},se=function(){var e=M*Q,t=e-Q;return n.slice(t,e)};return(0,r.jsx)("div",{children:b?(0,r.jsx)("div",{style:{textAlign:"center"},children:"Loading..."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"ml-5",children:n.length>0?(0,r.jsxs)(I.Z,{component:F.Z,children:[(0,r.jsx)(re,{numSelected:p.length}),(0,r.jsxs)(A.Z,{"aria-label":"sign up request table",children:[(0,r.jsx)(R.Z,{className:ee.tableHead,children:(0,r.jsxs)(_.Z,{children:[(0,r.jsx)(T.Z,{padding:"checkbox",children:(0,r.jsx)(q.Z,{indeterminate:p.length>0&&p.length<n.length,checked:n.length>0&&p.length===n.length,onChange:te,inputProps:{"aria-label":"select all desserts"}})}),(0,r.jsx)(T.Z,{className:ee.tableFont,children:"Name"}),(0,r.jsx)(T.Z,{className:ee.tableFont,children:"Email"}),(0,r.jsx)(T.Z,{className:ee.tableFont,children:"Phone"}),(0,r.jsx)(T.Z,{className:ee.tableFont,children:"Total Reward Points"}),(0,r.jsx)(T.Z,{className:ee.tableFont,children:"Action"})]})}),(0,r.jsx)(z.Z,{children:se().map((function(e,n){var t,a=(t=e,-1!==p.indexOf(t)),i="enhanced-table-checkbox-".concat(n);return(0,r.jsxs)(_.Z,{hover:!0,children:[(0,r.jsx)(T.Z,{padding:"checkbox",onClick:function(n){return function(e,n){var t=p.indexOf(n),r=[];-1===t?r=r.concat(p,n):0===t?r=r.concat(p.slice(1)):t===p.length-1?r=r.concat(p.slice(0,-1)):t>0&&(r=r.concat(p.slice(0,t),p.slice(t+1))),j(r)}(0,e)}
1,"aria-checked":a,selected:a,tabIndex:-1,children:(0,r.jsx)(q.Z,{checked:a,inputProps:{"aria-labelledby":i}})}),(0,r.jsx)(T.Z,{children:e.firstName}),(0,r.jsx)(T.Z,{children:l===e._id?(0,r.jsx)("div",{children:(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(S.J9,{initialValues:{email:m.email},onSubmit:ie,children:function(e){var n=e.errors,t=e.touched;return(0,r.jsx)(S.l0,{children:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)("div",{children:(0,r.jsx)(B.Z,{fullWidth:!0,type:"email",label:"Email",name:"email",invalid:!(!n.email||!t.email),style:{marginBottom:"15px"}})}),(0,r.jsx)(N.Z,{variant:"contained",color:"primary",className:"mr-2",type:"submit",children:"Save"}),(0,r.jsx)(N.Z,{variant:"contained",onClick:ae,children:"Cancel"})]})})}})})}):(0,r.jsx)("div",{children:e.email})}),(0,r.jsx)(T.Z,{children:e.phone}),(0,r.jsx)(T.Z,{children:e.rewardPoints}),(0,r.jsx)(T.Z,{children:(0,r.jsx)(N.Z,{color:"success",size:"sm",className:"mr-2",onClick:function(n){return function(e,n){e.preventDefault(),d(n._id);var t={email:n.email};x(t)}(n,e)},children:"Edit Email"})})]},n)}))})]})]}):(0,r.jsx)("h1",{children:"Customers not found"})}),v&&(0,r.jsx)(H,{isOpen:v,toggle:ne,selectedUsers:p}),(0,r.jsxs)("div",{style:{margin:"50px",alignItems:"center",display:"flex",justifyContent:"center"},children:[(0,r.jsx)(D.Z,{count:function(){for(var e,t=1;t<=Math.ceil(n.length/Q);t++)e=t;return e}(),variant:"outlined",color:"secondary",size:"large",onChange:function(e,n){V(n)}}),(0,r.jsx)(N.Z,{color:"secondary",size:"sm",className:"mr-2",onClick:function(){J(G+1)},children:"Load User"})]})]})})}var X="Non Promotional Customers";function G(e){var n=e.customers,t=e.handleLoadPage,i=e.toggle,s=(0,a.useState)(1),c=s[0],o=s[1],l=(0,a.useState)(25)[0],d=function(){var e=c*l,t=e-l;return n.slice(t,e)},u=$();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"ml-5",children:n.length>0?(0,r.jsx)(I.Z,{component:F.Z,children:(0,r.jsxs)(A.Z,{"aria-label":"sign up request table",children:[(0,r.jsx)(R.Z,{className:u.tableHead,children:(0,r.jsxs)(_.Z,{children:[(0,r.jsx)(T.Z,{className:u.tableFont,children:"Name"}),(0,r.jsx)(T.Z,{className:u.tableFont,children:"Email"}),(0,r.jsx)(T.Z,{className:u.tableFont,children:"Phone"}),(0,r.jsx)(T.Z,{className:u.tableFont,children:"Total Reward Points"}),i!=X&&(0,r.jsx)(T.Z,{className:u.tableFont,children:"Total Promotional Points"})]})}),(0,r.jsx)(z.Z,{children:d().map((function(e,n){return(0,r.jsxs)(_.Z,{hover:!0,children:[(0,r.jsx)(T.Z,{children:e.firstName}),(0,r.jsx)(T.Z,{children:e.email}),(0,r.jsx)(T.Z,{children:e.phone}),(0,r.jsx)(T.Z,{children:e.rewardPoints}),i!=X&&(0,r.jsx)(T.Z,{children:e.promotionalRewardPoints})]},n)}))})]})}):(0,r.jsx)("h1",{children:"Customers database empty"})}),(0,r.jsxs)("div",{style:{margin:"50px",alignItems:"center",display:"flex",justifyContent:"center"},children:[(0,r.jsx)(D.Z,{count:function(){for(var e,t=1;t<=Math.ceil(n.length/l);t++)e=t;return e}(),variant:"outlined",color:"secondary",size:"large",onChange:function(e,n){o(n)}}),(0,r.jsx)(N.Z,{color:"secondary",size:"sm",className:"mr-2",onClick:t,children:"Load User"})]})]})}function J(e){var n=e.toggle,t=(0,a.useState)({customers:[]}),o=t[0],l=t[1],d=(0,a.useState)(!0),u=d[0],m=d[1],x=(0,a.useState)(0),f=x[0],p=x[1],j=(0,i.v9)((function(e){return e.admin.auth})).token,g=(0,i.I0)();(0,a.useEffect)((function(){var e=function(){var e=(0,s.Z)((function(){var e;return(0,c.__generator)(this,(function(n){switch(n.label){case 0:return[4,(t={body:{page:f},options:(0,W.zl)(j),dispatch:g},(0,E.Z)((0,O.Z)({path:"/api/admin/models/promotionalreward/getregularcustomers"},t)))];case 1:return(e=n.sent()).data.length?l({customers:o.customers.concat(e.data)}):h.Am.warning("No more Customers "),m(!1),[2]}var t}))}));return function(){return e.apply(this,arguments)}}();try{e()}catch(n){console.log(n),h.Am.error("Todo: errorMessage")}}),[g,j,n,f]);return(0,r.jsx)("div",{children:u?(0,r.jsx)("div",{style:{textAlign:"center"},children:"Loading..."}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(G,{customers:o.customers,handleLoadPage:function(){p(f+1)},toggle:n})})})}function Q(e){var n=e.toggle,t=(0,a.useState)({customers:[]}),o=t[0],l=t[1],d=(0,a.useState)(!0),u=d[0],m=d[1],x=(0,a.useState)(0),f=x[0],p=x[1],j=(0,i.v9)((function(e){return e.admin.auth})).token,g=(0,i.I0)();(0,a.useEffect)((function(){var e=function(){var e=(0,s.Z)((function(){var e;return(0,c.__generator)(this,(function(n){switch(n.label){case 0:return[4,(t={body:{page:f},options:(0,W.zl)(j),dispatch:g},(0,E.Z)((0,O.Z)({path:"/api/admin/models/promotionalreward/getpromotionalcustomers"},t)))];case 1:return(e=n.sent()).data.length?l({customers:o.customers.concat(e.data)}):h.Am.warning("No more Customers "),m(!1),[2]}var t}))}));return function(){return e.apply(this,arguments)}}();try{e()}catch(n){console.log(n),h.Am.error("Todo: errorMessage")}}),[g,j,n,f]);return(0,r.jsx)("div",{children:u?(0,r.jsx)("div",{style:{textAlign:"center"},children:"Loading..."}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(G,{customers:o.customers,handleLoadPage:function(){p(f+1)}})})})}function K(){var e=(0,a.useState)(),n=e[0],t=e[1],o=(0,a.useState)(!0),l=o[0],d=o[1],u=$(),m=(0,i.v9)((function(e){return e.admin.auth})).token,x=(0,i.I0)();(0,a.useEffect)((function(){var e=function(){var e=(0,s.Z)((function(){var e;return(0,c.__generator)(this,(function(n){switch(n.label){case 0:return[4,(r={options:(0,W.zl)(m),dispatch:x},(0,E.Z)((0,O.Z)({path:"/api/admin/skiplyn/skiplynpromotionalreward/get"},r)))];case 1:return(e=n.sent()).data&&t(e.data),d(!1),[2]}var r}))}));return function(){return e.apply(this,arguments)}}();try{e()}catch(n){console.log(n),h.Am.error("Todo: errorMessage")}}),[x,m]);return(0,r.jsx)("div",{children:l?(0,r.jsx)("div",{style:{textAlign:"center"},children:"Loading..."}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"ml-5",children:n?(0,r.jsx)(I.Z,{component:F.Z,children:(0,r.jsxs)(A.Z,{"aria-label":"sign up request table",children:[(0,r.jsx)(R.Z,{className:u.tableHead,children:(0,r.jsxs)(_.Z,{children:[(0,r.jsx)(T.Z,{className:u.tableFont,children:"Pending Customers"}),(0,r.jsx)(T.Z,{className:u.tableFont,children:"Pending Points"}),(0,r.jsx)(T.Z,{className:u.tableFont,children:"Used Customers"}),(0,r.jsx)(T.Z,{className:u.tableFont,children:"Used Points"})]})}),(0,r.jsx)(z.Z,{children:(0,r.jsxs)(_.Z,{hover:!0,children:[(0,r.jsx)(T.Z,{children:""+n.availableCustomers}),(0,r.jsx)(T.Z,{children:n.availablePoints}),(0,r.jsx)(T.Z,{children:n.usedCustomers}),(0,r.jsx)(T.Z,{children:n.usedPoints})]})})]})}):(0,r.jsx)("h1",{children:"No statistics database "})})})})}var Y={container:{display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},button:{marginRight:"21px"}},ee=" Issue Reward",ne="Non Promotional Customers",te="Promotional Customers",re=" Promotional Statistics";function ae(){var e=(0,a.useState)(ee),n=e[0],t=e[1],i=function(e){t(e.target.innerHTML)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{style:Y.container,children:[(0,r.jsx)(N.Z,{variant:"contained",color:"secondary",style:Y.button,onClick:function(e){return i(e)},children:ee}),(0,r.jsx)(N.Z,{variant:"contained",color:"secondary",style:Y.button,onClick:function(e){return i(e)},children:ne}),(0,r.jsx)(N.Z,{variant:"contained",color:"secondary",style:Y.button,onClick:function(e){return i(e)},children:te}),(0,r.jsx)(N.Z,{variant:"contained",color:"secondary",style:Y.button,onClick:function(e){return i(e)},children:re})]}),n===ee&&(0,r.jsx)(V,{}),n===te&&(0,r.jsx)(Q,{}),n===ne&&(0,r.jsx)(J,{toggle:n}),n===re&&(0,r.jsx)(K,{})]})}var ie=t(53999),se=t(77243),ce=t(8193),oe=t(63750),le=(0,j.Z)({adminNavigation:{height:"100vh",background:"#2e86c1",color:"#f0f3f4",fontSize:"1.5em",position:"fixed",left:"0",right:"0",bottom:"0",zIndex:999,width:"fit-content"},adminNavItemIcon:{padding:"8px","&:hover":{background:"#21618c"}},adminNavItemIconChosen:{background:"#21618c"},adminNavItemText:{display:"inline-block",visibility:"hidden",opacity:0,transition:"opacity 1s, visibility 1s"},adminNavItemTextVisible:{display:"inline-block",visibility:"visible",opacity:1,transition:"opacity 1s, visibility 1s",margin:"0px 15px",fontFamily:"SF Pro Text, Myriad Set Pro, SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif"},adminLogOutButton:{backgroundColor:"#2e86c0",border:"#2e86c0",padding:"0px",borderRadius:"0px"},adminLogOutButtonIcon:{color:"white",marginLeft:"9px",fontSize:"22px",marginTop:"15p
1x",marginBottom:"15px"},adminLogOutButtonText:{color:"white",marginLeft:"22px",fontSize:"20px",fontWeight:500,marginTop:"12px",fontFamily:"SF Pro Text, Myriad Set Pro, SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif"}},{name:"at-SideNavigation"}),de={Reward:"Reward",signUpRequest:"Sign Up Request",menuPricing:"Menu Pricing",transactionPricing:"Transaction Pricing"};function ue(e){var n,t,s=e.tool,c=e.setTool,o=(0,i.I0)(),l=le(),d=(0,i.v9)((function(e){return e.admin.auth})).fullName,u=(0,a.useState)(!1),m=u[0],h=u[1],f=function(){h(!m)},p=function(e){return(0,r.jsxs)(ie.Z,{className:l.adminNavItemIcon,onClick:f,children:[(0,r.jsx)("span",{children:e({size:32})}),(0,r.jsx)("div",{className:(0,v.Z)(l.adminNavItemText,m&&l.adminNavItemTextVisible),children:m?d:""})]})},j=function(e,n){return(0,r.jsxs)(ie.Z,{className:(0,v.Z)(l.adminNavItemIcon,s===n&&l.adminNavItemIconChosen),onClick:function(){return c(n)},children:[(0,r.jsx)("span",{children:e({size:32})}),(0,r.jsx)("div",{className:(0,v.Z)(l.adminNavItemText,m&&l.adminNavItemTextVisible),children:m?n:""})]})};return(0,r.jsxs)(se.Z,{vertical:!0,className:l.adminNavigation,children:[p(m?oe.z3f:oe.Ps6),j(oe.im1,de.signUpRequest),(n=oe.jbI,t=de.Reward,(0,r.jsxs)(ie.Z,{className:(0,v.Z)(l.adminNavItemIcon,s===t&&l.adminNavItemIconChosen),onClick:function(){return c(t)},children:[(0,r.jsx)("span",{children:n({size:32})}),(0,r.jsx)("div",{className:(0,v.Z)(l.adminNavItemText,m&&l.adminNavItemTextVisible),children:m?t:""})]})),j(oe.HlX,de.menuPricing),j(oe.hrr,de.transactionPricing),function(e){return(0,r.jsx)(N.Z,{className:l.adminLogOutButton,color:"danger",onClick:function(){return o((0,x.n)())},children:(0,r.jsxs)("div",{style:{display:"flex"},children:[(0,r.jsx)(ce.k0d,{className:l.adminLogOutButtonIcon,size:25}),(0,r.jsx)("div",{className:l.adminLogOutButtonText,children:m?e:""})]})})}("Log Out")]})}var me=t(89583);var he=t(52875),xe=t(44909),fe=t(51353),pe=t(79323);var je=[{label:"Manual",value:"manual"},{label:"Stripe",value:"stripe"}];function ge(e){var n=e.signUpRequest,t=e.onToggleModalCreate,a=e.onToggleModalDelete,i=$();return(0,r.jsxs)("div",{className:"ml-5",children:[(0,r.jsx)("div",{className:i.signUpText,children:"Sign Up Request"}),n.length>0?(0,r.jsx)(I.Z,{component:F.Z,children:(0,r.jsxs)(A.Z,{"aria-label":"sign up request table",children:[(0,r.jsx)(R.Z,{className:i.tableHead,children:(0,r.jsxs)(_.Z,{children:[(0,r.jsx)(T.Z,{className:i.tableFont,children:"S.N"}),(0,r.jsx)(T.Z,{className:i.tableFont,children:"Name"}),(0,r.jsx)(T.Z,{className:i.tableFont,children:"Email"}),(0,r.jsx)(T.Z,{className:i.tableFont,children:"Address"}),(0,r.jsx)(T.Z,{className:i.tableFont,children:"First Name"}),(0,r.jsx)(T.Z,{className:i.tableFont,children:"Last Name"}),(0,r.jsx)(T.Z,{className:i.tableFont,children:"Floor"}),(0,r.jsx)(T.Z,{className:i.tableFont,children:"Number"}),(0,r.jsx)(T.Z,{align:"center",className:i.tableFont,children:"Action"})]})}),(0,r.jsx)(z.Z,{children:n.map((function(e,n){return(0,r.jsxs)(_.Z,{hover:!0,children:[(0,r.jsx)(T.Z,{component:"th",scope:"row",children:n}),(0,r.jsx)(T.Z,{children:e.restaurantName}),(0,r.jsx)(T.Z,{children:e.email}),(0,r.jsx)(T.Z,{children:e.restaurantAddress}),(0,r.jsx)(T.Z,{children:e.firstName}),(0,r.jsx)(T.Z,{children:e.lastName}),(0,r.jsx)(T.Z,{children:e.floor}),(0,r.jsx)(T.Z,{children:e.phone}),(0,r.jsx)(T.Z,{children:(0,r.jsxs)("div",{className:"d-flex",children:[(0,r.jsx)("div",{children:(0,r.jsx)(N.Z,{color:"success",size:"sm",className:"mr-2",onClick:function(){return t(e)},children:"Create"})}),(0,r.jsx)("div",{children:(0,r.jsx)(N.Z,{color:"danger",size:"sm",onClick:function(){return a(e)},children:"Delete"})})]})})]},n)}))})]})}):(0,r.jsx)("h1",{children:"No Requested"})]})}var ve=t(7652),Ze=t(37137),ye=t(9669),be=t.n(ye);var Ne=t(36955),Pe=t(56941),Se=t(38089),we=t(91121),ke=t(82669),Ce=t(67954),Ie=t(609),Fe=t(36595),Ae=t(32701),Re=t(15538),_e=t(97985),Te=t(25795),qe=t(63777),ze=function(){return function(e){return e((0,qe.Z)(Te.kS,null)),function(e){var n=e.dispatch;return(0,E.Z)({path:"/api/admin/skiplyn/menupricing/get",body:{},dispatch:n})}({dispatch:e}).then((function(n){if(n.data)return e((0,qe.Z)(Te.fL,n.data)),n.data}
1)).catch((function(n){var t=(0,W.S3)(n);throw e((0,f.cN)(t,Te.t2)),n}))}},De=function(e){return function(n){return n((0,qe.Z)(Te.XU,null)),function(e){var n=e.body,t=e.dispatch;return(0,E.Z)({path:"/api/admin/skiplyn/menupricing/create",body:n,dispatch:t})}({body:e,dispatch:n}).then((function(e){if(e.data)return n((0,qe.Z)(Te.uf,e.data)),e.data})).catch((function(e){var t=(0,W.S3)(e);throw n((0,qe.Z)(Te.f6,t)),n((0,f.cN)(t,Te.f6)),e}))}},Le=function(e){return function(n){return n((0,qe.Z)(Te._L,null)),function(e){var n=e.body,t=e.dispatch;return(0,E.Z)({path:"/api/admin/skiplyn/menupricing/update",body:n,dispatch:t})}({body:e,dispatch:n}).then((function(e){if(e.data)return n((0,qe.Z)(Te.Rm,e.data)),e.data})).catch((function(e){var t=(0,W.S3)(e);throw n((0,qe.Z)(Te.FN,t)),n((0,f.cN)(t,Te.FN)),e}))}},Ue=function(e){return function(n){return n((0,qe.Z)(Te.Qm,null)),function(e){var n=e.body,t=e.dispatch;return(0,E.Z)({path:"/api/admin/skiplyn/pricingtransactionmargin/get",body:n,dispatch:t})}({body:e,dispatch:n}).then((function(e){if(e.data)return n((0,qe.Z)(Te.Un,e.data)),e.data})).catch((function(e){var t=(0,W.S3)(e);throw n((0,f.cN)(t,Te.Ck)),e}))}},Oe=function(e){return function(n){return n((0,qe.Z)(Te.Es,null)),function(e){var n=e.restaurantId,t=e.dispatch;return(0,E.Z)({path:"/api/admin/restaurant/menu/get",body:{restaurantId:n},dispatch:t})}({restaurantId:e,dispatch:n}).then((function(e){if(e.data&&e.data.success){var t=e.data.data;return n((0,qe.Z)(Te.Uk,t)),t}})).catch((function(e){var t=(0,W.S3)(e);throw n((0,f.cN)(t,Te.RW)),e}))}};var Ee=t(17354),Me=t(17834),Be=t(71997),We=t(20627);var He,$e=(0,j.Z)({adminToolContainer:{paddingLeft:"0px"},adminToolRow:{marginLeft:"0px",display:"block"},adminToolSideNavigationColumn:{paddingLeft:"0px"}},{name:"at-Tools"}),Ve=(He={},(0,b.Z)(He,de.Reward,(function(){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(ae,{})})})),(0,b.Z)(He,de.signUpRequest,(function(){var e=(0,i.v9)((function(e){return e.admin.auth})).token,n=(0,a.useState)(!0),t=n[0],d=n[1],u=(0,a.useState)([]),m=u[0],x=u[1],f=(0,a.useState)(""),p=f[0],j=f[1],g=(0,a.useState)(null),v=g[0],y=g[1],b=(0,a.useState)([]),P=b[0],w=b[1],k=(0,a.useState)([]),C=k[0],I=k[1],F=(0,a.useState)(!1),A=F[0],R=F[1],_=(0,a.useState)(),T=_[0],q=_[1],z=(0,a.useState)(!1),D=z[0],H=z[1],$=(0,a.useState)({restaurantName:"",restaurantCategories:[],restaurantAddress:"",floor:"",firstName:"",lastName:"",email:"",phone:"",categories:[]}),V=$[0],X=$[1],G=(0,a.useRef)(""),J=(0,i.I0)();(0,a.useEffect)((function(){function e(){return(e=(0,s.Z)((function(){var e,n;return(0,c.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,ve.s)({dispatch:J})];case 1:return e=t.sent(),n=e.data.categories,x(n),[3,3];case 2:return t.sent(),h.Am.error("Failed to retrieve restaurant categories data"),[3,3];case 3:return[2]}}
1))}))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[J]),(0,a.useEffect)((function(){var n=function(){var n=(0,s.Z)((function(){var n;return(0,c.__generator)(this,(function(t){switch(t.label){case 0:return[4,M({options:(0,W.zl)(e),dispatch:J})];case 1:return(n=t.sent()).data&&n.data.length&&I(n.data),d(!1),[2]}}))}));return function(){return n.apply(this,arguments)}}();try{if(!e)throw Error("no token");n()}catch(t){console.log(t),h.Am.error("Todo: errorMessage")}}),[J,e]);var Q=function(){var e=(0,s.Z)((function(e){var n,t,r;return(0,c.__generator)(this,(function(a){switch(a.label){case 0:if(""===e||e===G.current||e.length<=3)return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),G.current=e,n=(0,Ze.tp)(e),[4,be().get(n)];case 2:return t=a.sent(),w(t.data.results),[3,4];case 3:return r=a.sent(),console.error(r),[3,4];case 4:return[2]}}))}));return function(n){return e.apply(this,arguments)}}(),K=(0,a.useCallback)(function(e,n){var t;return function(){for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];var s=this;t&&clearTimeout(t),t=setTimeout((function(){t=null,e.apply(s,a)}),n)}}((function(e){return Q(e)}),1e3),[]),Y=function(e){j(e),K(e)},ee=function(e){var n=e.address.freeformAddress;j(n),y(e)},ne=function(){var n=(0,s.Z)((function(n){var t,r,a;return(0,c.__generator)(this,(function(i){switch(i.label){case 0:if(!v)return h.Am.error("please manually select an address from from the autocomplete"),[2];t={_id:n._id,restaurantName:n.name,floor:n.floor,restaurantCategories:n.categories,firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,paymentService:n.select,tax:n.tax,restaurantAddress:v.address.freeformAddress,location:v.position},i.label=1;case 1:return i.trys.push([1,4,,5]),[4,(s={body:t,options:(0,W.zl)(e),dispatch:J},(0,E.Z)((0,O.Z)({path:"/api/admin/restaurant/signup"},s)))];case 2:return i.sent(),[4,M({options:(0,W.zl)(e),dispatch:J})];case 3:return(r=i.sent())&&r.data&&r.data.length>=0&&I(r.data),R(!A),[3,5];case 4:return a=i.sent(),console.log(a),h.Am.error("Bad request!"),[3,5];case 5:return[2]}var s}))}));return function(e){return n.apply(this,arguments)}}(),te=function(e){q(e),j(e.restaurantAddress),R(!A)},re=function(e){X(e),H(!D)},ae=function(){var n=(0,s.Z)((function(n){var t,r;return(0,c.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,(a={body:V,options:(0,W.zl)(e),dispatch:J},(0,E.Z)((0,O.Z)({path:"/api/admin/restaurant/deletenewsignuprequest"},a)))];case 1:return n.sent(),[4,M({options:(0,W.zl)(e),dispatch:J})];case 2:return(t=n.sent())&&t.data&&t.data.length>=0&&I(t.data),H(!D),[3,4];case 3:return r=n.sent(),console.log(r),h.Am.error("Bad request!"),[3,4];case 4:return[2]}var a}))}));return function(e){return n.apply(this,arguments)}}();return e?(0,r.jsx)("div",{children:t?(0,r.jsx)("span",{className:"text-center mt-4",children:"Loading..."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ge,{signUpRequest:C,onToggleModalCreate:te,onToggleModalDelete:re}),A&&function(e,n,t,a,i,s,c,d,u){return(0,r.jsx)(L.Z,{isOpen:e,toggle:n,children:(0,r.jsx)(U.Z,{style:{padding:"45px",border:"3px solid #3f51b5"},children:(0,r.jsx)(S.J9,{initialValues:{_id:t._id,name:t.restaurantName,tax:"",select:"",floor:t.floor,firstName:t.firstName,lastName:t.lastName,address:t.restaurantAddress,email:t.email,phone:t.phone,categories:t.restaurantCategories},onSubmit:a,validationSchema:Z.Bp,children:function(e){var t=e.errors,a=e.touched;return(0,r.jsxs)(S.l0,{children:[(0,r.jsx)("div",{children:(0,r.jsx)(B.Z,{fullWidth:!0,type:"text",name:"name",label:"Name",invalid:!(!t.name||!a.name),style:{marginBottom:"15px"}})}),(0,r.jsx)("div",{children:(0,r.jsx)(pe.Z,{name:"categories",label:"Categories",options:i.sort(),style:{marginBottom:"15px"}})}),(0,r.jsx)("div",{children:(0,r.jsx)(fe.ZP,{style:{marginBottom:"15px"},id:"address",name:"address",filterOptions:function(e){return e},noOptionsText:"No results...",inputValue:c,onInputChange:function(e,n,t){"clear"===t&&u(""),"input"===t&&u(n)},onChange:function(e,n,t){"select-option"===t&&d(n)},options:s,freeSolo:!0,getOptionLabel:function(e){return"string"===typeof e?e:e.address.freeformAddress},renderInput:function(e){return(0,r.jsx)(o.Z,(0,he.Z)((0,O.Z)({},e),{label:"Address",name:"address",variant:"outlined"}))}})}),(0,r.jsxs)("div",{className:"d-flex",children:[(0,r.jsx)("div",{className:"mr-2",children:(0,r.jsx)(B.Z,{label:"Floor",name:"floor",style:{marginBottom:"15px"}})}),(0,r.jsx)("div",{className:"mr-2",style:{flexBasis:"30%"},children:(0,r.jsx)(B.Z,{fullWidth:!0,type:"number",name:"tax",label:"Tax",invali
1d:!(!t.tax||!a.tax),style:{marginBottom:"15px"}})}),(0,r.jsx)("div",{style:{flexBasis:"40%"},children:(0,r.jsx)(xe.Z,{items:je,name:"select",label:"Select",invalid:!(!t.select||!a.select)})})]}),(0,r.jsx)("div",{children:(0,r.jsx)(B.Z,{fullWidth:!0,type:"email",label:"Email",name:"email",invalid:!(!t.email||!a.email),style:{marginBottom:"15px"}})}),(0,r.jsxs)("div",{className:"d-flex",children:[(0,r.jsx)("div",{className:"mr-2",style:{flexBasis:"50%"},children:(0,r.jsx)(B.Z,{fullWidth:!0,name:"firstName",type:"text",label:"First name",invalid:!(!t.firstName||!a.firstName),style:{marginBottom:"15px"}})}),(0,r.jsx)("div",{style:{flexBasis:"50%"},children:(0,r.jsx)(B.Z,{fullWidth:!0,name:"lastName",type:"text",label:"Last name",invalid:!(!t.lastName||!a.lastName),style:{marginBottom:"15px"}})})]}),(0,r.jsx)("div",{children:(0,r.jsx)(B.Z,{label:"Phone",type:"number",name:"phone",invalid:!(!t.phone||!a.phone),style:{marginBottom:"15px"}})}),(0,r.jsx)(l.Z,{variant:"contained",color:"primary",className:"mr-2",type:"submit",children:"Accept"}),(0,r.jsx)(l.Z,{variant:"contained",onClick:n,children:"Cancel"})]})}})})})}(A,te,T,ne,m,P,p,ee,Y),D&&function(){return e=D,n=re,t=ae,(0,r.jsx)("div",{children:(0,r.jsx)("div",{children:(0,r.jsx)(L.Z,{isOpen:e,toggle:n,children:(0,r.jsxs)(U.Z,{style:{padding:"0px"},children:[(0,r.jsx)("div",{className:"p-2 text-light bg-secondary",children:"Delete"}),(0,r.jsxs)("div",{className:"m-4",children:[(0,r.jsxs)("div",{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"mr-3",children:(0,r.jsx)(me.Zlu,{size:50})}),(0,r.jsx)("h5",{children:"Are you sure you want to delete"})]}),(0,r.jsxs)("div",{className:"d-flex justify-content-end",children:[(0,r.jsx)("div",{children:(0,r.jsx)(N.Z,{color:"danger",className:"mr-2 mt-2",onClick:t,size:"sm",children:"Confirm"})}),(0,r.jsx)("div",{children:(0,r.jsx)(N.Z,{color:"secondary",className:"mt-2",size:"sm",onClick:n,children:"Cancel"})})]})]})]})})})});var e,n,t}()]})}):(0,r.jsx)(r.Fragment,{children:"no token"})})),(0,b.Z)(He,de.menuPricing,(function(){var e=(0,i.I0)(),n=(0,i.v9)((function(e){return e.admin.pricing.menuPricing})),t=n.restaurants,o=n.loading,l=n.error,x=n.updating,p=(0,i.v9)((function(e){return e.admin.pricing.restaurantMenu})),j=p.data,g=p.loading,v=(0,i.v9)((function(e){return e.error.local})),Z=v.errorMessage,y=v.errorCode,b=(0,a.useState)(!1),S=b[0],w=b[1],k=(0,a.useState)(null),C=k[0],I=k[1],F=(0,a.useState)({pricingPercentage:0,isActive:!1}),A=F[0],R=F[1],_=(0,a.useState)(null),T=_[0],q=_[1],z=(0,a.useState)(""),D=z[0],E=z[1];(0,a.useEffect)((function(){M()}),[]),(0,a.useEffect)((function(){C&&j&&$(C,A.pricingPercentage)}),[j]);var M=function(){var n=(0,s.Z)((function(){var n;return(0,c.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e(ze())];case 1:return t.sent(),[3,3];case 2:return n=t.sent(),console.error("Failed to fetch restaurants:",n),[3,3];case 3:return[2]}}
1))}));return function(){return n.apply(this,arguments)}}(),B=function(){var n=(0,s.Z)((function(n){var t;return(0,c.__generator)(this,(function(r){switch(r.label){case 0:I(n),R({pricingPercentage:n.pricingPercentage,isActive:n.isActive}),w(!0),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e(Oe(n.restaurantId))];case 2:return r.sent(),$(n,n.pricingPercentage),[3,4];case 3:return t=r.sent(),console.error("Failed to fetch restaurant menu:",t),$(n,n.pricingPercentage),[3,4];case 4:return[2]}}))}));return function(e){return n.apply(this,arguments)}}(),H=function(e,n){if(!e||!n||n<=0)return e;var t=e*(1+n/100);return Math.round(100*t)/100},$=function(e,n){var t=[];if(j&&Array.isArray(j)){var r=[];j.forEach((function(e){var n;e&&e.foodItems&&Array.isArray(e.foodItems)&&(n=r).push.apply(n,(0,P.Z)(e.foodItems))})),t=r.map((function(e){return{name:e.foodName||e.name||e.itemName||"Unknown Item",currentPrice:parseFloat(e.foodPrice||e.price||e.cost||0)}})).filter((function(e){return e.currentPrice>0}))}0===t.length&&(t=[{name:"Burger",currentPrice:12.99},{name:"Pizza",currentPrice:18.5},{name:"Salad",currentPrice:9.99},{name:"Pasta",currentPrice:15.25}]);var a=t.slice(0,10).map((function(t){var r=H(t.currentPrice,e.pricingPercentage),a=H(t.currentPrice,n);return{name:t.name,restaurantPrice:(0,W.RI)(t.currentPrice).toFixed(2),currentSkiplynPrice:(0,W.RI)(r).toFixed(2),newSkiplynPrice:(0,W.RI)(a).toFixed(2),difference:(0,W.RI)(a-r).toFixed(2),markUp:(0,W.RI)(a-t.currentPrice).toFixed(2)}}));q(a)},V=t.filter((function(e){return e.restaurantName.toLowerCase().includes(D.toLowerCase())})),X=function(){var n=(0,s.Z)((function(){var n;return(0,c.__generator)(this,(function(t){switch(t.label){case 0:n={restaurantId:C.restaurantId,pricingPercentage:A.pricingPercentage,isActive:A.isActive},t.label=1;case 1:return t.trys.push([1,6,,7]),C.exists?[4,e(Le(n))]:[3,3];case 2:return t.sent(),[3,5];case 3:return[4,e(De(n))];case 4:t.sent(),t.label=5;case 5:return[3,7];case 6:return t.sent(),console.log("Operation failed, error handled by Redux"),[3,7];case 7:return[2]}}
1))}));return function(){return n.apply(this,arguments)}}();return(0,a.useEffect)((function(){y!==Te.f6&&y!==Te.FN||(h.Am.error(Z),e((0,f.sp)()))}),[y,Z,e]),(0,a.useEffect)((function(){x||l||(w(!1),M(),h.Am.success("Skiplyn pricing configuration updated successfully"))}),[x,l]),o?(0,r.jsxs)(d.Z,{className:"text-center mt-5",children:[(0,r.jsx)(Ne.Z,{color:"primary"}),(0,r.jsx)("p",{children:"Loading restaurants..."})]}):(0,r.jsxs)(d.Z,{fluid:!0,children:[(0,r.jsx)(u.Z,{children:(0,r.jsx)(m.Z,{children:(0,r.jsxs)(Pe.Z,{children:[(0,r.jsxs)(Se.Z,{children:[(0,r.jsx)("h4",{children:"Menu Pricing Management"}),(0,r.jsx)("p",{className:"mb-0",children:"Manage Skiplyn pricing for all restaurants"})]})," ",(0,r.jsxs)(we.Z,{children:[(0,r.jsxs)(u.Z,{className:"mb-3",children:[(0,r.jsx)(m.Z,{md:4,children:(0,r.jsxs)(ke.Z,{children:[(0,r.jsx)(Ce.Z,{for:"restaurantSearch",children:"Filter by Restaurant Name:"}),(0,r.jsx)(Ie.Z,{type:"text",id:"restaurantSearch",placeholder:"Search restaurants...",value:D,onChange:function(e){E(e.target.value)}})]})}),(0,r.jsx)(m.Z,{md:8,className:"d-flex align-items-end",children:(0,r.jsxs)("small",{className:"text-muted",children:["Showing ",V.length," of"," ",t.length," restaurants"]})})]}),(0,r.jsxs)(Fe.Z,{responsive:!0,striped:!0,children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Restaurant Name"}),(0,r.jsx)("th",{children:"Restaurant ID"}),(0,r.jsx)("th",{children:"Pricing %"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Last Updated"}),(0,r.jsx)("th",{children:"Actions"})]})}),(0,r.jsx)("tbody",{children:V.map((function(e){return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.restaurantName}),(0,r.jsx)("td",{children:(0,r.jsx)("small",{children:e.restaurantId})}),(0,r.jsxs)("td",{children:[e.pricingPercentage,"%"]}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"badge ".concat(e.isActive?"badge-success":"badge-secondary"),children:e.isActive?"Active":"Inactive"})}),(0,r.jsx)("td",{children:e.exists&&e.updatedAt?new Date(e.updatedAt).toLocaleDateString():"Not configured"}),(0,r.jsx)("td",{children:(0,r.jsx)(N.Z,{color:"primary",size:"sm",onClick:function(){return B(e)},children:e.exists?"Edit":"Create"})})]},e.restaurantId)}))})]})]})]})})}),(0,r.jsxs)(L.Z,{isOpen:S,toggle:function(){return w(!1)},size:"lg",children:[(0,r.jsxs)(Ae.Z,{toggle:function(){return w(!1)},children:[(null===C||void 0===C?void 0:C.exists)?"Edit":"Create"," Pricing -"," ",null===C||void 0===C?void 0:C.restaurantName]}),(0,r.jsxs)(U.Z,{children:[(0,r.jsx)(Re.Z,{children:(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(m.Z,{md:6,children:(0,r.jsxs)(ke.Z,{children:[(0,r.jsx)(Ce.Z,{for:"pricingPercentage",children:"Pricing Percentage"}),(0,r.jsx)(Ie.Z,{type:"number",id:"pricingPercentage",value:A.pricingPercentage,onChange:function(e){var n=e.target.value;n&&"0"!==n&&"0."!==n&&!n.startsWith("0.")&&(n=n.replace(/^0+/,""));var t=parseFloat(n)||0;e.target.value=n,R((function(e){return(0,he.Z)((0,O.Z)({},e),{pricingPercentage:t})})),C&&$(C,t)},min:"0",max:"100",step:"0.1"}),(0,r.jsx)("small",{className:"text-muted",children:"Percentage markup (0-100%)"})]})}),(0,r.jsx)(m.Z,{md:6,children:(0,r.jsxs)(ke.Z,{check:!0,className:"mt-4",children:[(0,r.jsxs)(Ce.Z,{check:!0,children:[(0,r.jsx)(Ie.Z,{type:"checkbox",checked:A.isActive,onChange:function(e){R((function(n){return(0,he.Z)((0,O.Z)({},n),{isActive:e.target.checked})}))}}),"Active"]}),(0,r.jsx)("small",{className:"text-muted d-block",children:"Enable pricing for this restaurant"})]})})]})}),T&&(0,r.jsxs)(Pe.Z,{className:"mt-3",children:[(0,r.jsxs)(Se.Z,{children:[(0,r.jsx)("h6",{children:"Price Preview"}),g&&(0,r.jsx)("small",{className:"text-muted",children:"Loading menu data..."}),!g&&j&&(0,r.jsx)("small",{className:"text-success",children:"Using actual restaurant menu"}),!g&&!j&&(0,r.jsx)("small",{className:"text-warning",children:"Using sample data (restaurant menu not available)"})]}),(0,r.jsx)(we.Z,{children:(0,r.jsxs)(Fe.Z,{size:"sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Item"}),(0,r.jsx)("th",{children:"Restaurant Price"}),(0,r.jsx)("th",{children:"Current Skiplyn Price"}),(0,r.jsx)("th",{children:"New Skiplyn Price"}),(0,r.jsx)("th",{children:"Difference"}),(0,r.jsx)("th",{children:"Mark Up"})]})}),(0,r.jsx)("tbody",{children:T.map((function(e,n){return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.name}),(0,r.jsxs)("td",{children:["$",e.restaurantPrice]}),(0,r.jsxs)("td",{children:["$",e.currentSkiplynPrice]}),(0,r.jsxs)("td",{className:0!==parseFloat(e.difference)?"font-weight-bold":"",children:["$",e.newSkiplynPrice]}),(0,r.jsxs)("td",{className:parseFloat(e.difference)>0?"text-success":parseFloat(e.difference)<0?"text-danger":"",children:[parseFloat(e.difference)>0?"+":"","$",e.difference]}),(0,r.jsxs)("td",{className:parseFloat(e.markUp)>0?"text-success":parseFloat(e.markUp)<0?"text-danger":"",children:[parseFloat(e.markUp)>0?"+":"","$",e.markUp]})]},n)}))})]})})]})]}),(0,r.jsxs)(_e.Z,{children:[(0,r.jsx)(N.Z,{color:"secondary",onClick:function(){return w(!1)},disabled:x,children:"Cancel"}),(0,r.jsx)(N.Z,{color:"primary",onClick:X,disabled:x,children:x?(0,r.jsx)(Ne.Z,{size:"sm"}):(null===C||void 0===C?void 0:C.exists)?"Update":"Create"})]})]})]})})),(0,b.Z)(He,de.transactionPricing,(function(){var e,n=(0,i.I0)(),t=(0,i.v9)((function(e){return e.admin.pricing.transactionPricing})),o=t.data,l=t.loading,h=t.error,x=(0,a.useState)("week"),f=x[0],p=x[1],j=(0,a.useState)({from:"",to:""}),g=j[0],v=j[1],Z=(0,a.useState)({}),y=Z[0],P=Z[1],S=(null===o||void 0===o?void 0:o.margins)||[],w=(null===o||void 0===o?void 0:o.summary)||null;(0,a.useEffect)((function(){k()}),[f,g]);var k=function(){var e=(0,s.Z)((function(){var e,t,r;return(0,c.__generator)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),e=function(){var e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate());switch(f){case"day":return{from:new Date(n.getTime()-864e5),to:e};case"week":default:return{from:new Date(n.getTime()-6048e5),to:e};case"month":return{from:new Date(n.getTime()-2592e6),to:e};
1case"custom":return{from:g.from?new Date(g.from):new Date(n.getTime()-6048e5),to:g.to?new Date(g.to):e}}}(),t={fromDateTime:e.from.toISOString(),toDateTime:e.to.toISOString()},[4,n(Ue(t))];case 1:return a.sent(),[3,3];case 2:return r=a.sent(),console.error("Failed to fetch transaction data:",r),[3,3];case 3:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),C=function(e){p(e),"custom"!==e&&v({from:"",to:""})},I=function(e,n){v((function(t){return(0,he.Z)((0,O.Z)({},t),(0,b.Z)({},e,n))}))},F=function(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e)},A=function(e){if(null==e||void 0===e)return"0%";var n="string"===typeof e?parseFloat(e):e;return isNaN(n)?"0%":"".concat(n>=1?Math.round(n):n.toFixed(2),"%")},R=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!e)return(0,r.jsx)("div",{children:"No order data available"});var i=e;if(t&&a&&e.items&&a.items){var s=a.subtotal||0,c=e.subtotal||0;if(s!==c&&s>0){var o=c/s;i=(0,he.Z)((0,O.Z)({},e),{items:e.items.map((function(e){return(0,he.Z)((0,O.Z)({},e),{foodPrice:e.originalFoodPrice||e.foodPrice*o,totalPrice:e.originalTotalPrice||e.totalPrice*o,isAdjustedPrice:!e.originalFoodPrice})}))})}}return(0,r.jsxs)("div",{className:"p-3 bg-light rounded",children:[(0,r.jsxs)("h6",{className:"text-primary",children:[n," Order Details"]}),(0,r.jsxs)(u.Z,{children:[(0,r.jsxs)(m.Z,{md:6,children:[(0,r.jsx)("strong",{children:"Total: "}),F(i.total||0),(0,r.jsx)("br",{}),(0,r.jsx)("strong",{children:"Subtotal: "}),F(i.subtotal||0),(0,r.jsx)("br",{}),(0,r.jsx)("strong",{children:"Tax: "}),F(i.tax||0),(0,r.jsx)("br",{}),(0,r.jsx)("strong",{children:"Delivery Fee: "}),F(i.deliveryFee||0),(0,r.jsx)("br",{}),i.tips&&(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Tips: "}),F(i.tips),(0,r.jsx)("br",{})]}),i.discount&&(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:"Discount: "}),F(i.discount),(0,r.jsx)("br",{})]})]}),(0,r.jsx)(m.Z,{md:6,children:i.items&&i.items.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:["Items (",i.items.length,"):"]}),(0,r.jsx)("ul",{className:"list-unstyled mt-2",children:i.items.map((function(e,n){return(0,r.jsxs)("li",{className:"mb-1",children:[(0,r.jsxs)(Ee.Z,{color:"secondary",className:"mr-1",children:[e.quantity||e.totalQuantity,"x"]}),e.name||e.foodName," ","-"," ",F(e.price||e.foodPrice||0),e.isAdjustedPrice&&(0,r.jsx)(Ee.Z,{color:"info",className:"ml-1",size:"sm",children:"calculated"}),e.modifiers&&e.modifiers.length>0&&(0,r.jsx)("div",{className:"text-muted small ml-3",children:e.modifiers.map((function(e,n){return(0,r.jsxs)("div",{children:["+"," ",e.name," ","(",F(e.price||0),")"]},n)}))})]},n)}))})]})})]})]})};return l?(0,r.jsxs)(d.Z,{className:"text-center mt-5",children:[(0,r.jsx)(Ne.Z,{color:"primary"}),(0,r.jsx)("p",{children:"Loading transaction data..."})]}):(0,r.jsx)(d.Z,{fluid:!0,children:(0,r.jsx)(u.Z,{children:(0,r.jsx)(m.Z,{children:(0,r.jsxs)(Pe.Z,{children:[(0,r.jsxs)(Se.Z,{children:[(0,r.jsx)("h4",{children:"Transaction Pricing Analytics"}),(0,r.jsx)("p",{className:"mb-0",children:"View pricing margin analytics and transaction data"})]}),(0,r.jsxs)(we.Z,{children:[h&&(0,r.jsx)(Me.Z,{color:"danger",className:"mb-3",children:h}),(0,r.jsx)(u.Z,{className:"mb-3",children:(0,r.jsxs)(m.Z,{md:8,children:[(0,r.jsx)(Ce.Z,{children:"Time Window:"}),(0,r.jsxs)(Be.Z,{className:"ml-2",children:[(0,r.jsx)(N.Z,{color:"day"===f?"primary":"outline-primary",onClick:function(){return C("day")},size:"sm",children:"Last Day"}),(0,r.jsx)(N.Z,{color:"week"===f?"primary":"outline-primary",onClick:function(){return C("week")},size:"sm",children:"Last Week"}),(0,r.jsx)(N.Z,{color:"month"===f?"primary":"outline-primary",onClick:function(){return C("month")},size:"sm",children:"Last Month"}),(0,r.jsx)(N.Z,{color:"custom"===f?"primary":"outline-primary",onClick:function(){return C("custom")},size:"sm",children:"Custom"})]})]})}),"custom"===f&&(0,r.jsxs)(u.Z,{className:"mb-3",children:[(0,r.jsx)(m.Z,{md:3,children:(0,r.jsxs)(ke.Z,{children:[(0,r.jsx)(Ce.Z,{for:"fromDate",children:"From Date"}),(0,r.jsx)(Ie.Z,{type:"date",id:"fromDate",value:g.from,onChange:function(e){return I("from",e.target.value)}})]})}),(0,r.jsx)(m.Z,{md:3,children:(0,r.jsxs)(ke.Z,{children:[(0,r.jsx)(Ce.Z,{for:"toDate",children:"To Date"}),(0,r.jsx)(Ie.Z,{type:"date",id:"toDate",value:g.to,onChange:function(e){return I("to",e.target.value)}})]})}),(0,r.jsx)(m.Z,{md:2,children:(0,r.jsxs)(ke.Z,{children:[(0,r.jsx)(Ce.Z,{children:"\xa0"}),(0,r.jsx)(N.Z,{color:"primary",block:!0,onClick:k,children:"Apply"})]})})]}),w&&(0,r.jsxs)(u.Z,{className:"mb-4",children:[(0,r.jsx)(m.Z,{md:3,children:(0,r.jsx)(Pe.Z,{className:"bg-primary text-white",children:(0,r.jsxs)(we.Z,{children:[(0,r.jsx)("h6",{children:"Total Transactions"}),(0,r.jsx)("h4",{children:w.totalTransactions})]})})}),(0,r.jsx)(m.Z,{md:3,children:(0,r.jsx)(Pe.Z,{className:"bg-success text-white",children:(0,r.jsxs)(we.Z,{children:[(0,r.jsx)("h6",{children:"Total Revenue"}),(0,r.jsx)("h4",{children:F(w.totalRevenue)})]})})}),(0,r.jsx)(m.Z,{md:3,children:(0,r.jsx)(Pe.Z,{className:"bg-info text-white",children:(0,r.jsxs)(we.Z,{children:[(0,r.jsx)("h6",{children:"Total Margin"}),(0,r.jsx)("h4",{children:F(w.totalMargin)})]})})}),(0,r.jsx)(m.Z,{md:3,children:(0,r.jsx)(Pe.Z,{className:"bg-warning text-white",children:(0,r.jsxs)(we.Z,{children:[(0,r.jsx)("h6",{children:"Avg Margin %"}),(0,r.jsxs)("h4",{children:[null===(e=w.averageMarginPercentage)||void 0===e?void 0:e.toFixed(2),"%"]})]})})})]}),S&&S.length>0&&(0,r.jsxs)(Fe.Z,{responsive:!0,striped:!0,children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{}),(0,r.jsx)("th",{children:"Order ID"}),(0,r.jsx)("th",{children:"Restaurant Info"}),(0,r.jsx)("th",{children:"Customer Total"}),(0,r.jsx)("th",{children:"Restaurant Total"}),(0,r.jsx)("th",{children:"Margin"}),(0,r.jsx)("th",{children:"Pricing %"}),(0,r.jsx)("th",{children:"Date"})]})}),(0,r.jsx)("tbody",{children:S.map((function(e){var n,t,i;return(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsx)(N.Z,{color:"link",size:"sm",onClick:function(){return n=e.orderId,void P((function(e){return(0,he.Z)((0,O.Z)({},e),(0,b.Z)({},n,!e[n]))}));var n},className:"p-0",children:y[e.orderId]?"\u2212":"+"})}),(0,r.jsx)("td",{children:(0,r.jsx)("small",{children:e.orderId})}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{children:e.restaurantName?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("strong",{children:e.restaurantName}),(0,r.jsx)("br",{}),(0,r.jsxs)("small",{className:"text-muted",children:["ID:"," ",e.restaurantId]})]}):(0,r.jsxs)("span",{children:["ID:"," ",e.restaurantId]})})}),(0,r.jsx)("td",{children:F((null===(n=e.skiplynOrder)||void 0===n?void 0:n.total)||0)}),(0,r.jsx)("td",{children:F((null===(t=e.restaurantOrder)||void 0===t?void 0:t.total)||0)}),(0,r.jsx)("td",{className:"text-success font-weight-bold",children:F(e.margin)}),(0,r.jsx)("td",{children:A(e.pricingPercentage)}),(0,r.jsx)("td",{children:(i=e.createdAt,new Date(i).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))})]}),(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:"8",className:"p-0",children:(0,r.jsx)(We.Z,{isOpen:y[e.orderId],children:(0,r.jsx)("div",{className:"p-3 bg-light",children:(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(m.Z,{md:6,children:R(e.skiplynOrder,"Customer (Skiplyn)",!1)}),(0,r.jsx)(m.Z,{md:6,children:R(e.restaurantOrder,"Restaurant",!0,e.skiplynOrder)})]})})})})})]},e.orderId)}))})]}),(!S||0===S.length)&&!w&&!l&&(0,r.jsx)(Me.Z,{color:"info",children:"No transaction data found for the selected time period."})]})]})})})})})),He);function Xe(){var e=(0,a.useState)(de.signUpRequest),n=e[0],t=e[1],i=Ve[n],s=$e();return(0,r.jsx)(d.Z,{className:s.adminToolContainer,fluid:!0,children:(0,r.jsxs)(u.Z,{className:s.adminToolRow,children:[(0,r.jsx)(m.Z,{className:s.adminToolSideNavigationColumn,children:(0,r.jsx)(ue,{tool:n,setTool:t})}),(0,r.jsx)(m.Z,{children:(0,r.jsx)(i,{})})]})})}function Ge(){return(0,i.v9)((function(e){return e.admin.auth})).token?(0,r.jsx)(Xe,{}):(0,r.jsx)(y,{})}function Je(){return(0,r.jsx)(Ge,{})}}},function(e){e.O(0,[5445,4617,2013,1120,430,309,714,674,3665,8643,6003,5102,1437,9774,2888,179],(function(){return n=84730,e(e.s=n);var n}));var n=e.O();_N_E=n}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.