1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[660],{68868:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return X}});var n=r(95235),a=r(20406),i=r(28526),o=r.n(i),c=r(2784),s=r(97963),l=r(15089),d=r.n(l),u=r(61297),p=r(95544),h=r(4614),f=r(36372),b=r(86235),m=r(41440),g=r(16955),y=r(22730),j=r(90506),v=r(60505),w=r(60873),x=r(79692),_=r(94339),O=r(90436),Z=r(19034),k=r.n(Z),P=r(81463),D=r(66054),L=r(79880),N=r(6277),C=r(67589),S=r(82269),E=r(77277),A=r(59816),T=r(52322),I=["order","onSubmit"];function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var W=(0,x.Z)((function(e){return{cancelOrderBtn:{borderWidth:2,padding:e.spacing(.8,1.8),"& > .MuiButton-label":{fontWeight:500},"&:hover":{borderWidth:2}}}})),q=function(e){if(!e)return"";switch(e.title){case"Alexandra":return"Ah Seng Durian Alexandra - 91596160";case"Ghim Moh":return"Ah Seng Durian Ghim Moh - 94656160";default:return""}},H=function(e){var t=W(),r=e.order,n=e.onSubmit,i=(0,S.Z)(e,I),s=(0,c.useState)(!1),l=s[0],d=s[1],u=r||{},h=u.location,f=u.collectionDate,b=u.fulfillmentStatus===g.tc.cancelled,m=k()().isAfter(k()("".concat(f," 11.59pm"),"".concat(C.v," hh.mma")).subtract(1,"day"));return(0,T.jsx)(A.Z,M(M({toggle:function(e){return!m&&(0,T.jsx)(E.Z,{variant:"outlined",color:"secondary",size:"small",className:t.cancelOrderBtn,onClick:e,disabled:b,children:"Cancel Order"})}},i),{},{children:function(e){var t,r=e.hide;return(0,T.jsxs)(p.Z,{px:4,pt:8,pb:6,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",children:[(0,T.jsx)(O.Z,{children:(0,T.jsx)(p.Z,{fontWeight:600,children:"Are you sure you want to cancel this order?"})}),m&&(0,T.jsx)(O.Z,{variant:"caption",color:"primary",children:(0,T.jsxs)(p.Z,{mt:2,fontWeight:600,children:["*Order cancelation is allowed up to 11.59pm on the day before the collection date. For any last minute cancellation, please call ",q(h),"."]})}),(0,T.jsx)(p.Z,{mt:3,children:(0,T.jsx)(E.Z,{type:"submit",variant:"contained",color:"primary",disabled:l||m,onClick:(t=r,(0,a.Z)(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(!0),e.next=3,n();case 3:d(!1),t();case 5:case"end":return e.stop()}}),e)})))),children:"Cancel Order"})})]})}}))},z=(0,x.Z)((function(e){return{fulfillmentStatus:{textTransform:"uppercase"},greenHighlightLabel:{color:P.Z[500]},redHighlightLabel:{color:D.Z[500]},brownHighlightLabel:{color:L.Z[900]},boldedLabel:{fontWeight:700},boldedLabelLight:{fontWeight:600}}})),B=function(e){var t=z(),r=e.order,n=e.handleCancelOrder,a=r||{},i=a.collectionDate,o=a.collectionStartTime,c=a.collectionEndTime,s=a.refNo,l=a.lines,d=a.fulfillmentStatus,u=a.location,h=u||{},f=h.title,b=h.zhTitle,m=b?"".concat(f,"(").concat(b,")"):f,y="".concat(k()(i,C.v).format("ddd, DD MMM YYYY")," ").concat(o," - ").concat(c),j=function(e,t){switch(e){case g.tc.confirmed:return{label:"ordered",className:t.greenHighlightLabel};case g.tc.cancelled:return{label:e,className:t.redHighlightLabel};default:return{label:e}}}(d,t),v=j.label,w=j.className;return(0,T.jsx)(_.Z,{children:(0,T.jsxs)(p.Z,{p:2.5,children:[(0,T.jsxs)(p.Z,{display:"flex",justifyContent:"space-between",children:[(0,T.jsx)(O.Z,{variant:"h6",className:t.boldedLabel,children:"Collection Date Time"}),(0,T.jsx)(O.Z,{className:(0,N.Z)(t.boldedLabel,t.fulfillmentStatus,w),children:v})]}),(0,T.jsxs)(p.Z,{display:"flex",justifyContent:"space-between",children:[(0,T.jsx)(O.Z,{variant:"subtitle1",color:"primary",className:t.boldedLabel,children:y}),(0,T.jsx)(H,{order:r,onSubmit:n})]}),u&&(0,T.jsxs)(O.Z,{variant:"subtitle1",color:"secondary",className:t.boldedLabelLight,children:["Location: ",m]}
1),(0,T.jsx)(p.Z,{pt:.8,children:(0,T.jsxs)(O.Z,{className:t.boldedLabelLight,children:["Order Id: #",s]})}),(0,T.jsx)(p.Z,{pt:2.5,pb:1,children:(0,T.jsx)(O.Z,{variant:"subtitle2",color:"primary",className:t.boldedLabel,children:"Items"})}),(0,T.jsx)(p.Z,{children:null===l||void 0===l?void 0:l.map((function(e,r){var n=e.quantity,a=e.variant||{},i=a.product,o=a.price,c=null===i||void 0===i?void 0:i.title;return(0,T.jsxs)(p.Z,{display:"flex",justifyContent:"space-between",children:[(0,T.jsxs)(O.Z,{variant:"body2",children:[(0,T.jsx)("span",{children:"".concat(n," pc(s) X ")}),(0,T.jsx)("span",{className:(0,N.Z)(t.boldedLabelLight,t.brownHighlightLabel),children:c})]}),(0,T.jsxs)(O.Z,{className:(0,N.Z)(t.boldedLabelLight,t.brownHighlightLabel),children:["SGD ",o,"/kg"]})]})}))})]})})};function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var G=function(){var e=(0,s.Z)(),t=(0,w.a)().user,r={userID:null===t||void 0===t?void 0:t.id},n=(0,u.QL)({variables:r,skip:!t}),i=n.orders,c=n.pagination,l=n.nextToken,x=Boolean(l),_=(0,b.xJ)(),O=(0,m.pF)({disableCacheUpdate:!0}).handleUpdateStock,Z=(0,u.e0)({variables:r,disableCacheUpdate:{listOrders:!0,listOrdersByPartitionCreatedAt:!0,listOrdersByLocationIdCreatedAt:!0}}).handleUpdateOrder,k=function(){var e=(0,a.Z)(o().mark((function e(t){var r,n,i,c,s,l,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.lines,n=void 0===r?[]:r,i=t.locationID,c=t.collectionDate,s=t.id,e.next=3,Promise.all(n.map(function(){var e=(0,a.Z)(o().mark((function e(t){var r,n,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(r=t.variant)||void 0===r?void 0:r.id,e.next=3,(0,f.H3)({client:_,variantID:n,locationID:i,date:c});case 3:return a=e.sent,e.abrupt("return",F(F({},t),{},{stock:a}));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:return l=e.sent,e.next=6,Promise.all(l.map((function(e){var t=e.quantity,r=e.stock,n=r.id,a=r.ordered;return O({id:n,ordered:a-t})})));case 6:return d={id:s,fulfillmentStatus:g.tc.cancelled},e.next=9,Z(d);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,T.jsxs)(y.Z,{title:"My Orders",navBar:{variant:"ghost",color:e.palette.common.white},children:[(0,T.jsx)(j.Z,{background:{src:"/hero/page-hero.jpg",overlay:!0},textAlign:"center",container:{maxWidth:"sm"},title:"Orders"}),(0,T.jsx)(v.Z,{container:{maxWidth:"lg"},px:0,children:(0,T.jsx)(d(),F(F({},c),{},{hasMore:x,loader:(0,T.jsx)(p.Z,{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",mt:4,children:(0,T.jsx)(h.Z,{})},"infinite-scroll-loading"),children:null===i||void 0===i?void 0:i.map((function(e){return(0,T.jsx)(p.Z,{mt:3,children:(0,T.jsx)(B,{order:e,handleCancelOrder:function(){return k(e)}})},e.id)}))}))})]})},X=G},90506:function(e,t,r){"use strict";var n=r(82269),a=r(95235),i=(r(2784),r(6277)),o=r(95544),c=r(85256),s=r(90436),l=r(26373),d=r(60505),u=r(52322),p=["children","tagline","title","content","className"];function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach((function(t){(0,a.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=(0,l.Z)((function(e){var t;
1return{root:(0,a.Z)({height:"60vh",minHeight:300,display:"flex",alignItems:"center"},e.breakpoints.up("sm"),{height:"75vh"}),content:(t={color:e.palette.common.white,display:"flex",flexDirection:"column",alignItems:"center"},(0,a.Z)(t,e.breakpoints.down("sm"),{textAlign:"center"}),(0,a.Z)(t,"& > :not(:first-child)",{marginTop:e.spacing(3)}),(0,a.Z)(t,e.breakpoints.up("md"),{whiteSpace:"pre-line"}),t),divider:{backgroundColor:e.palette.common.white,width:80,height:2}}}));t.Z=function(e){var t=e.children,r=e.tagline,a=e.title,l=e.content,h=e.className,m=(0,n.Z)(e,p),g=b(e);return(0,u.jsx)(d.Z,f(f({className:(0,i.Z)(g.root,h),container:!0,bgcolor:"white",px:0},m),{},{children:(0,u.jsxs)(o.Z,{px:{xs:.75,md:0},children:[(r||a||l)&&(0,u.jsxs)(o.Z,{className:g.content,children:[(r||a)&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(o.Z,{children:[r&&(0,u.jsx)(s.Z,{variant:"h4",color:"inherit",children:r}),a&&(0,u.jsx)(s.Z,{variant:"h2",color:"inherit",component:"h1",children:a})]}),l&&(0,u.jsx)(c.Z,{className:g.divider})]}),l&&(0,u.jsx)(s.Z,{children:l})]}),t]})}))}},67589:function(e,t,r){"use strict";r.d(t,{v:function(){return n}});var n="YYYY-MM-DD"},26458:function(e,t,r){"use strict";var n=r(34406);t.Z={arbitraryQueryLimit:1e3,address:{line1:"",line2:""},app:{name:"Ah Seng Durian",companyName:"",absoluteUrl:"https://www.company.com/",contact:{email:"",adminOrdersEmail:"[email protected]"}},printer:{serverUrl:"https://ahsengdurian.net/api/starcloudprint"},meta:{title:""},aws:{aws_project_region:"ap-southeast-1",aws_appsync_graphqlEndpoint:"https://bt5ratotfzfgrbpisfgzoujonq.appsync-api.ap-southeast-1.amazonaws.com/graphql",aws_appsync_region:"ap-southeast-1",aws_appsync_authenticationType:"API_KEY",aws_appsync_apiKey:"da2-kt3ci47uhffqxamcz7wswtbhfe",aws_cloud_logic_custom:[{name:"stripe",endpoint:n.env.aws_cloud_logic_custom_stripe_endpoint,region:"ap-southeast-1"},{name:"mailgen",endpoint:"https://vts2hhmtpg.execute-api.ap-southeast-1.amazonaws.com/asdprod",region:"ap-southeast-1"},{name:"twilio",endpoint:"https://bnl3sma7b6.execute-api.ap-southeast-1.amazonaws.com/asdprod",region:"ap-southeast-1"}],aws_cognito_identity_pool_id:"ap-southeast-1:2647feaa-e4e1-4dc4-a52d-97d251476a36",aws_cognito_region:"ap-southeast-1",aws_user_pools_id:"ap-southeast-1_yBVTbYRAY",aws_user_pools_web_client_id:"7frfnrl66sqidrnijg9shosqqt",oauth:{},aws_user_files_s3_bucket:"asdf21d2434fa574827bb9ee640c427e194221541-asdprod",aws_user_files_s3_bucket_region:"ap-southeast-1",aws_mobile_analytics_app_id:"",aws_mobile_analytics_app_region:"ap-southeast-1",aws_pinpoint_access_key_id:n.env.aws_pinpoint_access_key_id,aws_pinpoint_secret_access_key:n.env.aws_pinpoint_secret_access_key},mail:{defaultFrom:"Company <[email protected]>"},sms:{whitelist:["+6581122979","+6591198609","+6591592296","+6596585329","+6591737574","+6588817399"],template:[{title:"Collection delayed",content:"Please be informed that your durian order will be delayed due to the lorry arriving late. We will send you another text once the lorry has arrived."},{title:"Collection ready",content:"The lorry has arrived and your durians are ready for collection. Thank you for your patience."},{title:"Product out of stock",content:"Due to the high rejection rate of durians, your preferred durians are out of stock. You can replace them with other durians available at the shop. Thank you for your kind understanding.\r\n\r\nOut of stock durians include:"}]}}},26890:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/orders",function(){return r(68868)}])}},function(e){e.O(0,[664,912,273,440,297,774,888,179],(function(){return t=26890,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
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.