PageSourceSearch

https://billet.msj.dk/static/js/200.08c357d6.chunk.js

js msj.dk collected 2026-10-02 08:04:20 UTC 209,566 bytes, 2 lines download raw bytes

1(self.webpackChunk_ameroservices_platform_attraction_frontend=self.webpackChunk_ameroservices_platform_attraction_frontend||[]).push([[200],{8200:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>Qn});var s=t(43001),i=t(57055),l=t(23020),o=t(84698),r=t(88518),a=t(48436),c=t(97516),d=t(91002),u=t(75373),m=t(15611),p=t(69402),x=t.n(p),f=t(73712),b=t(35891),h=t(75929),g=t(69101),v=t(29505),j=t(49367),k=t(48194),y=t(16735),N=t(86590),Z=t(41609),S=t(73581),C=t(44379),T=t.n(C),w=t(11358),P=t(53180),E=t(38103),I=t(2574);const O=[{key:P.Z.CART,name:P.s[P.Z.CART],color:"bg-green-800 text-white",exclude:!0},{key:P.Z.DRAFT,name:P.s[P.Z.DRAFT],color:"bg-orange-200 text-white"},{key:P.Z.PENDING_PAYMENT,name:P.s[P.Z.PENDING_PAYMENT],color:"bg-yellow text-black"},{key:P.Z.REFUNDED,name:P.s[P.Z.REFUNDED],color:"bg-blue text-white"},{key:P.Z.PROCESSING,name:P.s[P.Z.PROCESSING],color:"bg-orange text-white"},{key:P.Z.COMPLETED,name:P.s[P.Z.COMPLETED],color:"bg-green text-white"},{key:P.Z.CLOSED,name:P.s[P.Z.CLOSED],color:"bg-red text-white"},{key:P.Z.CANCELED,name:P.s[P.Z.CANCELED],color:"bg-red-700 text-white"},{key:P.Z.HOLD,name:P.s[P.Z.HOLD],color:"bg-blue-700 text-white"},{key:P.Z.PAYMENT_REVIEW,name:P.s[P.Z.PAYMENT_REVIEW],color:"bg-purple-700 text-white"}
1,{key:P.Z.ERROR,name:P.s[P.Z.ERROR],color:"bg-red text-white"},{key:E.Z.RESERVED,name:E.o[E.Z.RESERVED],color:"bg-blue text-white"},{key:P.Z.UNKNOWN,name:P.s[P.Z.UNKNOWN],color:"bg-red text-white"}];const D=function(e){const n=T().find(O,{key:e.statusKey})||T().find(O,{key:P.Z.UNKNOWN});return(0,I.jsx)("span",{className:(0,w.default)("inline text-12 p-4 rounded truncate",n.color),children:n.name})},F=[{key:E.Z.ISSUED,name:E.o[E.Z.ISSUED],color:"bg-green text-white"},{key:E.Z.DRAFT,name:E.o[E.Z.DRAFT],color:"bg-red text-white"},{key:E.Z.USED,name:E.o[E.Z.USED],color:"bg-gray text-white"},{key:E.Z.EXPIRED,name:E.o[E.Z.EXPIRED],color:"bg-gray text-white"},{key:E.Z.BLOCKED,name:E.o[E.Z.BLOCKED],color:"bg-red text-white"},{key:E.Z.RESERVED,name:E.o[E.Z.RESERVED],color:"bg-blue text-white"},{key:E.Z.UNKNOWN,name:E.o[E.Z.UNKNOWN],color:"bg-red text-white"},{key:"invalid",name:"Ugyldig",color:"bg-red text-white"}];const A=function(e){const n=T().find(F,{key:e.statusKey})||T().find(F,{key:E.Z.UNKNOWN});return e.large?(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate",n.color,e.className),children:n.name}):(0,I.jsx)("div",{className:(0,w.default)("inline text-12 p-4 rounded truncate",n.color),children:n.name})};var U=t(87713);const R=[{key:U.Z.ACTIVE,name:U.b[U.Z.ACTIVE],color:"bg-green text-white"},{key:U.Z.TERMINATED,name:U.b[U.Z.TERMINATED],color:"bg-red text-white"},{key:U.Z.RESERVED,name:U.b[U.Z.RESERVED],color:"bg-red text-white"},{key:U.Z.DRAFT,name:U.b[U.Z.DRAFT],color:"bg-gray text-white"},{key:U.Z.PAYMENT,name:U.b[U.Z.PAYMENT],color:"bg-orange text-white"},{key:U.Z.UNKNOWN,name:U.b[U.Z.UNKNOWN],color:"bg-red text-white"},{key:U.Z.RENEWAL,name:U.b[U.Z.ACTIVE],color:"bg-green text-white"}];const M=function(e){const n=T().find(R,{key:e.statusKey})||T().find(R,{key:U.Z.UNKNOWN});return e.large?(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate",n.color,e.className),children:n.name}):(0,I.jsx)("div",{className:(0,w.default)("inline text-12 p-4 rounded truncate",n.color),children:n.name})};var W=t(66831),B=t(68025),L=t(82034),K=t(80534),Y=t(87171),z=t(55834),V=t(99161),H=t(67540),G=t(30756),q=t(69762),J=t(43854),Q=t(36923),X=t(56994),$=t.n(X),ee=t(87467),ne=t(75337),te=t(10556),se=t(14347),ie=t(79288),le=t(97382);const oe=(0,te.Z)((e=>({root:{border:".2rem solid ".concat(e.palette.secondary.main),borderRadius:".5rem","&:hover":{borderWidth:".2rem"},"&:disabled":{border:"unset"}}})))(m.Z),re=(0,te.Z)((e=>({root:{border:".2rem solid ".concat(e.palette.primary.main),borderRadius:".5rem","&:hover":{borderWidth:".2rem"},"&:disabled":{border:"unset"}}})))(m.Z),ae=(0,te.Z)((e=>({root:{border:".2rem solid ".concat(e.palette.secondary.main),borderRadius:".5rem","&:hover":{borderWidth:".2rem"}}})))(m.Z),ce=(0,te.Z)((e=>({root:{border:".2rem solid ".concat(e.palette.primary.main),borderRadius:".5rem","&:hover":{borderWidth:".2rem"}}})))(m.Z);const de=function(e){let{loading:n,help:t,...i}=e;const o=(0,l.useFlags)(),r=(0,y.v9)((e=>(0,ee.NH)(e,n||""))),a=(0,y.v9)(ee.lp),c="outlined"===i.variant?"primary"===i.color?ce:ae:"primary"===i.color?re:oe,d=(0,s.useRef)();return n?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(J.Z,{buttonComponent:c,classes:i.fullWidth?{wrapper:(0,w.default)("w-full not-blur",i.wrapperClassName),button:i.className}:void 0,...i,disableLoadingOnClick:!0,loading:r,ref:d}),o.flexsdkSubscriptionImprovements&&t&&t.message&&se.createPortal((0,I.jsx)(ie.Z,{id:"popup",open:a,placement:t.placement||"right",anchorEl:d.current,children:(0,I.jsx)(le.Z,{className:"m-6 p-6 max-w-160",style:{backgroundColor:"#7cb8ea",color:"#000"},children:t.message})}),document.getElementById("root"))]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(c,{ref:d,classes:i.buttonClasses,className:(0,w.default)(i.className,"not-blur"),...i}),o.flexsdkSubscriptionImprovements&&t&&t.message&&se.createPortal((0,I.jsx)(ie.Z,{id:"popup",open:a,placement:t.placement||"right",anchorEl:d.current,children:(0,I.jsx)(le.Z,{className:"m-6 p-6 max-w-160",style:{backgroundColor:"#7cb8ea"},children:t.message})}),document.getElementById("root"))]})};var ue=t(29534),me=t(96358),pe=t(94243),xe=t(65842),fe=t(84413),be=t(90488),he=t(32594),ge=t(39800),ve=t(55762);const je=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2}),ke=(0,j.Z)((()=>({root:{"& .MuiDialogContent-root":{"&::-webkit-scrollbar":{width:"2.2rem"},"&::-webkit-scrollbar-track":{borderLeft:"0.05rem solid #283c49"},"&::-webkit-scrollbar-thumb":{}}}})));const ye=function(e){var n;let{open:t,onClose:i,onCreate:o,handlePrintPDF:r,locationUid:c,onAddCustomer:d}=e;const u=ke(),p=(0,l.useFlags)(),x=(0,y.I0)(),f=(0,y.v9)(ee.H5),b=(0,y.v9)(ee.q0),h=(0,y.v9)(ee.Ry),v=(0,y.v9)(ee.nR),j=(0,y.v9)(ee.R1),k=(0,y.v9)(ee.mY),N=(0,y.v9)(Q.SO),Z=(0,y.v9)(ee.Hl),C=(0,y.v9)(Q.UK),T=(0,y.v9)(ee.ao),[P,E]=(0,s.use
1State)(null),[O,D]=(0,s.useState)({}),[F,A]=(0,s.useState)(!1),[U,R]=(0,s.useState)(null),[M,_]=(0,s.useState)(!1),[X,te]=(0,s.useState)([]),se=(0,s.useRef)(!1),[ie,le]=(0,s.useState)({}),[oe,re]=(0,s.useState)(["cardHolder-"+f.id]),[ae,ce]=(0,s.useState)([f.id]),[ye,Ne]=(0,s.useState)({}),[Ze,Se]=(0,s.useState)({}),[Ce,Te]=(0,s.useState)({}),we=(0,s.useMemo)((()=>v&&h?v.filter((e=>{const n=h.find((n=>n.id===e.ticketTypeUid));if(n&&![$().ENTRANCE_TICKETS,$().TICKETS].includes(n.type))return!1;if(e.prices)if(p.useLocationPricesForDiscountProductInSubscriptionOnPos){if((0,ne.QL)(e,c,new Date,!0)<=0)return!1}else{const n=e.prices.find((e=>"Sale"===e.type));if(!n||n.price<=0)return!1}return!(!n||!n.useTicketCountsAsEntry)})):null),[v,h,c,p.useLocationPricesForDiscountProductInSubscriptionOnPos]),Pe=(0,s.useMemo)((()=>j?j.filter((e=>void 0===e.showOnPos||null===e.showOnPos||!!e.showOnPos)):null),[j]);(0,s.useEffect)((()=>{x((0,ee.ZV)())}),[x]),(0,ve.Z)((()=>{const e=setTimeout((()=>{Promise.allSettled(Object.entries(ye).filter((e=>{var n;let[,t]=e;return null===t||void 0===t||null===(n=t.discount)||void 0===n?void 0:n.ticketNumber})).map((e=>{let[n,t]=e;return le((e=>({...e,[n]:null}))),(0,S.cg)(t.discount.ticketNumber).then((async e=>{const s=e[0],i=await(0,S.kr)(s.customerUid,s.id,t.subscriptionType.id).catch((()=>({validated:!1,error:"Ukendt fejl"})));return null!==i&&void 0!==i&&i.validated?le((e=>({...e,[n]:{...i,price:s.price,customerUid:s.customerUid,ticketUid:s.id}}))):le((e=>({...e,[n]:{...i}}))),e})).catch((()=>{le((e=>({...e,[n]:{validated:!1,error:"Ukendt fejl"}})))}))})))}),500);return()=>{clearTimeout(e)}}),[ye,v]),(0,s.useEffect)((()=>{if(null===f||void 0===f||!f.id||p.optimizationOfCreateAndRenewSubscriptions)return()=>{};const e=Object.values(Ze).map((e=>(0,ee.PJ)(null===f||void 0===f?void 0:f.id,e,(e=>{Te((n=>({...n,[e.id]:e})))}))));return()=>e.forEach((e=>e()))}),[Ze,f,p.optimizationOfCreateAndRenewSubscriptions]);const Ee=(0,s.useMemo)((()=>Ce?(console.log("[CREATE-SUBSCRIPTION] Setting subscription order..."),Object.values(Ce)):null),[Ce]);(0,s.useEffect)((()=>{if(p.optimizationOfCreateAndRenewSubscriptions)return()=>{};if(null!==f&&void 0!==f&&f.id&&(null===Ee||void 0===Ee?void 0:Ee.length)>0){console.log("[CREATE-SUBSCRIPTION] Creating order lines listener");const e=Ee.map((e=>(0,S.zM)(e.customerUid,e.id,(n=>{D((t=>({...t,[e.id]:n})))}))));return()=>e.forEach((e=>e()))}return()=>{}}),[null===f||void 0===f?void 0:f.id,Ee,b,p.optimizationOfCreateAndRenewSubscriptions]),(0,s.useEffect)((()=>{if(P&&k&&k.length>0&&!se.current){const e=k.filter((e=>P.includes(e.subscriptionUid)));(null===e||void 0===e?void 0:e.length)>=P.length&&(console.log("[CREATE-SUBSCRIPTION] Finished creation"),te(e),!N||!0!==N.automaticIssueTicketNumber&&null!==N.automaticIssueTicketNumber&&void 0!==N.automaticIssueTicketNumber||o(e),A(!1),_(!0),se.current=!0)}}),[P,k,o,N]);const Ie=(0,s.useMemo)((()=>Z&&Z.subscription?Z.subscription:"medlemskab"),[Z]),Oe=(0,s.useMemo)((()=>Z&&Z.subscriptionType?Z.subscriptionType:"medlemskabstype"),[Z]);function De(e){let n=(0,he.Z)();e&&(n=f.id),ce((e=>[...e,n])),Ne((e=>({...e,[n]:{firstname:"",lastname:"",subscriptionType:null,discount:null}}))),re((e=>[...e,"cardHolder-".concat(n)]))}(0,s.useEffect)((()=>{if(T&&Pe&&ae){const e=Pe.find((e=>{if(T.subscriptionTypeUid)return T.subscriptionTypeUid===e.id;return Object.values(e.selectedProducts).some((e=>e.product===T.productUid))}));if(e){const n=ae[0];Ne((t=>({...t,[n]:{...t[n],subscriptionType:e}})))}}}),[T,Pe,ae]);const Fe=(0,s.useMemo)((()=>ae.length<=0||(!!ae.some((e=>{var n,t,s;if(p.groupSubscriptions){var i,l,o;if(Object.values(null!==(i=null===ye||void 0===ye||null===(l=ye[e])||void 0===l||null===(o=l.subscriptionType)||void 0===o?void 0:o.selectedProducts)&&void 0!==i?i:{}).some((e=>e.enableGroupAmount))){if(Number.isNaN(Number.parseInt(ye[e].groupAmount,10)))return!0;if(ye[e].groupAmount<=0)return!0}}return e!==f.id&&(!(null!==(n=ye[e])&&void 0!==n&&n.firstname)||!(null!==(t=ye[e])&&void 0!==t&&t.lastname))||!(null!==(s=ye[e])&&void 0!==s&&s.subscriptionType)}))||F)),[F,ae,f,ye]),Ae=(0,s.useMemo)((()=>ae.reduce(((e,n)=>{var t;const s=null===(t=ye[n])||void 0===t?void 0:t.subscriptionType;return s&&v?s.samePriceAsAllProducts&&s.selectedProducts?(e[n]=Object.values(s.selectedProducts).reduce(((e,t)=>{var s,i;const l=v.find((e=>e.id===t.product));return l?p.groupSubscriptions?e+(0,ne.QL)(l,c,new Date,p.displayPeriodePrices):e+(0,ne.QL)(l,c,new Date,p.displayPeriodePrices,null!==(s=ye[n].groupAmount)&&void 0!==s?s:1)*(null!==(i=ye[n].groupAmount)&&void 0!==i?i:1):e}),0),e):(e[n]=s.subscriptionPrice,e):e}),{})),[ae,ye,p.displayPeriodePrices,c]),Ue=(0,s.useMemo)((()=>ae.reduce(((e,n)=>{var t,s;const i=null===(t=ye[n])||void 0===t?void 0:t.discount;if(null!==i&&void 0!==i&&i.product){let t=i.product;if(t.giftProductUid&&(t=v.find((e=>e.id===t.giftProductUid))),!t.prices)return e;if(p.useLocationPricesForDiscountProductInSubscriptionOnPos){var l;const s=(0,ne.QL)(t,c,new Date,!0);if(!s)return e;e[n]=Ae[n]-s*(null!==(l=i.amount)&&void 0!==l?l:1)}else{var o;const s=t.prices.find((e=>"Sale"===e.type));if(!s)return e;e[n]=Ae[n]-s.price*(null!==(o=i.amount)&&void 0!==o?o:1)}}else if(null!==(s=ie[n])&&void 0!==s&&s.price){var r;e[n]=Ae[n]-ie[n].price*(null!==(r=null===i||void 0===i?void 0:i.amount)&&void 0!==r?r:1)}return e}),{})),[ae,ye,v,Ae,p.useLocationPricesForDiscountProductInSubscriptionOnPos,c,ie]),Re=s.useMemo((()=>ae.reduce(((e,n)=>{var t;const s=null===(t=ye[n])||void 0===t?void 0:t.subscriptionType;return s&&v?s.samePriceAsAllProducts&&s.selectedProducts?e+Object.values(s.selectedProducts).reduce(((e,t)=>{var s,i;const l=v.find((e=>e.id===t.product));return l?e+(0,ne.QL)(l,null,new Date,p.displayPeriodePrices,null!==(s=ye[n].groupAmount)&&void 0!==s?s:1)*(null!==(i=ye[n].groupAmount)&&void 0!==i?i:1):e}),0):e+s.subscriptionPrice:e}),0)),[ae,ye,p.displayPeriodePrices,v]),Me=s.useMemo((()=>Object.values(Ue).reduce(((e,n)=>e+n),0)),[Ue]);function We(e,n){Ne((t=>{var s,i;const l={...t},o=null===(s=l[e])||void 0===s?void 0:s.discount;return o?(l[e].discount.amount=(null!==(i=o.amount)&&void 0!==i?i:1)+n,l):l}))}return(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(W.Z,{maxWidth:"lg",fullWidth:!0,open:t,onClose:i,className:u.root,children:[(0,I.jsxs)("div",{className:"flex items-center justify-between",children:[(0,I.jsxs)(B.Z,{children:["Oprettelse af ",Ie]}),(0,I.jsxs)("div",{className:"flex items-center justify-end gap-8 mr-32",children:[Me<=0&&(0,I.jsx)(a.Z,{className:"font-bold",children:je.format(Re/100)}),Me>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"line-through opacity-75",children:je.format(Re/100)}),(0,I.jsx)(a.Z,{className:"font-bold",children:je.format(Me/100)})]})]})]}),F&&(0,I.jsx)(L.Z,{children:(0,I.jsx)(G.Z,{})}),!F&&!M&&(0,I.jsx)(L.Z,{className:"p-0",children:(0,I.jsxs)(I.Fragment,{children:[Object.values(ae).map(((e,n)=>{var t,s,i,l,o,r,d,u,x,b,h,v,j,k,y,N,Z,S,P,E,O,D,F,A,U,R,M,W,B,L,Y,G,_,q,J,Q,X,$,ee,te,se,le,ae,de,he,ve,ke,Ze,Se,Ce,Te,Ee,De,Fe,Re,Me,Be,Le,Ke,Ye,ze,Ve,He,Ge,_e,qe,Je,Qe,Xe,$e,en,nn,tn,sn,ln,on,rn,an,cn,dn,un,mn,pn,xn,fn,bn,hn,gn,vn,jn;const kn=e!==f.id&&(!(null!==(t=ye[e])&&void 0!==t&&t.firstname)||!(null!==(s=ye[e])&&void 0!==s&&s.lastname))||!(null!==(i=ye[e])&&void 0!==i&&i.subscriptionType);return(0,I.jsxs)(fe.Z,{disableGutters:!0,elevation:0,square:!0,expanded:oe.includes("cardHolder-".concat(e)),onChange:(yn="c
1ardHolder-".concat(e),(e,n)=>{re((e=>e.includes(yn)&&!n?e.filter((e=>e!==yn)):[...e,yn]))}),className:"px-10 border-b-1",children:[(0,I.jsx)(pe.Z,{expandIcon:(null===C||void 0===C||null===(l=C.subscriptions)||void 0===l?void 0:l.subcustomers)&&(0,I.jsx)(ue.Z,{}),className:(0,w.default)(!(null!==C&&void 0!==C&&null!==(o=C.subscriptions)&&void 0!==o&&o.subcustomers)&&"hidden"),children:(null===C||void 0===C||null===(r=C.subscriptions)||void 0===r?void 0:r.subcustomers)&&(0,I.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,I.jsxs)("div",{className:"py-10 flex gap-6 flex-row items-center md:gap-16",children:[(0,I.jsxs)(a.Z,{className:"font-bold",children:["Kortholder #",n+1,null!==ye&&void 0!==ye&&null!==(d=ye[e])&&void 0!==d&&null!==(u=d.subscriptionType)&&void 0!==u&&u.name?" for ".concat(null===ye||void 0===ye||null===(x=ye[e])||void 0===x||null===(b=x.subscriptionType)||void 0===b?void 0:b.name):""]}),e===f.id&&(0,I.jsx)(me.Z,{label:"Hovedkunde",size:"small"}),e!==f.id&&(0,I.jsx)(me.Z,{label:"Underkunde",size:"small"}),kn&&(0,I.jsx)(me.Z,{label:"Mangler udfyldelse",size:"small",color:"error"})]}),(0,I.jsxs)("div",{className:"flex items-center gap-8 mr-10",children:[Ae[e]&&(0,I.jsx)(a.Z,{className:(0,w.default)((null===(h=ye[e])||void 0===h||null===(v=h.discount)||void 0===v?void 0:v.product)&&"line-through opacity-75"),children:je.format(Ae[e]/100)}),!(null===(j=ye[e])||void 0===j||null===(k=j.discount)||void 0===k||!k.product)&&(0,I.jsx)(a.Z,{children:je.format(Ue[e]/100)}),ye[e]&&e!==f.id&&(0,I.jsxs)(a.Z,{className:"font-bold",children:[ye[e].firstname," ",ye[e].lastname]}),(null===f||void 0===f||null===(y=f.contactInfo)||void 0===y?void 0:y.billing)&&e===f.id&&(0,I.jsxs)(a.Z,{className:"font-bold",children:[f.contactInfo.billing.firstname," ",f.contactInfo.billing.lastname]}),(0,I.jsx)(be.Z,{size:"small",color:"error",onClick:()=>function(e){ce((n=>[...n].filter((n=>n!==e)))),e!==f.id&&Ne((n=>{const t={...n};return delete t[e],t}))}(e),children:(0,I.jsx)(H.Z,{children:"delete"})})]})]})}),(0,I.jsxs)(xe.Z,{children:[T&&!(null!==(N=ye[e])&&void 0!==N&&N.subscriptionType)&&(0,I.jsxs)(g.Z,{severity:"error",className:"mb-16",children:["Det ser ud til at det produktgavekort ikke er kompatibelt med nogle"," ",Oe,", s\xe5 du kan desv\xe6rre ikke oprette et"," ",Ie," med dette produktgavekort"]}),(0,I.jsx)(V.Z,{loading:!Pe,disabled:!Pe||!!T,className:"w-full col-start-1 col-end-2 mt-2",options:Pe,value:(null===(Z=ye[e])||void 0===Z?void 0:Z.subscriptionType)||null,onChange:async(n,t)=>{Ne((n=>({...n,[e]:{...n[e],subscriptionType:t}})))},getOptionLabel:e=>e.eventGroupUid?e.name:"".concat(e.name," [Ikke opsat korrekt]"),getOptionDisabled:e=>!e.eventGroupUid,getOptionSelected:(e,n)=>e.id===n.id,renderInput:e=>(0,I.jsx)(z.Z,{...e,label:"Type",variant:"outlined",required:!0}),openOnFocus:!0,required:!0,fullWidth:!0}),e!==f.id&&(0,I.jsxs)("div",{className:"flex items-center justify-between gap-10 mt-20",children:[(0,I.jsx)(z.Z,{label:"Fornavn",className:"w-full",fullWidth:!0,value:(null===(S=ye[e])||void 0===S?void 0:S.firstname)||"",onChange:n=>{const t=n.currentTarget.value;Ne((n=>({...n,[e]:{...n[e]||{},firstname:t}})))}}),(0,I.jsx)(z.Z,{label:"Efternavn",className:"w-full",fullWidth:!0,value:(null===(P=ye[e])||void 0===P?void 0:P.lastname)||"",onChange:n=>{const t=n.currentTarget.value;Ne((n=>({...n,[e]:{...n[e]||{},lastname:t}})))}})]}),p.groupSubscriptions&&Object.values(null!==(E=null===ye||void 0===ye||null===(O=ye[e])||void 0===O||null===(D=O.subscriptionType)||void 0===D?void 0:D.selectedProducts)&&void 0!==E?E:{}).some((e=>e.enableGroupAmount))&&(0,I.jsxs)(g.Z,{severity:"info",className:"my-10",children:["Dette er et gruppemedlemskab, derfor skal du angive hvor mange personer der skal have adgang herunder.",(0,I.jsx)("br",{}),(0,I.jsx)(z.Z,{label:"Antal",size:"small",className:"mt-8 w-full",InputProps:{endAdornment:(0,I.jsx)(K.Z,{position:"end",children:"personer"})},value:null!==(F=null===(A=ye[e])||void 0===A?void 0:A.groupAmount)&&void 0!==F?F:"",onChange:n=>{const t=n.currentTarget.value;Ne((n=>
1({...n,[e]:{...n[e]||{},groupAmount:t}})))},error:Number.isNaN(Number.parseInt(null!==(U=null===(R=ye[e])||void 0===R?void 0:R.groupAmount)&&void 0!==U?U:"1",10))||Number.parseInt(null!==(M=null===(W=ye[e])||void 0===W?void 0:W.groupAmount)&&void 0!==M?M:"1",10)<1,helperText:Number.isNaN(Number.parseInt(null!==(B=null===(L=ye[e])||void 0===L?void 0:L.groupAmount)&&void 0!==B?B:"1",10))||Number.parseInt(null!==(Y=null===(G=ye[e])||void 0===G?void 0:G.groupAmount)&&void 0!==Y?Y:"1",10)<1?"Antal skal v\xe6re et tal st\xf8rre end 0":""})]}),(0,I.jsxs)("div",{className:"flex justify-between gap-20 mt-20",children:[!(null!==ye&&void 0!==ye&&null!==(_=ye[e])&&void 0!==_&&_.discount)&&(0,I.jsxs)("div",{className:"flex items-center gap-12",children:[!1!==(null===ye||void 0===ye||null===(q=ye[e])||void 0===q||null===(J=q.subscriptionType)||void 0===J||null===(Q=J.conversionSettings)||void 0===Q?void 0:Q.enableProductSelector)&&(0,I.jsx)(m.Z,{variant:"contained",onClick:()=>{Ne((n=>({...n,[e]:{...n[e]||{},discount:{type:"product"}}})))},disabled:!(null!==ye&&void 0!==ye&&null!==(X=ye[e])&&void 0!==X&&X.subscriptionType)||!1===(null===ye||void 0===ye||null===($=ye[e])||void 0===$||null===(ee=$.subscriptionType)||void 0===ee||null===(te=ee.conversionSettings)||void 0===te?void 0:te.enabled)||!1===(null===ye||void 0===ye||null===(se=ye[e])||void 0===se||null===(le=se.subscriptionType)||void 0===le||null===(ae=le.conversionSettings)||void 0===ae?void 0:ae.enableOnPos)||!!T,children:"Giv rabat ved valg af produkt"}),(0,I.jsx)(m.Z,{variant:"contained",onClick:()=>{Ne((n=>({...n,[e]:{...n[e]||{},discount:{type:"ticket"}}})))},disabled:!(null!==ye&&void 0!==ye&&null!==(de=ye[e])&&void 0!==de&&de.subscriptionType)||!1===(null===ye||void 0===ye||null===(he=ye[e])||void 0===he||null===(ve=he.subscriptionType)||void 0===ve||null===(ke=ve.conversionSettings)||void 0===ke?void 0:ke.enabled)||!1===(null===ye||void 0===ye||null===(Ze=ye[e])||void 0===Ze||null===(Se=Ze.subscriptionType)||void 0===Se||null===(Ce=Se.conversionSettings)||void 0===Ce?void 0:Ce.enableO
1nPos)||!!T,children:"Giv rabat ved at scanne billet"}),(!1===(null===ye||void 0===ye||null===(Te=ye[e])||void 0===Te||null===(Ee=Te.subscriptionType)||void 0===Ee||null===(De=Ee.conversionSettings)||void 0===De?void 0:De.enabled)||!1===(null===ye||void 0===ye||null===(Fe=ye[e])||void 0===Fe||null===(Re=Fe.subscriptionType)||void 0===Re||null===(Me=Re.conversionSettings)||void 0===Me?void 0:Me.enableOnPos))&&(0,I.jsx)(a.Z,{color:"error",children:"Konvertering er ikke tilladt p\xe5 denne medlemskabstype"})]}),!(null===ye||void 0===ye||null===(Be=ye[e])||void 0===Be||!Be.discount)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(m.Z,{variant:"outlined",color:"error",onClick:()=>{Ne((n=>({...n,[e]:{...n[e]||{},discount:null}})))},className:"whitespace-nowrap px-40 h-full py-12",children:"Fjern rabat"}),"ticket"===(null===ye||void 0===ye||null===(Le=ye[e])||void 0===Le||null===(Ke=Le.discount)||void 0===Ke?void 0:Ke.type)&&(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsx)(z.Z,{className:"w-full",value:null!==(Ye=null===ye||void 0===ye||null===(ze=ye[e])||void 0===ze||null===(Ve=ze.discount)||void 0===Ve?void 0:Ve.ticketNumber)&&void 0!==Ye?Ye:"",onChange:n=>{const t=n.currentTarget.value;Ne((n=>{var s;return{...n,[e]:{...n[e]||{},discount:{...(null===(s=n[e])||void 0===s?void 0:s.discount)||{},ticketNumber:t}}}}))},autoFocus:!0,label:"Billetnummer",variant:"outlined",fullWidth:!0}),(0,I.jsxs)("div",{className:"flex items-center gap-8 pl-10 mt-2",children:[(0,I.jsxs)("div",{className:"flex items-center",children:[(null===ye||void 0===ye||null===(He=ye[e])||void 0===He||null===(Ge=He.discount)||void 0===Ge?void 0:Ge.ticketNumber)&&!ie[e]&&(0,I.jsx)(ge.Z,{size:12,className:"ml-4"}),(null===(_e=ie[e])||void 0===_e?void 0:_e.validated)&&(0,I.jsx)(H.Z,{fontSize:"inherit",color:"success",className:"text-18",children:"check"}),ie[e]&&!(null!==(qe=ie[e])&&void 0!==qe&&qe.validated)&&(0,I.jsx)(H.Z,{fontSize:"inherit",color:"error",className:"-mr-4 text-18",children:"close"})]}),(0,I.jsxs)(a.Z,{className:"whitespace-nowrap text-12",color:"textSecondary",children:[(null===ye||void 0===ye||null===(Je=ye[e])||void 0===Je||null===(Qe=Je.discount)||void 0===Qe?void 0:Qe.ticketNumber)&&!ie[e]&&"Validere billet...",ie[e]&&!(null!==(Xe=ie[e])&&void 0!==Xe&&Xe.validated)&&"Ugyldig billet",(null===($e=ie[e])||void 0===$e?void 0:$e.validated)&&"Gyldig billet"]})]})]}),"product"===(null===ye||void 0===ye||null===(en=ye[e])||void 0===en||null===(nn=en.discount)||void 0===nn?void 0:nn.type)&&(0,I.jsx)(V.Z,{loading:!we,disabled:!we,className:"w-full",options:we,value:(null===ye||void 0===ye||null===(tn=ye[e])||void 0===tn||null===(sn=tn.discount)||void 0===sn?void 0:sn.product)||null,onChange:async(n,t)=>{Ne((n=>{var s;return{...n,[e]:{...n[e]||{},discount:{...(null===(s=n[e])||void 0===s?void 0:s.discount)||{},product:t}}}}))},getOptionLabel:e=>{if(!e)return"-";if(!e.prices)return e.name;if(p.useLocationPricesForDiscountProductInSubscriptionOnPos){const n=(0,ne.QL)(e,c,new Date,!0);return null===n||void 0===n?e.name:"".concat(e.name," (").concat(je.format(n/100),")")}{const n=e.prices.find((e=>"Sale"===e.type));return n?"".concat(e.name," (").concat(je.format(n.price/100),")"):e.name}},renderInput:e=>(0,I.jsx)(z.Z,{...e,autoFocus:!0,label:"Produkt",variant:"outlined"}),openOnFocus:!0,fullWidth:!0,getOptionDisabled:n=>{if(!n)return!1;if(!n.prices)return!1;if(p.useLocationPricesForDiscountProductInSubscriptionOnPos){const t=(0,ne.QL)(n,c,new Date,!0);return null!==t&&void 0!==t&&t>Ae[e]}{const t=n.prices.find((e=>"Sale"===e.type));return!!t&&t.price>Ae[e]}}}),(0,I.jsx)("div",{children:(0,I.jsxs)("div",{className:"flex items-center justify-center",children:[(0,I.jsx)(m.Z,{variant:"outlined",color:"primary",className:"w-full py-10 px-40",onClick:()=>We(e,-1),disabled:(null===(ln=ye[e])||void 0===ln||null===(on=ln.discount)||void 0===on?void 0:on.amount)<=1||!(null!==(rn=ye[e])&&void 0!==rn&&null!==(an=rn.discount)&&void 0!==an&&an.product),children:(0,I.jsx)(H.Z,{children:"remove"})}),(0,I.jsx)(a.Z,{className:"text-24 w-192 text-center",children:null!==(cn=null===(dn=ye[e])||void 0===dn||null===(un=dn.discount)||void 0===un?void 0:un.amount)&&void 0!==cn?cn:1}),(0,I.jsx)(m.Z,{variant:"outlined",color:"primary",className:"w-full py-10 px-40",onClick:()=>
1We(e,1),disabled:Ue[e]-((p.useLocationPricesForDiscountProductInSubscriptionOnPos?(0,ne.QL)(null===(mn=ye[e])||void 0===mn||null===(pn=mn.discount)||void 0===pn?void 0:pn.product,c,new Date,!0):null===(xn=ye[e])||void 0===xn||null===(fn=xn.discount)||void 0===fn||null===(bn=fn.product)||void 0===bn||null===(hn=bn.prices)||void 0===hn||null===(gn=hn.find((e=>"Sale"===e.type)))||void 0===gn?void 0:gn.price)||0)<0||!(null!==(vn=ye[e])&&void 0!==vn&&null!==(jn=vn.discount)&&void 0!==jn&&jn.product),children:(0,I.jsx)(H.Z,{children:"add"})})]})})]})]})]})]},"cardHolder-".concat(e));var yn})),(0,I.jsx)("hr",{className:"mt-10 mb-20"}),(null===C||void 0===C||null===(n=C.subscriptions)||void 0===n?void 0:n.subcustomers)&&(0,I.jsxs)("div",{className:"px-24 pb-10 pt-2 flex items-center gap-10",children:[!ae.some((e=>e===f.id))&&(0,I.jsxs)(de,{variant:"outlined",color:"primary",onClick:()=>De(!0),children:["Opret ",Ie," til hovedkunde"]}),(0,I.jsxs)(de,{variant:"outlined",color:"primary",onClick:()=>De(),children:["Opret ",Ie," til underkunde"]})]})]})}),(0,I.jsx)(Y.Z,{className:"flex".concat(M&&" flex-col"," justify-between"),children:M?(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsxs)("div",{className:"flex justify-center w-full",children:[N&&N.issueTicketNumberButton&&(0,I.jsx)(J.Z,{onClick:function(){o(X)},color:"primary",variant:"outlined",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"},disabled:F||U,disableLoadingOnClick:!0,loading:"issueTicketNumber"===U,children:"Tilf\xf8j kortnummer"}
1),(0,I.jsx)(J.Z,{onClick:function(){X.forEach((e=>r(e)))},color:"primary",variant:"outlined",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"},disabled:F||U,disableLoadingOnClick:!0,loading:"print"===U,children:"Print Kort"}),(0,I.jsx)(J.Z,{onClick:async function(){R("add"),p.optionToAddCustomerOnSubscriptionCreateOrRenew&&null!==N&&void 0!==N&&N.addCustomerOnSubscriptionCreation&&await d(),await Promise.all(Object.values(O).map((async e=>{await Promise.all(e.filter((e=>"discount"!==e.lineType&&"voucherRedemption"!==e.lineType)).map((e=>{let n=f.id;e.forCustomerUid&&(n=e.forCustomerUid);const t=T?T.vpcItemPrice:e.linePrice/100;return q.Z.addProduct(e.productNumber,e.qty,t,"".concat(n?"ATT".concat(n):"null",";").concat(e.currentEvent?"ATT".concat(e.eventUid):"null",";").concat(e.subscriptionUid||"null",";").concat(e.productId||"null"))}))),T||await Promise.all(e.filter((e=>"discount"===e.lineType)).map((e=>q.Z.ifVersion("4.1.17.03",">=",(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,-1)),(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,0))))))}))),await q.Z.closeBrowser(),setTimeout((()=>R(null)),1e3)},color:"primary",variant:"contained",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"},disabled:F||U||!O||Object.values(O).length<=0,disableLoadingOnClick:!0,loading:"add"===U,children:"Tilf\xf8j til bon"})]}),(0,I.jsx)(J.Z,{onClick:i,color:"secondary",variant:"outlined",classes:{button:"w-full h-96 mt-10 rounded-none",wrapper:"w-full"},disabled:F||U,style:{marginLeft:0},disableLoadingOnClick:!0,loading:"cancel"===U,children:"Luk"})]}):(0,I.jsxs)("div",{className:"w-full flex items-center justify-between gap-10 mx-16 mb-12",children:[(0,I.jsx)(de,{onClick:function(){i()},color:"secondary",variant:"outlined",className:"w-full",disabled:F,children:"Annuller"}),(0,I.jsxs)(de,{onClick:async function(){console.log("[CREATE-SUBSCRIPTION] Clicked confirm");const e=[],n={},t={};for(const E of ae){var s,i;const I=null===(s=ye[E])||void 0===s||null===(i=s.subscriptionType)||void 0===i?void 0:i.id;if(!I)return void console.log("[CREATE-SUBSCRIPTION] Selected subscription type is missing");if(!v)return void console.log("[CREATE-SUBSCRIPTION] Products is missing");if(A(!0),p.optimizationOfCreateAndRenewSubscriptions){var l,o,r,a,d,u;const n={subscriptionTypeUid:I,customerUid:b?b.id:f.id,subCustomerUid:b?f.id:null},s=null!==(l=null===(o=ye[E])||void 0===o||null===(r=o.discount)||void 0===r?void 0:r.amount)&&void 0!==l?l:1;if(T){let e=Number.parseFloat(T.vpcItemPrice);Number.isNaN(e)&&(e=0),n.voucherRedemption={vpcItemUid:T.vpcItemUid,productUid:T.productUid,productNumber:T.productNumber,cardNumber:T.cardNumber,vpcItemPrice:100*e}}else if(null!==(a=ye[E])&&void 0!==a&&null!==(d=a.discount)&&void 0!==d&&d.ticketNumber&&null!==(u=ie[E])&&void 0!==u&&u.validated){const e=ie[E].price;console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(e,"*").concat(s,"=").concat(e*s," on subscription used ticket number ").concat(ye[E].discount.ticketNumber)),n.upgradeDiscount={type:"ticket",value:e*s,discountTicketNumber:ye[E].discount.ticketNumber,discountTicketUid:ie[E].ticketUid,discountCustomerUid:ie[E].customerUid}}else{var m,x;const e=null===(m=ye[E])||void 0===m||null===(x=m.discount)||void 0===x?void 0:x.product;if(p.useLocationPricesForDiscountProductInSubscriptionOnPos){const t=(0,ne.QL)(e,c,new Date,!0);t&&(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(t,"*").concat(s,"=").concat(t*s," on subscription")),n.upgradeDiscount={type:"ticket",value:t*s,discountProductNumber:e.productNumber})}else{var h;const t=null===e||void 0===e||null===(h=e.prices)||void 0===h?void 0:h.find((e=>"Sale"===e.type));null!==t&&void 0!==t&&t.price&&(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(t.price,"*").concat(s,"=").concat(t.price*s," on subscription")),n.upgradeDiscount={type:"ticket",value:t.price*s,discountProductNumber:e.productNumber})}}if(console.log("[CREATE-SUBSCRIPTION] Creating subscription..."),E!==f.id){const e=await(0,S.fe)(f.id,"".concat(ye[E].firstname," ").concat(ye[E].lastname));n.subCustomerUid=e.id}var g;if(p.groupSubscriptions&&null!==ye[E].groupAmount&&void 0!==ye[E].groupAmount)n.groupAmount=Number.parseInt(null!==(g=ye[E].groupAmount)&&void 0!==g?g:1,10);const i=await(0,S.lY)(n);if(i.error)return console.log("[CREATE-SUBSCRIPTION] Error: "+i.error),void A(!1);const v=await(0,S.Pp)(b?b.id:f.id,i.orderUid);t[i.orderUid]=v,console.log("[CREATE-SUBSCRIPTION] Subscription confirmed"),e.push(i.subscriptionUid)}
1else{var j,k,y,N,Z;let t;console.log("[CREATE-SUBSCRIPTION] Creating subscription...");let s=null;if(E!==f.id){s=(await(0,S.fe)(f.id,"".concat(ye[E].firstname," ").concat(ye[E].lastname))).id}t=b?await(0,S.XW)(I,b.id,s):E!==f.id?await(0,S.XW)(I,f.id,s):await(0,S.XW)(I,null===f||void 0===f?void 0:f.id),console.log("[CREATE-SUBSCRIPTION] Subscription created");const i={},l=null!==(j=null===(k=ye[E])||void 0===k||null===(y=k.discount)||void 0===y?void 0:y.amount)&&void 0!==j?j:1;if(null!==ye&&void 0!==ye&&null!==(N=ye.discount)&&void 0!==N&&N.ticketNumber&&null!==(Z=ie[E])&&void 0!==Z&&Z.validated){const e=ie[E].price;console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(e,"*").concat(l,"=").concat(e*l," on subscription used ticket number ").concat(ye.discount.ticketNumber)),i.upgradeDiscount={type:"ticket",value:e*l,discountTicketNumber:ye.discount.ticketNumber,discountTicketUid:ie[E].ticketUid,discountCustomerUid:ie[E].customerUid}}else{var C,w;const e=null===(C=ye[E])||void 0===C||null===(w=C.discount)||void 0===w?void 0:w.product;if(p.useLocationPricesForDiscountProductInSubscriptionOnPos){const n=(0,ne.QL)(e,c,new Date,!0);n&&(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(n,"*").concat(l,"=").concat(n*l," on subscription")),i.upgradeDiscount={type:"ticket",value:n*l,discountProductNumber:e.productNumber})}else{var P;const n=null===e||void 0===e||null===(P=e.prices)||void 0===P?void 0:P.find((e=>"Sale"===e.type));null!==n&&void 0!==n&&n.price&&(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(n.price,"*").concat(l,"=").concat(n.price*l," on subscription")),i.upgradeDiscount={type:"ticket",value:n.price*l,discountProductNumber:e.productNumber})}}let o;console.log("[CREATE-SUBSCRIPTION] Confirming subscription..."),o=b?await(0,S.h9)(t.subscriptionUid,b.id,i):await(0,S.h9)(t.subscriptionUid,f.id,i),n[t.subscriptionUid]=o.orderUid,console.log("[CREATE-SUBSCRIPTION] Subscription confirmed"),e.push(t.subscriptionUid)}}E(e),Se(n),D(t)},color:"primary",variant:"contained",className:"w-full",disabled:Fe,children:["Opret ",Ie]})]})})]})})};t(72955);const Ne=(0,t(180).Z)({breakpoints:{keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:960,lg:1280,xl:1920}},direction:"ltr",mixins:{toolbar:{minHeight:56,"@media (min-width:0px) and (orientation: landscape)":{minHeight:48},"@media (min-width:600px)":{minHeight:64}}},overrides:{},palette:{common:{black:"#000",white:"#fff"},type:"light",primary:{main:"#233d68"},secondary:{main:"#4FAED1",contrastText:"#fff"},error:{50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000",main:"#ff3333",light:"#FF6666",dark:"#E60000",contrastText:"#fff"},warning:{light:"#ffb74d",main:"#ff9800",dark:"#f57c00",contrastText:"rgba(0, 0, 0, 0.87)"},info:{light:"#64b5f6",main:"#2196f3",dark:"#1976d2",contrastText:"#fff"},success:{light:"#99cc99",main:"#669966",dark:"#336633",contrastText:"rgba(0, 0, 0, 0.87)"},grey:{50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9eb0bf",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#d5d5d5",A200:"#aaaaaa",A400:"#303030",A700:"#616161"},contrastThreshold:3,tonalOffset:.2,text:{primary:"#333333",secondary:"#333333",disabled:"rgba(0, 0, 0, 0.38)",hint:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{default:"#ffffff",paper:"#f8f8f8"},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12},footer:{background:"#4d4845",text:"#fdfbf7"}},props:{},shadows:["none","0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)","0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)","0px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)","0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)","0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)","0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)","0px 4px 5px -2px rgba(0,0,0,0.2),0px 7px 10px 1px rgba(0,0,0,0.14),0px 2px 16px 1px rgba(0,0,0,0.12)","0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12)","0px 5px 6px -3px rgba(0,0,0,0.2),0px 9px 12px 1px rgba(0,0,0,0.14),0px 3px 16px 2px rgba(0,0,0,0.12)","0px 6px 6px -3px rgba(0,0,0,0.2),0px 10px 14px 1px rgba(0,0,0,0.14),0px 4px 18px 3px rgba(0,0,0,0.12)","0px 6px 7px -4px rgba(0,0,0,0.2),0px 11px 15px 1px rgba(0,0,0,0.14),0px 4px 20px 3px rgba(0,0,0,0.12)","0px 7px 8px -4px rgba(0,0,0,0.2),0px 12px 17px 2px rgba(0,0,0,0.14),0px 5px 22px 4px rgba(0,0,0,0.12)","0px 7px 8px -4px rgba(0,0,0,0.2),0px 13px 19px 2px rgba(0,0,0,0.14),0px 5px 24px 4px rgba(0,0,0,0.12)","0px 7px 9px -4px rgba(0,0,0,0.2),0px 14px 21px 2px rgba(0,0,0,0.14),0px 5px 26px 4px rgba(0,0,0,0.12)","0px 8px 9px -5px rgba(0,0,0,0.2),0px 15px 22px 2px rgba(0,0,0,0.14),0px 6px 28px 5px rgba(0,0,0,0.12)","0px 8px 10px -5px rgba(0,0,0,0.2),0px 16px 24px 2px rgba(0,0,0,0.14),0px 6px 30px 5px rgba(0,0,0,0.12)","0px 8px 11px -5px rgba(0,0,0,0.2),0px 17px 26px 2px rgba(0,0,0,0.14),0px 6px 32px 5px rgba(0,0,0,0.12)","0px 9px 11px -5px rgba(0,0,0,0.2),0px 18px 28px 2px rgba(0,0,0,0.14),0px 7px 34px 6px rgba(0,0,0,0.12)","0px 9px 12px -6px rgba(0,0,0,0.2),0px 19px 29px 2px rgba(0,0,0,0.14),0px 7px 36px 6px rgba(0,0,0,0.12)","0px 10px 13px -6px rgba(0,0,0,0.2),0px 20px 31px 3px rgba(0,0,0,0.14),0px 8px 38px 7px rgba(0,0,0,0.12)","0px 10px 13px -6px rgba(0,0,0,0.2),0px 21px 33px 3px rgba(0,0,0,0.14),0px 8px 40px 7px rgba(0,0,0,0.12)","0px 10px 14px -6px rgba(0,0,0,0.2),0px 22px 35px 3px rgba(0,0,0,0.14),0px 8px 42px 7px rgba(0,0,0,0.12)","0px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)","0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)"],typography:{htmlFontSize:10,fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontSize:14,fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:600,fontWeightBold:700,h1:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:300,fontSize:"9.6rem",lineHeight:1.167},h2:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:300,fontSize:"6rem",lineHeight:1.2},h3:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"4.8rem",lineHeight:1.167},h4:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"3.4rem",lineHeight:1.235},h5:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"2.4rem",lineHeight:1.334},h6:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:600,fontSize:"2rem",lineHeight:1.6},subtitle1:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"1.6rem",lineHeight:1.75},subtitle2:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:600,fontSize:"1.4rem",lineHeight:1.57},body1:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"1.4rem",lineHeight:1.5},body2:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"1.4rem",lineHeight:1.43},button:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:600,fontSize:"1.4rem",lineHeight:1.75,textTransform:"uppercase"},caption:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"1.2rem",lineHeight:1.66},overline:{fontFamily:["Roboto","Helvetica","Arial","sans-serif"].join(", "),fontWeight:400,fontSize:"1.2rem",lineHeight:2.66,textTransform:"uppercase"},useNextVariants:!0,suppressDeprecationWarnings:!0,fontType:"google"},shape:{borderRadius:4}
1,transitions:{easing:{easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},duration:{shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195}},zIndex:{mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},status:{danger:"orange"}});var Ze=t(1188);const Se=function(e){return(0,I.jsx)(Ze.Z,{theme:Ne,...e})};var Ce=t(52438),Te=t(97344),we=t(79729);const Pe=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2});const Ee=function(e){let{disabled:n,subscriptionPrice:t,onDiscountSelect:i}=e;const o=(0,l.useFlags)(),r=(0,we.TH)(),[c,d]=(0,s.useState)(null),[u,p]=(0,s.useState)(""),[x,f]=(0,s.useState)(""),[b,g]=(0,s.useState)(null),[v,j]=(0,s.useState)(null),[k,N]=(0,s.useState)(null),[Z,C]=(0,s.useState)(null),T=(0,y.v9)(Q.SO),w=(0,s.useMemo)((()=>b&&k[b]?k[b].name:""),[k,b]),P=(0,s.useMemo)((()=>{if(!b||!k[b])return"";const e=k[b].giftProductUid||b;if(!k[e].prices)return"";if(o.useLocationPricesForDiscountProductInSubscriptionOnPos){var n;const t=(0,Ce.ak)("token",null===r||void 0===r?void 0:r.search),s=(0,Te.Wu)(t,"localhost"===window.location.hostname?window.location.host:window.location.hostname),i=null===T||void 0===T||null===(n=T.tokens)||void 0===n?void 0:n[s],l=(0,ne.QL)(k[e],i,new Date,!0,1);return l||""}{const n=k[e].prices.find((e=>"Sale"===e.type));return n?n.price:""}}),[k,b,r,T,o.useLocationPricesForDiscountProductInSubscriptionOnPos]),E=(0,s.useMemo)((()=>(t||0)-(P||0)),[t,P]);return(0,s.useEffect)((()=>{const e=(0,S.ZV)((e=>C(e)));return()=>e()}),[]),(0,s.useEffect)((()=>{if(Z&&Z.length>0){const e=(0,S.Cr)((e=>N(e.reduce(((e,n)=>{const t=Z.find((e=>e.id===n.ticketTypeUid));return t&&t.useTicketCountsAsEntry&&(e[n.id]=n),e}),{}))));return()=>e()}return()=>{}}),[Z]),(0,s.useEffect)((()=>{u&&(0,S.cg)(u).then((e=>{g(e[0].productId)}))}),[u]),(0,s.useEffect)((()=>
1{b&&k[b]?i(k[b]):i(null)}),[k,b,i]),"scan"===c?(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsx)(Se,{open:!u,fullWidth:!0,icon:"help_outline",content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Scan billetnummer fra billetten du vil fratr\xe6kke medlemskabets pris"}),(0,I.jsx)(z.Z,{autoFocus:!0,variant:"outlined",fullWidth:!0,className:"w-full mt-16",label:"Billetnummer",value:x,onChange:e=>{const n=e.currentTarget.value;f(n)}})]}),onClose:e=>{e?p(x):(d(null),p(""),f(""),g(null))},okButton:"V\xe6lg billet",cancelButton:"Annuller",bigButtons:!0,disableOk:!x}),u&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Billet:"})," ",u]}),w&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Produkt:"})," ",w]}),t&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Medlemskabspris f\xf8r rabat:"})," ",Pe.format(t/100)]}),P&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Rabat:"})," ",Pe.format(P/100)]}),E&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Medlemskabspris efter rabat:"})," ",Pe.format(E/100)]}),(0,I.jsx)(m.Z,{className:"w-full mt-10",variant:"outlined",color:"primary",onClick:()=>{d(null),p(""),f(""),g(null)},children:"Annuller rabat"})]}):"select"===c?(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsx)(Se,{open:!b,fullWidth:!0,icon:"help_outline",content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"V\xe6lg det produkt du vil fratr\xe6kke medlemskabets pris"}),(0,I.jsx)(V.Z,{loading:!k,disabled:!k,className:"w-full",options:k?Object.keys(k):[],value:v,onChange:async(e,n)=>{j(n)},getOptionLabel:e=>k&&e&&k[e]?k[e].name:"-",renderInput:e=>(0,I.jsx)(z.Z,{...e,autoFocus:!0,label:"Produkt",variant:"outlined"}),openOnFocus:!0,fullWidth:!0})]}),onClose:e=>{e?g(v):(d(null),g(""),j(""))},okButton:"V\xe6lg produkt",cancelButton:"Annuller",bigButtons:!0,disableOk:!v}),(0,I.jsx)("div",{className:"flex justify-center",children:(0,I.jsxs)("div",{children:[w&&(0,I.jsxs)(a.Z,{className:"",children:[(0,I.jsx)("span",{className:"font-bold",children:"Produkt:"})," ",w]}),t&&(0,I.jsxs)(a.Z,{className:"",children:[(0,I.jsx)("span",{className:"font-bold",children:"Medlemskabspris f\xf8r rabat:"})," ",Pe.format(t/100)]}),P&&(0,I.jsxs)(a.Z,{className:"",children:[(0,I.jsx)("span",{className:"font-bold",children:"Rabat:"})," ",Pe.format(P/100)]}),E&&(0,I.jsxs)(a.Z,{className:"",children:[(0,I.jsx)("span",{className:"font-bold",children:"Medlemskabspris efter rabat:"})," ",Pe.format(E/100)]})]})}),(0,I.jsx)(m.Z,{className:"w-full mt-10",variant:"outlined",color:"primary",onClick:()=>{d(null),g(null),j(null)},children:"Annuller rabat"})]}):(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(h.Z,{className:"w-full",children:[(0,I.jsx)(m.Z,{disabled:n,className:"w-1/2 rounded-none",onClick:()=>d("scan"),children:"Scan billet"}),(0,I.jsx)(m.Z,{disabled:n,className:"w-1/2 rounded-none",onClick:()=>d("select"),children:"V\xe6lg produkt"})]})})};var Ie=t(65343);const Oe=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2}),De=[{id:1,name:"Scan billet",type:"scan"},{id:2,name:"V\xe6lg produkt",type:"select"}];const Fe=function(e){let{products:n,subscriptionTypes:t,open:i,onClose:o,customerUid:r,membershipTickets:c,subscriptions:d,flexposCustomerUid:u,parentCustomer:p,onCreate:x,handlePrintPDF:f,upgrade:b,locationUid:h,onAddCustomer:v}=e;const j=(0,l.useFlags)(),k=(0,y.I0)(),N=(0,y.v9)(ee.ny),[Z,C]=(0,s.useState)(!1),[T,w]=(0,s.useState)(!1),[P,E]=(0,s.useState)(null),[O,D]=(0,s.use
1State)(null),[F,A]=(0,s.useState)(null),[U,R]=(0,s.useState)(null),[M,K]=(0,s.useState)(null),[H,_]=(0,s.useState)(null),[X,$]=(0,s.useState)(null),[te,se]=(0,s.useState)(!1),[ie,le]=(0,s.useState)([]),[oe,re]=(0,s.useState)(null),[ae,ce]=(0,s.useState)(1),de=(0,s.useRef)(!1),ue=(0,y.v9)(Q.SO),me=(0,y.v9)(ee.hB),pe=(0,y.v9)(ee.Hl);(0,s.useEffect)((()=>{if(j.optimizationOfCreateAndRenewSubscriptions)return()=>{};if(r&&H&&H.id){console.log("[CREATE-SUBSCRIPTION] Creating order lines listener");const e=(0,S.zM)(j.createSubcustomersOnFlexsdk&&p?p.id:r,H.id,(e=>{$(e)}));return()=>e()}return()=>{}}),[r,H,j.createSubcustomersOnFlexsdk,p,j.optimizationOfCreateAndRenewSubscriptions]);const xe=s.useMemo((()=>O&&n?O.samePriceAsAllProducts&&O.selectedProducts?Object.values(O.selectedProducts).reduce(((e,t)=>{const s=n.find((e=>e.id===t.product));return s?e+(0,ne.QL)(s,null,new Date,j.displayPeriodePrices):e}),0):O.subscriptionPrice:0),[O,n,j.displayPeriodePrices]);function fe(e){console.log("[CREATE-SUBSCRIPTION] Changed product for discount to ".concat(e&&e.productNumber?e.productNumber:"null")),re(e)}function be(e){console.log("[CREATE-SUBSCRIPTION] Changed amount for discount to ".concat(e)),ce(e)}(0,s.useEffect)((()=>{if(j.optimizationOfCreateAndRenewSubscriptions)return()=>{};if(!r)return()=>{};const e=k((0,ee.yQ)(j.createSubcustomersOnFlexsdk&&p?p.id:r));return()=>{e()}}),[k,r,j.createSubcustomersOnFlexsdk,p,j.optimizationOfCreateAndRenewSubscriptions]),(0,s.useEffect)((()=>{U&&d&&d.length>0&&(console.log("[CREATE-SUBSCRIPTION] Setting subscription..."),K(d.find((e=>e.id===U))))}),[U,d]),(0,s.useEffect)((()=>{U&&N&&N.length>0&&(console.log("[CREATE-SUBSCRIPTION] Setting subscription order..."),_(N.find((e=>e.subscriptionUid===U))))}),[U,N]),(0,s.useEffect)((()=>{if(U&&c&&c.length>0&&!de.current){const e=c.filter((e=>e.subscriptionUid===U));e&&e.length>0&&(console.log("[CREATE-SUBSCRIPTION] Finished creation"),le(e),j.optionToChangeFlowForCreationOfSubscriptionOnPos&&(!ue||!0!==ue.automaticIssueTicketNumber&&null!==ue.automaticIssueTicketNumber&&void 0!==ue.automaticIssueTicketNumber)||x(e),C(!1),se(!0),de.current=!0)}}),[U,c,x,ue,j.optionToChangeFlowForCreationOfSubscriptionOnPos]);const he=(0,s.useMemo)((()=>j.flexsdkSubscriptionImprovements&&pe&&pe.subscription?pe.subscription:"medlemskab"),[pe,j.flexsdkSubscriptionImprovements]),ge=(0,s.useMemo)((()=>j.flexsdkSubscriptionImprovements&&pe&&pe.subscriptionType?pe.subscriptionType:"medlemskabstype"),[pe,j.flexsdkSubscriptionImprovements]);return(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(W.Z,{maxWidth:"lg",fullWidth:!0,open:i,onClose:o,"aria-labelledby":"form-dialog-title",children:[(0,I.jsxs)(B.Z,{id:"form-dialog-title",children:[b?"Opgradering":"Oprettelse"," af ",he,b&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(a.Z,{children:["Opgrader ",he," ",(0,I.jsx)("strong",{children:b.name})," til et nyt"," ",he,", og giv det gamle ",he," i rabat"]}),(0,I.jsxs)(a.Z,{children:["V\xe6lg hvilket ",he," der skal opgraderes til"]})]})]}),Z?(0,I.jsx)(L.Z,{children:(0,I.jsx)(G.Z,{})}):(0,I.jsx)(L.Z,{children:!te&&(0,I.jsxs)("div",{className:j.newFlowForOpgradingTicket&&F?"grid grid-cols-2 col-gap-28":"",children:[(0,I.jsx)(V.Z,{loading:!t,disabled:!t,className:"w-full col-start-1 col-end-2",options:t,value:O,onChange:async(e,n)=>{D(n)},getOptionLabel:e=>e.eventGroupUid?e.name:"".concat(e.name," [Ikke opsat korrekt]"),getOptionDisabled:e=>!e.eventGroupUid,getOptionSelected:(e,n)=>e.id===n.id,renderInput:e=>(0,I.jsx)(z.Z,{...e,label:"Type",variant:"outlined",required:!0}),openOnFocus:!0,required:!0,fullWidth:!0}),!b&&j.upgradeFromTicketToSubscriptionOnPos&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"mt-20 text-15 font-bold col-start-1 col-end-2",children:"Fratr\xe6k allerede k\xf8bt billet fra k\xf8bspris"}),j.newFlowForOpgradingTicket&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(V.Z,{className:"mt-16 w-full col-start-1 col-end-2",options:De,value:F,onChange:async(e,n)=>{A(n)},getOptionLabel:e=>e.name,getOptionSelected:(e,n)=>e.id===n.id,renderInput:e=>(0,I.jsx)(z.Z,{...e,label:"V\xe6lg en mulighed",variant:"outlined",required:!0}),openOnFocus:!0,required:!0,fullWidth:!0}),(0,I.jsxs)("div",{className:"col-start-2 col-end-3 row-start-1 row-end-4",children:[F&&"scan"===F.type&&(0,I.jsx)(Ue,{subscriptionPrice:xe,setSelectedDeductType:A,onDiscountSelect:fe,discountAmount:ae,onDiscountAmountChange:be,locationUid:h,subscriptionTypeUid:null===O||void 0===O?void 0:O.id}),F&&"select"===F.type&&(0,I.jsx)(Ae,{subscriptionPrice:xe,setSelectedDeductType:A,onDiscountSelect:fe,discountAmount:ae,onDiscountAmountChange:be,locationUid:h})]})]}),!j.newFlowForOpgradingTicket&&(0,I.jsx)(Ee,{disabled:!O,subscriptionPrice:xe,onDiscountSelect:fe})]}),j.upgradeSubscriptionToNewSubscription&&b&&(0,I.jsx)(I.Fragment,{children:O&&xe-b.subscriptionPrice<0?(0,I.jsxs)(g.Z,{severity:"error",className:"mt-10",children:["Du kan ikke opgradere til det ",he,", da det er dyrere end det oprindelige ",he]}):(0,I.jsxs)("div",{className:"mt-10",children:[b.name&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsxs)("span",{className:"font-bold",children:[(0,Ce.Io)(ge),":"]})," ",b.name]}),!me&&b.subscriptionNumber&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Medlemskabsnummer:"})," ",b.subscriptionNumber]}),O&&(0,I.jsxs)(I.Fragment,{children:[null!==xe&&void 0!==xe&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Pris f\xf8r rabat:"})," ",Oe.format(xe/100)]}),null!==b.subscriptionPrice&&void 0!==b.subscriptionPrice&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Rabat:"})," ",Oe.format(b.subscriptionPrice/100)]}),null!==b.subscriptionPrice&&void 0!==b.subscriptionPrice&&null!==xe&&void 0!==xe&&(0,I.jsxs)(a.Z,{className:"text-center",children:[(0,I.jsx)("span",{className:"font-bold",children:"Pris efter rabat:"})," ",Oe.format((xe-b.subscriptionPrice)/100)]})]})]})})]})}),(0,I.jsx)(Y.Z,{className:"flex".concat(te&&" flex-col"," justify-between"),children:te?(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsxs)("div",{className:"flex justify-center w-full",children:[j.optionToChangeFlowForCreationOfSubscriptionOnPos&&ue&&ue.issueTicketNumberButton&&(0,I.jsx)(J.Z,{onClick:function(){x(ie)},color:"primary",variant:"outlined",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"}
1,disabled:Z||P,disableLoadingOnClick:!0,loading:"issueTicketNumber"===P,children:"Tilf\xf8j kortnummer"}),(0,I.jsx)(J.Z,{onClick:function(){f(ie[0])},color:"primary",variant:"outlined",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"},disabled:Z||P,disableLoadingOnClick:!0,loading:"print"===P,children:"Print Kort"}),(0,I.jsx)(J.Z,{onClick:async function(){T||(w(!0),E("add"),j.optionToAddCustomerOnSubscriptionCreateOrRenew&&null!==ue&&void 0!==ue&&ue.addCustomerOnSubscriptionCreation&&await v(),j.upgradeFromTicketToSubscriptionOnPos||j.upgradeSubscriptionToNewSubscription?(await Promise.all(X.filter((e=>"discount"!==e.lineType)).map((e=>q.Z.addProduct(e.productNumber,e.qty,e.linePrice/100,"".concat(r?"ATT".concat(r):"null",";").concat(M.currentEvent?"ATT".concat(M.currentEvent):"null",";").concat(M.id||"null",";").concat(e.productId||"null"))))),await Promise.all(X.filter((e=>"discount"===e.lineType)).map((e=>q.Z.ifVersion("4.1.17.03",">=",(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,-1)),(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,0))))))):await Promise.all(Object.values(M.selectedProducts).map((e=>{const t=n.find((n=>n.id===e.product)),s=t.prices.find((e=>"Sale"===e.type));return q.Z.addProduct(t.productNumber,1,s.price/100,"".concat(r?"ATT".concat(r):"null",";").concat(M.currentEvent?"ATT".concat(M.currentEvent):"null",";").concat(M.id||"null",";").concat(t&&t.id?t.id:"null"))}))),await q.Z.closeBrowser(),E(null))},color:"primary",variant:"contained",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"},disabled:Z||P||!X||X.length<=0,disableLoadingOnClick:!0,loading:"add"===P||T,children:"Tilf\xf8j til bon"})]}),(0,I.jsx)(J.Z,{onClick:o,color:"secondary",variant:"outlined",classes:{button:"w-full h-96 mt-10 rounded-none",wrapper:"w-full"},disabled:Z||P,style:{marginLeft:0},disableLoadingOnClick:!0,loading:"cancel"===P,children:"Luk"})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(m.Z,{onClick:o,color:"secondary",variant:"outlined",className:"w-1/2 rounded-none",disabled:Z,children:"Annuller"}),(0,I.jsxs)(m.Z,{onClick:async function(){if(w(!1),console.log("[CREATE-SUBSCRIPTION] Clicked confirm"),O)if(n)if(C(!0),j.optimizationOfCreateAndRenewSubscriptions){const n={subscriptionTypeUid:O.id,customerUid:p?p.id:r,subCustomerUid:p?r:null};if(null!==b&&void 0!==b&&b.subscriptionPrice)n.upgradeDiscount={type:"subscription",value:b.subscriptionPrice,discountCustomerUid:b.customerUid,discountSubscriptionUid:b.id};else if(j.upgradeFromTicketToSubscriptionOnPos&&null!==oe&&void 0!==oe&&oe.prices){const e=(0,ne.QL)(oe,h,new Date,!0);j.selectQtyForDiscountOnSubscriptionCreation?(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(e,"*").concat(ae,"=").concat(e*ae," on subscription")),n.upgradeDiscount={type:"ticket",value:e*ae,discountProductNumber:oe.productNumber}):(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(e," on subscription")),n.upgradeDiscount={type:"ticket",value:e,discountProductNumber:oe.productNumber})}const s=await(0,S.lY)(n).catch((e=>({error:e})));var e,t;if(s.error)return console.log("[CREATE-SUBSCRIPTION] Error: "+s.error),C(!1),o(),void k((0,ee.sT)("Fejl ved oprettelse af medlemskab: "+Ie.Z[null===(e=s.error)||void 0===e||null===(t=e.details)||void 0===t?void 0:t.code]||0));const i=await(0,S.Pp)(p?p.id:r,s.orderUid);R(s.subscriptionUid),$(i)}else{let e;console.log("[CREATE-SUBSCRIPTION] Creating subscription..."),e=j.createSubcustomersOnFlexsdk&&p?await(0,S.XW)(O.id,p.id,r):await(0,S.XW)(O.id,r),console.log("[CREATE-SUBSCRIPTION] Subscription created");const n={};if(b)b.subscriptionPrice&&(n.upgradeDiscount={type:"subscription",value:b.subscriptionPrice,discountCustomerUid:b.customerUid,discountSubscriptionUid:b.id});else if(j.upgradeFromTicketToSubscriptionOnPos&&oe&&oe.prices){const e=(0,ne.QL)(oe,h,new Date,!0);e&&(j.selectQtyForDiscountOnSubscriptionCreation?(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(e,"*").concat(ae,"=").concat(e*ae," on subscription")),n.upgradeDiscount={type:"ticket",value:e*ae,discountProductNumber:oe.productNumber}):(console.log("[CREATE-SUBSCRIPTION] Setting discount to ".concat(e," on subscription")),n.upgradeDiscount={type:"ticket",value:e,discountProductNumber:oe.productNumber}))}console.log("[CREATE-SUBSCRIPTION] Confirming subscription..."),j.createSubcustomersOnFlexsdk&&p?await(0,S.h9)(e.subscriptionUid,p.id,n):await(0,S.h9)(e.subscriptionUid,r,n),console.log("[CREATE-SUBSCRIPTION] Subscription confirmed"),R(e.subscriptionUid)}else console.log("[CREATE-SUBSCRIPTION] Products is missing");else console.log("[CREATE-SUBSCRIPTION] Selected subscription type is missing")}
1,color:"primary",variant:"contained",className:"w-1/2 rounded-none",disabled:Z||!O||j.upgradeSubscriptionToNewSubscription&&b&&xe-b.subscriptionPrice<0,children:[j.upgradeSubscriptionToNewSubscription&&b?"Opgrader":"Opret"," ",he]})]})})]})})},Ae=e=>{let{subscriptionPrice:n,setSelectedDeductType:t,onDiscountSelect:i,discountAmount:o,onDiscountAmountChange:r,locationUid:c}=e;const{disableUpgradeFromTicketIfPriceIsAboveSubscriptionPrice:d,selectQtyForDiscountOnSubscriptionCreation:u,productGroupTypes:p,flexsdkSubscriptionImprovements:x}=(0,l.useFlags)(),[f,b]=(0,s.useState)(null),[h,g]=(0,s.useState)(null),[v,j]=(0,s.useState)(null),k=(0,s.useMemo)((()=>f&&h[f]?h[f].name:""),[h,f]),y=(0,s.useMemo)((()=>{if(!f||!h[f])return"";const e=h[f].giftProductUid||f;if(!h[e].prices)return"";const n=(0,ne.QL)(h[e],c,new Date,!0);return null===n||void 0===n?"":u?n*o:n}),[h,f,u,o]),N=(0,s.useMemo)((()=>(n||0)-(y||0)),[n,y]);function Z(e){r(o+e)}return(0,s.useEffect)((()=>{const e=(0,S.ZV)((e=>j(e)));return()=>e()}),[]),(0,s.useEffect)((()=>{if(v&&v.length>0){const e=(0,S.Cr)((e=>g(e.reduce(((e,n)=>{const t=v.find((e=>e.id===n.ticketTypeUid));if(x&&p&&t&&![$().ENTRANCE_TICKETS,$().TICKETS].includes(t.type))return e;if(x&&n.prices){const t=n.prices.find((e=>"Sale"===e.type));if(!t||t.price<=0)return e}return t&&t.useTicketCountsAsEntry&&(e[n.id]=n),e}),{}))));return()=>e()}return()=>{}}),[v,p,x]),(0,s.useEffect)((()=>{f&&h[f]?i(h[f]):i(null)}),[h,f,i]),(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"V\xe6lg det produkt du vil fratr\xe6kke medlemskabets pris"}),(0,I.jsx)(V.Z,{loading:!h,disabled:!h,className:"w-full my-16",options:h?Object.keys(h):[],value:f,onChange:async(e,n)=>{b(n)},getOptionLabel:e=>{if(!h||!e||!h[e])return"-";if(!d)return h[e].name;if(!h[e].prices)return h[e].name;const n=(0,ne.QL)(h[e],c,new Date,!0);return null===n||void 0===n?h[e].name:"".concat(h[e].name," (").concat(Oe.format(n/100),")")},renderInput:e=>(0,I.jsx)(z.Z,{...e,autoFocus:!0,label:"Produkt",variant:"outlined"}),openOnFocus:!0,fullWidth:!0,getOptionDisabled:e=>{if(!d)return!1;if(!h||!e||!h[e])return!1;if(!h[e].prices)return!1;const t=(0,ne.QL)(h[e],c,new Date,!0);return null!==t&&void 0!==t&&t>n}}),(0,I.jsxs)("div",{children:[u&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold mb-6",children:"V\xe6lg antal"}),(0,I.jsxs)("div",{className:"flex justify-center items-center mb-20",children:[(0,I.jsx)(m.Z,{variant:"outlined",color:"primary",className:"w-full py-10",onClick:()=>Z(-1),disabled:o<=1||!f,children:(0,I.jsx)(H.Z,{children:"remove"})}),(0,I.jsx)(a.Z,{className:"text-24 w-192 text-center",children:o}),(0,I.jsx)(m.Z,{variant:"outlined",color:"primary",className:"w-full py-10",onClick:()=>Z(1),disabled:N<=0||!f,children:(0,I.jsx)(H.Z,{children:"add"})})]})]}),!!k&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Produkt:"})," ",k]}),!!n&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Pris f\xf8r rabat:"})," ",Oe.format(n/100)]}),!!y&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Rabat:"})," ",Oe.format(y/100)]}),(!!N||0===N)&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Pris efter rabat:"})," ",Oe.format(N/100)]})]}),(0,I.jsx)(m.Z,{className:"w-full mt-10",variant:"outlined",color:"primary",onClick:()=>{b(null),t(null)},children:"Annuller rabat"})]})},Ue=e=>{let{subscriptionPrice:n,setSelectedDeductType:t,onDiscountSelect:i,discountAmount:o,onDiscountAmountChange:r,locationUid:c,subscriptionTypeUid:d}=e;const{disableUpgradeFromTicketIfPriceIsAboveSubscriptionPrice:u,selectQtyForDiscountOnSubscriptionCreation:p,validateTicketToSubscriptionConvert:x}=(0,l.useFlags)(),[f,b]=(0,s.useState)(null),[h,g]=(0,s.useState)(""),[v,j]=(0,s.useState)(null),[k,y]=(0,s.useState)(null),[N,Z]=(0,s.use
1State)(null),C=(0,s.useMemo)((()=>v&&k[v]?k[v].name:""),[k,v]),T=(0,s.useMemo)((()=>{if(!v||!k[v])return"";const e=k[v].giftProductUid||v;if(!k[e].prices)return"";const n=(0,ne.QL)(k[e],c,new Date,!0);return null===n||void 0===n?"":p?n*o:n}),[k,v,p,o]),w=(0,s.useMemo)((()=>(n||0)-(T||0)),[n,T]);function P(e){r(o+e)}return(0,s.useEffect)((()=>{const e=(0,S.ZV)((e=>Z(e)));return()=>e()}),[]),(0,s.useEffect)((()=>{if(N&&N.length>0){const e=(0,S.Cr)((e=>y(e.reduce(((e,n)=>{const t=N.find((e=>e.id===n.ticketTypeUid));return t&&t.useTicketCountsAsEntry&&(e[n.id]=n),e}),{}))));return()=>e()}return()=>{}}),[N]),(0,s.useEffect)((()=>{h&&(0,S.cg)(h).then((async e=>{if(x){if(!(await(0,S.kr)(e[0].customerUid,e[0].id,d)).validated)return j(null),b("Billetten er ikke gyldig til konverteringen"),!1}return e})).then((e=>{e&&(u?e&&e[0]&&e[0].productId?(j(e[0].productId),b(null)):(j(null),b("Billetten kunne ikke findes")):j(e[0].productId))})).catch((()=>{u&&b("Ukendt fejl")}))}),[h,u,d,x]),(0,s.useEffect)((()=>{v&&k[v]&&(!u||w>0)?i(k[v]):i(null)}),[k,v,i,w,u]),(0,s.useEffect)((()=>{u&&w<0&&b("Prisen p\xe5 billetten overstiger prisen p\xe5 medlemskabet")}),[w,u]),(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Scan billetnummer fra billetten du vil fratr\xe6kke medlemskabets pris"}),(0,I.jsx)(z.Z,{autoFocus:!0,variant:"outlined",fullWidth:!0,className:"w-full my-16",label:"Billetnummer",onBlur:e=>{const n=e.currentTarget.value;g(n)},error:u&&!!f,helperText:u?f:null}),p&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold mb-6",children:"V\xe6lg antal"}),(0,I.jsxs)("div",{className:"flex justify-center items-center mb-20",children:[(0,I.jsx)(m.Z,{variant:"outlined",color:"primary",className:"w-full py-10",onClick:()=>P(-1),disabled:o<=1||!v,children:(0,I.jsx)(H.Z,{children:"remove"})}),(0,I.jsx)(a.Z,{className:"text-24 w-192 text-center",children:o}),(0,I.jsx)(m.Z,{variant:"outlined",color:"primary",className:"w-full py-10",onClick:()=>P(1),disabled:w<=0||!v,children:(0,I.jsx)(H.Z,{children:"add"})})]})]}),!!h&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Billet:"})," ",h]}),!!C&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Produkt:"})," ",C]}),!!n&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Medlemskabspris f\xf8r rabat:"})," ",Oe.format(n/100)]}),!!T&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Rabat:"})," ",Oe.format(T/100)]}),!!w&&(0,I.jsxs)(a.Z,{children:[(0,I.jsx)("span",{className:"font-bold",children:"Medlemskabspris efter rabat:"})," ",Oe.format(w/100)]}),(0,I.jsx)(m.Z,{className:"w-full mt-10",variant:"outlined",color:"primary",onClick:()=>{g(""),j(null),t(null)},children:"Annuller rabat"})]})};function Re(e){const n=(0,l.useFlags)();return!e.upgrade&&n.createMultipleSubscriptionsAndSubSubscriptionsOnPos?(0,I.jsx)(ye,{...e}):(0,I.jsx)(Fe,{...e})}var Me=t(43580),We=t(1605),Be=t(94466),Le=t(68502),Ke=t(21897),Ye=t(17603),ze=t(26928),Ve=t.n(ze);const He=function(e){let{src:n,awaiting:t,onAvatarChange:i,loading:o,onAvatarConfirm:r,fromNewDesign:c,disabled:d}=e;const{addedMemoAttAndErpFromFlexposWhenImportingSubscriptions:u,customerPosDesignUpdate:p}=(0,l.useFlags)(),[x,f]=(0,s.useState)(!1),[b,h]=(0,s.useState)(!1),[g,v]=(0,s.useState)(!0),[j,k]=(0,s.useState)(null),[y,N]=(0,s.useState)(null),[Z,S]=(0,s.useState)(!1),C=(0,s.useRef)(null),T=(0,s.useCallback)((()=>{const e=C.current.getScreenshot();k(e)}),[C]);function w(){f(!1),k(null)}function P(e){e&&r(),S(!1)}return(0,I.jsxs)(I.Fragment,{children:[p&&c&&(0,I.jsxs)(I.Fragment,{children:[n||t?(0,I.jsxs)("div",{className:"relative h-192 flex justify-center",children:[b&&(0,I.jsx)("div",{className:"border-1 rounded-4 border-gray w-192 h-192 mb-10",style:{backgroundColor:"#EBEBEB"},children:(0,I.jsx)("div",{className:"flex justify-center items-center h-full",children:(0,I.jsx)(a.Z,{className:"font-bold uppercase",children:"Indl\xe6ser..."})})}),g&&(0,I.jsx)("img",{className:"absolute border-1 rounded-4 border-gray w-192 h-192",src:t||n,alt:"Billede af kunde",onError:()=>{y&&clearTimeout(y),h(!0),v(!1),N(setTimeout((()=>h(!1)),200)),setTimeout((()=>v(!0)),50)}})]}):(0,I.jsx)("div",{className:"border-1 rounded-4 border-gray w-192 h-192 mb-10",style:{backgroundColor:"#EBEBEB"},children:(0,I.jsx)("div",{className:"flex justify-center items-center h-full",children:(0,I.jsx)(a.Z,{className:"font-bold uppercase",children:"INTET BILLEDE"})})}),(0,I.jsxs)("div",{className:"flex flex-col w-192",children:[t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de,{className:"w-full mt-10",fullWidth:!0,variant:"contained",color:"primary",onClick:()=>S(!0),children:"Bekr\xe6ft Billede"}),(0,I.jsx)(Se,{open:Z,onClose:P,cancelButton:"Annuller",okButton:"Bekr\xe6ft",loading:o,content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"h2 mb-10",children:"Vil du bekr\xe6fte kundens billede?"}),(0,I.jsx)(a.Z,{className:"h4",color:"textSecondary",children:"Ved at bekr\xe6fte kundens billede, kan kunden ikke l\xe6ngere selv \xe6ndre profil billede."})]})})]}),(0,I.jsx)(de,{fullWidth:!0,className:"w-full mb-10 mt-10",variant:"outlined",color:"primary",onClick:()=>{f(!0)},help:{message:"Klik p\xe5 knappen, for at \xe6ndre billedet for kunden",placement:"top"},disabled:d,children:"Skift Billede"})]})]}),(!p||!c)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:u?"relative w-full":"",children:[n||t?(0,I.jsxs)("div",{className:"relative h-216 flex justify-center",children:[b&&(0,I.jsx)("div",{className:"absolute left-0 top-0 bg-black flex flex-col justify-center items-center w-216 h-216 z-50",children:(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{className:"text-white font-bold mb-16",children:"INDL\xc6SER..."}),(0,I.jsx)(G.Z,{})]})}),g&&(0,I.jsx)("img",{className:"absolute z-40",src:n||t,style:{maxWidth:"200px",maxHeight:"200px"},alt:"Billede af kunde",onError:()=>{y&&clearTimeout(y),h(!0),v(!1),N(setTimeout((()=>h(!1)),200)),setTimeout((()=>v(!0)),50)}})]}):(0,I.jsx)("div",{className:"flex justify-center",children:(0,I.jsx)("div",{className:"bg-black flex justify-center items-center",style:{width:"200px",height:"200px"},children:(0,I.jsx)(a.Z,{className:"text-white font-bold",children:"INTET BILLEDE"})})}),u&&(0,I.jsx)("div",{className:"bottom-0 left-0 absolute flex justify-center w-full",children:(0,I.jsx)(m.Z,{className:"rounded-none h-40",style:{zIndex:100,width:"200px"},fullWidth:!0,variant:"contained",color:"primary",size:"small",onClick:()=>f(!0),disabled:d,children:"Skift Billede"})})]}),t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(m.Z,{className:"rounded-none h-56 mt-10 w-full",fullWidth:!0,variant:"contained",color:"primary",size:"small",onClick:()=>S(!0),disabled:d,children:"Bekr\xe6ft Billede"}),(0,I.jsx)(Se,{open:Z,onClose:P,cancelButton:"Annuller",okButton:"Bekr\xe6ft",loading:o,content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"h2 mb-10",children:"Vil du bekr\xe6fte kundens billede?"}),(0,I.jsx)(a.Z,{className:"h4",color:"textSecondary",children:"Ved at bekr\xe6fte kundens billede, kan kunden ikke l\xe6ngere selv \xe6ndre profil billede."})]})})]}),!u&&(0,I.jsx)(m.Z,{className:"rounded-none h-56 mt-10",fullWidth:!0,variant:"outlined",color:"primary",size:"small",onClick:()=>f(!0),disabled:d,children:"Skift Billede"})]}),(0,I.jsxs)(W.Z,{maxWidth:"md",fullWidth:!0,open:x,onClose:w,"aria-labelledby":"form-dialog-title",children:[(0,I.jsxs)(L.Z,{className:"flex justify-around",children:[(0,I.jsx)("div",{className:"flex justify-center items-center",children:j?(0,I.jsx)("img",{src:j,alt:"Billede"}):(0,I.jsx)(Ve(),{audio:!1,ref:C,screenshotFormat:"image/png",videoConstraints:{facingMode:"user"},width:400})}),(0,I.jsxs)("div",{className:"ml-16",children:[(0,I.jsx)(B.Z,{id:"form-dialog-title",className:"pl-0 ml-0",children:"Billede til kunde"}),(0,I.jsxs)(Ye.Z,{children:["Tryk p\xe5 knappen under, for at tage et billede.",(0,I.jsx)("br",{}),"Tryk p\xe5 bekr\xe6ft, hvis billedet skal bruges til kunden."]}),(0,I.jsxs)(m.Z,{variant:j?"outlined":"contained",color:"primary",fullWidth:!0,className:"rounded-none",onClick:()=>{j?k(null):T()},disabled:o,children:["Tag ",j?"nyt ":"","billede"]})]})]}),(0,I.jsxs)(Y.Z,{children:[(0,I.jsx)(m.Z,{onClick:w,color:"secondary",disabled:o,className:"w-1/2 h-56",variant:"outlined",children:"Annuller"}),(0,I.jsx)(m.Z,{disabled:!j||o,onClick:function(){Me.Z.callFunctionByName("contentFileUpload",{frontend:!0,flexpos:!0},!0).then((e=>{const{url:n,pathName:t}=e.data;(function(e,n){return new Promise((t=>{const s=new XMLHttpRequest;s.open("PUT",n,!0),s.responseType="blob",s.onload=()=>{t(!0)},s.send(e),s.onerror=e=>{console.error(e),t(!1)}}))})(function(e,n){const t=e.split(","),s=t[0].match(/:(.*?);/)[1],i=atob(t[1]);let l=i.length;const o=new Uint8Array(l);for(;l--;)o[l]=i.charCodeAt(l);return new File([o],n,{type:s})}(j),n).then((e=>{setTimeout((()=>{i(t)}),1e3),f(!1)})).catch((e=>{console.error(e)}))})).catch((e=>{console.error(e)}))},color:"primary",className:"w-1/2 h-56",variant:"contained",children:"Bekr\xe6ft"})]})]})]})};var Ge=t(77364),_e=t(19626);const qe=function(e){let{customer:n,customerUid:t,membershipTickets:i,popAlertWithError:o,parentCustomer:r,goToCustomer:c}=e;const d=(0,y.v9)(Q.UK),u=(0,y.v9)(Q.U8),m=(0,l.useFlags)(),[p,x]=(0,s.use
1State)(null),{watch:f,formState:b,reset:h,handleSubmit:j,control:k,setValue:N}=((0,s.useRef)(null),(0,Ge.cI)({mode:"onChange",defaultValues:{firstname:"",lastname:"",email:"",phone:"",postalCode:"",city:"",address:"",acceptSMSForSubscription:!1,acceptEmailForSubscription:!1,newsletterOptIn:!1}})),Z=f(),{isValid:C}=b,[T,w]=(0,s.useState)(""),[P,E]=(0,s.useState)("DK"),O=(0,y.v9)(Q.SO),D=(0,y.v9)(Q.EW);(0,s.useEffect)((()=>{n&&n.contactInfo&&n.contactInfo.billing&&(h(n.contactInfo.billing),m.salesToOtherCountries&&E(n.contactInfo.billing.countryCode||"DK")),n&&m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions&&(w(n.note||""),N("companyType",n.companyType||""),N("companyName",n.companyName||""))}),[n,m.salesToOtherCountries,m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions]),(0,s.useEffect)((()=>{n&&n.acceptSMSForSubscription&&N("acceptSMSForSubscription",!0),n&&n.acceptEmailForSubscription&&N("acceptEmailForSubscription",!0)}),[n]),(0,s.useEffect)((()=>{m.emailSubscription&&n&&n.newsletterOptIn&&N("newsletterOptIn",!0)}),[n,m.emailSubscription]);const F=e=>O&&O.disableCustomerFieldValidation&&O.disableCustomerFieldValidation.includes(e),A=r&&r.contactInfo&&r.contactInfo.billing&&(r.contactInfo.billing.firstname||r.contactInfo.billing.lastname);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"flex",children:[(0,I.jsx)(a.Z,{variant:"h6",className:"",children:"Kundens Kontaktoplysninger"}),(0,I.jsx)("div",{className:"ml-20 flex justify-between items-center",children:r&&r.contactInfo.billing&&(0,I.jsxs)(g.Z,{severity:"info",children:[(0,I.jsx)(v.Z,{children:"Underkunde"}),(0,I.jsxs)("div",{className:"flex",children:["Dette er en underkunde til\xa0",A?(0,I.jsxs)(I.Fragment,{children:["kunden\xa0",(0,I.jsx)("span",{role:"link",tabIndex:0,onClick:()=>c(r,!0),onKeyDown:()=>c(r,!0),className:"underline cursor-pointer",children:"".concat(r.contactInfo.billing.firstname," ").concat(r.contactInfo.billing.lastname)})]}):(0,I.jsx)("span",{role:"link",tabIndex:0,onClick:()=>c(r,!0),onKeyDown:()=>c(r,!0),className:"underline cursor-pointer",children:"en kunde"})]})]})})]}),(0,I.jsxs)("div",{className:"flex items-start",children:[(0,I.jsxs)("div",{className:"mr-10 mt-20 flex flex-col items-center w-320",children:[(!D||!m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions)&&(0,I.jsx)(He,{src:n&&n.data&&n.data.photoURL?n.data.photoURL:null,awaiting:n&&n.data&&n.data.photoWaiting?n.data.photoWaiting:null,onAvatarChange:async e=>{x("webcam"),await(0,S.uG)(t,{"data.photoURL":"https://storage.googleapis.com/".concat(Me.Z.getProjectId(),".appspot.com/").concat(e)}),x(null)},onAvatarConfirm:async()=>{x("webcam"),await(0,S.uG)(t,{"data.photoURL":n.data.photoWaiting,"data.photoWaiting":null}),x(null)},loading:"webcam"===p}),(0,I.jsx)(J.Z,{classes:{button:"rounded-none h-56 mt-10 w-full",wrapper:"w-full"},fullWidth:!0,variant:"outlined",color:"primary",size:"small",onClick:async function(){n&&!n.email_verified&&(x("sendActivateLink"),await(0,S.h1)(t),x(null))},disabled:!n||n.email_verified,loading:p&&"sendActivateLink"===p,disableLoadingOnClick:!0,children:"Send aktiveringslink"}),m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions&&(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(z.Z,{id:"note",className:"w-full mt-10 mb-6",multiline:!0,type:"text",name:"note",label:"Note",value:T||"",onChange:e=>{const n=e.currentTarget.value;w(n)},variant:"outlined",fullWidth:!0})}),m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions&&(0,I.jsxs)("div",{className:"w-full flex justify-start flex-col",children:[d&&d.createCustomersBySMS&&(0,I.jsx)("div",{children:(0,I.jsx)(Ke.Z,{children:(0,I.jsx)(Be.Z,{control:(0,I.jsx)(Le.Z,{color:"primary",name:"acceptSMSForSubscription",checked:Z.acceptSMSForSubscription,onChange:e=>N("acceptSMSForSubscription",e.currentTarget.checked)}),label:"Ja til modtagelse af SMS vedr. medlemskaber"})})}),m.emailSubscription&&(0,I.jsx)("div",{children:(0,I.jsx)(Ke.Z,{children:(0,I.jsx)(Be.Z,{control:(0,I.jsx)(Le.Z,{color:"primary",name:"newsletterOptIn",checked:Z.newsletterOptIn,onChange:e=>N("newsletterOptIn",e.currentTarget.checked)}),label:"Tilmeld nyhedsbrev"})})})]})]}),(0,I.jsx)("form",{onSubmit:j((async function(){const e={...Z};if(C&&t){x("saveCustomer");const n={contactInfo:{},acceptSMSForSubscription:Z.acceptSMSForSubscription,acceptEmailForSubscription:Z.acceptEmailForSubscription,newsletterOptIn:Z.newsletterOptIn};Object.entries(e).forEach((e=>{let[t,s]=e;n.contactInfo[t]=s})),m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions&&(n.contactInfo&&void 0!==n.contactInfo.companyName&&delete n.contactInfo.companyName,n.contactInfo&&void 0!==n.contactInfo.companyType&&delete n.contactInfo.companyType,n.companyName=e.companyName,n.companyType=e.companyType,T&&(n.note=T)),m.salesToOtherCountries&&(n.contactInfo.countryCode=P);const s=await(0,S.Co)(t,n);s&&s.error&&("phone"===s.errorType?o("Det valgte telefonnummer bruges allerede"):o("Den valgte email adresse bruges allerede")),x(null)}})),className:"flex flex-col justify-center w-full",children:(0,I.jsxs)(We.ZP,{container:!0,spacing:0,className:"sm:max-w-screen",children:[(0,I.jsx)(We.ZP,{item:!0,xs:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"firstname",className:"mt-8 mb-16 pr-6",type:"text",name:"firstname",label:"Fornavn",value:Z.firstname,validations:F("firstname")?void 0:{minLength:2},validationErrors:F("firstname")?void 0:{minLength:"Fornavn skal indeholde mindst 2 tegn"},variant:"standard",fullWidth:!0,required:O.requiredCustomerFields.includes("firstname")}
1)}),(0,I.jsx)(We.ZP,{item:!0,xs:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"lastname",className:"mt-8 mb-16",type:"text",name:"lastname",label:"Efternavn",value:Z.lastname,validations:F("lastname")?void 0:{minLength:2},validationErrors:F("lastname")?void 0:{minLength:"Efternavn skal indeholde mindst 2 tegn"},variant:"standard",fullWidth:!0,required:O.requiredCustomerFields.includes("lastname")})}),(0,I.jsx)(We.ZP,{item:!0,xs:12,sm:12,children:(0,I.jsx)(_e.Z,{control:k,id:"address",className:"mt-8 mb-16",type:"text",name:"address",label:"Adresse",value:Z.address,validations:F("address")?void 0:{minLength:2},validationErrors:F("address")?void 0:{minLength:"Adressen skal indeholde mindst 2 tegn"},variant:"standard",fullWidth:!0,required:O.requiredCustomerFields.includes("address")&&!r})}),(0,I.jsx)(We.ZP,{item:!0,xs:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"postalCode",className:"mt-8 mb-16 pr-6",type:"text",name:"postalCode",label:"Postnr.",value:Z.postalCode,validations:F("postalCode")?void 0:{minLength:3,maxLength:4,isNumeric:!0},validationErrors:F("postalCode")?void 0:{minLength:"Postnummer skal indeholde 3-4 tegn",maxLength:"Postnummer skal indeholde 3-4 tegn",isNumeric:"Postnummer skal indeholde tal"},variant:"standard",fullWidth:!0,required:O.requiredCustomerFields.includes("postalCode")})}),(0,I.jsx)(We.ZP,{item:!0,xs:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"city",className:"mt-8 mb-16",type:"text",name:"city",label:"By",value:Z.city,validations:F("city")?void 0:{minLength:1},validationErrors:F("city")?void 0:{minLength:"Bynavn skal indeholde mindst 1 tegn"},variant:"standard",fullWidth:!0,required:O.requiredCustomerFields.includes("city")})}),m.salesToOtherCountries&&(0,I.jsx)(We.ZP,{item:!0,sm:12,children:(0,I.jsx)(V.Z,{className:"mt-8 mb-16 w-full",fullWidth:!0,id:"countryCode",name:"countryCode",options:Object.keys(u),value:P,onChange:async(e,n)=>{E(n)},getOptionLabel:e=>{if(!u[e])return"-";const{name:n}=u[e];return n||"-"},renderInput:e=>(0,I.jsx)(z.Z,{...e,label:"Land".concat(O.requiredCustomerFields.includes("countryCode")?" *":""),error:!P&&O.requiredCustomerFields.includes("countryCode")}),openOnFocus:!0,required:!0})}),(0,I.jsx)(We.ZP,{item:!0,xs:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"email",className:"mt-8 mb-16 pr-6",type:"text",name:"email",label:"Email",value:Z.email,validations:F("email")?void 0:{isEmail:!0},validationErrors:F("email")?void 0:{isEmail:"Dette skal v\xe6re en gyldig email"},variant:"standard",fullWidth:!0,required:O.requiredCustomerFields.includes("email"),enableTrim:!0})}),(0,I.jsx)(We.ZP,{item:!0,xs:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"phone",className:"mt-8 mb-16",type:"text",name:"phone",label:"Telefon nr.",value:Z.phone,validations:F("phone")?void 0:{minLength:8,maxLength:11,isNumeric:!0},validationErrors:F("phone")?void 0:{minLength:"Telefonnummer skal v\xe6re imellem 8-11 tegn",maxLength:"Telefonnummer skal v\xe6re imellem 8-11 tegn",isNumeric:"Telefonnummer skal indeholde tal"},variant:"standard",fullWidth:!0,required:O.requiredCustomerFields.includes("phone")})}),m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(We.ZP,{item:!0,sx:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"companyName",className:"w-full mt-10",type:"text",name:"companyName",label:"Firmanavn",value:Z.companyName,variant:"standard",fullWidth:!0})}),(0,I.jsx)(We.ZP,{item:!0,sx:6,sm:6,children:(0,I.jsx)(_e.Z,{control:k,id:"companyType",className:"w-full mt-10",type:"text",name:"companyType",label:"Firmatype",value:Z.companyType,variant:"standard",fullWidth:!0})})]}),!m.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions&&(0,I.jsxs)(I.Fragment,{children:[d&&d.createCustomersBySMS&&(0,I.jsx)(We.ZP,{item:!0,sm:m.emailSubscription?6:12,children:(0,I.jsx)(Ke.Z,{children:(0,I.jsx)(Be.Z,{control:(0,I.jsx)(Le.Z,{color:"primary",name:"acceptSMSForSubscription",checked:Z.acceptSMSForSubscription,onChange:e=>N("acceptSMSForSubscription",e.currentTarget.checked)}),label:"Ja til modtagelse af SMS vedr. medlemskaber"})})}),m.emailSubscription&&(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(Ke.Z,{children:(0,I.jsx)(Be.Z,{control:(0,I.jsx)(Le.Z,{color:"primary",name:"newsletterOptIn",checked:Z.newsletterOptIn,onChange:e=>N("newsletterOptIn",e.currentTarget.checked)}),label:"Tilmeld nyhedsbrev"})})})]}),(0,I.jsx)(We.ZP,{item:!0,sm:12,children:(0,I.jsx)(J.Z,{type:"submit",variant:"contained",color:"primary",fullWidth:!0,classes:{button:"rounded-none h-56 mt-16"}
1,loading:"saveCustomer"===p,disableLoadingOnClick:!0,children:"Gem"})})]})})]})]})};var Je=t(47583);function Qe(e){let{ticket:n,open:t,onClose:i}=e;const o=(0,l.useFlags)(),[r,a]=(0,s.useState)(!1),[c,d]=(0,s.useState)(""),[u,p]=(0,s.useState)({}),[x,f]=(0,s.useState)(null),[b,h]=(0,s.useState)(null),[j,k]=(0,s.useState)(null),N=(0,y.v9)(ee.Hl),Z=o.createMultipleSubscriptionsAndSubSubscriptionsOnPos&&Array.isArray(n)&&n.length>=2,C=(0,s.useMemo)((()=>o.flexsdkSubscriptionImprovements&&N&&N.subscription?N.subscription:"medlemskab"),[N,o.flexsdkSubscriptionImprovements]);return(0,I.jsx)("div",{children:(0,I.jsxs)(W.Z,{maxWidth:"xs",fullWidth:!0,open:t,onClose:i,children:[(0,I.jsxs)(B.Z,{children:["Tilknyt eventuelt ",Z?"kortnumre":"kortnummer"]}),(0,I.jsxs)(L.Z,{children:[x&&(0,I.jsxs)(g.Z,{severity:"error",className:"mb-16",children:[(0,I.jsx)(v.Z,{children:"Fejl"}),x||"Det p\xe5g\xe6ldende kortnummer er allerede i brug",j&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("br",{}),(0,I.jsx)("span",{className:"font-bold",children:"Klik p\xe5 bekr\xe6ft for at fjerne kortnummeret fra den gamle kunde, og tilknyt det denne"})]})]}),Z&&(0,I.jsxs)(Ye.Z,{children:["Scan \xe9t nyt kortnummer pr. ",C,", du kan udstede dem med eller uden et fysisk kort"]}),!Z&&(0,I.jsxs)(Ye.Z,{children:["Scan \xe9t nyt kortnummer, du kan udstede et ",C," med eller uden et fysisk kort"]}),(0,I.jsxs)("div",{className:"flex flex-col gap-16 mt-16",children:[Z&&n.map((e=>(0,I.jsx)(z.Z,{autoFocus:!0,id:"ticketNumber",label:"Kortnummer for "+e.issuedTo.firstname+" "+e.issuedTo.lastname+" til "+e.name,type:"text",fullWidth:!0,onChange:n=>{const{value:t}=n.currentTarget;p((n=>({...n,[e.id]:t})))},value:u[e.id]||"",error:!(null===b||void 0===b||!b.some((n=>n.id===e.id)))}))),!Z&&(0,I.jsx)(z.Z,{autoFocus:!0,id:"ticketNumber",label:"Kortnummer",type:"text",fullWidth:!0,onChange:e=>{const{value:n}=e.currentTarget;d(n)},value:c})]})]}),(0,I.jsxs)(Y.Z,{className:"justify-between gap-8 px-24 pb-20 pt-0",children:[(0,I.jsx)(m.Z,{onClick:()=>{i(),f(null),k(null)},color:"primary",className:"w-1/2",variant:"outlined",children:"Udsted uden kortnummer"}),(0,I.jsx)(Je.Z,{onClick:()=>async function(){a(!0),Z?await Promise.allSettled(n.map((e=>(0,S.$H)(e.customerUid,e.id,u[e.id],!(!j||!u[e.id]||j!==u[e.id])).catch((n=>({error:n,ticket:e})))))).then((e=>{const n=e.filter((e=>"rejected"===e.status||e.value.error));if(n.length>0){const e=n.map((e=>{var n,t,s,i,l,o,r,a,c,d;const u={id:(null===e||void 0===e||null===(n=e.value)||void 0===n||null===(t=n.ticket)||void 0===t?void 0:t.id)||e.reason.ticket.id};if("alreadyUsed"===(null===e||void 0===e||null===(s=e.value)||void 0===s||null===(i=s.error)||void 0===i?void 0:i.message)||"alreadyUsed"===(null===e||void 0===e||null===(l=e.reason)||void 0===l||null===(o=l.error)||void 0===o?void 0:o.message))u.error="Det billetnummer findes allerede, benyt venligst et andet";else if("formerUse"===(null===e||void 0===e||null===(r=e.value)||void 0===r||null===(a=r.error)||void 0===a?void 0:a.message)||"formerUse"===(null===e||void 0===e||null===(c=e.reason)||void 0===c||null===(d=c.error)||void 0===d?void 0:d.message))u.error="Det billetnummer er tidligere blevet brugt af en anden. Vil du fjerne det fra den gamle kunde?";else{var m,p;u.error=(null===e||void 0===e||null===(m=e.value)||void 0===m||null===(p=m.error)||void 0===p?void 0:p.message)||e.reason.error.message}return u}));h(e),f("Der er fejl i nogle af billetnumrene");const t=n.filter((e=>{var n,t,s,i;return"formerUse"===(null===e||void 0===e||null===(n=e.value)||void 0===n||null===(t=n.error)||void 0===t?void 0:t.message)||"formerUse"===(null===e||void 0===e||null===(s=e.reason)||void 0===s||null===(i=s.error)||void 0===i?void 0:i.message)}));k(t.map((e=>{var n,t;const s=(null===e||void 0===e||null===(n=e.reason)||void 0===n||null===(t=n.ticket)||void 0===t?void 0:t.id)||e.reason.ticket.id;return{id:s,ticketNumber:u[s]}})))}else p({}),f(null),h(null),i(!0),k(null)})).finally((()=>{a(!1)})):(0,S.$H)(n.customerUid,n.id,c,!(!j||!c||j!==c)).then((()=>{d(""),f(null),i(!0),k(null)})).catch((e=>{console.log(e),"alreadyUsed"===e.message?f("Det billetnummer findes allerede, benyt venligst et andet"):"formerUse"===e.message?(k(c),f("Det billetnummer er tidligere blevet brugt af en anden. Vil du fjerne det fra den gamle kunde?")):f(e.message)})).finally((()=>{a(!1)}))}(),color:"primary",variant:"contained",className:"w-1/2",loading:r,disabled:!Z&&!c||Z&&0===Object.keys(u).length,children:j?"Bekr\xe6ft":"Udsted med kortnummer"})]})]})})}const Xe=function(e){let{orderToRefund:n,onTerminate:t,loading:i,open:o,state:r}=e;
1const c=(0,l.useFlags)(),[d,u]=(0,s.useState)(""),[m,p]=(0,s.useState)(null),x=(0,y.v9)(ee.Hl),f=(0,s.useMemo)((()=>c.flexsdkSubscriptionImprovements&&x&&x.theSubscription?x.theSubscription:"medlemskabet"),[x,c.flexsdkSubscriptionImprovements]);function b(e){1===e?t(!0,!1,!1,!1,d||null):2===e?t(!0,!0,!1,!1,d||null):3===e?t(!0,!0,!0,!0,d||null):t(null,null,null,null,null)}return(0,s.useMemo)((()=>c.flexsdkSubscriptionImprovements&&x&&x.subscription?x.subscription:"medlemskab"),[x,c.flexsdkSubscriptionImprovements]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Se,{open:null!==m,onClose:e=>{e&&b(m),p(null)},icon:null,cancelButton:"Annuller",okButton:"Opsig & refund\xe9r",fullWidth:!0,maxWidth:"sm",content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"h2 mb-10",children:"Begrundelse for refundering"}),(0,I.jsx)(g.Z,{severity:d?"success":"error",fullWidth:!0,className:"w-full mt-20",classes:{message:"w-full"},children:(0,I.jsx)(z.Z,{fullWidth:!0,className:"w-full",value:d,onChange:e=>{const n=e.currentTarget.value;u(n)},label:"Begrundelse for refundering",required:!0})})]})}),(0,I.jsx)(Se,{loading:i,open:o,onClose:e=>{3===e&&n?p(e):b(e)},bigButtons:!0,buttons:[{result:null,variant:"outlined",label:"Annuller"},{result:1,variant:"contained",color:"primary",label:"Opsig"},{result:2,variant:"contained",color:"primary",label:"Opsig & blok\xe9r",disabled:r&&(r===U.Z.PAYMENT||r===U.Z.RESERVED)},{result:3,variant:"contained",color:"primary",label:"Opsig, blok\xe9r & refund\xe9r",disabled:r&&(r===U.Z.PAYMENT||r===U.Z.RESERVED)||n&&n.payments&&n.payments[0]&&"free"===n.payments[0].type}],fullWidth:!0,icon:null,maxWidth:"sm",content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(a.Z,{className:"h2 mb-10",children:["Hvad vil du g\xf8re med ",f,"?"]}),n&&n.payments&&n.payments[0]&&"free"===n.payments[0].type&&(0,I.jsx)(g.Z,{severity:"error",fullWidth:!0,className:"w-full text-left mb-6",children:'Det er ikke muligt at refundere en ordre som er blevet betalt med betalingsmetoden "Gratis"'}),n&&n.payments&&n.payments[0]&&"card"!==n.payments[0].type&&"free"!==n.payments[0].type?(0,I.jsxs)(g.Z,{severity:"error",className:"w-full text-left mt-20",children:[(0,I.jsx)("strong",{children:"BEM\xc6RK, hvis du refundere"})," s\xe5 vil ordren blive sat til refunderet, men kunden vil ikke modtage pengene tilbage automatisk, da kunden har k\xf8bt",f," igennem FlexPOS.",(0,I.jsx)("br",{}),(0,I.jsx)("strong",{children:"Hvis kunden skal have pengene tilbage fra ordren, skal du ogs\xe5 give kunden pengene tilbage igennem FlexPOS."})]}):(0,I.jsx)(I.Fragment,{})]})})]})};function $e(e){var n,t,i,l,o,r,c,d,u,p;let{dialogOpen:f,goToCustomerTabFromScannerDialog:b,addEntry:h,addCustomerToBonFromScannerDialog:v,issueNewTicketNumber:j,addEntryAndGuest:k,customer:N,subscriptions:Z,scannerDialogEntryObj:C,handleWebExit:T,onClose:P,loading:O,onlyAddEntry:D=!1}=e;const{currentTicket:F}=C||{},[R,B]=(0,s.useState)(!0),[K,z]=(0,s.useState)(null),[V,G]=(0,s.useState)(0),[q,J]=(0,s.useState)(null),[X,$]=(0,s.useState)(!1),ne=(0,s.useRef)(!1),te=(0,y.v9)(Q.SO),se=(0,y.v9)(ee.R1),ie=(0,y.v9)(ee.hB),oe=(0,y.v9)(ee.Hl);function re(){P(),B(!1),$(!1)}(0,s.useEffect)((()=>{window.callbackKeyDown=e=>{const n=JSON.parse(e);n.sucess&&(n.KeyDelete&&G((e=>(console.log("[KEY] Clicking delete on keypad, typed: ".concat(e)),Number(e)>9?e/10|0:0))),n.Key&&G((e=>e+n.Key>=5e4?(console.log("[KEY] Clicking number on keypad, clicked: keyObj.Key, maxed out at 50000"),5e4):0!==e?(console.log("[KEY] Clicking number on keypad, clicked: keyObj.Key, typed: ".concat(e+n.Key)),e+n.Key):"00"===n.Key||"0"===n.Key?(console.log("[KEY] Clicking number on keypad, clicked: keyObj.Key, typed: 0"),0):(console.log("[KEY] Clicking number on keypad, clicked: keyObj.Key, typed: ".concat(n.Key)),n.Key))))}}),[]),(0,s.useEffect)((()=>{Z&&C&&C.subscriptionUid&&(z(Z.find((e=>e.id===C.subscriptionUid))),B(!0))}),[Z,C]),(0,s.useEffect)((()=>{F&&F.ticketNumber&&!ne.current&&(ne.current=!0,(0,S.li)(F.ticketNumber).then((e=>J(e))))}),[F]),(0,s.useEffect)((()=>{B(f)}),[f]);const ae=(0,s.useMemo)((()=>{var e;let n=_.cloneDeep(null!==(e=null===te||void 0===te?void 0:te.flexsdkScanDialogButtons)&&void 0!==e?e:[]);return D&&(n=n.filter((e=>"addEntry"===e||"addGroupEntry"===e))),F&&null!==F.groupAmount&&void 0!==F.groupAmount&&(n.includes("addEntry")&&n.push("addGroupEntry"),n=n.filter((e=>"addEntryAndGuest"!==e&&"addEntry"!==e))),n}),[te,F,D]);function ce(e){return ae.includes(e)}const de=(0,s.useMemo)((()=>!K||![U.Z.ACTIVE,U.Z.RENEWAL].includes(K.state)||null===q||!0!==q.success),[K,q]),ue=(0,s.useMemo)((()=>
1{if(!se||!K)return!1;const e=se.find((e=>e.id===K.subscriptionTypeUid));return!e||!e.guestProductUid}),[K,se]),me=(0,s.useMemo)((()=>oe&&oe.memberCard?oe.memberCard:"medlemskort"),[oe]),pe=(0,s.useMemo)((()=>{switch(ae.filter((e=>["addCustomer","goToCustomer","issueNewNumber"].includes(e))).length){case 1:return 12;case 2:return 6;default:return 4}}),[oe]);return O?(0,I.jsx)("div",{children:(0,I.jsx)(W.Z,{style:{"z-index":"9999"},maxWidth:"xs",fullWidth:!0,open:R,onClose:re,"aria-labelledby":"form-dialog-title",children:(0,I.jsx)(L.Z,{children:(0,I.jsx)("div",{className:"flex justify-center items-center flex-col",children:(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(ge.Z,{fontSize:"inherit",className:"text-128 mb-10"}),(0,I.jsx)(a.Z,{className:"h2 font-bold mb-10",children:"Henter kort..."})]})})})})}):C?(0,I.jsx)("div",{children:(0,I.jsxs)(W.Z,{maxWidth:"sm",fullWidth:!0,open:R,onClose:re,children:[(0,I.jsxs)(L.Z,{children:[(0,I.jsxs)("div",{className:"flex items-center justify-between",children:[(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{className:"text-18 font-bold",children:null===K||void 0===K?void 0:K.name}),(0,I.jsxs)("div",{className:"flex items-center gap-6 mt-4",children:[(0,I.jsx)(H.Z,{fontSize:"inherit",className:"text-18",children:"person"}),(0,I.jsxs)(a.Z,{className:"text-15",children:[null!==(n=null===N||void 0===N||null===(t=N.contactInfo)||void 0===t||null===(i=t.billing)||void 0===i?void 0:i.firstname)&&void 0!==n?n:""," ",null!==(l=null===N||void 0===N||null===(o=N.contactInfo)||void 0===o||null===(r=o.billing)||void 0===r?void 0:r.lastname)&&void 0!==l?l:""]})]})]}),C&&C.time&&C.time.start&&(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{variant:"caption",color:"textSecondary",children:"Gyldighedsperiode"}),(0,I.jsxs)("div",{className:"flex items-center gap-6",children:[(0,I.jsx)(H.Z,{fontSize:"inherit",className:"text-18",children:"event"}),(0,I.jsxs)(a.Z,{className:"h4",children:[x()(C.time.start.toDate()).format("DD-MM-YYYY")," -"," ",x()(C.time.end.toDate()).format("DD-MM-YYYY")]})]})]})]}),(0,I.jsxs)("div",{className:"flex justify-center items-center flex-col mt-20",children:[(0,I.jsx)("div",{className:"text-center w-full",children:(0,I.jsxs)("div",{className:"flex justify-between gap-16 mb-10 w-full",children:[!ie&&(0,I.jsxs)(le.Z,{className:"w-1/2 p-12 pb-16 bg-white border-0",variant:"outlined",children:[(0,I.jsx)(a.Z,{className:"text-16 mb-10",children:"Medlemskab"}),(0,I.jsx)(M,{statusKey:K?K.state:null,large:!0})]}),(0,I.jsxs)(le.Z,{className:(0,w.default)("p-12 pb-16 bg-white border-0",ie?"w-full":"w-1/2"),variant:"outlined",children:[!ie&&(0,I.jsx)(a.Z,{className:"text-16 mb-10",children:"Medlemskort"}),ie&&(0,I.jsx)(a.Z,{className:"text-16 mb-10",children:"Status"}),null===q&&(0,I.jsx)(ge.Z,{size:24}),!ie&&(0,I.jsxs)(I.Fragment,{children:[null!==q&&q.success&&F&&[E.Z.ISSUED,E.Z.EXPIRED,E.Z.BLOCKED,E.Z.DRAFT].includes(F.state)&&(0,I.jsx)(A,{statusKey:F?F.state:null,large:!0}),null!==q&&q.success&&F&&F.state===E.Z.USED&&(0,I.jsx)(A,{statusKey:E.Z.ISSUED,large:!0}),null!==q&&q.success&&(!F||F.state===E.Z.RESERVED)&&(0,I.jsx)(A,{statusKey:"invalid",large:!0}),null!==q&&!q.success&&(0,I.jsx)(A,{statusKey:"invalid",large:!0})]}),ie&&(0,I.jsxs)(I.Fragment,{children:[null!==q&&q.success&&F&&[E.Z.ISSUED,E.Z.USED].includes(F.state)&&(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate bg-green text-white"),children:"Aktiv"}),null!==q&&q.success&&F&&[E.Z.EXPIRED,E.Z.BLOCKED,E.Z.DRAFT,E.Z.RESERVED,E.Z.UNKNOWN].includes(F.state)&&(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate bg-red text-white"),children:"Ugyldig"}),null!==q&&!q.success&&(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate bg-red text-white"),children:"Ugyldig"})]})]})]})}),null!==q&&!q.success&&(0,I.jsxs)("div",{className:"text-center w-full mt-8",children:[(0,I.jsxs)(a.Z,{className:"h3 font-bold",children:[(0,Ce.Io)(me)," ugyldig:"]}),(0,I.jsx)(a.Z,{className:"h4 mb-10",children:q.error})]})]})]}),(0,I.jsxs)(Y.Z,{className:"block",children:[(0,I.jsxs)("div",{className:"w-full mb-20",children:[ce("addGroupEntry")&&(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"flex items-center justify-center",children:[(0,I.jsx)(m.Z,{onClick:()=>{G(Math.max(1,V-1))},color:"primary",className:"h-56 w-56 rounded-r-none",disableElevation:!0,variant:"contained",disabled:de||X||V<=1,children:(0,I.jsx)(H.Z,{children:"remove"})}),(0,I.jsx)("div",{className:"flex items-center justify-center h-full min-w-56 px-10",children:(0,I.jsx)(a.Z,{className:"text-[23px] font-bold cursor-default",children:V})}),(0,I.jsx)(m.Z,{onClick:()=>{var e;G(Math.min(5e4,null!==(e=F.groupAmount)&&void 0!==e?e:1,V+1))},disableElevation:!0,color:"primary",className:"h-56 w-56 rounded-l-none",variant:"contained",disabled:de||X||V>=(null!==(c=null===F||void 0===F?void 0:F.groupAmount)&&void 0!==c?c:1)||V>=5e4,children:(0,I.jsx)(H.Z,{children:"add"})})]}),(0,I.jsx)("div",{className:"mt-14",children:(0,I.jsxs)(m.Z,{onClick:()=>{$(!0),h(Number.parseInt(V,10))},color:"primary",className:"w-full h-60 flex-col",variant:"contained",disabled:de||X||V>(null!==(d=null===F||void 0===F?void 0:F.groupAmount)&&void 0!==d?d:1)||V>=5e4||V<=0,children:["Tilf\xf8j ",V," entr\xe9 til bon",de&&(0,I.jsxs)(a.Z,{className:"text-10 -mt-4",children:["(ugyldigt ",me,")"]})]})}),V>(null!==(u=null===F||void 0===F?void 0:F.groupAmount)&&void 0!==u?u:1)&&(0,I.jsx)(g.Z,{severity:"error",className:"mt-10",children:(0,I.jsxs)(a.Z,{className:"text-12",children:["Du kan maksimalt tilf\xf8je ",null!==(p=null===F||void 0===F?void 0:F.groupAmount)&&void 0!==p?p:1," entr\xe9er til bonnen."]})})]}),ce("addEntry")&&(0,I.jsxs)(m.Z,{onClick:()=>{$(!0),h()},color:"primary",className:"w-full h-60 flex-col",variant:"contained",disabled:de||X,children:["Tilf\xf8j entr\xe9 til bon",de&&(0,I.jsxs)(a.Z,{className:"text-10 -mt-4",children:["(ugyldigt ",me,")"]})]}),ce("addEntryAndGuest")&&(0,I.jsxs)(m.Z,{onClick:()=>{$(!0),k(K,F)},color:"primary",className:"w-full h-60 flex-col mt-14",variant:"contained",disabled:de||ue||X,children:["Tilf\xf8j entr\xe9 + g\xe6st til bon",de&&(0,I.jsxs)(a.Z,{className:"text-10 -mt-4",children:["(ugyldigt ",me,")"]}),ue&&!de&&(0,I.jsx)(a.Z,{className:"text-10 -mt-4",children:"(ugyldigt g\xe6steprodukt)"})]})]}),(0,I.jsx)("div",{className:"!ml-0",children:(0,I.jsxs)(We.ZP,{container:!0,spacing:1,children:[ce("goToCustomer")&&(0,I.jsx)(We.ZP,{item:!0,xs:pe,children:(0,I.jsx)(m.Z,{onClick:b,color:"primary",className:"w-full h-60 bg-white",variant:"outlined",children:"G\xe5 til kundekort"})}),ce("issueNewNumber")&&(0,I.jsx)(We.ZP,{item:!0,xs:pe,children:(0,I.jsxs)(m.Z,{onClick:()=>j(F),color:"primary",className:"w-full h-60 bg-white",variant:"outlined",children:["Udsted fysisk ",me]})}),ce("addCustomer")&&(0,I.jsx)(We.ZP,{item:!0,xs:pe,children:(0,I.jsxs)(m.Z,{onClick:v,color:"primary",className:"w-full h-60 bg-white flex-col text-13",variant:"outlined",disabled:!N||!N.flexposCustomerUid,children:["Tilf\xf8j kunde til bon",(!N||!N.flexposCustomerUid)&&(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(a.Z,{className:"text-[9px] -mt-4",children:"(kunde synkronisering deaktiveret)"})})]})}),(0,I.jsx)(We.ZP,{item:!0,xs:12,children:(0,I.jsx)(m.Z,{onClick:D?P:T,className:"h-56 bg-white w-full mt-10",variant:"outlined",color:"error",startIcon:(0,I.jsx)(H.Z,{children:"close"}),children:"Luk"})})]})})]})]})}):(0,I.jsx)("div",{children:(0,I.jsxs)(W.Z,{style:{"z-index":"9999"},maxWidth:"xs",fullWidth:!0,open:R,onClose:re,"aria-labelledby":"form-dialog-title",children:[(0,I.jsx)(L.Z,{children:(0,I.jsx)("div",{className:"flex justify-center items-center flex-col",children:(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(H.Z,{fontSize:"inherit",className:"text-128 mb-10",children:"highlight_off"}),(0,I.jsx)(a.Z,{className:"h2 font-bold mb-10",children:"Kortet er ikke tilknyttet nogen kunde"})]})})}),(0,I.jsx)(Y.Z,{children:(0,I.jsx)(We.ZP,{container:!0,spacing:1,children:(0,I.jsx)(We.ZP,{item:!0,xs:12,children:(0,I.jsx)(m.Z,{onClick:b,color:"primary",className:"w-full h-56 rounded-none",variant:"outlined",children:"Okay"})})})})]})})}const en=function(e){let{dialogOpen:n,goToCustomerTabFromScannerDialog:t,addEntry:i,addCustomerToBonFromScannerDialog:o,issueNewTicketNumber:r,addEntryAndGuest:c,customer:d,subscriptions:u,scannerDialogEntryObj:p,handleWebExit:f,onClose:b,loading:h}=e;const{validationOnPosScanTrigger:g,flexsdkSubscriptionImprovements:v}=(0,l.useFlags)(),{currentTicket:j}
1=p||{},[k,N]=(0,s.useState)(!0),[Z,C]=(0,s.useState)(null),[T,P]=(0,s.useState)(null),[O,D]=(0,s.useState)(!1),F=(0,s.useRef)(!1),R=(0,y.v9)(Q.SO),K=(0,y.v9)(ee.R1),z=(0,y.v9)(ee.hB),V=(0,y.v9)(ee.Hl);function G(){b(),N(!1),D(!1)}function _(e){return!v||R&&R.flexsdkScanDialogButtons&&R.flexsdkScanDialogButtons.includes(e)}(0,s.useEffect)((()=>{u&&p&&p.subscriptionUid&&(C(u.find((e=>e.id===p.subscriptionUid))),N(!0))}),[u,p]),(0,s.useEffect)((()=>{g&&j&&j.ticketNumber&&!F.current&&(F.current=!0,(0,S.li)(j.ticketNumber).then((e=>P(e))))}),[j,g]),(0,s.useEffect)((()=>{N(n)}),[n]);const q=(0,s.useMemo)((()=>!Z||Z.state!==U.Z.ACTIVE||g&&(null===T||!0!==T.success)),[Z,g,T]),J=(0,s.useMemo)((()=>{if(!K||!Z)return!1;const e=K.find((e=>e.id===Z.subscriptionTypeUid));return!e||!e.guestProductUid}),[Z,K]),X=(0,s.useMemo)((()=>v?j&&j.oldTicketNumbers&&j.oldTicketNumbers.length>0?"Kort Scannet":"PDF Scannet":"Kort Scannet"),[j,v]),$=(0,s.useMemo)((()=>v&&V&&V.subscription?V.subscription:"medlemskab"),[V,v]),ne=(0,s.useMemo)((()=>v&&V&&V.memberCard?V.memberCard:"medlemskort"),[V,v]);return h?(0,I.jsx)("div",{children:(0,I.jsx)(W.Z,{style:{"z-index":"9999"},maxWidth:"xs",fullWidth:!0,open:k,onClose:G,"aria-labelledby":"form-dialog-title",children:(0,I.jsx)(L.Z,{children:(0,I.jsx)("div",{className:"flex justify-center items-center flex-col",children:(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(ge.Z,{fontSize:"inherit",className:"text-128 mb-10"}),(0,I.jsx)(a.Z,{className:"h2 font-bold mb-10",children:"Henter kort..."})]})})})})}):p?(0,I.jsx)("div",{children:(0,I.jsxs)(W.Z,{maxWidth:"xs",fullWidth:!0,open:k,onClose:G,"aria-labelledby":"form-dialog-title",children:[(0,I.jsx)("div",{className:"flex items-center",children:(0,I.jsx)(B.Z,{id:"form-dialog-title",children:X})}),(0,I.jsx)(L.Z,{children:(0,I.jsxs)("div",{className:"flex justify-center items-center flex-col",children:[(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{className:"h3 font-bold",children:"Kunde Navn"}),(0,I.jsxs)(a.Z,{className:"h4 mb-10",children:[d&&d.contactInfo&&d.contactInfo.billing&&d.contactInfo.billing.firstname?d.contactInfo.billing.firstname:""," ",d&&d.contactInfo&&d.contactInfo.billing&&d.contactInfo.billing.lastname?d.contactInfo.billing.lastname:""]})]}),Z&&Z.name&&(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{className:"h3 font-bold",children:(0,Ce.Io)($)}),(0,I.jsx)(a.Z,{className:"h4 mb-10",children:Z.name})]}),!g&&(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{className:"h3 mb-10 font-bold",children:"Medlemskabs Status"}),(0,I.jsx)(M,{statusKey:Z?Z.state:null,large:!0})]}),p&&p.time&&p.time.start&&(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{className:"h3 font-bold ".concat(g?"":"mt-16"),children:"Periode"}),(0,I.jsxs)(a.Z,{className:"h4 mb-10",children:[x()(p.time.start.toDate()).format("DD-MM-YYYY")," -"," ",x()(p.time.end.toDate()).format("DD-MM-YYYY")]})]}),g&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"text-center w-full",children:[(0,I.jsx)(a.Z,{className:"h3 font-bold",children:"Status"}),(0,I.jsxs)("div",{className:"flex justify-between mb-10 w-full",children:[(!v||!z)&&(0,I.jsxs)("div",{className:"w-1/2",children:[(0,I.jsx)(a.Z,{className:"h4 mb-6 font-semibold",children:"Medlemskab"}),(0,I.jsx)(M,{statusKey:Z?Z.state:null,large:!0})]}),(0,I.jsxs)("div",{className:v&&z?"w-full pt-10":"w-1/2",children:[(!v||!z)&&(0,I.jsx)(a.Z,{className:"h4 mb-6 font-semibold",children:"Medlemskort"}),null===T&&(0,I.jsx)(ge.Z,{size:24}),(!v||!z)&&(0,I.jsxs)(I.Fragment,{children:[null!==T&&T.success&&j&&[E.Z.ISSUED,E.Z.EXPIRED,E.Z.BLOCKED,E.Z.DRAFT].includes(j.state)&&(0,I.jsx)(A,{statusKey:j?j.state:null,large:!0}),null!==T&&T.success&&j&&j.state===E.Z.USED&&(0,I.jsx)(A,{statusKey:E.Z.ISSUED,large:!0}),null!==T&&T.success&&(!j||j.state===E.Z.RESERVED)&&(0,I.jsx)(A,{statusKey:"invalid",large:!0}),null!==T&&!T.success&&(0,I.jsx)(A,{statusKey:"invalid",large:!0})]}),v&&z&&(0,I.jsxs)(I.Fragment,{children:[null!==T&&T.success&&j&&[E.Z.ISSUED,E.Z.USED].includes(j.state)&&(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate bg-green text-white"),children:"Aktiv"}),null!==T&&T.success&&j&&[E.Z.EXPIRED,E.Z.BLOCKED,E.Z.DRAFT,E.Z.RESERVED,E.Z.UNKNOWN].includes(j.state)&&(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate bg-red text-white"),children:"Ugyldig"}),null!==T&&!T.success&&(0,I.jsx)("div",{className:(0,w.default)("inline text-16 p-6 px-10 rounded truncate bg-red text-white"),children:"Ugyldig"})]})]})]})]}),null!==T&&!T.success&&(0,I.jsxs)("div",{className:"text-center w-full mt-8",children:[(0,I.jsxs)(a.Z,{className:"h3 font-bold",children:[(0,Ce.Io)(ne)," ugyldig:"]}),(0,I.jsx)(a.Z,{className:"h4 mb-10",children:T.error})]})]})]})}),(0,I.jsx)(Y.Z,{children:(0,I.jsxs)(We.ZP,{container:!0,spacing:1,children:[_("addEntry")&&(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsxs)(m.Z,{onClick:()=>{D(!0),i()},color:"primary",className:"w-full h-56 rounded-none flex-col",variant:"contained",disabled:q||O,children:["Tilf\xf8j entr\xe9 til bon",q&&(0,I.jsxs)(a.Z,{className:"text-10 -mt-4",children:["(ugyldigt ",ne,")"]})]})}),v&&_("addEntryAndGuest")&&(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsxs)(m.Z,{onClick:()=>{D(!0),c(Z,j)},color:"primary",className:"w-full h-56 rounded-none flex-col",variant:"contained",disabled:q||J||O,children:["Tilf\xf8j entr\xe9 + g\xe6st til bon",q&&(0,I.jsxs)(a.Z,{className:"text-10 -mt-4",children:["(ugyldigt ",ne,")"]}),J&&!q&&(0,I.jsx)(a.Z,{className:"text-10 -mt-4",children:"(ugyldigt g\xe6steprodukt)"})]})}),_("goToCustomer")&&(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsx)(m.Z,{onClick:t,color:"primary",className:"w-full h-56 rounded-none",variant:"contained",children:"G\xe5 til kundekort"})}),v&&_("issueNewNumber")&&(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsxs)(m.Z,{onClick:()=>r(j),color:"primary",className:"w-full h-56 rounded-none",variant:"contained",children:["Udsted fysisk ",ne]})}),_("addCustomer")&&(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsxs)(m.Z,{onClick:o,color:"primary",className:"w-full h-56 rounded-none flex-col",variant:"contained",disabled:!d||!d.flexposCustomerUid,children:["Tilf\xf8j kunde til bon",(!d||!d.flexposCustomerUid)&&(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(a.Z,{className:"text-10 -mt-4",children:"(kunde synkronisering deaktiveret)"})})]})}),(0,I.jsx)(We.ZP,{item:!0,xs:v&&R&&R.flexsdkScanDialogButtons&&R.flexsdkScanDialogButtons.length%2===0?12:6,children:(0,I.jsx)(m.Z,{onClick:f,color:"primary",className:"w-full h-56 rounded-none",variant:"outlined",children:"Luk"})})]})})]})}):(0,I.jsx)("div",{children:(0,I.jsxs)(W.Z,{style:{"z-index":"9999"},maxWidth:"xs",fullWidth:!0,open:k,onClose:G,"aria-labelledby":"form-dialog-title",children:[(0,I.jsx)(L.Z,{children:(0,I.jsx)("div",{className:"flex justify-center items-center flex-col",children:(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(H.Z,{fontSize:"inherit",className:"text-128 mb-10",children:"highlight_off"}),(0,I.jsx)(a.Z,{className:"h2 font-bold mb-10",children:"Kortet er ikke tilknyttet nogen kunde"})]})})}),(0,I.jsx)(Y.Z,{children:(0,I.jsx)(We.ZP,{container:!0,spacing:1,children:(0,I.jsx)(We.ZP,{item:!0,xs:12,children:(0,I.jsx)(m.Z,{onClick:t,color:"primary",className:"w-full h-56 rounded-none",variant:"outlined",children:"Okay"})})})})]})})};const nn=function(e){return(0,l.useFlags)().groupSubscriptions?(0,I.jsx)($e,{...e}):(0,I.jsx)(en,{...e})};var tn=t(89697);const sn=function(e){const n=T().pick(e,["id","className","classes","name","disabled","label","value","onChange","onBlur","clearable","onAccept","inputVariant","size","inputProps","onOpen","onClose","open","minDate","maxDate"]);return(0,I.jsx)(tn.Z,{...n,ampm:!1,cancelText:"Annuller",todayText:"Nu",clearText:"Ryd tid",views:["hours","minutes"],minutesStep:15,components:{OpenPickerIcon:null},renderInput:e=>(0,I.jsx)(z.Z,{type:"time",size:n.size||void 0,className:n.className,...n.inputProps,...e})})};var ln=t(19504),on=t(37020);const rn=(0,j.Z)((e=>({fontSize:{fontSize:"0.6em"}})));const an=function(e){const n=rn(),t=(0,s.useMemo)((()=>{const n=T().pick(e,["id","className","classes","name","disabled","label","value","onChange","onBlur","clearable","onAccept","inputVariant","disablePast","minDate","maxDate","inputVariant","size","inputProps","onOpen","onClose","open"]);return n.value&&!x().isMoment(n.value)&&(n.value=x()(n.value)),n.minDate&&!x().isMoment(n.minDate)&&(n.minDate=x()(n.minDate)),n.maxDate&&!x().isMoment(n.maxDate)&&(n.maxDate=x()(n.maxDate)),n}),[e]);return(0,I.jsx)(on.Z,{...t,inputFormat:"DD/MM/yyyy",mask:"__/__/____",cancelText:"Annuller",todayText:"I dag",showTodayButton:!0,clearText:"Ryd dato",renderDay:function(e,t,s){return(0,I.jsxs)("div",{children:[1===e.day()&&(0,I.jsx)("div",{className:(0,w.default)(n.fontSize,"absolute"),children:e.isoWeek()}),(0,I.jsx)(ln.ZP,{...s})]},e.toString())},renderInput:e=>(0,I.jsx)(z.Z,{size:t.size||void 0,className:t.className,...t.inputProps,...e})})};var cn=t(98122),dn=t(14677),un=t(30417),mn=t(13759),pn=t(5439);const xn=function(e){let{handleWebExit:n,onCustomerSelect:t}=e;(0,l.useFlags)();
1const[i,o]=(0,s.useState)(!1),[r,c]=(0,s.useState)([]),[d,u]=(0,s.useState)(null),[p,x]=(0,s.useState)({});function f(){x({}),o(!1)}return(0,s.useEffect)((()=>{r&&r.length>0?o(!0):o(!1)}),[r,d,!0]),(0,s.useEffect)((()=>{if(r&&r.length>0){const e=r.filter((e=>e.customerUid)).map((e=>(0,S.qP)(e.customerUid,(e=>{e&&x((n=>{const t={...n};return t[e.id]=e,t}))}))));return()=>e.forEach((e=>e()))}return()=>{}}),[r]),(0,s.useEffect)((()=>{window.callbackOpening=()=>{q.Z.getJournalAndLines(!1,(e=>{if(e.sucess){const n=e.journal.journalLines;c(n.filter((e=>{if(e.ProdNo.startsWith("ATT-"))return!0;if(e.SN){const n=e.SN.split(";");if(n.length>=4&&n[0]&&"null"!==n[0])return!0}return!1})).map((e=>{const n=e.SN.split(";");return n.length>=4&&n[0]&&"null"!==n[0]?{...e,customerUid:n[0].replace(/^ATT/g,"")}:e})))}else c([])}))}}),[]),(0,s.useEffect)((()=>{r&&r.length>0||d?o(!0):o(!1)}),[r,d]),(0,I.jsx)("div",{children:(0,I.jsxs)(W.Z,{style:{"z-index":"9999"},maxWidth:"sm",fullWidth:!0,open:i,onClose:f,"aria-labelledby":"form-dialog-title",disableBackdropClick:!0,disableEscapeKeyDown:!0,children:[(0,I.jsx)(L.Z,{children:(0,I.jsx)("div",{className:"flex justify-center items-center flex-col",children:(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{className:"h2 font-bold mb-10",children:"Der er allerede et eller flere medlemskaber, som endnu ikke er betalt p\xe5 bonnen"}),r.length>0&&(0,I.jsxs)(dn.Z,{className:"mb-10",children:[(0,I.jsx)(mn.Z,{children:(0,I.jsxs)(un.Z,{children:[(0,I.jsx)(cn.Z,{className:"font-bold",children:"Kunde"}),(0,I.jsx)(cn.Z,{className:"font-bold",children:"Produkt"}),(0,I.jsx)(cn.Z,{className:"font-bold",children:"Antal"}),(0,I.jsx)(cn.Z,{className:"font-bold",children:"Pris"}),(0,I.jsx)(cn.Z,{})]})}),(0,I.jsx)(pn.Z,{children:r.map((e=>(0,I.jsxs)(un.Z,{children:[(0,I.jsx)(cn.Z,{children:p&&p[e.customerUid]&&p[e.customerUid].contactInfo&&p[e.customerUid].contactInfo.billing?"".concat(p[e.customerUid].contactInfo.billing.firstname," ").concat(p[e.customerUid].contactInfo.billing.lastname):"-"}),(0,I.jsx)(cn.Z,{children:e.ProdNo}),(0,I.jsx)(cn.Z,{children:e.Quntity}),(0,I.jsx)(cn.Z,{children:e.Price}),(0,I.jsx)(cn.Z,{children:(0,I.jsx)(m.Z,{variant:"contained",color:"primary",onClick:()=>{return n=e.customerUid,t(n),void f();var n},disabled:!e.customerUid,children:"V\xe6lg kunde"})})]},e.UID)))})]}),(0,I.jsx)(a.Z,{className:"h3 font-bold mb-10",children:"Klik p\xe5 knappen til venstre, for at tilf\xf8je endnu et medlemskab til bonnen"})]})})}),(0,I.jsx)(Y.Z,{children:(0,I.jsxs)(We.ZP,{container:!0,spacing:1,children:[(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsx)(m.Z,{onClick:async function(){f()},color:"primary",className:"w-full h-56 rounded-none",variant:"contained",children:"Opret ny / Find eksisterende kunde"})}),(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsx)(m.Z,{onClick:()=>{f(),n()},color:"primary",className:"w-full h-56 rounded-none",variant:"outlined",children:"Luk"})})]})})]})})};const fn=function(e){let{open:n,onClose:t,customerUid:i,membershipTickets:o,popAlertWithError:r,onCreate:c,handlePrintPDF:d,products:u}=e;const p=(0,l.useFlags)(),[x,f]=(0,s.useState)(!1),[b,h]=(0,s.useState)(""),[g,v]=(0,s.useState)(null),[j,k]=(0,s.useState)(!1),[N,Z]=(0,s.use
1State)([]),C=(0,s.useRef)(!1),T=(0,y.v9)(ee.Hl);(0,s.useEffect)((()=>{if(g&&o&&o.length>0){const e=o.filter((e=>e.subscriptionUid===g));e&&e.length>0&&(Z(e),C.current||(c(e),f(!1),k(!0),C.current=!0))}}),[g,o,c]);const w=(0,s.useMemo)((()=>p.flexsdkSubscriptionImprovements&&T&&T.theSubscription?T.theSubscription:"medlemskabet"),[T,p.flexsdkSubscriptionImprovements]),P=(0,s.useMemo)((()=>p.flexsdkSubscriptionImprovements&&T&&T.subscription?T.subscription:"medlemskab"),[T,p.flexsdkSubscriptionImprovements]),E=()=>{f(!1),k(!1),v(null),h(""),Z([])},O=()=>{E(),t()};return(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(W.Z,{maxWidth:"sm",fullWidth:!0,open:n,onClose:t,"aria-labelledby":"form-dialog-title",children:[(0,I.jsx)(B.Z,{id:"form-dialog-title",className:j?"text-center":"",children:j?"".concat((0,Ce.Io)(P)," er oprettet"):"Oprettelse af ".concat(P)}),x&&(0,I.jsxs)(L.Z,{className:"flex items-center",children:[(0,I.jsx)("div",{className:"w-72",children:(0,I.jsx)(G.Z,{})}),(0,I.jsxs)(a.Z,{className:"text-lg ml-12",children:["Opretter ",P]})]}),!x&&!j&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(L.Z,{children:[(0,I.jsxs)(a.Z,{className:"mb-24",children:["Scan eller indtast gavekortnummeret, for at oprette det ",P," der er givet i gave"]}),(0,I.jsx)(z.Z,{autoFocus:!0,id:"giftNumber",label:"Gavenummer",type:"text",fullWidth:!0,onChange:e=>{const{value:n}=e.currentTarget;h(n)},value:b,className:"mb-16"})]}),(0,I.jsxs)(Y.Z,{className:"flex justify-between",children:[(0,I.jsx)(m.Z,{onClick:O,color:"secondary",variant:"outlined",className:"w-1/2 rounded-none",disabled:x,children:"Luk"}),(0,I.jsxs)(m.Z,{onClick:async function(){f(!0);const e=await(0,S.wW)([b],"megetRandom");if(e.validated&&e.subscriptionTypeUid){const n=await(0,S.XW)(e.subscriptionTypeUid,i);v(n.subscriptionUid),await(0,S.cc)(n.subscriptionUid,i,{ticketNumber:b,controlNumber:"megetRandom"})}else E(),t(),r("Det indtastede gavekort findes ikke eller er allerede brugt")},color:"primary",variant:"contained",className:"w-1/2 rounded-none",disabled:x,children:["Opret ",P]})]})]}),!x&&j&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(L.Z,{children:(0,I.jsxs)(a.Z,{className:"text-center text-16 -mt-10 mb-6",children:["Gavekortet er nu indl\xf8st, og ",w," er oprettet korrekt"]})}),(0,I.jsx)(Y.Z,{className:"flex flex-col justify-between",children:(0,I.jsxs)("div",{className:"w-full",children:[(0,I.jsxs)("div",{className:"flex justify-center w-full",children:[(0,I.jsx)(J.Z,{onClick:function(){d(N[0])},color:"primary",variant:"outlined",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"},disabled:x,disableLoadingOnClick:!0,children:"Print Kort"}),(0,I.jsx)(J.Z,{onClick:async function(){let e="";if(e="attractionWeb"===N[0].origin?"ATT-Entry-Online":N[0].validations&&N[0].validations.some((e=>"use"===e.type))?"ATT-Entry-FP2":"ATT-Entry-FP1",p.directEntranceOnPosOffUseFp2OnValidation){const n=u.find((e=>e.id===N[0].productId));n&&null!==n.directEntranceOnPosIfPossible&&void 0!==n.directEntranceOnPosIfPossible&&!n.directEntranceOnPosIfPossible&&(e="ATT-Entry-FP2")}await q.Z.addProduct(e,1,0,"FT".concat(N[0].ticketNumber)),await q.Z.closeBrowser()},color:"primary",variant:"contained",classes:{button:"w-full h-96 rounded-none",wrapper:"w-1/2"},disabled:x,disableLoadingOnClick:!0,children:"Tilf\xf8j entr\xe9 til bon"})]}),(0,I.jsx)(J.Z,{onClick:O,color:"secondary",variant:"outlined",classes:{button:"w-full h-96 mt-10 rounded-none",wrapper:"w-full"},disabled:x,style:{marginLeft:0},disableLoadingOnClick:!0,children:"Luk"})]})})]})]})})};const bn=function(e){let{customer:n,open:t,onClose:i}=e;
1const[l,o]=(0,s.useState)(""),[r,a]=(0,s.useState)(!1);function c(){o(""),a(!1),i()}return(0,I.jsxs)(W.Z,{maxWidth:"xs",fullWidth:!0,open:t,onClose:c,"aria-labelledby":"form-dialog-title",children:[(0,I.jsx)(B.Z,{id:"form-dialog-title",children:"Oprettelse af underkunde"}),(0,I.jsxs)(L.Z,{children:[(0,I.jsx)(Ye.Z,{children:"Indtast underkundens oplysninger"}),(0,I.jsx)(z.Z,{className:"w-full mb-10",fullWidth:!0,label:"Navn",value:l,required:!0,onChange:e=>{const n=e.currentTarget.value;o(n)}})]}),(0,I.jsxs)(Y.Z,{children:[(0,I.jsx)(m.Z,{onClick:c,color:"primary",className:"w-1/2 h-56",variant:"outlined",children:"Annuller"}),(0,I.jsx)(J.Z,{onClick:async function(){await(0,S.fe)(n.id,l),c()},color:"primary",classes:{button:"w-full h-56",wrapper:"w-1/2"},variant:"contained",loading:r,disabled:!l,children:"Opret"})]})]})};function hn(e){let{customer:n,associatedCustomers:t,goToCustomer:i}=e;const[o,r]=(0,s.useState)(!1),{createSubcustomersOnFlexsdk:c}=(0,l.useFlags)();return(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"flex justify-between",children:[(0,I.jsx)(a.Z,{variant:"h6",children:"Kundens underkunder"}),c&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(m.Z,{className:"h-48 px-28 rounded-none",color:"primary",variant:"outlined",onClick:()=>r(!0),children:"Opret underkunde"}),(0,I.jsx)(bn,{customer:n,open:o,onClose:()=>r(!1)})]})]}),(!t||t&&0===t.length)&&(0,I.jsx)(a.Z,{variant:"subtitle1",className:"text-center mt-4",children:"Der blev ikke fundet nogle underkunder p\xe5 denne kunde"}),t&&t.length>0&&(0,I.jsx)(I.Fragment,{children:t.map((e=>(0,I.jsx)(b.Z,{className:"rounded-none bg-gray-100 my-10 p-10",children:(0,I.jsx)("table",{className:"w-full",children:(0,I.jsx)("tbody",{children:e.contactInfo&&e.contactInfo.billing&&(0,I.jsxs)("tr",{children:[(0,I.jsx)("td",{className:"w-400",children:(0,I.jsxs)("div",{children:[(0,I.jsxs)(a.Z,{variant:"h6",className:"mb-8",children:[e.contactInfo.billing.firstname||""," ",e.contactInfo.billing.lastname||""]}),(0,I.jsx)(a.Z,{color:"textSecondary",children:e.contactInfo.billing.address||""}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:[e.contactInfo.billing.postalCode||""," ",e.contactInfo.billing.city||""]})]})}),(0,I.jsx)("td",{children:(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{color:"textSecondary",children:e.contactInfo.billing.email||""}),(0,I.jsx)(a.Z,{color:"textSecondary",children:e.contactInfo.billing.phone||""})]})}),(0,I.jsx)("td",{className:"w-80",children:(0,I.jsx)(m.Z,{className:"rounded-none",color:"primary",variant:"contained",onClick:()=>i(e,!1,!0),children:"G\xe5 til kunde"})})]})})})})))})]})}const gn=function(e){let{handleWebExit:n,selectedCustomer:t,onCustomerSelect:i}=e;
1const[l,o]=(0,s.useState)(!1),[r,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(!1);function p(){o(!1),n()}return(0,s.useEffect)((()=>{t&&t.isAnonymous&&(console.log("[ANONYMOUS] Selected customer is anonymous"),o(!0))}),[t]),(0,I.jsx)("div",{children:(0,I.jsxs)(W.Z,{style:{"z-index":"9999"},maxWidth:"sm",fullWidth:!0,open:l,onClose:p,"aria-labelledby":"form-dialog-title",disableBackdropClick:!0,disableEscapeKeyDown:!0,children:[!d&&(0,I.jsxs)(L.Z,{children:[r&&(0,I.jsxs)(g.Z,{severity:"error",children:[(0,I.jsx)(v.Z,{children:"Fejl"}),r]}),(0,I.jsx)("div",{className:"flex justify-center items-center flex-col",children:(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{className:"h2 font-bold mb-10",children:"Denne kunde stammer fra et online salg og er endnu ikke oprettet i kunde databasen"}),(0,I.jsx)(a.Z,{className:"h3 font-bold mb-10",children:"For at kunne s\xe6lge et medlemskab til kunden, skal kunden oprettes."})]})})]}),d&&(0,I.jsxs)(L.Z,{className:"flex items-center",children:[(0,I.jsx)("div",{className:"w-72",children:(0,I.jsx)(G.Z,{})}),(0,I.jsx)(a.Z,{className:"text-lg ml-12",children:"Opretter kunde..."})]}),(0,I.jsx)(Y.Z,{children:(0,I.jsxs)(We.ZP,{container:!0,spacing:1,children:[(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsx)(m.Z,{onClick:()=>{p(),n()},color:"primary",className:"w-full h-56 rounded-none",variant:"outlined",children:"Luk"})}),(0,I.jsx)(We.ZP,{item:!0,xs:6,children:(0,I.jsx)(m.Z,{onClick:async function(){console.log("[ANONYMOUS] Trying to create customer from an anonymous customer"),u(!0);const e=await(0,S.aq)(t.id);u(!1),console.log("[ANONYMOUS] Response from creation:"),Object.entries(e).forEach((e=>{let[n,t]=e;return console.log("[ANONYMOUS] - ".concat(n,": ").concat(t))})),e.customerUid?(i(e.customerUid),o(!1)):c("Kunden kunne ikke oprettes")},color:"primary",className:"w-full h-56 rounded-none",variant:"contained",disabled:d,children:"Opret kunde"})})]})})]})})},vn=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2}),jn=(0,j.Z)({alertPosition:{left:"30%",top:"4%",width:"500px"},modalPosition:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"500px"}});const kn=function(){const e=(0,l.useFlags)(),n=jn(),t=(0,y.v9)(Q.UK),[i,p]=(0,s.use
1State)(null),[j,C]=(0,s.useState)(0),[T,w]=(0,s.useState)(!1),[O,F]=(0,s.useState)(null),[R,W]=(0,s.useState)(null),[B,L]=(0,s.useState)(null),[K,Y]=(0,s.useState)([]),[z,V]=(0,s.useState)([]),[H,G]=(0,s.useState)([]),[_,J]=(0,s.useState)([]),[X,$]=(0,s.useState)(null),[ee,ne]=(0,s.useState)(null),[te,se]=(0,s.useState)(null),[ie,le]=(0,s.useState)(null),[oe,re]=(0,s.useState)(!1),[ae,ce]=(0,s.useState)(!1),[de,ue]=(0,s.useState)(null),[me,pe]=(0,s.useState)({}),[xe,fe]=(0,s.useState)(null),[be,he]=(0,s.useState)(!1),[ge,ve]=(0,s.useState)(null),[je,ke]=(0,s.useState)(null),[ye,Ne]=(0,s.useState)(null),Ze=(0,s.useRef)(null),Te=(0,s.useRef)(null),we=(0,s.useRef)(null),Pe=(0,s.useRef)(null),[Ee,Ie]=(0,s.useState)(!1),[Oe,De]=(0,s.useState)(null),[Fe,Ae]=(0,s.useState)(null),[Ue,We]=(0,s.useState)(null),Be=(0,y.v9)(Q.SO);function Le(){q.Z.closeBrowser()}(0,s.useEffect)((()=>{(0,Ce.ak)("scan")&&setTimeout((()=>{window.callbackScanData(JSON.stringify({ScanData:(0,Ce.ak)("scan"),sucess:!0}))}),1e3)}),[]),(0,s.useEffect)((()=>{window.callbackScanData=n=>{const t=JSON.parse(n);t.sucess&&(0,S.cg)(t.ScanData).then((n=>{if(n.length<=0)Ie(!0);else if(W((e=>e||n[0].customerUid)),w(!1),Be&&Be.onScan&&"customerCard"!==Be.onScan){if("cardScannerOptions"===Be.onScan){let t="";console.log("[PRODUCT] Product ID: ".concat(n[0].productId));const s=e.changeOfEntryProduct2AddFunctionalityInFlexposFlexTicketApi&&ge&&ge.find((e=>e.id===n[0].productId));console.log("[PRODUCT] FlexPOS Settings ValidationProductsPerProduct: ".concat(Be&&Be.validationProductsPerProduct)),console.log("[PRODUCT] Product ValidationProductsPerProduct: ".concat(s&&s.hasValidationProducts)),t=e.changeOfEntryProduct2AddFunctionalityInFlexposFlexTicketApi&&(Be&&Be.validationProductsPerProduct||s&&s.hasValidationProducts)?"attractionWeb"===n[0].origin?"".concat(s.productNumber,"-Online"):n[0].validations&&n[0].validations.some((e=>"use"===e.type))?"".concat(s.productNumber,"-FP2"):"".concat(s.productNumber,"-FP1"):"attractionWeb"===n[0].origin?"ATT-Entry-Online":n[0].validations&&n[0].validations.some((e=>"use"===e.type))?"ATT-Entry-FP2":"ATT-Entry-FP1",e.directEntranceOnPosOffUseFp2OnValidation&&s&&null!==s.directEntranceOnPosIfPossible&&void 0!==s.directEntranceOnPosIfPossible&&!s.directEntranceOnPosIfPossible&&(t=t.replace("-FP1","-FP2").replace("-Online","-FP2")),We({productNumber:t,qty:1,overloadedPrice:0,eventUid:"FT".concat(n[0].ticketNumber),subscriptionUid:n[0].subscriptionUid,time:n[0].event,currentTicket:n[0]}),Ie(!0)}}else C(4)}))},q.Z.readyToReceive().catch((e=>{console.error(e)}))}),[e.changeOfEntryProduct2AddFunctionalityInFlexposFlexTicketApi,e.directEntranceOnPosOffUseFp2OnValidation,Be,ge]),(0,s.useEffect)((()=>{if(de){const e=K.filter((e=>e.subscriptionUid===de.id));e.sort(((e,n)=>e.orderDate-n.orderDate)),ke(e[0])}else ke(null)}),[de,K]),(0,s.useEffect)((()=>{if(de){const e=H.filter((e=>e.subscriptionUid===de.id));Ne(e)}else Ne(null)}),[de,H]),(0,s.useEffect)((()=>{if(B){if(B.isAssociated){const e=(0,S.qP)(B.associatedCustomer,(e=>{De(e)}));return()=>{e()}}const e=(0,S.nh)(B.uid||B.id,(e=>{Ae(e)}));return()=>{e()}}return()=>{}}),[B]),(0,s.useEffect)((()=>{if(R){let n;return n=e.createCustomerFromAnonymousOnPos?(0,S.b8)(R,(e=>L(e))):(0,S.qP)(R,(e=>{L(e)})),()=>{n()}}return w(!0),()=>{}}),[R,e.createCustomerFromAnonymousOnPos]),(0,s.useEffect)((()=>{if(R){const n=(0,S.dn)(R,(e=>{V(e.filter((e=>!e.subscriptionUid))),G(e.filter((e=>!!e.subscriptionUid)))}));let t,s;return e.minorFixes?(t=(0,S.K4)(e.createSubcustomersOnFlexsdk&&Oe?Oe.id:R,(e=>{Y(e)})),s=(0,S.C3)(e.createSubcustomersOnFlexsdk&&Oe?Oe.id:R,(n=>{e.createSubcustomersOnFlexsdk&&Oe?J(n.filter((e=>e.selectedProducts&&Object.values(e.selectedProducts).some((e=>e.associatedCustomer===R))))):J(n)}))):(t=(0,S.yQ)(e.createSubcustomersOnFlexsdk&&Oe?Oe.id:R,(e=>{Y(e)})),s=(0,S.u2)(e.createSubcustomersOnFlexsdk&&Oe?Oe.id:R,(n=>{e.createSubcustomersOnFlexsdk&&Oe?J(n.filter((e=>e.selectedProducts&&Object.values(e.selectedProducts).some((e=>e.associatedCustomer===R))))):J(n)}))),()=>{t(),n(),s()}}return w(!0),()=>{}}),[R,Oe,e.createCustomerFromAnonymousOnPos,e.minorFixes,e.createSubcustomersOnFlexsdk]),(0,s.useEffect)((()=>{const e=(0,S.Z1)((e=>fe(e.filter((e=>void 0===e.showOnPos||null===e.showOnPos||!!e.showOnPos))))),n=(0,S.Cr)((e=>ve(e)));return()=>{e(),n()}}),[]);const Ke=e=>{p((0,I.jsxs)(g.Z,{className:"absolute z-10 ".concat(n.alertPosition),severity:"error",onClose:()=>{p(null)},children:[(0,I.jsx)(v.Z,{children:"Fejl"}),(0,I.jsx)(a.Z,{children:e})]}))};async function Ye(n){if(console.log("[PRINT] Clicked print card for ticket ".concat(n.id)),e.changedWhe
1nToDownloadPdfFilesOnFlexpos){const e=Me.Z.getStorage().ref("tickets/organisation/".concat(n.organisationUid,"/tickets/").concat(n.id,".pos.pdf")),t=await e.getDownloadURL().catch((()=>null));t?(console.log("[PRINT] Sending newly generated URL to FlexSDK: ".concat(t)),await q.Z.downloadAndPrintPDF("".concat(t,"&timestamp=").concat((new Date).getTime()))):me[n.id]?(console.log("[PRINT] Sending cached URL to FlexSDK: ".concat(me[n.id])),await q.Z.downloadAndPrintPDF("".concat(me[n.id],"&timestamp=").concat((new Date).getTime()))):console.log("[PRINT] No link to pdf found")}else me[n.id]?(console.log("[PRINT] Sending cached URL to FlexSDK: ".concat(me[n.id])),await q.Z.downloadAndPrintPDF("".concat(me[n.id],"&timestamp=").concat((new Date).getTime()))):console.log("[PRINT] No link to pdf found")}function ze(e){F(e)}async function Ve(n){if(e.upgradeFromTicketToSubscriptionOnPos||e.upgradeSubscriptionToNewSubscription){const e=K.find((e=>e.subscriptionUid===n.id)),t=await(0,S.Pp)(n.customerUid,e.id);await Promise.all(t.filter((e=>"discount"!==e.lineType)).map((e=>q.Z.addProduct(e.productNumber,e.qty,e.linePrice/100,"".concat(R?"ATT".concat(R):"null",";").concat(n.currentEvent?"ATT".concat(n.currentEvent):"null",";").concat(n.id||"null",";").concat(e.productId||"null"))))),await Promise.all(t.filter((e=>"discount"===e.lineType)).map((e=>q.Z.ifVersion("4.1.17.03",">=",(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,-1)),(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,0))))))}else await Promise.all(Object.values(n.selectedProducts).map((e=>{const t=ge.find((n=>n.id===e.product)),s=t.prices.find((e=>"Sale"===e.type));return q.Z.addProduct(t.productNumber,1,s.price/100,"".concat(R?"ATT".concat(R):"null",";").concat(n.currentEvent?"ATT".concat(n.currentEvent):"null",";").concat(n.id||"null",";").concat(t&&t.id?t.id:"null"))})));await q.Z.closeBrowser()}(0,s.useEffect)((()=>{if(z&&H){const e=Me.Z.getStorage();Promise.all([...z,...H].map((async n=>{const t=e.ref("tickets/organisation/".concat(n.organisationUid,"/tickets/").concat(n.id,".pos.pdf")),s=await t.getDownloadURL().catch((()=>null));return{ticketId:n.id,url:s}}))).then((e=>{const n=e.reduce(((e,n)=>(e[n.ticketId]=n.url,e)),{});pe(n)}))}}),[z,H]);const He=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];W(e.id),L(e),n&&De(null),t&&(Ae(null),C(0))};return(0,I.jsxs)(N.Z,{children:[i,e.createCustomerFromAnonymousOnPos&&(0,I.jsx)(gn,{selectedCustomer:B,onCustomerSelect:e=>{W((n=>n||e)),w(!1)},handleWebExit:Le}),(0,I.jsx)(nn,{dialogOpen:Ee,goToCustomerTabFromScannerDialog:()=>{C(0),Ie(!1)},addEntry:async()=>{await q.Z.addProduct(Ue.productNumber,Ue.qty,Ue.overloadedPrice,Ue.eventUid),Ie(!1),await q.Z.closeBrowser()},addCustomerToBonFromScannerDialog:async()=>{Ie(!1),await q.Z.closeBrowser()},customer:B,subscriptions:_,scannerDialogEntryObj:Ue,handleWebExit:Le}),(0,I.jsx)(xn,{handleWebExit:Le,onCustomerSelect:e=>{W((n=>n||e)),w(!1)}}),(0,I.jsx)(Z.Z,{onCustomerSelect:e=>{W((n=>n||e)),w(!1)},open:T,onClose:()=>{w(!1),R||Le()}}),(0,I.jsx)(Qe,{open:!!O,ticket:O,onClose:e=>{F(null),e&&function(){const e=Me.Z.getStorage();Promise.all([...z,...H].map((async n=>{const t=e.ref("tickets/organisation/".concat(n.organisationUid,"/tickets/").concat(n.id,".pos.pdf")),s=await t.getDownloadURL().catch((()=>null));return{ticketId:n.id,url:s}}))).then((e=>{const n=e.reduce(((e,n)=>(e[n.ticketId]=n.url,e)),{});pe(n)}))}()}}),(0,I.jsxs)(r.Z,{className:"mb-10",value:j,variant:"fullWidth",children:[(0,I.jsx)(o.Z,{label:"Kontakt Oplysninger",value:0,onClick:()=>C(0)}),(!e.createSubcustomersOnFlexsdk||!Oe)&&(0,I.jsx)(o.Z,{label:"Ordre",value:1,onClick:()=>C(1)}),(0,I.jsx)(o.Z,{label:"Billetter",value:2,onClick:()=>C(2)}),(0,I.jsx)(o.Z,{label:"Medlemskort",value:3,onClick:()=>C(3)}),(0,I.jsx)(o.Z,{label:"Medlemskaber",value:4,onClick:()=>C(4)}),(!e.createSubcustomersOnFlexsdk||t.subscriptions&&t.subscriptions.subcustomers&&!Oe)&&(0,I.jsx)(o.Z,{label:"Underkunder",value:5,onClick:()=>C(5)})]}),(0,I.jsxs)("div",{className:"flex",children:[(0,I.jsxs)("div",{className:"w-full",children:[0===j&&(0,I.jsx)(qe,{customer:B,customerUid:R,membershipTickets:H,popAlertWithError:Ke,parentCustomer:Oe,goToCustomer:He}),1===j&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{variant:"h6",className:"",children:"Kundens Ordre"}),(0,I.jsx)("div",{ref:Ze,className:"overflow-hidden max-h-384",children:K&&K.length>0?K.map((n=>(0,I.jsx)(b.Z,{className:"rounded-none bg-gray-100 my-10 p-10",children:(0,I.jsx)("table",{className:"w-full",children:(0,I.jsx)("tbody",{children:(0,I.jsxs)("tr",{children:[(0,I.jsx)("td",{className:"w-400",children:(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{variant:"h6",className:"mb-8",children:n.orderNumber}),(0,I.jsx)(a.Z,{color:"textSecondary",children:x()(n.createdAt.toDate()).format("DD-MM-YYYY, HH:mm")}
1)]})}),(0,I.jsx)("td",{children:(0,I.jsx)(a.Z,{variant:"subtitle1",children:(0,I.jsx)(D,{statusKey:n.state})})}),(0,I.jsx)("td",{className:"w-76",children:(0,I.jsx)(a.Z,{variant:"subtitle1",className:"mr-16",children:n.totals&&n.totals.total?vn.format(n.totals.total/100):"-"})}),(0,I.jsx)("td",{className:"w-128",children:n.state===P.Z.RESERVED&&(0,I.jsx)(m.Z,{className:"rounded-none h-60",color:"primary",variant:"contained",onClick:()=>async function(n){if(n.subscriptionUid){const t=_.find((e=>e.id===n.subscriptionUid));t&&(e.upgradeFromTicketToSubscriptionOnPos||e.upgradeSubscriptionToNewSubscription?await Ve(t):await Promise.all(Object.values(t.selectedProducts).map((e=>{const n=ge.find((n=>n.id===e.product)),s=n.prices.find((e=>"Sale"===e.type));return q.Z.addProduct(n.productNumber,1,s.price/100,"".concat(R?"ATT".concat(R):"null",";").concat(t.currentEvent?"ATT".concat(t.currentEvent):"null",";").concat(t.id||"null",";").concat(n&&n.id?n.id:"null"))}))),await q.Z.closeBrowser())}}(n),children:"Tilf\xf8j til bon"})})]})})})}))):(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen ordrer p\xe5 denne kunde"})})]}),2===j&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{variant:"h6",className:"",children:"Kundens Billetter"}),(0,I.jsx)("div",{ref:Te,className:"overflow-hidden max-h-384",children:z&&z.length>0?z.map((e=>(0,I.jsx)(b.Z,{className:"rounded-none bg-gray-100 my-10 p-10",children:(0,I.jsx)("table",{className:"w-full",children:(0,I.jsx)("tbody",{children:(0,I.jsxs)("tr",{children:[(0,I.jsx)("td",{className:"w-400",children:(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{variant:"h6",className:"mb-8",children:e.name}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Billetnummer: ",e.ticketNumber]}),(0,I.jsx)(a.Z,{color:"textSecondary",children:x()(e.issueDate).format("DD-MM-YYYY, HH:mm")})]})}),(0,I.jsx)("td",{children:e.event&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{variant:"subtitle",className:"mb-8",children:"Begivenhedstidspunkt"}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Start:"," ",x()(e.event.start.toDate()).format("DD-MM-YYYY, HH:mm")]}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Slut:"," ",x()(e.event.end.toDate()).format("DD-MM-YYYY, HH:mm")]})]})}),(0,I.jsx)("td",{children:(0,I.jsx)(a.Z,{variant:"subtitle1",children:(0,I.jsx)(A,{statusKey:e.state})})}),(0,I.jsx)("td",{className:"w-76",children:(0,I.jsx)(a.Z,{variant:"subtitle1",className:"mr-16",children:e.price?vn.format(e.price/100):"-"})}),(0,I.jsx)("td",{className:"w-128",children:me[e.id]&&(0,I.jsx)(m.Z,{className:"rounded-none",color:"primary",variant:"contained",onClick:()=>Ye(e),children:"Print PDF"})})]})})})}))):(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen billetter p\xe5 denne kunde"})})]}),3===j&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{variant:"h6",className:"",children:"Kundens Medlemskort"}),(0,I.jsx)("div",{ref:we,className:"overflow-hidden max-h-384",children:H&&H.length>0?H.map((t=>(0,I.jsx)(b.Z,{className:"rounded-none bg-gray-100 my-10 p-10",children:(0,I.jsx)("table",{className:"w-full",children:(0,I.jsx)("tbody",{children:(0,I.jsxs)("tr",{children:[(0,I.jsx)("td",{className:"w-400",children:(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{variant:"h6",className:"mb-8",children:t.name}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Kortnummer: ",t.ticketNumber]}),(0,I.jsx)(a.Z,{color:"textSecondary",children:x()(t.issueDate).format("DD-MM-YYYY, HH:mm")})]})}),(0,I.jsx)("td",{children:t.event&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{variant:"subtitle",className:"mb-8",children:"Gyldighedsperiode"}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Fra:"," ",x()(t.event.start.toDate()).format("DD-MM-YYYY, HH:mm")]}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Til:"," ",x()(t.event.end.toDate()).format("DD-MM-YYYY, HH:mm")]})]})}),(0,I.jsx)("td",{children:(0,I.jsx)(a.Z,{variant:"subtitle1",children:(0,I.jsx)(A,{statusKey:t.state})})}),(0,I.jsx)("td",{className:"w-76",children:(0,I.jsx)(a.Z,{variant:"subtitle1",className:"mr-16",children:t.price?vn.format(t.price/100):"-"})}),(0,I.jsx)("td",{className:"w-128",children:me[t.id]&&(0,I.jsx)(m.Z,{className:"rounded-none h-60",color:"primary",variant:"contained",onClick:()=>Ye(t),children:"Print Kort"})}
1),e.addTilfojEntreButtonToFlexposSubscriptionsUi&&(0,I.jsx)("td",{className:"w-128",children:(0,I.jsx)(m.Z,{className:"rounded-none h-60",color:"primary",variant:"contained",onClick:()=>async function(n){let t="";if(t="attractionWeb"===n.origin?"ATT-Entry-Online":n.validations&&n.validations.some((e=>"use"===e.type))?"ATT-Entry-FP2":"ATT-Entry-FP1",e.directEntranceOnPosOffUseFp2OnValidation){const e=ge.find((e=>e.id===n.productId));e&&null!==e.directEntranceOnPosIfPossible&&void 0!==e.directEntranceOnPosIfPossible&&!e.directEntranceOnPosIfPossible&&(t="ATT-Entry-FP2")}await q.Z.addProduct(t,1,0,"FT".concat(n.ticketNumber)),Ie(!1),await q.Z.closeBrowser()}(t),disabled:!t||t.state!==E.Z.USED&&t.state!==E.Z.ISSUED,children:"Tilf\xf8j entr\xe9"})}),(0,I.jsx)("td",{className:"w-80",children:(0,I.jsx)(m.Z,{className:"rounded-none",color:"primary",variant:"contained",onClick:()=>(e=>{p((0,I.jsx)(f.Z,{open:!0,onClose:()=>p(null),children:(0,I.jsxs)(g.Z,{severity:"info",className:"".concat(n.modalPosition," border-2 border-blue-800"),children:[(0,I.jsx)(a.Z,{variant:"h6",component:"h6",children:"Kontrolkode"}),(0,I.jsx)(a.Z,{variant:"h5",component:"h5",className:"mt-10 text-center",children:e&&e.controlNumber})]})}))})(t),children:"Se kontrolkode"})}),(0,I.jsx)("td",{className:"w-128",children:(0,I.jsx)(m.Z,{className:"rounded-none",color:"primary",variant:"contained",onClick:()=>ze(t),children:"Nyt Kortnummer"})})]})})})}))):(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen medlemskort p\xe5 denne kunde"})})]}),4===j&&(0,I.jsxs)(I.Fragment,{children:[ae&&(0,I.jsx)(Re,{open:ae,onClose:()=>{ce(!1),$(null)},customerUid:R,popAlertWithError:Ke,flexposCustomerUid:B?B.flexposCustomerUid:null,products:ge,subscriptionTypes:xe,membershipTickets:H,subscriptions:_,orders:K,onCreate:e=>{ze(e[0])},parentCustomer:Oe,handlePrintPDF:Ye,upgrade:e.upgradeSubscriptionToNewSubscription&&X?X:null}),e.redeemGiftSubscriptionOnPos&&t.giftSubscriptions&&(0,I.jsx)(fn,{open:oe,onClose:()=>re(!1),customerUid:R,popAlertWithError:Ke,membershipTickets:H,onCreate:e=>{ze(e[0])},products:ge}),(0,I.jsx)(Xe,{onTerminate:async function(e,n,t,s,i){(e||n||t||s||i)&&(he(!0),await(0,S.TO)(de.id,R,{terminateSubscription:e,blockTickets:n,refundNewestOrder:t,sendReceipt:s,reason:i,orderToRefund:je?je.id:null,ticketsToBlock:ye?ye.map((e=>e.id)):[]}),he(!1)),ue(null)},loading:be,open:de,orderToRefund:je,state:de&&de.state?de.state:null}),ee&&(0,I.jsx)(Se,{maxWidth:"sm",fullWidth:!0,loading:be,open:ee,onClose:async function(e){const n=ee;if(!1!==e&&te&&ie){he(!0);const t=te;t.setHours(ie.getHours()),t.setMinutes(ie.getMinutes()),t.setSeconds(ie.getSeconds()),1===e&&await(0,S.RP)(n.customerUid,n.id,t.getTime(),!1),2===e&&await(0,S.RP)(n.customerUid,n.id,t.getTime(),!0),he(!1)}ne(!1),ne(null)},icon:null,bigButtons:!0,buttons:[{label:"Annuller",result:!1,variant:"outlined",color:"primary"},{label:"\xc6ndre Dato",result:1,variant:"outlined",color:"secondary"},{label:"\xc6ndre og send ny billet email",result:2,variant:"contained",color:"primary"}],content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"h2",children:"\xc6ndre slut dato"}),(0,I.jsx)(a.Z,{className:"h3 mb-20",children:"V\xe6lg hvad du vil \xe6ndre datoen til"}),(0,I.jsx)(an,{className:"mt-4 mr-12 ml-10 inline-block",id:"endDate",name:"endDate",label:"Dato",value:te||null,onChange:e=>{e&&e._isValid&&se(e.toDate())},onAccept:e=>{se(e.toDate())},clearable:!0}),(0,I.jsx)(sn,{id:"endTime",className:"mt-4 mr-12 ml-10 inline-block",name:"startTime",label:"Tid",value:ie||null,onChange:e=>{e&&e._isValid&&le(e.toDate())},onAccept:e=>{le(e.toDate())},clearable:!0})]})}),(0,I.jsxs)("div",{className:"flex justify-between",children:[(0,I.jsx)(a.Z,{variant:"h6",children:"Kundens Medlemskaber"}),e.redeemGiftSubscriptionOnPos&&t.giftSubscriptions?(0,I.jsxs)(h.Z,{children:[(0,I.jsx)(m.Z,{className:"h-48 px-28 rounded-none",color:"primary",variant:"outlined",onClick:()=>re(!0),disabled:!B,children:"Indl\xf8s gavekort"}),(0,I.jsx)(m.Z,{className:"h-48 px-28 rounded-none",color:"primary",variant:"outlined",onClick:()=>ce(!0),disabled:!B||!1,children:"Opret medlemskab"})]}):(0,I.jsx)(m.Z,{className:"h-48 px-28 rounded-none",color:"primary",variant:"outlined",onClick:()=>ce(!0),disabled:!B,children:"Opret medlemskab"})]}),(0,I.jsx)("div",{ref:Pe,className:"overflow-hidden max-h-384",children:_&&_.length>0?_.map((n=>{const t=H?H.find((e=>e.subscriptionUid===n.id)):null;return(0,I.jsx)(b.Z,{className:"rounded-none bg-gray-100 my-10 p-10",children:(0,I.jsx)("table",{className:"w-full",children:(0,I.jsx)("tbody",{children:(0,I.jsxs)("tr",{children:[(0,I.jsx)("td",{className:"w-400",children:(0,I.jsxs)("div",{children:[(0,I.jsx)(a.Z,{variant:"h6",className:"mb-8",children:n.name}),(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Medlemskabsnummer:"," ",n.subscriptionNumber]}),t&&t.event&&t.event.start&&t.event.end&&(0,I.jsxs)(a.Z,{color:"textSecondary",children:["Gyldig:"," ",x()(t.event.start.toDate()).format("DD-MM-YYYY")," - ",x()(t.event.end.toDate()).format("DD-MM-YYYY")]})]})}),(0,I.jsx)("td",{children:(0,I.jsx)(a.Z,{variant:"subtitle1",children:(0,I.jsx)(M,{statusKey:n.state})})}),(0,I.jsx)("td",{className:"w-76",children:(0,I.jsx)(a.Z,{variant:"subtitle1",className:"mr-16",children:n.subscriptionPrice?vn.format(n.subscriptionPrice/100):"-"})}),e.upgradeSubscriptionToNewSubscription&&(0,I.jsx)("td",{className:"w-128",children:(0,I.jsx)(m.Z,{className:"rounded-none h-60 w-full",color:"primary",variant:"contained",onClick:()=>function(e){ce(!0),$(e)}(n),children:"Opgrader"})}),(0,I.jsx)("td",{className:"w-128",children:n.state===U.Z.RESERVED?(0,I.jsx)(m.Z,{className:"rounded-none h-60 w-full",color:"primary",variant:"contained",onClick:()=>Ve(n),children:"Tilf\xf8j til bon"}):(0,I.jsx)(m.Z,{className:"rounded-none h-60 w-full",color:"primary",variant:"contained",onClick:()=>function(e){const n=H.find((n=>n.subscriptionUid===e.id));n&&n.event&&n.event.end&&(le(n.event.end.toDate()),se(n.event.end.toDate()),ne(e))}
1(n),children:"\xc6ndre Periode"})}),(0,I.jsx)("td",{className:"w-128",children:(n.state===U.Z.ACTIVE||n.state===U.Z.RESERVED||n.state===U.Z.PAYMENT)&&(0,I.jsx)(m.Z,{className:"rounded-none h-60 w-full",color:"primary",variant:"contained",onClick:()=>ue(n),children:"Opsig/Refund\xe9r"})})]})})})},"paper-".concat(n.id))})):(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen medlemskaber p\xe5 denne kunde"})})]}),5===j&&(0,I.jsx)(hn,{customer:B,associatedCustomers:Fe,goToCustomer:He})]}),(0,I.jsx)("div",{children:(0,I.jsxs)("div",{className:"flex flex-col justify-between p-10 w-60 h-360",children:[(0,I.jsx)("div",{className:"h-20"}),(0,I.jsx)(c.Z,{fontSize:"large",onClick:()=>{let e=Ze;2===j&&(e=Te),3===j&&(e=we),4===j&&(e=Pe),e.current.scrollTop-=100}}),(0,I.jsx)(k.Z,{fontSize:"large",onClick:function(){W(null)}}),(0,I.jsx)(d.Z,{fontSize:"large",onClick:Le}),(0,I.jsx)(u.Z,{fontSize:"large",onClick:()=>{let e=Ze;2===j&&(e=Te),3===j&&(e=we),4===j&&(e=Pe),e.current.scrollTop+=100}})]})})]})]})};var yn=t(68049),Nn=t(26532);const Zn=function(e){var n;let{onExit:t,onBack:i,onAddCustomer:o}=e;const r=(0,l.useFlags)(),c=(0,y.I0)(),d=(0,y.v9)(ee.q0),u=(0,y.v9)(ee.H5),m=(0,y.v9)(Q.UK),p=(0,y.v9)(Q.SO),x=(0,y.v9)(Q.EW),f=(0,y.v9)(Q.U8),b=(0,y.v9)((e=>(0,ee.NH)(e,"webcam"))),h={firstname:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.firstname?u.contactInfo.billing.firstname:"",lastname:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.lastname?u.contactInfo.billing.lastname:"",email:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.email?u.contactInfo.billing.email:"",phone:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.phone?u.contactInfo.billing.phone:"",postalCode:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.postalCode?u.contactInfo.billing.postalCode:"",city:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.city?u.contactInfo.billing.city:"",address:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.address?u.contactInfo.billing.address:"",countryCode:u.contactInfo&&u.contactInfo.billing&&u.contactInfo.billing.countryCode?u.contactInfo.billing.countryCode:null,acceptSMSForSubscription:void 0!==u.acceptSMSForSubscription?u.acceptSMSForSubscription:null!==(n=null===p||void 0===p?void 0:p.preselectSMSForSubscription)&&void 0!==n&&n,acceptEmailForSubscription:u.acceptEmailForSubscription||!1,newsletterOptIn:u.newsletterOptIn||!1,companyName:u.companyName||"",companyType:u.companyType||"",note:u.note||""},{watch:g,setValue:v,control:j,formState:k,handleSubmit:N}=(0,Ge.cI)({mode:"onChange",defaultValues:h}),Z=g(),{isValid:S}=k,C=(0,s.useMemo)((()=>r.disableSaveForDefaultCustomersOnPos&&u&&u.id&&p&&p.defaultCustomerUids&&p.defaultCustomerUids.includes(u.id)),[r.disableSaveForDefaultCustomersOnPos,p,u]),w=(0,s.useMemo)((()=>!T().isEqual(h,Z)),[h,Z]);(0,s.useEffect)((()=>{c((0,ee.KE)(w))}),[w,c]);const P=(0,s.useMemo)((()=>!!x||!!r.flexsdkSubscriptionImprovements&&(p&&p.flexsdkSidebarButtons&&!p.flexsdkSidebarButtons.includes("profilePicture"))),[x,p,r.flexsdkSubscriptionImprovements]),E=(0,s.useMemo)((()=>u&&u.contactInfo&&u.contactInfo.billing?"".concat(u.contactInfo.billing.firstname," ").concat(u.contactInfo.billing.lastname):"Ukendt kunde"),[u]);function O(e){return d?["firstname","lastname"].includes(e):p&&p.requiredCustomerFields&&p.requiredCustomerFields.includes(e)}function D(e){return p&&p.disableCustomerFieldValidation&&p.disableCustomerFieldValidation.includes(e)}function F(e){return!r.flexsdkSubscriptionImprovements||p&&p.flexsdkSidebarButtons&&p.flexsdkSidebarButtons.includes(e)}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"flex justify-between mb-64 mt-32",children:[(0,I.jsx)(be.Z,{size:"small",onClick:i,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"arrow_back"})}),(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{variant:"h6",className:"font-bold",children:"Kundens kontaktoplysninger"}),(0,I.jsx)(a.Z,{variant:"h6",className:"text-12 font-normal",color:"textSecondary",children:E})]}),(0,I.jsx)(be.Z,{size:"small",onClick:t,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"exit_to_app"})})]}),(0,I.jsxs)("form",{onSubmit:N((function(){console.log("[CUSTOMER] Clicking save customer");const e={...Z},n={contactInfo:{},acceptSMSForSubscription:e.acceptSMSForSubscription,acceptEmailForSubscription:e.acceptEmailForSubscription,newsletterOptIn:e.newsletterOptIn};Object.entries(e).forEach((e=>{let[t,s]=e;["newsletterOptIn","acceptEmailForSubscription","acceptSMSForSubscription"].includes(t)||(n.contactInfo[t]=s)}
1)),Object.entries(Z).forEach((e=>{let[t,s]=e;n.contactInfo[t]||["newsletterOptIn","acceptEmailForSubscription","acceptSMSForSubscription"].includes(t)||(n.contactInfo[t]=s)})),r.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions?(n.contactInfo&&void 0!==n.contactInfo.companyName&&delete n.contactInfo.companyName,n.contactInfo&&void 0!==n.contactInfo.companyType&&delete n.contactInfo.companyType,n.contactInfo&&void 0!==n.contactInfo.note&&delete n.contactInfo.note,n.companyName=e.companyName,n.companyType=e.companyType,n.note=e.note):(delete n.contactInfo.companyName,delete n.contactInfo.companyType,delete n.contactInfo.note,delete n.companyName,delete n.companyType,delete n.note),!r.salesToOtherCountries&&n.contactInfo&&void 0!==n.contactInfo.countryCode&&delete n.contactInfo.countryCode,c((0,ee.uG)(u.id,n))})),children:[(0,I.jsxs)("div",{className:"flex",children:[(!r.flexsdkSubscriptionImprovements||!p||!p.flexsdkSidebarButtons||p.flexsdkSidebarButtons.length>0)&&(0,I.jsxs)("div",{className:"mr-10",children:[!P&&(0,I.jsx)(He,{fromNewDesign:!0,src:u&&u.data&&u.data.photoURL?u.data.photoURL:null,awaiting:u&&u.data&&u.data.photoWaiting?u.data.photoWaiting:null,onAvatarChange:async function(e){c((0,ee.bW)("webcam")),await(0,ee.KU)(u.id,{"data.photoURL":"https://storage.googleapis.com/".concat(Me.Z.getProjectId(),".appspot.com/").concat(e)}),c((0,ee.iP)("webcam"))},onAvatarConfirm:async function(){c((0,ee.bW)("webcam")),await(0,ee.KU)(u.id,{"data.photoURL":u.data.photoWaiting,"data.photoWaiting":null}),c((0,ee.iP)("webcam"))},loading:!!b,disabled:C}),(0,I.jsxs)("div",{className:"flex flex-col w-192",children:[F("sendActivateLink")&&(0,I.jsx)(de,{variant:"outlined",color:"primary",onClick:function(){u&&!u.email_verified&&c((0,ee.h1)(u.id))},className:"w-full",loading:"sendConfirmationMail",fullWidth:!0,help:{message:"Send et aktiveringslink til kunden, for at kunden kan aktivere sin online bruger",placement:"right"},disabled:C,children:"Send aktiveringslink"}),F("addCustomer")&&(0,I.jsxs)(de,{variant:"outlined",color:"primary",onClick:async function(){c((0,ee.bW)("addCustomer")),await o(),c((0,ee.iP)("addCustomer"))},loading:"addCustomer",className:"w-full",wrapperClassName:"mt-10",fullWidth:!0,disabled:!u.flexposCustomerUid||C,buttonClasses:{label:"flex-col"},help:{message:"Tilf\xf8j kunden til bonnen, s\xe5fremt synkronisering er aktiveret",placement:"bottom"},children:[(!u||!u.flexposCustomerUid)&&(0,I.jsxs)("div",{className:"flex flex-col",children:[(0,I.jsx)(a.Z,{className:"block text-13 font-bold",children:"Tilf\xf8j kunde til bon"}),(0,I.jsx)(a.Z,{className:"text-10 -mt-4 block",children:"(kunde synkronisering deaktiveret)"})]}),(null===u||void 0===u?void 0:u.flexposCustomerUid)&&"Tilf\xf8j kunde til bon"]})]})]}),(0,I.jsx)("div",{className:"w-full flex-grow ml-10",children:(0,I.jsxs)(We.ZP,{container:!0,spacing:2,children:[(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,label:"Fornavn",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"firstname",value:Z.firstname,required:O("firstname"),validations:D("firstname")?void 0:{minLength:2},validationErrors:D("firstname")?void 0:{minLength:"Fornavn skal indeholde mindst 2 tegn"},onChange:e=>v("firstname",e.currentTarget.value)})}),(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,label:"Efternavn",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",name:"lastname",value:Z.lastname,required:O("lastname"),validations:D("lastname")?void 0:{minLength:2},validationErrors:D("lastname")?void 0:{minLength:"Efternavn skal indeholde mindst 2 tegn"},onChange:e=>v("lastname",e.currentTarget.value)})}),(0,I.jsx)(We.ZP,{item:!0,sm:12,children:(0,I.jsx)(_e.Z,{control:j,label:"Adresse",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"address",value:Z.address,required:O("address"),validations:D("address")?void 0:{minLength:2},validationErrors:D("address")?void 0:{minLength:"Adressen skal indeholde mindst 2 tegn"},onChange:e=>v("address",e.currentTarget.value)})}),(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,label:"Postnummer",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"postalCode",value:Z.postalCode,required:O("postalCode"),validations:D("postalCode")?void 0:{minLength:3,maxLength:4,isNumeric:!0}
1,validationErrors:D("postalCode")?void 0:{minLength:"Postnummer skal indeholde 3-4 tegn",maxLength:"Postnummer skal indeholde 3-4 tegn",isNumeric:"Postnummer skal indeholde tal"},onChange:e=>v("postalCode",e.currentTarget.value)})}),(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,label:"By",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"city",value:Z.city,required:O("city"),validations:D("city")?void 0:{minLength:1},validationErrors:D("city")?void 0:{minLength:"Bynavn skal indeholde mindst 1 tegn"},onChange:e=>v("city",e.currentTarget.value)})}),r.salesToOtherCountries&&(0,I.jsx)(We.ZP,{item:!0,sm:12,children:(0,I.jsx)(V.Z,{className:"w-full",fullWidth:!0,variant:"outlined",id:"countryCode",name:"countryCode",options:Object.keys(f),value:Z.countryCode,onChange:async(e,n)=>{v("countryCode",n)},getOptionLabel:e=>{if(!f[e])return"-";const{name:n}=f[e];return n||"-"},renderInput:e=>(0,I.jsx)(z.Z,{...e,variant:"outlined",InputLabelProps:{shrink:!0},size:"small",label:"Land".concat(O("countryCode")?" *":"")}
1),openOnFocus:!0,required:O("countryCode")})}),(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,label:"Email",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"email",value:Z.email,required:O("email"),validations:D("email")?void 0:{isEmail:!0},validationErrors:D("email")?void 0:{isEmail:"Dette skal v\xe6re en gyldig email"},onChange:e=>v("email",e.currentTarget.value)})}),(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,label:"Telefonnummer",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"phone",value:Z.phone,required:O("phone"),validations:D("phone")?void 0:{minLength:8,maxLength:11,isNumeric:!0},validationErrors:D("phone")?void 0:{minLength:"Telefonnummer skal v\xe6re imellem 8-11 tegn",maxLength:"Telefonnummer skal v\xe6re imellem 8-11 tegn",isNumeric:"Telefonnummer skal indeholde tal"},onChange:e=>v("phone",e.currentTarget.value)})}),r.addedMemoAttAndErpFromFlexposWhenImportingSubscriptions&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"companyName",label:"Firmanavn",value:Z.companyName,required:O("companyName"),onChange:e=>v("companyName",e.currentTarget.value)})}),(0,I.jsx)(We.ZP,{item:!0,sm:6,children:(0,I.jsx)(_e.Z,{control:j,size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},name:"companyType",label:"Firmatype",value:Z.companyType,required:O("companyType"),onChange:e=>v("companyType",e.currentTarget.value)})}),(0,I.jsx)(We.ZP,{item:!0,sm:12,children:(0,I.jsx)(_e.Z,{control:j,label:"Note",size:"small",variant:"outlined",fullWidth:!0,className:"w-full",InputLabelProps:{shrink:!0},multiline:!0,name:"note",value:Z.note,required:O("note"),onChange:e=>v("note",e.currentTarget.value)})})]}),m&&m.createCustomersBySMS&&(0,I.jsx)(We.ZP,{item:!0,sm:12,children:(0,I.jsx)(Ke.Z,{className:"-mt-10",children:(0,I.jsx)(Be.Z,{control:(0,I.jsx)(Le.Z,{checked:Z.acceptSMSForSubscription,color:"primary",name:"acceptSMSForSubscription"}),label:"Ja til modtagelse af SMS vedr. medlemskaber",onChange:e=>{v("acceptSMSForSubscription",e.target.checked)}})})}),r.emailSubscription&&(0,I.jsx)(We.ZP,{item:!0,sm:12,children:(0,I.jsx)(Ke.Z,{className:"-mt-20",children:(0,I.jsx)(Be.Z,{control:(0,I.jsx)(Le.Z,{checked:Z.newsletterOptIn,color:"primary",name:"newsletterOptIn"}),label:"Tilmeld nyhedsbrev",onChange:e=>{v("newsletterOptIn",e.target.checked)}})})})]})})]}),(0,I.jsx)(de,{type:"submit",variant:w?"contained":"outlined",color:"primary",fullWidth:!0,className:"w-full mt-20 h-40 text-18",disabled:!S||C,loading:"updateCustomer",help:{message:"Gemmer oplysningerne som er indtastet herover p\xe5 kunden",placement:"top"},children:"GEM"}),!S&&(0,I.jsx)(a.Z,{className:"text-12 text-red-300",children:"Tjek at alle p\xe5kr\xe6vet felter er udfyldt korrekt"}),C&&(0,I.jsx)(a.Z,{className:"text-12 text-red-300",children:"\xc6ndringer kan ikke gemmes p\xe5 standard kunder"})]})]})},Sn=(0,te.Z)({root:{border:".2rem solid rgba(0, 0, 0, .125)",borderRadius:"0.4rem",boxShadow:"none",marginBottom:"1rem","&.Mui-expanded ":{marginTop:"0",marginBottom:"1rem"}}})(fe.Z);const Cn=function(e){return(0,I.jsx)(Sn,{...e})},Tn=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2});const wn=function(e){let{onBack:n,onExit:t}=e;const i=(0,y.I0)(),l=(0,y.v9)(ee.H5),o=(0,y.v9)(ee.ny),r=(0,s.useMemo)((()=>l&&l.contactInfo&&l.contactInfo.billing?"".concat(l.contactInfo.billing.firstname," ").concat(l.contactInfo.billing.lastname):"Ukendt kunde"),[l]);return(0,s.useEffect)((()=>{if(!l||!l.id)return()=>{};const e=i((0,ee.yQ)(l.id));return()=>e()}),[i,l]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"flex justify-between mb-64 mt-32",children:[(0,I.jsx)(be.Z,{size:"small",onClick:n,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"arrow_back"})}),(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{variant:"h6",className:"font-bold",children:"Kundens ordrer"}),(0,I.jsx)(a.Z,{variant:"h6",className:"text-12 font-normal",color:"textSecondary",children:r})]}),(0,I.jsx)(be.Z,{size:"small",onClick:t,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"exit_to_app"})})]}),(!o||o.length<=0)&&(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen ordrer p\xe5 denne kunde"}),o&&o.length>0&&o.map((e=>
1(0,I.jsxs)(Cn,{children:[(0,I.jsx)(pe.Z,{expandIcon:(0,I.jsx)(H.Z,{color:"inherit",className:"text-black",children:"expand_more"}),children:(0,I.jsxs)(We.ZP,{container:!0,children:[(0,I.jsxs)(We.ZP,{item:!0,sm:4,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Ordre"}),(0,I.jsxs)(a.Z,{children:["Ordre #",e.orderNumber]}),(0,I.jsxs)(a.Z,{children:["Betalt: ",x()(e.createdAt.toDate()).format("DD-MM-YYYY, HH:mm")]})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:4,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Status"}),(0,I.jsx)(D,{statusKey:e.state})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:4,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Total"}),(0,I.jsx)(a.Z,{children:Tn.format(e.totals.total/100)})]})]})}),(0,I.jsx)(xe.Z,{children:e.state===P.Z.RESERVED&&(0,I.jsx)(m.Z,{className:"rounded-none h-60",color:"primary",variant:"contained",onClick:()=>{},children:"Tilf\xf8j til bon"})})]})))]})},Pn=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2});const En=function(e){let{onBack:n,onExit:t}=e;const i=(0,l.useFlags)(),o=(0,y.I0)(),r=(0,y.v9)(ee.H5),c=(0,y.v9)(ee.q0),d=(0,y.v9)(ee.Tz),u=(0,y.v9)(ee.Fd),m=(0,s.useMemo)((()=>r&&r.contactInfo&&r.contactInfo.billing?"".concat(r.contactInfo.billing.firstname," ").concat(r.contactInfo.billing.lastname):"Ukendt kunde"),[r]);return(0,s.useEffect)((()=>{if(!r||!r.id)return()=>{};const e=o((0,ee.dn)(r.id));return()=>e()}),[o,r,i.createSubcustomersOnFlexsdk,c]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"flex justify-between mb-64 mt-32",children:[(0,I.jsx)(be.Z,{size:"small",onClick:n,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"arrow_back"})}),(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{variant:"h6",className:"font-bold",children:"Kundens billetter"}),(0,I.jsx)(a.Z,{variant:"h6",className:"text-12 font-normal",color:"textSecondary",children:m})]}),(0,I.jsx)(be.Z,{size:"small",onClick:t,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"exit_to_app"})})]}),(!d||d.length<=0)&&(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen billetter p\xe5 denne kunde"}),d&&d.length>0&&d.map((e=>(0,I.jsxs)(Cn,{children:[(0,I.jsx)(pe.Z,{expandIcon:(0,I.jsx)(H.Z,{color:"inherit",className:"text-black",children:"expand_more"}),children:(0,I.jsxs)(We.ZP,{container:!0,children:[(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Billet"}),(0,I.jsx)(a.Z,{children:e.name}),(0,I.jsxs)(a.Z,{children:["Billetnummer: ",e.ticketNumber]}),(0,I.jsxs)(a.Z,{children:["Udstedt: ",x()(e.issueDate).format("DD-MM-YYYY, HH:mm")]})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Status"}),(0,I.jsx)(A,{statusKey:e.state})]}),(0,I.jsx)(We.ZP,{item:!0,sm:3,children:e.event&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Gyldighed"}),(0,I.jsxs)(a.Z,{children:["Start: ",x()(e.event.start.toDate()).format("DD-MM-YYYY, HH:mm")]}),(0,I.jsxs)(a.Z,{children:["Slut: ",x()(e.event.end.toDate()).format("DD-MM-YYYY, HH:mm")]})]})}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"V\xe6rdi"}),(0,I.jsx)(a.Z,{children:Pn.format(e.price/100)})]})]})}),(0,I.jsx)(xe.Z,{children:(0,I.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"printCard-".concat(e.id),fullWidth:!0,onClick:()=>function(e){u[e.id]?(o((0,ee.bW)("printCard-".concat(e.id))),q.Z.downloadAndPrintPDF("".concat(u[e.id],"&timestamp=").concat((new Date).getTime())).catch((e=>o((0,ee.sT)("Der skete en fejl under print af kort: ".concat(e.message))))).finally((()=>o((0,ee.iP)("printCard-".concat(e.id)))))):o((0,ee.sT)("Der skete en fejl under print af kort: Der er ingen PDF p\xe5 billetten"))}(e),disabled:!u[e.id],children:"Print kort"})})})]})))]})},In=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2});const On=function(e){let{onExit:n,onBack:t,onAddEntry:i}=e;
1const{changedWhenToDownloadPdfFilesOnFlexpos:o,flexsdkSubscriptionImprovements:r}=(0,l.useFlags)(),c=(0,y.I0)(),d=(0,y.v9)(ee.H5),u=(0,y.v9)(ee.cU),m=(0,y.v9)(ee.Fd),p=(0,y.v9)(Q.SO),[f,b]=(0,s.useState)(null),h=(0,s.useMemo)((()=>d&&d.contactInfo&&d.contactInfo.billing?"".concat(d.contactInfo.billing.firstname," ").concat(d.contactInfo.billing.lastname):"Ukendt kunde"),[d]);function g(e){return!r||p&&p.flexsdkMembercardButtons&&p.flexsdkMembercardButtons.includes(e)}return(0,s.useEffect)((()=>{if(!d||!d.id)return()=>{};const e=c((0,ee.dn)(d.id));return()=>e()}),[c,d]),(0,s.useEffect)((()=>{u&&c((0,ee.Mv)(u))}),[c,u]),(0,I.jsxs)(I.Fragment,{children:[f&&(0,I.jsx)(Se,{open:!!f,onClose:()=>b(null),icon:null,content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{variant:"h5",children:"Bilettens kontrolkode er:"}),(0,I.jsx)(a.Z,{variant:"h6",children:f.controlNumber})]}),okButton:"Okay"}),(0,I.jsxs)("div",{className:"flex justify-between mb-64 mt-32",children:[(0,I.jsx)(be.Z,{size:"small",onClick:t,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"arrow_back"})}),(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{variant:"h6",className:"font-bold",children:"Kundens medlemskort"}),(0,I.jsx)(a.Z,{variant:"h6",className:"text-12 font-normal",color:"textSecondary",children:h})]}),(0,I.jsx)(be.Z,{size:"small",onClick:n,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"exit_to_app"})})]}),(!u||u.length<=0)&&(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen medlemskort p\xe5 denne kunde"}),u&&u.length>0&&u.map(((e,n)=>(0,I.jsxs)(Cn,{defaultExpanded:0===n,children:[(0,I.jsx)(pe.Z,{expandIcon:(0,I.jsx)(H.Z,{color:"inherit",className:"text-black",children:"expand_more"}),children:(0,I.jsxs)(We.ZP,{container:!0,children:[(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Medlemskort"}),(0,I.jsx)(a.Z,{children:e.name}),(0,I.jsxs)(a.Z,{children:["Kortnummer: ",e.ticketNumber]}),(0,I.jsxs)(a.Z,{children:["Udstedt: ",x()(e.issueDate).format("DD-MM-YYYY, HH:mm")]})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Status"}),(0,I.jsx)(A,{statusKey:e.state})]}),(0,I.jsx)(We.ZP,{item:!0,sm:3,children:e.event&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Gyldighed"}),(0,I.jsxs)(a.Z,{children:["Start: ",x()(e.event.start.toDate()).format("DD-MM-YYYY, HH:mm")]}),(0,I.jsxs)(a.Z,{children:["Slut: ",x()(e.event.end.toDate()).format("DD-MM-YYYY, HH:mm")]})]})}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"V\xe6rdi"}),(0,I.jsx)(a.Z,{children:In.format(e.price/100)})]})]})}),(0,I.jsx)(xe.Z,{children:(0,I.jsxs)("div",{className:"flex items-center justify-between w-full -mx-10",children:[g("printCard")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"printCard-".concat(e.id),fullWidth:!0,onClick:()=>async function(e){if(console.log("[PRINT] Clicked print card for ticket ".concat(e.id)),m[e.id])if(c((0,ee.bW)("printCard-".concat(e.id))),o){const n=Me.Z.getStorage().ref("tickets/organisation/".concat(e.organisationUid,"/tickets/").concat(e.id,".pos.pdf")),t=await n.getDownloadURL().catch((()=>null));t?(console.log("[PRINT] Sending newly generated URL to FlexSDK: ".concat(t)),q.Z.downloadAndPrintPDF("".concat(t,"&timestamp=").concat((new Date).getTime())).catch((e=>c((0,ee.sT)("Der skete en fejl under print af kort: ".concat(e.message))))).finally((()=>c((0,ee.iP)("printCard-".concat(e.id)))))):(console.log("[PRINT] Sending cached URL to FlexSDK: ".concat(m[e.id])),q.Z.downloadAndPrintPDF("".concat(m[e.id],"&timestamp=").concat((new Date).getTime())).catch((e=>c((0,ee.sT)("Der skete en fejl under print af kort: ".concat(e.message))))).finally((()=>c((0,ee.iP)("printCard-".concat(e.id))))))}else console.log("[PRINT] Sending cached URL to FlexSDK: ".concat(m[e.id])),q.Z.downloadAndPrintPDF("".concat(m[e.id],"&timestamp=").concat((new Date).getTime())).catch((e=>c((0,ee.sT)("Der skete en fejl under print af kort: ".concat(e.message))))).finally((()=>c((0,ee.iP)("printCard-".concat(e.id)))));else console.log("[PRINT] No link to pdf found"),c((0,ee.sT)("Der skete en fejl under print af kort: Der er ingen PDF p\xe5 billetten"))}(e),disabled:!m[e.id],help:{message:"Printer oplysninger p\xe5 et fysisk kort",placement:"bottom"},children:"Print kort"}),g("printCard")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"showControlCode-".concat(e.id),fullWidth:!0,onClick:()=>function(e){b(e)}(e),disabled:!e.controlNumber,help:{message:"Se kontrolkoden for den p\xe5g\xe6ldende billet",placement:"bottom"},children:"Se kontrolkode"}),p&&p.automaticSendMailWhenCardNumberChange&&g("resendTicketNumber")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"resendTicketNumber-".concat(e.id),onClick:()=>function(e){c((0,ee.uC)(e.customerUid,e.orderUid,e.id))}(e),help:{message:"Gensender kortnummeret til kunden pr. mail",placement:"bottom"},children:"Gensend kortnummer"}),g("addEntry")&&(0,I.jsx)(de,{variant:"contained",color:"primary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"addEntry-".concat(e.id),onClick:()=>async function(e){c((0,ee.bW)("addEntry-".concat(e.id)));const n=await(0,S.li)(e.ticketNumber).catch((()=>null));null!==n&&void 0!==n&&n.success?i(e).catch((e=>c((0,ee.sT)("Der skete en fejl under tilf\xf8jelse af entr\xe9 til bonnen: ".concat(e.message))))).finally((()=>setTimeout((()=>c((0,ee.iP)("addEntry-".concat(e.id)))),1e3))):(c((0,ee.sT)("Billetten er ugyldig eller udl\xf8bet, du kan derfor ikke tilf\xf8je entr\xe9")),setTimeout((()=>c((0,ee.iP)("addEntry-".concat(e.id)))),1e3))}(e),disabled:!e||e.state!==E.Z.USED&&e.state!==E.Z.ISSUED,help:{message:"Tilf\xf8jer en entr\xe9 til bonnen for dette medlemskort",placement:"bottom"},children:"Tilf\xf8j entr\xe9"}),g("newMembercardNumber")&&(0,I.jsx)(de,{variant:"contained",color:"primary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"reissueNumber-".concat(e.id),onClick:()=>function(e){c((0,ee.d9)(e))}(e),help:{message:"Erstat det nuv\xe6rende kortnummer med et nyt",placement:"bottom"},children:"Nyt kortnummer"})]})})]})))]})};var Dn=t(56900);const Fn=function(e){let{open:n,onClose:t,subscription:i}=e;
1const[l,o]=(0,s.useState)(!1),[r,c]=(0,s.useState)(i&&i.ticket&&i.ticket.event&&i.ticket.event.end?i.ticket.event.end.toDate():null),[d,u]=(0,s.useState)(i&&i.ticket&&i.ticket.event&&i.ticket.event.end?i.ticket.event.end.toDate():null);return(0,I.jsx)(Se,{maxWidth:"sm",fullWidth:!0,loading:l,open:n,onClose:async function(e){if(!1!==e&&r&&d){o(!0);const n=r;n.setHours(d.getHours()),n.setMinutes(d.getMinutes()),n.setSeconds(d.getSeconds()),1===e&&await(0,S.RP)(i.customerUid,i.id,n.getTime(),!1),2===e&&await(0,S.RP)(i.customerUid,i.id,n.getTime(),!0),o(!1)}t()},icon:null,bigButtons:!0,buttons:[{label:"Annuller",result:!1,variant:"outlined",color:"primary"},{label:"\xc6ndre Dato",result:1,variant:"outlined",color:"secondary"},{label:"\xc6ndre og send ny billet email",result:2,variant:"contained",color:"primary"}],content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"h2",children:"\xc6ndre slut dato"}),(0,I.jsx)(a.Z,{className:"h3 mb-20",children:"V\xe6lg hvad du vil \xe6ndre datoen til"}),(0,I.jsx)(an,{className:"mt-4 mr-12 ml-10 inline-block",id:"endDate",name:"endDate",label:"Dato",value:r||null,onChange:e=>{e&&e._isValid&&c(e.toDate())},onAccept:e=>{c(e.toDate())},clearable:!0}),(0,I.jsx)(sn,{id:"endTime",className:"mt-4 mr-12 ml-10 inline-block",name:"startTime",label:"Tid",value:d||null,onChange:e=>{e&&e._isValid&&u(e.toDate())},onAccept:e=>{u(e.toDate())},clearable:!0})]})})};var An=t(71271),Un=t.n(An);const Rn=function(e){let{open:n,onClose:t,subscription:i,onAddCustomer:o}=e;const r=(0,l.useFlags)(),c=(0,y.I0)(),[d,u]=(0,s.useState)(!0),[p,x]=(0,s.useState)(!1),[f,b]=(0,s.useState)(void 0),[h,g]=(0,s.useState)(!1),v=(0,s.useRef)(!1),j=(0,y.v9)(ee.ny),k=(0,y.v9)(ee.gq),N=(0,y.v9)(ee.H5),Z=(0,y.v9)(ee.Hl),S=(0,y.v9)(Q.SO),C=(0,s.useMemo)((()=>N&&N.contactInfo&&N.contactInfo.billing?"".concat(N.contactInfo.billing.firstname," ").concat(N.contactInfo.billing.lastname):"Ukendt kunde"),[N]);(0,s.useEffect)((()=>{if(!i||!i.customerUid)return()=>{};const e=c((0,ee.yQ)(i.customerUid));return()=>e()}),[c,i]);const T=(0,s.useMemo)((()=>j&&i?j.find((e=>e.subscriptionUid===i.id&&(e.state===P.Z.PENDING_PAYMENT||r.fixForRenewSubscriptionOnPosIfPaymentTypeIsAutomatic&&e.state===P.Z.SCHEDULED_PAYMENT))):null),[i,j,r.fixForRenewSubscriptionOnPosIfPaymentTypeIsAutomatic]),w=(0,s.useMemo)((()=>T&&k&&k[T.id]?k[T.id]:null),[T,k]);(0,s.useEffect)((()=>{i&&i.currentEvent&&(r.renewExpiredSubscription?(0,ee.VF)(i.subscriptionTypeUid,i.currentEvent).then((e=>{Un()(e.currentEvent.end).isAfter(Un()())?(b(e),u(!1)):(g(!0),(0,ee.VF)(i.subscriptionTypeUid,null).then((e=>{b(e)})).finally((()=>u(!1))))})).catch((()=>u(!1))):(0,ee.VF)(i.subscriptionTypeUid,i.currentEvent).then((e=>{b(e)})).finally((()=>u(!1))))}),[i,r.renewExpiredSubscription]),(0,s.useEffect)((()=>{if(i&&i.customerUid&&T&&T.id){const e=c((0,ee.zM)(i.customerUid,T.id));return()=>e()}return()=>{}}),[c,i,T,r.createSubcustomersOnFlexsdk]);const E=(0,s.useCallback)((async()=>{v.current||(v.current=!0,r.optionToAddCustomerOnSubscriptionCreateOrRenew&&null!==S&&void 0!==S&&S.addCustomerOnSubscriptionRenewal&&await o(),await Promise.all(w.filter((e=>"discount"!==e.lineType)).map((e=>q.Z.addProduct(e.productNumber,e.qty,e.linePrice/100,"".concat(i.customerUid?"ATT".concat(i.customerUid):"null",";").concat(i.currentEvent?"ATT".concat(i.currentEvent):"null",";").concat(i.id||"null",";").concat(e.productId||"null"))))),await Promise.all(w.filter((e=>"discount"===e.lineType)).map((e=>q.Z.ifVersion("4.1.17.03",">=",(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,-1)),(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,0)))))),await q.Z.closeBrowser())}),[i,w,S,r.optionToAddCustomerOnSubscriptionCreateOrRenew]),O=(0,s.useMemo)((()=>r.flexsdkSubscriptionImprovements&&Z&&Z.theSubscription?Z.theSubscription:"medlemskabet"),[Z,r.flexsdkSubscriptionImprovements]),D=(0,s.useMemo)((()=>r.flexsdkSubscriptionImprovements&&Z&&Z.subscription?Z.subscription:"medlemskab"),[Z,r.flexsdkSubscriptionImprovements]);return(0,s.useEffect)((()=>{T&&w&&w.length>0&&(T.state===P.Z.PENDING_PAYMENT||r.fixForRenewSubscriptionOnPosIfPaymentTypeIsAutomatic&&T.state===P.Z.SCHEDULED_PAYMENT)&&p&&E().catch((e=>c((0,ee.sT)("Der skete en fejl under fornyelsen af ".concat(O,": ").concat(e.message)))))}),[c,p,T,w,E,O,r.fixForRenewSubscriptionOnPosIfPaymentTypeIsAutomatic]),(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(W.Z,{maxWidth:"sm",fullWidth:!0,open:n,onClose:t,"aria-labelledby":"form-dialog-title",children:[(0,I.jsxs)(B.Z,{id:"form-dialog-title",children:["Fornyelse af ",D]}),d?(0,I.jsx)(L.Z,{children:(0,I.jsx)(G.Z,{})}):(0,I.jsxs)(L.Z,{className:"text-center",children:[(0,I.jsxs)(a.Z,{children:["Du er igang med at fornye ",D," for"]}),(0,I.jsx)(a.Z,{className:"font-bold mb-4",children:C}),(!r.renewExpiredSubscription||!h)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(a.Z,{children:["Nuv\xe6rende ",D," l\xf8ber ind til den"]}),(0,I.jsxs)(a.Z,{className:"font-bold mb-4",children:[void 0===f&&"indl\xe6ser...",void 0!==f&&null!==f&&f.currentEvent&&f.currentEvent.end&&Un()(f.currentEvent.end).format("DD-MM-YYYY"),void 0!==f&&(null===f||!f.currentEvent||!f.currentEvent.end)&&"-"]})]}),r.renewExpiredSubscription&&h&&(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(a.Z,{children:["Nuv\xe6rende ",D," er ",(0,I.jsx)("span",{className:"font-bold",children:"udl\xf8bet"})]})}),f&&f.nextPossible&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(a.Z,{className:"text-red-300",children:[(0,Ce.Io)(O)," kan ikke fornyes f\xf8r den"]}),(0,I.jsx)(a.Z,{className:"font-bold mb-20 text-red-300",children:Un()(f.nextPossible).format("DD-MM-YYYY")}
1)]}),(!f||!f.nextPossible)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(a.Z,{children:["Fornyelsen forl\xe6nger ",O," til den"]}),(0,I.jsxs)(a.Z,{className:"font-bold mb-20",children:[void 0===f&&"indl\xe6ser...",void 0!==f&&null!==f&&f.end&&Un()(f.end).format("DD-MM-YYYY"),void 0!==f&&(null===f||!f.end)&&"-"]})]})]}),(0,I.jsxs)(Y.Z,{className:"flex justify-between",children:[(0,I.jsx)(m.Z,{onClick:t,color:"secondary",variant:"outlined",className:"w-1/2 rounded-none",children:"Annuller"}),(0,I.jsx)(m.Z,{onClick:async function(){v.current=!1,u(!0),await c((0,ee.$0)(i.customerUid,i.id)),x(!0),u(!1)},color:"primary",variant:"contained",className:"w-1/2 rounded-none",disabled:d||f&&f.nextPossible||!f,children:"Opret fornyelse og tilf\xf8j til bon"})]})]})})},Mn=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2});const Wn=function(e){let{onBack:n,onExit:t,onAddEntry:i,onAddCustomer:o,locationUid:r}=e;const c=(0,l.useFlags)(),d=(0,y.I0)(),u=(0,y.v9)(Q.UK),m=(0,y.v9)(Q.SO),p=(0,y.v9)(ee.q0),f=(0,y.v9)(ee.H5),b=(0,y.v9)(ee.qf),h=(0,y.v9)(ee.nR),g=(0,y.v9)(ee.R1),v=(0,y.v9)(ee.cU),j=(0,y.v9)(ee.Fd),k=(0,y.v9)(ee.ao),N=(0,s.useMemo)((()=>f&&f.contactInfo&&f.contactInfo.billing?"".concat(f.contactInfo.billing.firstname," ").concat(f.contactInfo.billing.lastname):"Ukendt kunde"),[f]),[Z,S]=(0,s.useState)(!1),[C,T]=(0,s.useState)(null),[w,P]=(0,s.useState)(!1),[E,O]=(0,s.useState)(!1),[D,F]=(0,s.use
1State)(null),[A,R]=(0,s.useState)(null),W=(0,s.useMemo)((()=>c.disableSaveForDefaultCustomersOnPos&&f&&f.id&&m&&m.defaultCustomerUids&&m.defaultCustomerUids.includes(f.id)),[c.disableSaveForDefaultCustomersOnPos,m,f]),B=s.useMemo((()=>g?g.filter((e=>void 0===e.showOnPos||null===e.showOnPos||!!e.showOnPos)):null),[g]);function L(e){return!c.flexsdkSubscriptionImprovements||m&&m.flexsdkSubscriptionButtons&&m.flexsdkSubscriptionButtons.includes(e)}return(0,s.useEffect)((()=>{const e=d((0,ee.kG)());return()=>{e()}}),[d]),(0,s.useEffect)((()=>{v&&d((0,ee.Mv)(v))}),[d,v]),(0,s.useEffect)((()=>{if(!f||!f.id)return()=>{};const e=d((0,ee.u2)(c.createSubcustomersOnFlexsdk&&p?p.id:f.id,c.createSubcustomersOnFlexsdk&&p?f.id:null)),n=d((0,ee.dn)(f.id));return()=>{e(),n()}}),[d,f,c.createSubcustomersOnFlexsdk,p]),(0,I.jsxs)(I.Fragment,{children:[c.pensoPaySubscription&&c.renewSubscriptionOnPos&&f&&f.id&&A&&(0,I.jsx)(Rn,{open:!!A,onClose:()=>R(null),subscription:A,onAddCustomer:o}),f&&f.id&&Z&&(0,I.jsx)(Re,{open:Z,onClose:()=>{S(!1)},customerUid:f.id,products:h,subscriptionTypes:B,membershipTickets:v,subscriptions:b,onCreate:e=>{c.createMultipleSubscriptionsAndSubSubscriptionsOnPos&&1!==e.length?d((0,ee.d9)(e)):d((0,ee.d9)(e[0]))},parentCustomer:p,handlePrintPDF:function(e){j[e.id]?(d((0,ee.bW)("printCard-".concat(e.id))),q.Z.downloadAndPrintPDF("".concat(j[e.id],"&timestamp=").concat((new Date).getTime())).catch((e=>d((0,ee.sT)("Der skete en fejl under print af kort: ".concat(e.message))))).finally((()=>d((0,ee.iP)("printCard-".concat(e.id)))))):d((0,ee.sT)("Der skete en fejl under print af kort: Der er ingen PDF p\xe5 billetten"))},upgrade:c.upgradeSubscriptionToNewSubscription&&C?C:null,locationUid:r,onAddCustomer:o}),c.redeemGiftSubscriptionOnPos&&u.giftSubscriptions&&(0,I.jsx)(fn,{open:w,onClose:()=>P(!1),customerUid:f.id,popAlertWithError:e=>d((0,ee.sT)(e)),membershipTickets:v,onCreate:e=>{d((0,ee.d9)(e[0]))},products:h}),(0,I.jsx)(Xe,{onTerminate:async function(e,n,t,s,i){(e||n||t||s||i)&&d((0,ee.TO)(E.id,f.id,{terminateSubscription:e,blockTickets:n,refundNewestOrder:t,sendReceipt:s,reason:i,orderToRefund:E&&E.order&&E.order.id?E.order.id:null,ticketsToBlock:E&&E.tickets?E.tickets.map((e=>e.id)):[]})),O(null)},loading:!1,open:!!E,orderToRefund:E?E.order:null,state:E&&E.state?E.state:null}),!!D&&(0,I.jsx)(Fn,{open:!!D,onClose:()=>F(null),subscription:D}),(0,I.jsxs)("div",{className:"flex justify-between mb-32 mt-32",children:[(0,I.jsx)(be.Z,{size:"small",onClick:n,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"arrow_back"})}),(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{variant:"h6",className:"font-bold",children:"Kundens medlemskaber"}),(0,I.jsx)(a.Z,{variant:"h6",className:"text-12 font-normal",color:"textSecondary",children:N})]}),(0,I.jsx)(be.Z,{size:"small",onClick:t,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"exit_to_app"})})]}),(0,I.jsxs)("div",{className:"flex justify-center mb-32",children:[c.redeemGiftSubscriptionOnPos&&u.giftSubscriptions&&(0,I.jsx)(de,{variant:"outlined",color:"primary",className:"mr-10 w-224 py-10",onClick:function(){P(!0)},disabled:W||!!k,children:"Indl\xf8s gavekort"}),(0,I.jsx)(de,{variant:"outlined",color:"primary",className:"w-224 py-10",onClick:function(){S(!0)},disabled:W,children:"Opret medlemskab"})]}),(0,I.jsxs)(Dn.Z,{children:[(!b||b.length<=0)&&(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen medlemskaber p\xe5 denne kunde"}),b&&b.length>0&&b.map(((e,n)=>{const t=v?v.find((n=>n.subscriptionUid===e.id)):null;return(0,I.jsxs)(Cn,{defaultExpanded:0===n&&!k,disabled:!!k,children:[(0,I.jsx)(pe.Z,{expandIcon:(0,I.jsx)(H.Z,{color:"inherit",className:"text-black",children:"expand_more"}),children:(0,I.jsxs)(We.ZP,{container:!0,children:[(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Medlemskab"}),(0,I.jsx)(a.Z,{children:e.name}),(0,I.jsxs)(a.Z,{children:["Medlemskabsnummer: ",e.subscriptionNumber]})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Status"}),(0,I.jsx)(M,{statusKey:e.state})]}),(0,I.jsx)(We.ZP,{item:!0,sm:3,children:t&&t.event&&t.event.start&&t.event.end&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Gyldigheds
1periode"}),(0,I.jsxs)(a.Z,{children:["Fra: ",x()(t.event.start.toDate()).format("DD-MM-YYYY")]}),(0,I.jsxs)(a.Z,{children:["Til: ",x()(t.event.end.toDate()).format("DD-MM-YYYY")]})]})}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Pris"}),(0,I.jsx)(a.Z,{children:Mn.format(e.subscriptionPrice/100)})]})]})}),(0,I.jsx)(xe.Z,{children:(0,I.jsxs)("div",{className:"flex items-center justify-between w-full -mx-10",children:[c.pensoPaySubscription&&c.renewSubscriptionOnPos&&u&&u.subscriptions&&u.subscriptions.automaticRenewal&&L("renew")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"renew-".concat(e.id),fullWidth:!0,disabled:c.renewExpiredSubscription?!(e.state===U.Z.TERMINATED||e.state===U.Z.CANCELED||e.state===U.Z.ACTIVE||e.state===U.Z.PAYMENT||e.state===U.Z.RENEWAL):!(e.state===U.Z.ACTIVE||e.state===U.Z.PAYMENT||e.state===U.Z.RENEWAL),onClick:()=>{R(e)},help:{message:"Fornyer medlemskabet med samme periode",placement:"bottom"},children:"Forny"}),c.upgradeSubscriptionToNewSubscription&&L("upgrade")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"upgrade-".concat(e.id),fullWidth:!0,disabled:!(e.state===U.Z.ACTIVE||e.state===U.Z.PAYMENT||e.state===U.Z.RENEWAL),onClick:()=>{return n=e,S(!0),void T(n);var n},help:{message:"Opgradere medlemskabet til en anden type, man betaler differencen",placement:"bottom"},children:"Opgrader"}),e.state===U.Z.RESERVED&&L("addOrder")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"addToCart-".concat(e.id),fullWidth:!0,onClick:()=>async function(e){d((0,ee.bW)("addToCart-".concat(e.id))),await q.Z.getJournalAndLines(!1,(async n=>{if(n.journal.journalLines.some((n=>!!n.SN&&n.SN.split(";")[2]===e.id)))return d((0,ee.sT)("Det medlemskab er allerede tilf\xf8jet til bonnen")),void d((0,ee.iP)("addToCart-".concat(e.id)));if(c.upgradeFromTicketToSubscriptionOnPos||c.upgradeSubscriptionToNewSubscription){const n=(await(0,ee.AU)(f.id)).find((n=>n.subscriptionUid===e.id)),t=await(0,ee.Pp)(e.customerUid,n.id);await Promise.all(t.filter((e=>"discount"!==e.lineType)).map((n=>{let t=f.id;return c.createMultipleSubscriptionsAndSubSubscriptionsOnPos&&n.forCustomerUid&&(t=n.forCustomerUid),q.Z.addProduct(n.productNumber,n.qty,n.linePrice/100,"".concat(t?"ATT".concat(t):"null",";").concat(e.currentEvent?"ATT".concat(e.currentEvent):"null",";").concat(e.id||"null",";").concat(n.productId||"null"))}))),await Promise.all(t.filter((e=>"discount"===e.lineType)).map((e=>q.Z.ifVersion("4.1.17.03",">=",(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,-1)),(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,0))))))}else await Promise.all(Object.values(e.selectedProducts).map((n=>{const t=h.find((e=>e.id===n.product)),s=t.prices.find((e=>"Sale"===e.type));return q.Z.addProduct(t.productNumber,1,s.price/100,"".concat(f.id?"ATT".concat(f.id):"null",";").concat(e.currentEvent?"ATT".concat(e.currentEvent):"null",";").concat(e.id||"null",";").concat(t&&t.id?t.id:"null"))})));d((0,ee.iP)("addToCart-".concat(e.id))),await q.Z.closeBrowser()}))}(e),help:{message:"Tilf\xf8jer en uf\xe6rdiggjort ordre til bonnen",placement:"bottom"},disabled:!!e.voucherRedemption,children:"Tilf\xf8j til bon"}),e.state!==U.Z.RESERVED&&L("changePeriod")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"changePeriod-".concat(e.id),disabled:!(e.state===U.Z.ACTIVE||e.state===U.Z.PAYMENT||e.state===U.Z.RENEWAL),onClick:()=>function(e){const n={...e};n.ticket=v.find((n=>n.subscriptionUid===e.id)),F(n)}(e),help:{message:"\xc6ndre perioden for medlemskabet uden beregning",placement:"bottom"},children:"\xc6ndre periode"}),L("terminateRefund")&&(0,I.jsx)(de,{variant:"contained",color:"primary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"termniateRefund-".concat(e.id),disabled:!(e.state===U.Z.ACTIVE||e.state===U.Z.RESERVED||e.state===U.Z.PAYMENT||e.state===U.Z.RENEWAL),onClick:()=>async function(e){const n={...e},t=(await(0,ee.AU)(f.id)).filter((n=>n.subscriptionUid===e.id));t.sort(((e,n)=>e.orderDate-n.orderDate)),n.order=t[0],n.tickets=v.filter((n=>n.subscriptionUid===e.id)),O(n)}(e),help:{message:"Refunder seneste ordre og/eller opsiger medlemskabet",placement:"bottom"},children:"Opsig/refund\xe9r"})]})})]})}))]})]})};var Bn=t(2722);const Ln=6e4;function Kn(e){return!(null===e||void 0===e||!e.start)&&!(null===e||void 0===e||!e.end)}
1function Yn(e,n){const t=e.event,{subscriptionUid:s}=e;if(!Kn(t)||!s)return t;const i=n.filter((e=>function(e,n){return e.subscriptionUid===n&&(e.state===Bn.Z.ISSUED||e.state===Bn.Z.USED)&&Kn(e.event)}(e,s))).map((e=>e.event)).filter((e=>e.start.toDate()>t.start.toDate())).sort(((e,n)=>e.start.toDate().getTime()-n.start.toDate().getTime()));let{end:l}=t;for(const o of i){if(o.start.toDate().getTime()-l.toDate().getTime()>Ln)break;o.end.toDate()>l.toDate()&&(l=o.end)}return{start:t.start,end:l}}var zn=t(72413);const Vn=function(e){let{onBack:n,onExit:t,goToTab:i}=e;const{createSubcustomersOnFlexsdk:o}=(0,l.useFlags)(),r=(0,y.I0)(),c=(0,y.v9)(ee.H5),d=(0,y.v9)(ee.LT),u=(0,s.useMemo)((()=>c&&c.contactInfo&&c.contactInfo.billing?"".concat(c.contactInfo.billing.firstname," ").concat(c.contactInfo.billing.lastname):"Ukendt kunde"),[c]),[p,x]=(0,s.useState)(!1);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"flex justify-between mb-32 mt-32",children:[(0,I.jsx)(be.Z,{size:"small",onClick:n,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"arrow_back"})}),(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsx)(a.Z,{variant:"h6",className:"font-bold",children:"Kundens underkunder"}),(0,I.jsx)(a.Z,{variant:"h6",className:"text-12 font-normal",color:"textSecondary",children:u})]}),(0,I.jsx)(be.Z,{size:"small",onClick:t,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"exit_to_app"})})]}),(0,I.jsx)("div",{className:"flex justify-center mb-32",children:o&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de,{variant:"outlined",color:"primary",className:"w-224 py-10",onClick:function(){x(!0)},children:"Opret underkunde"}),(0,I.jsx)(bn,{customer:c,open:p,onClose:()=>x(!1)})]})}),(!d||d.length<=0)&&(0,I.jsx)(a.Z,{className:"mt-16 font-bold text-center",children:"Ingen underkunder p\xe5 denne kunde"}),d&&d.length>0&&d.map((e=>(0,I.jsxs)(Cn,{children:[(0,I.jsx)(pe.Z,{expandIcon:(0,I.jsx)(H.Z,{color:"inherit",className:"text-black",children:"expand_more"}),children:(0,I.jsx)(We.ZP,{container:!0,children:e.contactInfo&&e.contactInfo.billing&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(We.ZP,{item:!0,sm:4,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Underkunde"}),(0,I.jsxs)(a.Z,{children:[e.contactInfo.billing.firstname||""," ",e.contactInfo.billing.lastname||""]})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:4,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Adresse"}),(0,I.jsx)(a.Z,{children:e.contactInfo.billing.address||""}),(0,I.jsxs)(a.Z,{children:[e.contactInfo.billing.postalCode||""," ",e.contactInfo.billing.city||""]})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:4,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Kontakt"}),(0,I.jsx)(a.Z,{children:e.contactInfo.billing.email||""}),(0,I.jsx)(a.Z,{children:e.contactInfo.billing.phone||""})]})]})})}),(0,I.jsx)(xe.Z,{children:(0,I.jsx)("div",{className:"flex items-center justify-between w-full -mx-10",children:(0,I.jsx)(m.Z,{variant:"contained",color:"secondary",className:"w-full h-48 mx-10",fullWidth:!0,onClick:()=>{return n=e,r((0,ee.mc)({customerUid:n.id})),void i("contactInfo");var n},children:"V\xe6lg kunde"})})})]})))]})},Hn=new Intl.NumberFormat("da-DK",{style:"currency",currency:"DKK",minimumFractionDigits:2});const Gn=function(e){let{onBack:n,onExit:t,onAddEntry:i,onAddEntryAndGuest:o,locationUid:r,onAddCustomer:c}=e;const d=(0,l.useFlags)(),u=(0,y.I0)(),m=(0,y.v9)(Q.UK),p=(0,y.v9)(Q.SO),f=(0,y.v9)(ee.q0),b=(0,y.v9)(ee.LT),h=(0,y.v9)(ee.H5),g=(0,y.v9)(ee.qf),v=(0,y.v9)(ee.nR),j=(0,y.v9)(ee.R1),k=(0,y.v9)(ee.cU),N=(0,y.v9)(ee.Hl),Z=(0,y.v9)(ee.Fd),C=(0,y.v9)(ee.ao),T=(0,s.useMemo)((()=>h&&h.contactInfo&&h.contactInfo.billing?"".concat(h.contactInfo.billing.firstname," ").concat(h.contactInfo.billing.lastname):"Ukendt kunde"),[h]),[w,P]=(0,s.useState)(!1),[O,D]=(0,s.use
1State)(null),[F,A]=(0,s.useState)(!1),[R,W]=(0,s.useState)(!1),[B,L]=(0,s.useState)(null),[K,Y]=(0,s.useState)(null),[z,V]=(0,s.useState)(null),G=(0,s.useMemo)((()=>d.disableSaveForDefaultCustomersOnPos&&h&&h.id&&p&&p.defaultCustomerUids&&p.defaultCustomerUids.includes(h.id)),[d.disableSaveForDefaultCustomersOnPos,p,h]),_=s.useMemo((()=>j?j.filter((e=>void 0===e.showOnPos||null===e.showOnPos||!!e.showOnPos)):null),[j]);(0,s.useEffect)((()=>{k&&u((0,ee.Mv)(k))}),[u,k]),(0,s.useEffect)((()=>{if(!h||!h.id)return()=>{};const e=u((0,ee.u2)(d.createSubcustomersOnFlexsdk&&f?f.id:h.id,d.createSubcustomersOnFlexsdk&&f?h.id:null)),n=u((0,ee.dn)(h.id));return()=>{e(),n()}}),[u,h,d.createSubcustomersOnFlexsdk,f]),(0,s.useEffect)((()=>{if(!h||!h.id||!b||b.length<=0)return()=>{};const e=b.map((e=>u((0,ee.HM)(e.id))));return()=>{e.forEach((e=>e()))}}),[u,h,b]);const J=(0,s.useMemo)((()=>k&&g?g.map((e=>{const n=k.find((n=>n.subscriptionUid===e.id));return{...e,ticket:n}})).filter((e=>e.ticket)):null),[g,k]),X=(0,s.useMemo)((()=>d.flexsdkSubscriptionImprovements&&N&&N.subscriptions?N.subscriptions:"medlemskaber"),[N,d.flexsdkSubscriptionImprovements]),$=(0,s.useMemo)((()=>d.flexsdkSubscriptionImprovements&&N&&N.subscription?N.subscription:"medlemskab"),[N,d.flexsdkSubscriptionImprovements]);function ne(e){Z[e.id]?(u((0,ee.bW)("printCard-".concat(e.id))),q.Z.downloadAndPrintPDF("".concat(Z[e.id],"&timestamp=").concat((new Date).getTime())).catch((e=>u((0,ee.sT)("Der skete en fejl under print af kort: ".concat(e.message))))).finally((()=>u((0,ee.iP)("printCard-".concat(e.id)))))):u((0,ee.sT)("Der skete en fejl under print af kort: Der er ingen PDF p\xe5 billetten"))}function te(e){return!d.flexsdkSubscriptionImprovements||p&&p.flexsdkSimpleSubscriptionButtons&&p.flexsdkSimpleSubscriptionButtons.includes(e)}const se=(0,s.useCallback)((e=>{if(!j||!e)return!1;const n=j.find((n=>n.id===e.subscriptionTypeUid));return!n||!n.guestProductUid}),[j]);return(0,I.jsxs)(I.Fragment,{children:[z&&(0,I.jsx)(Se,{open:!!z,onClose:()=>V(null),icon:null,content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{variant:"h5",children:"Bilettens kontrolkode er:"}),(0,I.jsx)(a.Z,{variant:"h6",children:z.controlNumber})]}),okButton:"Okay"}),d.pensoPaySubscription&&d.renewSubscriptionOnPos&&h&&h.id&&K&&(0,I.jsx)(Rn,{open:!!K,onClose:()=>Y(null),subscription:K,onAddCustomer:c}),h&&h.id&&w&&(0,I.jsx)(Re,{open:w,onClose:()=>{P(!1)},customerUid:h.id,products:v,subscriptionTypes:_,membershipTickets:k,subscriptions:g,onCreate:e=>{d.createMultipleSubscriptionsAndSubSubscriptionsOnPos&&1!==e.length?u((0,ee.d9)(e)):u((0,ee.d9)(e[0]))},parentCustomer:f,handlePrintPDF:ne,upgrade:d.upgradeSubscriptionToNewSubscription&&O?O:null,locationUid:r,onAddCustomer:c}),d.redeemGiftSubscriptionOnPos&&m.giftSubscriptions&&(0,I.jsx)(fn,{open:F,onClose:()=>A(!1),customerUid:h.id,popAlertWithError:e=>u((0,ee.sT)(e)),membershipTickets:k,onCreate:e=>{u((0,ee.d9)(e[0]))},products:v}),(0,I.jsx)(Xe,{onTerminate:async function(e,n,t,s,i){(e||n||t||s||i)&&u((0,ee.TO)(R.id,h.id,{terminateSubscription:e,blockTickets:n,refundNewestOrder:t,sendReceipt:s,reason:i,orderToRefund:R&&R.order&&R.order.id?R.order.id:null,ticketsToBlock:R&&R.tickets?R.tickets.map((e=>e.id)):[]})),W(null)},loading:!1,open:!!R,orderToRefund:R?R.order:null,state:R&&R.state?R.state:null}),!!B&&(0,I.jsx)(Fn,{open:!!B,onClose:()=>L(null),subscription:B}),(0,I.jsxs)("div",{className:"flex justify-between mb-32 mt-32",children:[(0,I.jsx)(be.Z,{size:"small",onClick:n,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"arrow_back"})}),(0,I.jsxs)("div",{className:"text-center",children:[(0,I.jsxs)(a.Z,{variant:"h6",className:"font-bold",children:["Kundens ",X]}),(0,I.jsx)(a.Z,{variant:"h6",className:"text-12 font-normal",color:"textSecondary",children:T})]}),(0,I.jsx)(be.Z,{size:"small",onClick:t,children:(0,I.jsx)(H.Z,{fontSize:"large",children:"exit_to_app"})})]}),(0,I.jsxs)("div",{className:"flex justify-center mb-32",children:[d.redeemGiftSubscriptionOnPos&&m.giftSubscriptions&&(0,I.jsx)(de,{variant:"outlined",color:"primary",className:"mr-10 w-224 py-10",onClick:function(){A(!0)},help:{message:"Indl\xf8s et gavekort med et gavekortnummer",placement:"top"},disabled:G||!!C,children:"Indl\xf8s gavekort"}),(0,I.jsxs)(de,{variant:"outlined",color:"primary",className:"w-224 py-10",onClick:function(){P(!0)},help:{message:"Opret et medlemskab og betal det via kassen",placement:"top"},disabled:G,children:["Opret ",$]})]}),(0,I.jsxs)(Dn.Z,{children:[(!J||J.length<=0)&&(0,I.jsxs)(a.Z,{className:"mt-16 font-bold text-center",children:["Ingen ",X," p\xe5 denne kunde"]}),J&&J.length>0&&J.map(((e,n)=>{let{ticket:t,...s}=e;return(0,I.jsxs)(Cn,{defaultExpanded:0===n&&!C,disabled:!!C,children:[(0,I.jsx)(pe.Z,{exp
1andIcon:(0,I.jsx)(H.Z,{color:"inherit",className:"text-black",children:"expand_more"}),children:(0,I.jsxs)(We.ZP,{container:!0,children:[(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:(0,Ce.Io)($)}),(0,I.jsx)(a.Z,{children:s.name}),t&&(0,I.jsxs)(a.Z,{children:["Kortnummer: ",t.ticketNumber]})]}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Status"}),(0,I.jsx)(M,{statusKey:s.state})]}),(0,I.jsx)(We.ZP,{item:!0,sm:3,children:t&&t.event&&t.event.start&&t.event.end&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Gyldighedsperiode"}),(0,I.jsxs)(a.Z,{children:["Fra: ",x()(t.event.start.toDate()).format("DD-MM-YYYY")]}),(0,I.jsxs)(a.Z,{children:["Til: ",x()(t.event.end.toDate()).format("DD-MM-YYYY")]})]})}),(0,I.jsxs)(We.ZP,{item:!0,sm:3,children:[(0,I.jsx)(a.Z,{className:"font-bold",children:"Pris"}),(0,I.jsx)(a.Z,{children:Hn.format(s.subscriptionPrice/100)})]})]})}),(0,I.jsx)(xe.Z,{children:(0,I.jsxs)("div",{className:"flex items-center justify-between w-full -mx-10",children:[d.pensoPaySubscription&&d.renewSubscriptionOnPos&&m&&m.subscriptions&&m.subscriptions.automaticRenewal&&te("renew")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"renew-".concat(s.id),fullWidth:!0,disabled:d.renewExpiredSubscription?!(s.state===U.Z.TERMINATED||s.state===U.Z.CANCELED||s.state===U.Z.ACTIVE||s.state===U.Z.PAYMENT||s.state===U.Z.RENEWAL):!(s.state===U.Z.ACTIVE||s.state===U.Z.PAYMENT||s.state===U.Z.RENEWAL),onClick:()=>{Y(s)},help:{message:"Fornyer medlemskabet med samme periode",placement:"bottom"},children:"Forny"}),d.upgradeSubscriptionToNewSubscription&&te("upgrade")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"upgrade-".concat(s.id),fullWidth:!0,disabled:!(s.state===U.Z.ACTIVE||s.state===U.Z.PAYMENT||s.state===U.Z.RENEWAL),onClick:()=>{return e=s,P(!0),void D(e);var e},help:{message:"Opgradere medlemskabet til en anden type, man betaler differencen",placement:"bottom"},children:"Opgrader"}),s.state===U.Z.RESERVED&&te("addOrder")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"addToCart-".concat(s.id),fullWidth:!0,onClick:()=>async function(e){u((0,ee.bW)("addToCart-".concat(e.id))),await q.Z.getJournalAndLines(!1,(async n=>{if(n.journal.journalLines.some((n=>!!n.SN&&n.SN.split(";")[2]===e.id)))return u((0,ee.sT)("Det medlemskab er allerede tilf\xf8jet til bonnen")),void u((0,ee.iP)("addToCart-".concat(e.id)));if(d.upgradeFromTicketToSubscriptionOnPos||d.upgradeSubscriptionToNewSubscription){const n=(await(0,ee.AU)(h.id)).find((n=>n.subscriptionUid===e.id)),t=await(0,ee.Pp)(e.customerUid,n.id);await Promise.all(t.filter((e=>"discount"!==e.lineType)).map((n=>{let t=h.id;return d.createMultipleSubscriptionsAndSubSubscriptionsOnPos&&n.forCustomerUid&&(t=n.forCustomerUid),q.Z.addProduct(n.productNumber,n.qty,n.linePrice/100,"".concat(t?"ATT".concat(t):"null",";").concat(e.currentEvent?"ATT".concat(e.currentEvent):"null",";").concat(e.id||"null",";").concat(n.productId||"null"))}))),await Promise.all(t.filter((e=>"discount"===e.lineType)).map((e=>q.Z.ifVersion("4.1.17.03",">=",(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,-1)),(()=>q.Z.addDiscountToJournal(e.name,Math.abs(e.linePrice)/100,0))))))}else await Promise.all(Object.values(e.selectedProducts).map((n=>{const t=v.find((e=>e.id===n.product)),s=t.prices.find((e=>"Sale"===e.type));return q.Z.addProduct(t.productNumber,1,s.price/100,"".concat(h.id?"ATT".concat(h.id):"null",";").concat(e.currentEvent?"ATT".concat(e.currentEvent):"null",";").concat(e.id||"null",";").concat(t&&t.id?t.id:"null"))})));u((0,ee.iP)("addToCart-".concat(e.id))),await q.Z.closeBrowser()}))}(s),help:{message:"Tilf\xf8jer en uf\xe6rdiggjort ordre til bonnen",placement:"bottom"},disabled:!!s.voucherRedemption,children:"Tilf\xf8j til bon"}),s.state!==U.Z.RESERVED&&te("changePeriod")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"changePerio
1d-".concat(s.id),disabled:!(s.state===U.Z.ACTIVE||s.state===U.Z.PAYMENT||s.state===U.Z.RENEWAL),onClick:()=>function(e){const n={...e};n.ticket=k.find((n=>n.subscriptionUid===e.id)),L(n)}(s),help:{message:"\xc6ndre perioden for medlemskabet uden beregning",placement:"bottom"},children:"\xc6ndre periode"}),te("terminateRefund")&&(0,I.jsx)(de,{variant:"contained",color:"primary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"termniateRefund-".concat(s.id),disabled:!(s.state===U.Z.ACTIVE||s.state===U.Z.RESERVED||s.state===U.Z.PAYMENT||s.state===U.Z.RENEWAL),onClick:()=>async function(e){const n={...e},t=(await(0,ee.AU)(h.id)).filter((n=>n.subscriptionUid===e.id));t.sort(((e,n)=>e.orderDate-n.orderDate)),n.order=t[0],n.tickets=k.filter((n=>n.subscriptionUid===e.id)),W(n)}(s),help:{message:"Refunder seneste ordre og/eller opsiger medlemskabet",placement:"bottom"},children:"Opsig/refund\xe9r"}),te("printCard")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"printCard-".concat(t.id),fullWidth:!0,onClick:()=>ne(t),disabled:!Z[t.id],help:{message:"Printer oplysninger p\xe5 et fysisk kort",placement:"bottom"},children:"Print kort"}),te("printCard")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",loading:"showControlCode-".concat(t.id),fullWidth:!0,onClick:()=>function(e){V(e)}(t),disabled:!t.controlNumber,help:{message:"Se kontrolkoden for den p\xe5g\xe6ldende billet",placement:"bottom"},children:"Se kontrolkode"}),p&&p.automaticSendMailWhenCardNumberChange&&te("resendTicketNumber")&&(0,I.jsx)(de,{variant:"contained",color:"secondary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"resendTicketNumber-".concat(t.id),onClick:()=>function(e){u((0,ee.uC)(e.customerUid,e.orderUid,e.id))}(t),help:{message:"Gensender kortnummeret til kunden pr. mail",placement:"bottom"},children:"Gensend kortnummer"}),te("addEntry")&&(0,I.jsx)(de,{variant:"contained",color:"primary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"addEntry-".concat(t.id),onClick:()=>async function(e){u((0,ee.bW)("addEntry-".concat(e.id)));const n=await(0,S.li)(e.ticketNumber).catch((()=>null));null!==n&&void 0!==n&&n.success?i(e).catch((e=>u((0,ee.sT)("Der skete en fejl under tilf\xf8jelse af entr\xe9 til bonnen: ".concat(e.message))))).finally((()=>setTimeout((()=>u((0,ee.iP)("addEntry-".concat(e.id)))),1e3))):(u((0,ee.sT)("Billetten er ugyldig eller udl\xf8bet, du kan derfor ikke tilf\xf8je entr\xe9")),setTimeout((()=>u((0,ee.iP)("addEntry-".concat(e.id)))),1e3))}(t),disabled:!t||t.state!==E.Z.USED&&t.state!==E.Z.ISSUED,help:{message:"Tilf\xf8jer en entr\xe9 til bonnen for dette medlemskort",placement:"bottom"},children:"Tilf\xf8j entr\xe9"}),d.flexsdkSubscriptionImprovements&&te("addEntryAndGuest")&&(0,I.jsx)(de,{variant:"contained",color:"primary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"addEntryAndGuest-".concat(t.id),onClick:()=>async function(e,n){u((0,ee.bW)("addEntryAndGuest-".concat(n.id)));const t=await(0,S.li)(n.ticketNumber).catch((()=>null));null!==t&&void 0!==t&&t.success?o(e,n).catch((e=>u((0,ee.sT)("Der skete en fejl under tilf\xf8jelse af entr\xe9 + g\xe6st til bonnen: ".concat(e.message))))).finally((()=>setTimeout((()=>u((0,ee.iP)("addEntryAndGuest-".concat(n.id)))),1e3))):(u((0,ee.sT)("Billetten er ugyldig eller udl\xf8bet, du kan derfor ikke tilf\xf8je entr\xe9")),setTimeout((()=>u((0,ee.iP)("addEntryAndGuest-".concat(n.id)))),1e3))}(s,t),disabled:!t||t.state!==E.Z.USED&&t.state!==E.Z.ISSUED||se(s),help:{message:"Tilf\xf8jer en entr\xe9 til bonnen for dette medlemskort og for en g\xe6st",placement:"bottom"},children:"Tilf\xf8j entr\xe9 + g\xe6st"}),te("newMembercardNumber")&&(0,I.jsx)(de,{variant:"contained",color:"primary",wrapperClassName:"mx-10",className:"w-full h-48",fullWidth:!0,loading:"reissueNumber-".concat(t.id),onClick:()=>function(e){u((0,ee.d9)(e))}(t),help:{message:"Erstat det nuv\xe6rende kortnummer med et nyt",placement:"bottom"},children:"Nyt kortnummer"})]})})]})}))]})]})},_n=(0,te.Z)((e=>({indicator:{display:"flex",justifyContent:"center",backgroundColor:"transparent","& > span":{width:"100%",height:"2px",backgroundColor:e.palette.primary.main}}})))((e=>(0,I.jsx)(r.Z,{...e,TabIndicatorProps:{children:(0,I.jsx)("span",{})}})));const qn=(0,zn.Z)("subscriptionModule",ee.ZP)((function(){var e;const n=(0,y.v9)((e=>{let{auth:n}=e;return n.user.role})),t=(0,we.TH)(),i=(0,l.useFlags)(),r=(0,y.I0)(),a=(0,y.v9)(Q.UK),c=(0,y.v9)(ee.zh),d=(0,y.v9)(ee.uf),u=(0,y.v9)(ee.H5),p=(0,y.v9)(ee.q0),f=(0,y.v9)(ee.nR),b=(0,y.v9)(ee.IN),h=(0,y.v9)(ee.qf),v=(0,y.v9)(Q.SO),j=(0,y.v9)(ee.R1),k=(0,y.v9)(ee.hB),N=(0,y.v9)(ee.Hl),C=(0,y.v9)(ee.lp),T=(0,y.v9)(ee.Tj),w=(0,y.v9)(ee.ao),[P,E]=(0,s.use
1State)("contactInfo"),[O,D]=(0,s.useState)(!1),[F,A]=(0,s.useState)((0,Ce.ak)("scan")||null),[U,R]=(0,s.useState)(null),[M,W]=(0,s.useState)(!1),B=(0,s.useMemo)((()=>{var e;if(!i.useLocationPricesForDiscountProductInSubscriptionOnPos)return null;if(null===t||void 0===t||!t.search)return null;const n=(0,Ce.ak)("token",t.search),s=(0,Te.Wu)(n,"localhost"===window.location.hostname?window.location.host:window.location.hostname);return null===v||void 0===v||null===(e=v.tokens)||void 0===e?void 0:e[s]}),[i.useLocationPricesForDiscountProductInSubscriptionOnPos,v,t]),L=(0,s.useMemo)((()=>i.disableSaveForDefaultCustomersOnPos&&u&&u.id&&v&&v.defaultCustomerUids&&v.defaultCustomerUids.includes(u.id)),[i.disableSaveForDefaultCustomersOnPos,v,u]);function K(e){console.log("[TAB] Change tab to "+e),i.disableTabsIfContactInfoIsNotSaved?T?(E("contactInfo"),r((0,ee.sT)("Kundens kontaktoplysninger er ikke blevet gemt. Gem dem, f\xf8r du skifter fane"))):(E(e),"Kundens kontaktoplysninger er ikke blevet gemt. Gem dem, f\xf8r du skifter fane"===c&&r((0,ee.sT)(null))):E(e)}const Y=(0,s.useCallback)((async()=>{await q.Z.runPOSSync(["17"]),await q.Z.addCustomer(u.flexposCustomerUid)}),[u]);function z(e){r((0,ee.Mt)(e))}async function V(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(i.groupSubscriptions&&!U&&null!==e.groupAmount&&void 0!==e.groupAmount&&e.groupAmount>1)return void R({...e,onlyAddEntry:!0});i.optionToAutomaticAddCustomerOnAddEntryOnFlexpos&&v&&v.addCustomerOnEntryAdd&&await Y();let t="ATT-Entry";const s=f.find((n=>n.id===e.productId));(v&&v.validationProductsPerProduct||s&&s.hasValidationProducts)&&(t=s.productNumber);let l="";l="attractionWeb"===e.origin?"".concat(t,"-Online"):e.validations&&e.validations.some((e=>"use"===e.type))?"".concat(t,"-FP2"):"".concat(t,"-FP1"),i.directEntranceOnPosOffUseFp2OnValidation&&s&&null!==s.directEntranceOnPosIfPossible&&void 0!==s.directEntranceOnPosIfPossible&&!s.directEntranceOnPosIfPossible&&(l="".concat(t,"-FP2")),await q.Z.addProduct(l,null!==n&&void 0!==n?n:1,0,"FT".concat(e.ticketNumber)),await q.Z.closeBrowser()}function G(){A(null),R(null)}async function _(e,n){i.optionToAutomaticAddCustomerOnAddEntryOnFlexpos&&v&&v.addCustomerWhenAddingEntry&&await Y();const t=j.find((n=>n.id===e.subscriptionTypeUid));if(t&&t.guestProductUid){const e=f.find((e=>e.id===t.guestProductUid));e&&await async function(e){await q.Z.addProduct(e.productNumber,1,void 0,void 0)}(e)}await V(n),G()}function J(){q.Z.closeBrowser()}function X(){z(null)}function $(){r((0,ee.tn)(!C))}return(0,s.useEffect)((()=>{i.flexsdkSubscriptionImprovements&&a&&a.subscriptions&&a.subscriptions.simpleSubscriptions?(console.log("[SIMPLE] Enabling simple subscription"),r((0,ee.sq)(!0)),a.subscriptions.text&&r((0,ee.zr)(a.subscriptions.text))):console.log("[SIMPLE] Not enabling simple subscription: ".concat(i.flexsdkSubscriptionImprovements," ").concat(a&&a.subscriptions&&a.subscriptions.simpleSubscriptions))}),[r,a,i.flexsdkSubscriptionImprovements]),(0,s.useEffect)((()=>{r((0,ee.tn)(!1))}),[r,P]),(0,s.useEffect)((()=>{window.callbackClosing=()=>{console.log("[CLOSE] Got close callback from FlexPOS"),r((0,ee.mc)()),A(""),R(null),D(!0),E("contactInfo")}}),[r]),(0,s.useEffect)((()=>{if(!d)return D(!0),console.log("[CUSTOMER-SELECT] Opening select dialog"),r((0,ee.Xg)(null)),()=>{};const e=r((0,ee.qP)(d));return()=>{e()}}),[r,d]),(0,s.useEffect)((()=>{var e;if(!u||!u.id||null===a||void 0===a||null===(e=a.subscriptions)||void 0===e||!e.subcustomers)return()=>{};const n=r((0,ee.qL)(u.id));return()=>n()}),[r,u,a]),(0,s.useEffect)((()=>{if(!u||!u.id)return()=>{};const e=r((0,ee.u2)(i.createSubcustomersOnFlexsdk&&p?p.id:u.id,i.createSubcustomersOnFlexsdk&&p?u.id:null));return()=>{e()}}),[r,u,p,i.createSubcustomersOnFlexsdk]),(0,s.useEffect)((()=>{const e=r((0,ee.GM)()),n=r((0,ee.kG)());return()=>{e(),n()}}),[r]),(0,s.useEffect)((()=>{if(!u||!u.isAssociated)return()=>{};const e=r((0,ee.TU)(u.associatedCustomer));return()=>{e()}}),[r,u]),(0,s.useEffect)((()=>{window.callbackScanData=e=>{console.log("[SCAN] Callback scan data triggered"),console.log("[
1SCAN] Callback data: ".concat(e));const n=JSON.parse(e);n.sucess&&(W(!0),A(n.ScanData))},window.callbackVPCRedeem=e=>{console.log("[VOUCHER] Got voucher redemption callback from FlexPOS"),console.log("[VOUCHER] Callback data: ".concat(e));const n=JSON.parse(e),t=JSON.parse(n.parameters);(0,S.oC)(t.ProdNo).then((e=>{e&&r((0,ee.Z1)({cardNumber:t.CardNo,vpcItemPrice:t.VpcItemPrice,vpcItemUid:t.VpcItemUid,productNumber:t.ProdNo,productUid:e.id,subscriptionTypeUid:e.subscriptionTypeUid}))}))},i.scanSubscriptionCardFromTicketSaleToOpenSubscriptionModule&&(window.callbackParameters=e=>{console.log("[PARA] Callback parameter data triggered"),console.log("[PARA] Callback data: ".concat(e));const n=JSON.parse(e),t=JSON.parse(n.parameters);t.ticketNumber&&window.callbackScanData(JSON.stringify({ScanData:t.ticketNumber,sucess:!0}))}),console.log("[SDK] User role: |".concat(n,"| ").concat("flexposUser"==="".concat(n))),"flexposUser"==="".concat(n)&&q.Z.readyToReceive().catch((e=>{console.error(e)}))}),[n,i.scanSubscriptionCardFromTicketSaleToOpenSubscriptionModule]),(0,s.useEffect)((()=>{if(null===t||void 0===t||!t.search)return;const e=(0,Ce.ak)("voucherRedemption",t.search);e&&window.callbackVPCRedeem(e)}),[t]),(0,s.useEffect)((()=>{i.addCustomerToBonOnCardScan&&F&&d&&u&&v&&v.addCustomerOnScan&&Y().catch((e=>{console.error("[ERROR] Tried to add customer to bon, but failed: ".concat(e.message))}))}),[i.addCustomerToBonOnCardScan,d,F,Y,v,u]),(0,s.useEffect)((()=>{F&&(0,S.cg)(F).then((e=>{if(W(!1),e.length<=0)return;console.log("[SCAN] Ticket scanned");let n=e.find((e=>e.event&&e.event.start&&e.event.end&&x()().isBetween(x()(e.event.start.toDate()),x()(e.event.end.toDate()))));if(n)console.log("[SCAN] Valid ticket found");else if(console.log("[SCAN] No valid ticket found, using first ticket"),n=e[0],!n)return void console.log("[SCAN] No tickets found at all");if(r((0,ee.Mt)(n.customerUid)),console.log("[CUSTOMERUID] Setting customerUid to ".concat(n.customerUid)),D(!1),console.log("[CUSTOMER-SELECT] Closing select dialog"),v&&v.onScan&&"customerCard"!==v.onScan){if("cardScannerOptions"===v.onScan){let t="";console.log("[PRODUCT] Product ID: ".concat(n.productId));const s=i.changeOfEntryProduct2AddFunctionalityInFlexposFlexTicketApi&&f&&f.find((e=>e.id===n.productId));console.log("[PRODUCT] FlexPOS Settings ValidationProductsPerProduct: ".concat(v&&v.validationProductsPerProduct)),console.log("[PRODUCT] Product ValidationProductsPerProduct: ".concat(s&&s.hasValidationProducts)),t=i.changeOfEntryProduct2AddFunctionalityInFlexposFlexTicketApi&&(v&&v.validationProductsPerProduct||s&&s.hasValidationProducts)?"attractionWeb"===n.origin?"".concat(s.productNumber,"-Online"):n.validations&&n.validations.some((e=>"use"===e.type))?"".concat(s.productNumber,"-FP2"):"".concat(s.productNumber,"-FP1"):"attractionWeb"===n.origin?"ATT-Entry-Online":n.validations&&n.validations.some((e=>"use"===e.type))?"ATT-Entry-FP2":"ATT-Entry-FP1",i.directEntranceOnPosOffUseFp2OnValidation&&s&&null!==s.directEntranceOnPosIfPossible&&void 0!==s.directEntranceOnPosIfPossible&&!s.directEntranceOnPosIfPossible&&(t=t.replace("-FP1","-FP2").replace("-Online","-FP2")),R({...n,productNumber:t,displayPeriod:Yn(n,e)})}}else E("contactInfo"),R(null),A(null)}))}),[r,F,i.changeOfEntryProduct2AddFunctionalityInFlexposFlexTicketApi,i.directEntranceOnPosOffUseFp2OnValidation,v,f]),(0,I.jsxs)(I.Fragment,{children:[(F||U)&&(0,I.jsx)(nn,{loading:M,dialogOpen:F||U,onClose:G,goToCustomerTabFromScannerDialog:function(){E("contactInfo"),G()},addEntry:async function(){V(U,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1),G()},addCustomerToBonFromScannerDialog:async function(){await Y(),G(),await q.Z.closeBrowser()},issueNewTicketNumber:async function(e){r((0,ee.d9)(e))},addEntryAndGuest:_,customer:u,subscriptions:h,scannerDialogEntryObj:U?{productNumber:U.productNumber,qty:1,overloadedPrice:0,eventUid:"FT".concat(U.ticketNumber),subscriptionUid:U.subscriptionUid,time:null!==(e=U.displayPeriod)&&void 0!==e?e:U.event,currentTicket:U}:null,handleWebExit:J,onlyAddEntry:!(null===U||void 0===U||!U.onlyAddEntry)}),(0,I.jsx)(Qe,{open:!!b,ticket:b,onClose:e=>{r((0,ee.d9)(null))}}),(0,I.jsx)(gn,{selectedCustomer:u,onCustomerSelect:e=>{z(e),D(!1)},handleWebExit:J}),(0,I.jsx)(xn,{handleWebExit:J,onCustomerSelect:e=>{z(e),D(!1)}}),(0,I.jsx)(Z.Z,{onCustomerSelect:e=>{z(e),D(!1)},open:O,onClose:()=>{D(!1),d||J()}}),i.flexsdkSubscriptionImprovements&&!C&&(0,I.jsx)(m.Z,{className:"fixed",style:{bottom:".5rem",right:".5rem",zIndex:"99999999"},onClick:$,endIcon:(0,I.jsx)(H.Z,{children:"help_outlined"}),children:"Hj\xe6lp"}),i.flexsdkSubscriptionImprovements&&C&&(0,I.jsx)(m.Z,{className:"fixed",style:{bottom:".5rem",right:".5rem",zIndex:"99999999"},variant:"contained",color:"primary",onClick:$,endIcon:(0,I.jsx)(H.Z,{children:"help_outlined"}),children:"Hj\xe6lp-beskeder aktiveret"}),u&&!F&&!U&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("div",{className:"mb-10",children:[(0,I.jsxs)(_n,{value:P,variant:"fullWidth",classes:{},children:[(0,I.jsx)(o.Z,{label:"Kontaktoplysninger",value:"contactInfo",onClick:()=>K("contactInfo")}),i.flexsdkSubscriptionImprovements&&k&&(0,I.jsx)(o.Z,{label:N.subscriptions||"Medlemskaber",value:"simpleSubscriptions",onClick:()=>K("simpleSubscriptions")}),(!i.flexsdkSubscriptionImprovements||!k)&&(0,I.jsx)(o.Z,{label:"Medlemskort",value:"subscriptionTickets",onClick:()=>K("subscriptionTickets"),disabled:!!w}),(!i.flexsdkSubscriptionImprovements||!k)&&(0,I.jsx)(o.Z,{label:"Medlemskaber",value:"subscriptions",onClick:()=>K("subscriptions")}),(!i.createSubcustomersOnFlexsdk||a.subscriptions&&a.subscriptions.subcustomers&&!p)&&(0,I.jsx)(o.Z,{label:"Underkunder",value:"subcustomers",onClick:()=>K("subcustomers")})]}),p&&(0,I.jsxs)(g.Z,{severity:"info",children:["Den valgte kunde er ",(0,I.jsx)("span",{className:"font-bold",children:"underkunde"})," til"," ",p.contactInfo&&p.contactInfo.billing&&(0,I.jsxs)(m.Z,{variant:"text",color:"primary",onClick:()=>z(p.id),size:"small",children:[p.contactInfo.billing.firstname," ",p.contactInfo.billing.lastname]}),(!p.contactInfo||!p.contactInfo.billing)&&(0,I.jsx)(m.Z,{variant:"text",color:"primary",onClick:()=>z(p.id),size:"small",children:"en ukendt kunde"})]}),!!c&&(0,I.jsxs)(g.Z,{severity:"error",action:(0,I.jsx)(be.Z,{size:"small",onClick:()=>r((0,ee.sT)(null)),children:(0,I.jsx)(H.Z,{children:"close"})}),children:[(0,I.jsx)("span",{className:"font-bold",children:"Fejl:"})," ",c]}),i.disableSaveForDefaultCustomersOnPos&&L&&(0,I.jsxs)(g.Z,{severity:"error",children:["Dette er en ",(0,I.jsx)("span",{className:"font-bold",children:"standard kunde"}),". \xc6ndringer samt oprettelse af medlemskaber vil ikke blive gemt."]}),w&&(0,I.jsxs)(g.Z,{severity:"info",variant:"filled",children:['Du er igang med at indl\xf8se et produktgavekort. Indl\xf8s det ved at oprette medlemskabet under fanen "',N.subscriptions||"Medlemskaber",'"']})]}),(0,I.jsxs)("div",{className:"px-10",children:["contactInfo"===P&&(0,I.jsx)(Zn,{onExit:J,onBack:X,onAddCustomer:Y}),"orders"===P&&(0,I.jsx)(wn,{onExit:J,onBack:X}),"tickets"===P&&(0,I.jsx)(En,{onExit:J,onBack:X}),"simpleSubscriptions"===P&&(0,I.jsx)(Gn,{onExit:J,onBack:X,onAddEntry:V,onAddEntryAndGuest:_,onAddCustomer:Y,locationUid:B}),"subscriptionTickets"===P&&(0,I.jsx)(On,{onExit:J,onBack:X,onAddEntry:V,onAddEntryAndGuest:_}),"subscriptions"===P&&(0,I.jsx)(Wn,{onExit:J,onBack:X,onAddEntry:V,onAddEntryAndGuest:_,locationUid:B,onAddCustomer:Y}),"subcustomers"===P&&(0,I.jsx)(Vn,{onExit:J,onBack:X,goToTab:E})]})]})]})}));var Jn=t(9186);
1const Qn=function(){const[e,n]=(0,s.useState)(!0),[t,o]=(0,s.useState)("true"!==(0,Ce.ak)("design")&&"false"!==(0,Ce.ak)("design")||"true"===(0,Ce.ak)("design")),r=(0,l.useFlags)();return(0,s.useEffect)((()=>{r.customerPosDesignUpdate&&void 0===t||t||(window.callbackClosing=()=>{n(!1),n(!0)})}),[r.customerPosDesignUpdate,t]),(0,s.useEffect)((()=>{r.customerPosDesignUpdate&&q.Z.getVersion((e=>{e&&q.Z.setVersion(e.FlexPOS_Version),q.Z.ifVersion("2.4.24.21",">=",(()=>o(!0)),(()=>o(!1)))}))}),[r.customerPosDesignUpdate]),r.customerPosDesignUpdate&&void 0===t?(0,I.jsx)(Jn.Z,{}):r.customerPosDesignUpdate&&r.createCustomerFromAnonymousOnPos&&r.minorFixes&&r.addTilfojEntreButtonToFlexposSubscriptionsUi&&t?(0,I.jsx)(i.Z,{theme:Ne,children:(0,I.jsx)(yn.Z,{children:e?(0,I.jsx)(N.Z,{children:(0,I.jsx)(qn,{})}):""})}):(0,I.jsxs)(I.Fragment,{children:[r.newFpUiTheme&&(0,I.jsx)(i.Z,{theme:Nn.Z,children:(0,I.jsx)(yn.Z,{children:e?(0,I.jsx)(kn,{}):""})}),!r.newFpUiTheme&&(0,I.jsx)(yn.Z,{children:e?(0,I.jsx)(kn,{}):""})]})}},56994:e=>{e.exports={TICKETS:"tickets",FEES:"fees",SUBSCRIPTION_GIFTS:"subscriptionGifts",SUBSCRIPTION_TICKETS:"subscriptionTickets",BOOTH_SALE:"boothSale",BOOTH:"booth",ENTRANCE_TICKETS:"entranceTickets",EVENT_TICKETS:"eventTickets"}},72413:(e,n,t)=>{"use strict";t.d(n,{Z:()=>l});var s=t(26034),i=(t(43001),t(2574));const l=(e,n)=>t=>((0,s.f)(e,n),e=>(0,i.jsx)(t,{...e}))}}]);
2//# sourceMappingURL=200.08c357d6.chunk.js.map

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.