@oneclick.dev/cms-core-modules 0.0.114 → 0.0.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ContentEditor-MctMvN7D.js → ContentEditor-CsbOFg3a.js} +52 -52
- package/dist/{ContentEditor-C5yNNLeV.mjs → ContentEditor-Df5uWpVC.mjs} +10337 -8677
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +77 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BHeMJ6nr.mjs +1476 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js +1 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +925 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +5021 -0
- package/dist/Overview-CBahJviK.js +1 -0
- package/dist/Overview-CVQ1pkuD.mjs +527 -0
- package/dist/TableView-Csv5Lycy.mjs +6234 -0
- package/dist/TableView-Cwal0BPW.js +4 -0
- package/dist/agenda-BSdlrfxv.mjs +1253 -0
- package/dist/agenda-Bev1mO7E.js +1 -0
- package/dist/availability-ClBGVgE9.js +1 -0
- package/dist/availability-D8JdA4rP.mjs +274 -0
- package/dist/booking-data-Px7XCIfU.mjs +1024 -0
- package/dist/booking-data-aMS1p_3g.js +1 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/exceptions-CqityDo9.mjs +651 -0
- package/dist/exceptions-DXqc0Nza.js +1 -0
- package/dist/index-CM4eaK5T.mjs +1245 -0
- package/dist/index-DliTZzwI.js +35 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +12 -11
- package/dist/orders-1swJVKw2.js +1 -0
- package/dist/orders-D41GbzIa.mjs +624 -0
- package/dist/payment-BJHgpaeT.js +1 -0
- package/dist/payment-D5j-68Ig.mjs +1278 -0
- package/dist/refunds-D9nTeD2d.mjs +436 -0
- package/dist/refunds-oVB2Opib.js +1 -0
- package/dist/resources-8WouFvJe.js +1 -0
- package/dist/resources-B-D5MUhV.mjs +975 -0
- package/dist/server-handlers.cjs.js +1 -1
- package/dist/server-handlers.mjs +626 -515
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +146 -5
- package/dist/src/appointments/components/edit/EventDialog/CancelRefundReservationDialog.vue.d.ts +33 -0
- package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +26 -8
- package/dist/src/appointments/components/edit/EventDialog/RefundDetailsDisplay.vue.d.ts +8 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +91 -5
- package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +20 -3
- package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +5 -0
- package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +20 -2
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +240 -0
- package/dist/src/appointments/composables/useAgendaMetadataSchema.d.ts +37 -0
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +225 -0
- package/dist/src/appointments/pages/edit/refunds.vue.d.ts +2 -0
- package/dist/src/appointments/server.d.ts +2 -0
- package/dist/src/appointments/types.d.ts +6 -0
- package/dist/src/appointments/utils/printReservation.d.ts +65 -3
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.d.ts +36 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.vue.d.ts +95 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableCell.d.ts +13 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableHeader.d.ts +6 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableRow.d.ts +6 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/index.d.ts +4 -0
- package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/TableMenu.vue.d.ts +13 -0
- package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +14 -0
- package/package.json +2 -2
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +0 -76
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +0 -1263
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +0 -1
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +0 -330
- package/dist/Overview-98nkJUWN.mjs +0 -481
- package/dist/Overview-Dl8cMlsr.js +0 -1
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +0 -349
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +0 -3077
- package/dist/TableView-CVfkyj1k.js +0 -4
- package/dist/TableView-zDx0IegJ.mjs +0 -6096
- package/dist/agenda-BaJu3-1c.js +0 -1
- package/dist/agenda-BwVY_8oM.mjs +0 -1165
- package/dist/availability-CMrRa5y2.mjs +0 -269
- package/dist/availability-Cf2YfMwM.js +0 -1
- package/dist/booking-data-DgJd0BcM.mjs +0 -889
- package/dist/booking-data-Di5GmH_8.js +0 -1
- package/dist/exceptions-B6P9UiCj.js +0 -1
- package/dist/exceptions-De9-FvdP.mjs +0 -646
- package/dist/index-DL6orwdK.js +0 -35
- package/dist/index-hH3e-IYz.mjs +0 -1187
- package/dist/orders-C65SlpJy.mjs +0 -618
- package/dist/orders-XVzWAgG1.js +0 -1
- package/dist/payment-C3ohkehF.mjs +0 -1080
- package/dist/payment-Dfr-Ro-a.js +0 -1
- package/dist/resources-CxeFd57z.js +0 -1
- package/dist/resources-DwYxn2Vi.mjs +0 -811
|
@@ -0,0 +1,925 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),I=require("lucide-vue-next"),J=require("@oneclick.dev/cms-kit"),re=require("./index-ijdf0d9-.js");function ve(t){return Array.isArray?Array.isArray(t):ut(t)==="[object Array]"}function wt(t){if(typeof t=="string")return t;if(typeof t=="bigint")return t.toString();const o=t+"";return o=="0"&&1/t==-1/0?"-0":o}function Le(t){return t==null?"":wt(t)}function le(t){return typeof t=="string"}function Te(t){return typeof t=="number"}function _t(t){return t===!0||t===!1||Dt(t)&&ut(t)=="[object Boolean]"}function dt(t){return typeof t=="object"}function Dt(t){return dt(t)&&t!==null}function de(t){return t!=null}function Fe(t){return!t.trim().length}function ut(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Et="Incorrect 'index' type",$t=t=>`Invalid value for key ${t}`,St=t=>`Pattern length exceeds max of ${t}.`,Bt=t=>`Missing ${t} property in key`,At=t=>`Property 'weight' in key '${t}' must be a positive integer`,at=Object.prototype.hasOwnProperty;class Mt{constructor(o){this._keys=[],this._keyMap={};let n=0;o.forEach(s=>{const r=mt(s);this._keys.push(r),this._keyMap[r.id]=r,n+=r.weight}),this._keys.forEach(s=>{s.weight/=n})}get(o){return this._keyMap[o]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function mt(t){let o=null,n=null,s=null,r=1,u=null;if(le(t)||ve(t))s=t,o=st(t),n=Ue(t);else{if(!at.call(t,"name"))throw new Error(Bt("name"));const l=t.name;if(s=l,at.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(At(l));o=st(l),n=Ue(l),u=t.getFn}return{path:o,id:n,weight:r,src:s,getFn:u}}function st(t){return ve(t)?t:t.split(".")}function Ue(t){return ve(t)?t.join("."):t}function Rt(t,o){const n=[];let s=!1;const r=(u,l,d,p)=>{if(de(u))if(!l[d])n.push(p!==void 0?{v:u,i:p}:u);else{const m=l[d],c=u[m];if(!de(c))return;if(d===l.length-1&&(le(c)||Te(c)||_t(c)||typeof c=="bigint"))n.push(p!==void 0?{v:Le(c),i:p}:Le(c));else if(ve(c)){s=!0;for(let g=0,h=c.length;g<h;g+=1)r(c[g],l,d+1,g)}else l.length&&r(c,l,d+1,p)}};return r(t,le(o)?o.split("."):o,0),s?n:n[0]}const It={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Ft={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,o)=>t.score===o.score?t.idx<o.idx?-1:1:t.score<o.score?-1:1},Tt={location:0,threshold:.6,distance:100},jt={useExtendedSearch:!1,useTokenSearch:!1,getFn:Rt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},B=Object.freeze({...Ft,...It,...Tt,...jt}),zt=/[^ ]+/g;function Ot(t=1,o=3){const n=new Map,s=Math.pow(10,o);return{get(r){const u=r.match(zt).length;if(n.has(u))return n.get(u);const l=1/Math.pow(u,.5*t),d=parseFloat(Math.round(l*s)/s);return n.set(u,d),d},clear(){n.clear()}}}class qe{constructor({getFn:o=B.getFn,fieldNormWeight:n=B.fieldNormWeight}={}){this.norm=Ot(n,3),this.getFn=o,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(o=[]){this.docs=o}setIndexRecords(o=[]){this.records=o}setKeys(o=[]){this.keys=o,this._keysMap={},o.forEach((n,s)=>{this._keysMap[n.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,le(this.docs[0])?this.docs.forEach((o,n)=>{this._addString(o,n)}):this.docs.forEach((o,n)=>{this._addObject(o,n)}),this.norm.clear())}add(o){const n=this.size();le(o)?this._addString(o,n):this._addObject(o,n)}removeAt(o){this.records.splice(o,1);for(let n=o,s=this.size();n<s;n+=1)this.records[n].i-=1}removeAll(o){for(let n=o.length-1;n>=0;n-=1)this.records.splice(o[n],1);for(let n=0,s=this.records.length;n<s;n+=1)this.records[n].i=n}getValueForItemAtKeyId(o,n){return o[this._keysMap[n]]}size(){return this.records.length}_addString(o,n){if(!de(o)||Fe(o))return;const s={v:o,i:n,n:this.norm.get(o)};this.records.push(s)}_addObject(o,n){const s={i:n,$:{}};this.keys.forEach((r,u)=>{const l=r.getFn?r.getFn(o):this.getFn(o,r.path);if(de(l)){if(ve(l)){const d=[];for(let p=0,m=l.length;p<m;p+=1){const c=l[p];if(de(c)){if(le(c)){if(!Fe(c)){const g={v:c,i:p,n:this.norm.get(c)};d.push(g)}}else if(de(c.v)){const g=le(c.v)?c.v:Le(c.v);if(!Fe(g)){const h={v:g,i:c.i,n:this.norm.get(g)};d.push(h)}}}}s.$[u]=d}else if(le(l)&&!Fe(l)){const d={v:l,n:this.norm.get(l)};s.$[u]=d}}}),this.records.push(s)}toJSON(){return{keys:this.keys.map(({getFn:o,...n})=>n),records:this.records}}}function pt(t,o,{getFn:n=B.getFn,fieldNormWeight:s=B.fieldNormWeight}={}){const r=new qe({getFn:n,fieldNormWeight:s});return r.setKeys(t.map(mt)),r.setSources(o),r.create(),r}function Pt(t,{getFn:o=B.getFn,fieldNormWeight:n=B.fieldNormWeight}={}){const{keys:s,records:r}=t,u=new qe({getFn:o,fieldNormWeight:n});return u.setKeys(s),u.setIndexRecords(r),u}function Lt(t=[],o=B.minMatchCharLength){const n=[];let s=-1,r=-1,u=0;for(let l=t.length;u<l;u+=1){const d=t[u];d&&s===-1?s=u:!d&&s!==-1&&(r=u-1,r-s+1>=o&&n.push([s,r]),s=-1)}return t[u-1]&&u-s>=o&&n.push([s,u-1]),n}const xe=32;function Ut(t,o,n,{location:s=B.location,distance:r=B.distance,threshold:u=B.threshold,findAllMatches:l=B.findAllMatches,minMatchCharLength:d=B.minMatchCharLength,includeMatches:p=B.includeMatches,ignoreLocation:m=B.ignoreLocation}={}){if(o.length>xe)throw new Error(St(xe));const c=o.length,g=t.length,h=Math.max(0,Math.min(s,g));let i=u,v=h;const a=(E,w)=>{const $=E/c;if(m)return $;const F=Math.abs(h-w);return r?$+F/r:F?1:$},x=d>1||p,A=x?Array(g):[];let f;for(;(f=t.indexOf(o,v))>-1;){const E=a(0,f);if(i=Math.min(E,i),v=f+c,x){let w=0;for(;w<c;)A[f+w]=1,w+=1}}v=-1;let _=[],M=1,z=c+g;const P=1<<c-1;for(let E=0;E<c;E+=1){let w=0,$=z;for(;w<$;)a(E,h+$)<=i?w=$:z=$,$=Math.floor((z-w)/2+w);z=$;let F=Math.max(1,h-$+1);const ne=l?g:Math.min(h+$,g)+c,L=Array(ne+2);L[ne+1]=(1<<E)-1;for(let K=ne;K>=F;K-=1){const k=K-1,N=n[t[k]];if(x&&(A[k]=+!!N),L[K]=(L[K+1]<<1|1)&N,E&&(L[K]|=(_[K+1]|_[K])<<1|1|_[K+1]),L[K]&P&&(M=a(E,k),M<=i)){if(i=M,v=k,v<=h)break;F=Math.max(1,2*h-v)}}if(a(E+1,h)>i)break;_=L}const W={isMatch:v>=0,score:Math.max(.001,M)};if(x){const E=Lt(A,d);E.length?p&&(W.indices=E):W.isMatch=!1}return W}function Ht(t){const o={};for(let n=0,s=t.length;n<s;n+=1){const r=t.charAt(n);o[r]=(o[r]||0)|1<<s-n-1}return o}function et(t){if(t.length<=1)return t;t.sort((n,s)=>n[0]-s[0]||n[1]-s[1]);const o=[t[0]];for(let n=1,s=t.length;n<s;n+=1){const r=o[o.length-1],u=t[n];u[0]<=r[1]+1?r[1]=Math.max(r[1],u[1]):o.push(u)}return o}const ft={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},Wt=new RegExp("["+Object.keys(ft).join("")+"]","g"),Re=String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(Wt,o=>ft[o]):t=>t;class tt{constructor(o,{location:n=B.location,threshold:s=B.threshold,distance:r=B.distance,includeMatches:u=B.includeMatches,findAllMatches:l=B.findAllMatches,minMatchCharLength:d=B.minMatchCharLength,isCaseSensitive:p=B.isCaseSensitive,ignoreDiacritics:m=B.ignoreDiacritics,ignoreLocation:c=B.ignoreLocation}={}){if(this.options={location:n,threshold:s,distance:r,includeMatches:u,findAllMatches:l,minMatchCharLength:d,isCaseSensitive:p,ignoreDiacritics:m,ignoreLocation:c},o=p?o:o.toLowerCase(),o=m?Re(o):o,this.pattern=o,this.chunks=[],!this.pattern.length)return;const g=(i,v)=>{this.chunks.push({pattern:i,alphabet:Ht(i),startIndex:v})},h=this.pattern.length;if(h>xe){let i=0;const v=h%xe,a=h-v;for(;i<a;)g(this.pattern.substr(i,xe),i),i+=xe;if(v){const x=h-xe;g(this.pattern.substr(x),x)}}else g(this.pattern,0)}searchIn(o){const{isCaseSensitive:n,ignoreDiacritics:s,includeMatches:r}=this.options;if(o=n?o:o.toLowerCase(),o=s?Re(o):o,this.pattern===o){const a={isMatch:!0,score:0};return r&&(a.indices=[[0,o.length-1]]),a}const{location:u,distance:l,threshold:d,findAllMatches:p,minMatchCharLength:m,ignoreLocation:c}=this.options,g=[];let h=0,i=!1;this.chunks.forEach(({pattern:a,alphabet:x,startIndex:A})=>{const{isMatch:f,score:_,indices:M}=Ut(o,a,x,{location:u+A,distance:l,threshold:d,findAllMatches:p,minMatchCharLength:m,includeMatches:r,ignoreLocation:c});f&&(i=!0),h+=_,f&&M&&g.push(...M)});const v={isMatch:i,score:i?h/this.chunks.length:1};return i&&r&&(v.indices=et(g)),v}}class ge{constructor(o){this.pattern=o}static isMultiMatch(o){return rt(o,this.multiRegex)}static isSingleMatch(o){return rt(o,this.singleRegex)}search(o){return{isMatch:!1,score:1}}}function rt(t,o){const n=t.match(o);return n?n[1]:null}class Kt extends ge{constructor(o){super(o)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(o){const n=o===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Gt extends ge{constructor(o){super(o)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(o){const s=o.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,o.length-1]}}}class Yt extends ge{constructor(o){super(o)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(o){const n=o.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Jt extends ge{constructor(o){super(o)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(o){const n=!o.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,o.length-1]}}}class Qt extends ge{constructor(o){super(o)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(o){const n=o.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[o.length-this.pattern.length,o.length-1]}}}class Xt extends ge{constructor(o){super(o)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(o){const n=!o.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,o.length-1]}}}class vt extends ge{constructor(o,{location:n=B.location,threshold:s=B.threshold,distance:r=B.distance,includeMatches:u=B.includeMatches,findAllMatches:l=B.findAllMatches,minMatchCharLength:d=B.minMatchCharLength,isCaseSensitive:p=B.isCaseSensitive,ignoreDiacritics:m=B.ignoreDiacritics,ignoreLocation:c=B.ignoreLocation}={}){super(o),this._bitapSearch=new tt(o,{location:n,threshold:s,distance:r,includeMatches:u,findAllMatches:l,minMatchCharLength:d,isCaseSensitive:p,ignoreDiacritics:m,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(o){return this._bitapSearch.searchIn(o)}}class gt extends ge{constructor(o){super(o)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(o){let n=0,s;const r=[],u=this.pattern.length;for(;(s=o.indexOf(this.pattern,n))>-1;)n=s+u,r.push([s,n-1]);const l=!!r.length;return{isMatch:l,score:l?0:1,indices:r}}}const He=[Kt,gt,Yt,Jt,Xt,Qt,Gt,vt],lt=He.length,Zt="\0",qt="|";function eo(t){const o=[],n=t.length;let s=0;for(;s<n;){for(;s<n&&t[s]===" ";)s++;if(s>=n)break;let r=s;for(;r<n&&t[r]!==" "&&t[r]!=='"';)r++;if(r<n&&t[r]==='"'){for(r++;r<n;){if(t[r]==='"'){const u=r+1;if(u>=n||t[u]===" "){r++;break}if(t[u]==="$"&&(u+1>=n||t[u+1]===" ")){r+=2;break}}r++}o.push(t.substring(s,r)),s=r}else{for(;r<n&&t[r]!==" ";)r++;o.push(t.substring(s,r)),s=r}}return o}function to(t,o={}){return t.replace(/\\\|/g,Zt).split(qt).map(s=>{const r=s.replace(/\u0000/g,"|"),u=eo(r.trim()).filter(d=>d&&!!d.trim()),l=[];for(let d=0,p=u.length;d<p;d+=1){const m=u[d];let c=!1,g=-1;for(;!c&&++g<lt;){const h=He[g],i=h.isMultiMatch(m);i&&(l.push(new h(i,o)),c=!0)}if(!c)for(g=-1;++g<lt;){const h=He[g],i=h.isSingleMatch(m);if(i){l.push(new h(i,o));break}}}return l})}const oo=new Set([vt.type,gt.type]);class no{constructor(o,{isCaseSensitive:n=B.isCaseSensitive,ignoreDiacritics:s=B.ignoreDiacritics,includeMatches:r=B.includeMatches,minMatchCharLength:u=B.minMatchCharLength,ignoreLocation:l=B.ignoreLocation,findAllMatches:d=B.findAllMatches,location:p=B.location,threshold:m=B.threshold,distance:c=B.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:s,includeMatches:r,minMatchCharLength:u,findAllMatches:d,ignoreLocation:l,location:p,threshold:m,distance:c},o=n?o:o.toLowerCase(),o=s?Re(o):o,this.pattern=o,this.query=to(this.pattern,this.options)}static condition(o,n){return n.useExtendedSearch}searchIn(o){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:r,ignoreDiacritics:u}=this.options;o=r?o:o.toLowerCase(),o=u?Re(o):o;let l=0;const d=[];let p=0,m=!1;for(let c=0,g=n.length;c<g;c+=1){const h=n[c];d.length=0,l=0,m=!1;for(let i=0,v=h.length;i<v;i+=1){const a=h[i],{isMatch:x,indices:A,score:f}=a.search(o);if(x){l+=1,p+=f;const _=a.constructor.type;_.startsWith("inverse")&&(m=!0),s&&(oo.has(_)?d.push(...A):d.push(A))}else{p=0,l=0,d.length=0,m=!1;break}}if(l){const i={isMatch:!0,score:p/l};return m&&(i.hasInverse=!0),s&&(i.indices=et(d)),i}}return{isMatch:!1,score:1}}}const We=[];function ot(...t){We.push(...t)}function je(t,o){for(let n=0,s=We.length;n<s;n+=1){const r=We[n];if(r.condition(t,o))return new r(t,o)}return new tt(t,o)}const ze={AND:"$and",OR:"$or"},Ke={PATH:"$path",PATTERN:"$val"},Ge=t=>!!(t[ze.AND]||t[ze.OR]),ao=t=>!!t[Ke.PATH],so=t=>!ve(t)&&dt(t)&&!Ge(t),it=t=>({[ze.AND]:Object.keys(t).map(o=>({[o]:t[o]}))});function ht(t,o,{auto:n=!0}={}){const s=r=>{if(le(r)){const p={keyId:null,pattern:r};return n&&(p.searcher=je(r,o)),p}const u=Object.keys(r),l=ao(r);if(!l&&u.length>1&&!Ge(r))return s(it(r));if(so(r)){const p=l?r[Ke.PATH]:u[0],m=l?r[Ke.PATTERN]:r[p];if(!le(m))throw new Error($t(p));const c={keyId:Ue(p),pattern:m};return n&&(c.searcher=je(m,o)),c}const d={children:[],operator:u[0]};return u.forEach(p=>{const m=r[p];ve(m)&&m.forEach(c=>{d.children.push(s(c))})}),d};return Ge(t)||(t=it(t)),s(t)}function Ye(t,{ignoreFieldNorm:o=B.ignoreFieldNorm}){let n=1;return t.forEach(({key:s,norm:r,score:u})=>{const l=s?s.weight:null;n*=Math.pow(u===0&&l?Number.EPSILON:u,(l||1)*(o?1:r))}),n}function ro(t,{ignoreFieldNorm:o=B.ignoreFieldNorm}){t.forEach(n=>{n.score=Ye(n.matches,{ignoreFieldNorm:o})})}class lo{constructor(o){this.limit=o,this.heap=[]}get size(){return this.heap.length}shouldInsert(o){return this.size<this.limit||o<this.heap[0].score}insert(o){this.size<this.limit?(this.heap.push(o),this._bubbleUp(this.size-1)):o.score<this.heap[0].score&&(this.heap[0]=o,this._sinkDown(0))}extractSorted(o){return this.heap.sort(o)}_bubbleUp(o){const n=this.heap;for(;o>0;){const s=o-1>>1;if(n[o].score<=n[s].score)break;const r=n[o];n[o]=n[s],n[s]=r,o=s}}_sinkDown(o){const n=this.heap,s=n.length;let r=o;do{o=r;const u=2*o+1,l=2*o+2;if(u<s&&n[u].score>n[r].score&&(r=u),l<s&&n[l].score>n[r].score&&(r=l),r!==o){const d=n[o];n[o]=n[r],n[r]=d}}while(r!==o)}}function io(t,o){const n=t.matches;o.matches=[],de(n)&&n.forEach(s=>{if(!de(s.indices)||!s.indices.length)return;const{indices:r,value:u}=s,l={indices:r,value:u};s.key&&(l.key=s.key.src),s.idx>-1&&(l.refIndex=s.idx),o.matches.push(l)})}function co(t,o){o.score=t.score}function uo(t,o,{includeMatches:n=B.includeMatches,includeScore:s=B.includeScore}={}){const r=[];return n&&r.push(io),s&&r.push(co),t.map(u=>{const{idx:l}=u,d={item:o[l],refIndex:l};return r.length&&r.forEach(p=>{p(u,d)}),d})}const mo=/\b\w+\b/g;function Je({isCaseSensitive:t=!1,ignoreDiacritics:o=!1}={}){return{tokenize(n){return t||(n=n.toLowerCase()),o&&(n=Re(n)),n.match(mo)||[]}}}function po(t,o,n){const s=new Map,r=new Map;let u=0;function l(d,p,m,c){const g=n.tokenize(d);if(!g.length)return;u++;const h=new Map;for(const i of g)h.set(i,(h.get(i)||0)+1);for(const[i,v]of h){const a={docIdx:p,keyIdx:m,subIdx:c,tf:v};let x=s.get(i);x||(x=[],s.set(i,x)),x.push(a),r.set(i,(r.get(i)||0)+1)}}for(const d of t){const{i:p,v:m,$:c}=d;if(m!==void 0){l(m,p,-1,-1);continue}if(c)for(let g=0;g<o;g++){const h=c[g];if(h)if(Array.isArray(h))for(const i of h)l(i.v,p,g,i.i??-1);else l(h.v,p,g,-1)}}return{terms:s,fieldCount:u,df:r}}function fo(t,o,n,s){const{i:r,v:u,$:l}=o;function d(p,m,c){const g=s.tokenize(p);if(!g.length)return;t.fieldCount++;const h=new Map;for(const i of g)h.set(i,(h.get(i)||0)+1);for(const[i,v]of h){const a={docIdx:r,keyIdx:m,subIdx:c,tf:v};let x=t.terms.get(i);x||(x=[],t.terms.set(i,x)),x.push(a),t.df.set(i,(t.df.get(i)||0)+1)}}if(u!==void 0){d(u,-1,-1);return}if(l)for(let p=0;p<n;p++){const m=l[p];if(m)if(Array.isArray(m))for(const c of m)d(c.v,p,c.i??-1);else d(m.v,p,-1)}}function ct(t,o){for(const[n,s]of t.terms){const r=s.filter(l=>l.docIdx!==o),u=s.length-r.length;u>0&&(t.fieldCount-=u,t.df.set(n,(t.df.get(n)||0)-u),r.length===0?(t.terms.delete(n),t.df.delete(n)):t.terms.set(n,r))}}class he{constructor(o,n,s){this.options={...B,...n},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Mt(this.options.keys),this._docs=o,this._myIndex=null,this._invertedIndex=null,this.setCollection(o,s),this._lastQuery=null,this._lastSearcher=null}_getSearcher(o){if(this._lastQuery===o)return this._lastSearcher;const n=this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options,s=je(o,n);return this._lastQuery=o,this._lastSearcher=s,s}setCollection(o,n){if(this._docs=o,n&&!(n instanceof qe))throw new Error(Et);if(this._myIndex=n||pt(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const s=Je({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});this._invertedIndex=po(this._myIndex.records,this._myIndex.keys.length,s)}}add(o){if(de(o)&&(this._docs.push(o),this._myIndex.add(o),this._invertedIndex)){const n=this._myIndex.records[this._myIndex.records.length-1],s=Je({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});fo(this._invertedIndex,n,this._myIndex.keys.length,s)}}remove(o=()=>!1){const n=[],s=[];for(let r=0,u=this._docs.length;r<u;r+=1)o(this._docs[r],r)&&(n.push(this._docs[r]),s.push(r));if(s.length){if(this._invertedIndex)for(const r of s)ct(this._invertedIndex,r);for(let r=s.length-1;r>=0;r-=1)this._docs.splice(s[r],1);this._myIndex.removeAll(s)}return n}removeAt(o){this._invertedIndex&&ct(this._invertedIndex,o);const n=this._docs.splice(o,1)[0];return this._myIndex.removeAt(o),n}getIndex(){return this._myIndex}search(o,n){const{limit:s=-1}=n||{},{includeMatches:r,includeScore:u,shouldSort:l,sortFn:d,ignoreFieldNorm:p}=this.options;if(le(o)&&!o.trim()){let g=this._docs.map((h,i)=>({item:h,refIndex:i}));return Te(s)&&s>-1&&(g=g.slice(0,s)),g}const m=Te(s)&&s>0&&le(o);let c;if(m){const g=new lo(s);le(this._docs[0])?this._searchStringList(o,{heap:g,ignoreFieldNorm:p}):this._searchObjectList(o,{heap:g,ignoreFieldNorm:p}),c=g.extractSorted(d)}else c=le(o)?le(this._docs[0])?this._searchStringList(o):this._searchObjectList(o):this._searchLogical(o),ro(c,{ignoreFieldNorm:p}),l&&c.sort(d),Te(s)&&s>-1&&(c=c.slice(0,s));return uo(c,this._docs,{includeMatches:r,includeScore:u})}_searchStringList(o,{heap:n,ignoreFieldNorm:s}={}){const r=this._getSearcher(o),{records:u}=this._myIndex,l=n?null:[];return u.forEach(({v:d,i:p,n:m})=>{if(!de(d))return;const{isMatch:c,score:g,indices:h}=r.searchIn(d);if(c){const i={item:d,idx:p,matches:[{score:g,value:d,norm:m,indices:h}]};n?(i.score=Ye(i.matches,{ignoreFieldNorm:s}),n.shouldInsert(i.score)&&n.insert(i)):l.push(i)}}),l}_searchLogical(o){const n=ht(o,this.options),s=(d,p,m)=>{if(!("children"in d)){const{keyId:i,searcher:v}=d;let a;return i===null?(a=[],this._myIndex.keys.forEach((x,A)=>{a.push(...this._findMatches({key:x,value:p[A],searcher:v}))})):a=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(p,i),searcher:v}),a&&a.length?[{idx:m,item:p,matches:a}]:[]}const{children:c,operator:g}=d,h=[];for(let i=0,v=c.length;i<v;i+=1){const a=c[i],x=s(a,p,m);if(x.length)h.push(...x);else if(g===ze.AND)return[]}return h},r=this._myIndex.records,u=new Map,l=[];return r.forEach(({$:d,i:p})=>{if(de(d)){const m=s(n,d,p);m.length&&(u.has(p)||(u.set(p,{idx:p,item:d,matches:[]}),l.push(u.get(p))),m.forEach(({matches:c})=>{u.get(p).matches.push(...c)}))}}),l}_searchObjectList(o,{heap:n,ignoreFieldNorm:s}={}){const r=this._getSearcher(o),{keys:u,records:l}=this._myIndex,d=n?null:[];return l.forEach(({$:p,i:m})=>{if(!de(p))return;const c=[];let g=!1,h=!1;if(u.forEach((i,v)=>{const a=this._findMatches({key:i,value:p[v],searcher:r});a.length?(c.push(...a),a[0].hasInverse&&(h=!0)):g=!0}),!(h&&g)&&c.length){const i={idx:m,item:p,matches:c};n?(i.score=Ye(i.matches,{ignoreFieldNorm:s}),n.shouldInsert(i.score)&&n.insert(i)):d.push(i)}}),d}_findMatches({key:o,value:n,searcher:s}){if(!de(n))return[];const r=[];if(ve(n))n.forEach(({v:u,i:l,n:d})=>{if(!de(u))return;const{isMatch:p,score:m,indices:c,hasInverse:g}=s.searchIn(u);p&&r.push({score:m,key:o,value:u,idx:l,norm:d,indices:c,hasInverse:g})});else{const{v:u,n:l}=n,{isMatch:d,score:p,indices:m,hasInverse:c}=s.searchIn(u);d&&r.push({score:p,key:o,value:u,norm:l,indices:m,hasInverse:c})}return r}}class vo{static condition(o,n){return n.useTokenSearch}constructor(o,n){this.options=n,this.analyzer=Je({isCaseSensitive:n.isCaseSensitive,ignoreDiacritics:n.ignoreDiacritics});const s=this.analyzer.tokenize(o),r=n._invertedIndex,{df:u,fieldCount:l}=r;this.termSearchers=[],this.idfWeights=[];for(const d of s){this.termSearchers.push(new tt(d,{location:n.location,threshold:n.threshold,distance:n.distance,includeMatches:n.includeMatches,findAllMatches:n.findAllMatches,minMatchCharLength:n.minMatchCharLength,isCaseSensitive:n.isCaseSensitive,ignoreDiacritics:n.ignoreDiacritics,ignoreLocation:!0}));const p=u.get(d)||0,m=Math.log(1+(l-p+.5)/(p+.5));this.idfWeights.push(m)}}searchIn(o){if(!this.termSearchers.length)return{isMatch:!1,score:1};const n=[];let s=0,r=0,u=0;for(let p=0;p<this.termSearchers.length;p++){const m=this.termSearchers[p].searchIn(o),c=this.idfWeights[p];r+=c,m.isMatch&&(u++,s+=c*(1-m.score),m.indices&&n.push(...m.indices))}if(u===0)return{isMatch:!1,score:1};const l=r>0?1-s/r:0,d={isMatch:!0,score:Math.max(.001,l)};return this.options.includeMatches&&n.length&&(d.indices=et(n)),d}}he.version="7.3.0";he.createIndex=pt;he.parseIndex=Pt;he.config=B;he.match=function(t,o,n){return je(t,{...B,...n}).searchIn(o)};he.parseQuery=ht;ot(no);ot(vo);he.use=function(...t){t.forEach(o=>ot(o))};const te=t=>t==null?"—":`€${t.toFixed(2)}`,yt=t=>{if(!t)return"—";if(t<60)return`${t} min`;const o=Math.floor(t/60),n=t%60;return n>0?`${o}h ${n}min`:`${o}h`},Qe=t=>{const o=Number(t.value);return Number.isFinite(o)?t.type==="percent"?`${o}%`:`${o<0?"-":"+"}${te(Math.abs(o))}`:"—"},Xe=t=>{switch(t){case"confirmed":return"Confirmed";case"pending":return"Pending";case"cancelled":return"Cancelled";case"needs_approval":return"Needs Approval";case"approved":return"Approved";case"rejected":return"Rejected";default:return t||"Unknown"}},we=t=>{switch(t){case"confirmed":case"approved":return"#16a34a";case"pending":case"needs_approval":return"#ca8a04";case"cancelled":case"rejected":return"#dc2626";default:return"#6b7280"}},go=t=>{if(!t)return"—";const o=new Date(t);return Number.isNaN(o.getTime())?t:o.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})},ho=t=>{if(!t)return"—";const o=new Date(t);return Number.isNaN(o.getTime())?t:o.toLocaleString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})},yo=t=>t.status==="confirmed"&&["needs_approval","rejected","approved","cancelled"].includes(t.reservationStatus||"")?t.reservationStatus||t.status:t.status||t.reservationStatus||"",bt=t=>String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),q=(t,o="—")=>t==null||t===""?o:bt(t),bo=t=>t==null||t===""||t===!1?!1:Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!0,xo=t=>{if(t===!0)return"Yes";if(Array.isArray(t))return t.map(o=>typeof o=="object"?JSON.stringify(o):String(o)).join(", ");if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},Oe=(t,o,n)=>!t||!o?.length?[]:o.filter(s=>s.scope!==n||s.includeInPdf!==!0?!1:bo(t[s.key])).sort((s,r)=>(s.order||0)-(r.order||0)).map(s=>({id:s.id,key:s.key,label:s.label||s.key,value:t[s.key]})),xt=(t,o=!1)=>t.map(n=>`
|
|
2
|
+
<div class="metadata-row${o?" compact":""}">
|
|
3
|
+
<span class="metadata-label">${q(n.label)}</span>
|
|
4
|
+
<span class="metadata-value">${q(xo(n.value))}</span>
|
|
5
|
+
</div>
|
|
6
|
+
`).join(""),Ze=(t,o)=>o.length?`
|
|
7
|
+
<div class="section">
|
|
8
|
+
<div class="section-title">${q(t)}</div>
|
|
9
|
+
<div class="section-content">
|
|
10
|
+
<div class="metadata-list">
|
|
11
|
+
${xt(o)}
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
`:"",ko=(t,o={})=>{const n=`${t.customerInfo?.firstName||""} ${t.customerInfo?.lastName||""}`.trim()||"Unknown Customer",s=t.id?.slice(0,8)||"—",r=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),u=Oe(t.metadata,o.metadataSchema,"order"),l=Oe(t.reservationMetadata,o.metadataSchema,"reservation"),d=`
|
|
16
|
+
<!DOCTYPE html>
|
|
17
|
+
<html lang="en">
|
|
18
|
+
<head>
|
|
19
|
+
<meta charset="UTF-8">
|
|
20
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
21
|
+
<title>Reservation ${s}</title>
|
|
22
|
+
<style>
|
|
23
|
+
* {
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
body {
|
|
30
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
31
|
+
line-height: 1.6;
|
|
32
|
+
color: #1f2937;
|
|
33
|
+
background: #fff;
|
|
34
|
+
padding: 40px;
|
|
35
|
+
max-width: 800px;
|
|
36
|
+
margin: 0 auto;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.header {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
align-items: flex-start;
|
|
43
|
+
margin-bottom: 40px;
|
|
44
|
+
padding-bottom: 20px;
|
|
45
|
+
border-bottom: 2px solid #e5e7eb;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.company-info {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 16px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.company-logo {
|
|
55
|
+
max-height: 50px;
|
|
56
|
+
max-width: 150px;
|
|
57
|
+
object-fit: contain;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.company-name {
|
|
61
|
+
font-size: 24px;
|
|
62
|
+
font-weight: 700;
|
|
63
|
+
color: #111827;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.document-info {
|
|
67
|
+
text-align: right;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.document-title {
|
|
71
|
+
font-size: 28px;
|
|
72
|
+
font-weight: 700;
|
|
73
|
+
color: #111827;
|
|
74
|
+
margin-bottom: 8px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.booking-id {
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
color: #6b7280;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.status-badge {
|
|
83
|
+
display: inline-block;
|
|
84
|
+
padding: 4px 12px;
|
|
85
|
+
border-radius: 9999px;
|
|
86
|
+
font-size: 12px;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
text-transform: uppercase;
|
|
89
|
+
margin-top: 8px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.section {
|
|
93
|
+
margin-bottom: 32px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.section-title {
|
|
97
|
+
font-size: 12px;
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
text-transform: uppercase;
|
|
100
|
+
letter-spacing: 0.05em;
|
|
101
|
+
color: #6b7280;
|
|
102
|
+
margin-bottom: 12px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.section-content {
|
|
106
|
+
background: #f9fafb;
|
|
107
|
+
border-radius: 8px;
|
|
108
|
+
padding: 20px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.customer-name {
|
|
112
|
+
font-size: 18px;
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
margin-bottom: 8px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.contact-info {
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
color: #4b5563;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.contact-info a {
|
|
123
|
+
color: #4b5563;
|
|
124
|
+
text-decoration: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.grid {
|
|
128
|
+
display: grid;
|
|
129
|
+
grid-template-columns: 1fr 1fr;
|
|
130
|
+
gap: 16px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.info-card {
|
|
134
|
+
background: #f9fafb;
|
|
135
|
+
border-radius: 8px;
|
|
136
|
+
padding: 16px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.info-label {
|
|
140
|
+
font-size: 12px;
|
|
141
|
+
color: #6b7280;
|
|
142
|
+
margin-bottom: 4px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.info-value {
|
|
146
|
+
font-size: 16px;
|
|
147
|
+
font-weight: 600;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.metadata-list {
|
|
151
|
+
display: grid;
|
|
152
|
+
gap: 8px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.metadata-row {
|
|
156
|
+
display: flex;
|
|
157
|
+
justify-content: space-between;
|
|
158
|
+
gap: 16px;
|
|
159
|
+
padding: 8px 0;
|
|
160
|
+
border-bottom: 1px solid #e5e7eb;
|
|
161
|
+
font-size: 14px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.metadata-row:last-child {
|
|
165
|
+
border-bottom: none;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.metadata-label {
|
|
169
|
+
color: #6b7280;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.metadata-value {
|
|
173
|
+
max-width: 60%;
|
|
174
|
+
font-weight: 600;
|
|
175
|
+
text-align: right;
|
|
176
|
+
overflow-wrap: anywhere;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.package-row {
|
|
180
|
+
display: flex;
|
|
181
|
+
justify-content: space-between;
|
|
182
|
+
align-items: flex-start;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.package-name {
|
|
186
|
+
font-size: 16px;
|
|
187
|
+
font-weight: 600;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.package-duration {
|
|
191
|
+
font-size: 14px;
|
|
192
|
+
color: #6b7280;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.package-price {
|
|
196
|
+
font-size: 16px;
|
|
197
|
+
font-weight: 600;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.payment-row {
|
|
201
|
+
display: flex;
|
|
202
|
+
justify-content: space-between;
|
|
203
|
+
padding: 8px 0;
|
|
204
|
+
font-size: 14px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.payment-label {
|
|
208
|
+
color: #6b7280;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.payment-value {
|
|
212
|
+
font-weight: 500;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.payment-value.green {
|
|
216
|
+
color: #16a34a;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.payment-value.orange {
|
|
220
|
+
color: #ea580c;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.payment-divider {
|
|
224
|
+
border-top: 1px solid #e5e7eb;
|
|
225
|
+
margin: 12px 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.payment-total {
|
|
229
|
+
font-size: 16px;
|
|
230
|
+
font-weight: 600;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.footer {
|
|
234
|
+
margin-top: 60px;
|
|
235
|
+
padding-top: 20px;
|
|
236
|
+
border-top: 1px solid #e5e7eb;
|
|
237
|
+
text-align: center;
|
|
238
|
+
font-size: 12px;
|
|
239
|
+
color: #9ca3af;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media print {
|
|
243
|
+
body {
|
|
244
|
+
padding: 20px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.no-print {
|
|
248
|
+
display: none;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
</style>
|
|
252
|
+
</head>
|
|
253
|
+
<body>
|
|
254
|
+
<div class="header">
|
|
255
|
+
<div class="company-info">
|
|
256
|
+
${o.companyLogo?`<img src="${o.companyLogo}" alt="Logo" class="company-logo" />`:""}
|
|
257
|
+
${o.companyName?`<span class="company-name">${o.companyName}</span>`:""}
|
|
258
|
+
</div>
|
|
259
|
+
<div class="document-info">
|
|
260
|
+
<div class="document-title">Reservation</div>
|
|
261
|
+
<div class="booking-id">Booking #${s}</div>
|
|
262
|
+
<div
|
|
263
|
+
class="status-badge"
|
|
264
|
+
style="background-color: ${we(t.status)}20; color: ${we(t.status)};"
|
|
265
|
+
>
|
|
266
|
+
${Xe(t.status)}
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<div class="section">
|
|
272
|
+
<div class="section-title">Customer</div>
|
|
273
|
+
<div class="section-content">
|
|
274
|
+
<div class="customer-name">${n}</div>
|
|
275
|
+
<div class="contact-info">
|
|
276
|
+
${t.customerInfo?.email?`<div>Email: <a href="mailto:${t.customerInfo.email}">${t.customerInfo.email}</a></div>`:""}
|
|
277
|
+
${t.customerInfo?.phone?`<div>Phone: <a href="tel:${t.customerInfo.phone}">${t.customerInfo.phone}</a></div>`:""}
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
${Ze("Order Metadata",u)}
|
|
283
|
+
|
|
284
|
+
<div class="section">
|
|
285
|
+
<div class="section-title">Reservation Details</div>
|
|
286
|
+
<div class="grid">
|
|
287
|
+
<div class="info-card">
|
|
288
|
+
<div class="info-label">Date</div>
|
|
289
|
+
<div class="info-value">${o.date||"—"}</div>
|
|
290
|
+
</div>
|
|
291
|
+
<div class="info-card">
|
|
292
|
+
<div class="info-label">Time</div>
|
|
293
|
+
<div class="info-value">${t.startTime} - ${t.endTime}</div>
|
|
294
|
+
</div>
|
|
295
|
+
<div class="info-card">
|
|
296
|
+
<div class="info-label">Spots</div>
|
|
297
|
+
<div class="info-value">${t.spots||1} ${(t.spots||1)===1?"person":"people"}</div>
|
|
298
|
+
</div>
|
|
299
|
+
${o.resourceName?`
|
|
300
|
+
<div class="info-card">
|
|
301
|
+
<div class="info-label">Resource</div>
|
|
302
|
+
<div class="info-value">${o.resourceName}</div>
|
|
303
|
+
</div>
|
|
304
|
+
`:""}
|
|
305
|
+
${o.agendaName?`
|
|
306
|
+
<div class="info-card">
|
|
307
|
+
<div class="info-label">Service</div>
|
|
308
|
+
<div class="info-value">${o.agendaName}</div>
|
|
309
|
+
</div>
|
|
310
|
+
`:""}
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
${Ze("Reservation Metadata",l)}
|
|
315
|
+
|
|
316
|
+
${t.pricingOption?`
|
|
317
|
+
<div class="section">
|
|
318
|
+
<div class="section-title">Package</div>
|
|
319
|
+
<div class="section-content">
|
|
320
|
+
<div class="package-row">
|
|
321
|
+
<div>
|
|
322
|
+
<div class="package-name">${t.pricingOption.name}</div>
|
|
323
|
+
<div class="package-duration">${yt(t.pricingOption.duration)}</div>
|
|
324
|
+
</div>
|
|
325
|
+
<div class="package-price">${te(t.pricingOption.price)}</div>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
`:""}
|
|
330
|
+
|
|
331
|
+
<div class="section">
|
|
332
|
+
<div class="section-title">Payment Summary</div>
|
|
333
|
+
<div class="section-content">
|
|
334
|
+
<div class="payment-row">
|
|
335
|
+
<span class="payment-label">Base price</span>
|
|
336
|
+
<span class="payment-value">${te(t.reservationBasePrice)}</span>
|
|
337
|
+
</div>
|
|
338
|
+
${t.reservationAddOnsPrice?`
|
|
339
|
+
<div class="payment-row">
|
|
340
|
+
<span class="payment-label">Add-ons</span>
|
|
341
|
+
<span class="payment-value">${te(t.reservationAddOnsPrice)}</span>
|
|
342
|
+
</div>
|
|
343
|
+
`:""}
|
|
344
|
+
${t.reservationAdjustments?.length?t.reservationAdjustments.map(m=>`
|
|
345
|
+
<div class="payment-row">
|
|
346
|
+
<span class="payment-label">${m.label||"Adjustment"}</span>
|
|
347
|
+
<span class="payment-value">${Qe(m)}</span>
|
|
348
|
+
</div>
|
|
349
|
+
`).join(""):""}
|
|
350
|
+
${t.discount?`
|
|
351
|
+
<div class="payment-row">
|
|
352
|
+
<span class="payment-label">Discount</span>
|
|
353
|
+
<span class="payment-value green">-${te(t.discount)}</span>
|
|
354
|
+
</div>
|
|
355
|
+
`:""}
|
|
356
|
+
|
|
357
|
+
<div class="payment-divider"></div>
|
|
358
|
+
|
|
359
|
+
<div class="payment-row payment-total">
|
|
360
|
+
<span>Reservation Total</span>
|
|
361
|
+
<span>${te(t.reservationPrice)}</span>
|
|
362
|
+
</div>
|
|
363
|
+
|
|
364
|
+
${t.amountPaid!==void 0||t.amountDue!==void 0?`
|
|
365
|
+
<div class="payment-divider"></div>
|
|
366
|
+
|
|
367
|
+
${t.amountPaid!==void 0?`
|
|
368
|
+
<div class="payment-row">
|
|
369
|
+
<span class="payment-label">Amount paid</span>
|
|
370
|
+
<span class="payment-value green">${te(t.amountPaid)}</span>
|
|
371
|
+
</div>
|
|
372
|
+
`:""}
|
|
373
|
+
|
|
374
|
+
${t.amountDue!==void 0&&t.amountDue>0?`
|
|
375
|
+
<div class="payment-row">
|
|
376
|
+
<span class="payment-label">Amount due</span>
|
|
377
|
+
<span class="payment-value orange">${te(t.amountDue)}</span>
|
|
378
|
+
</div>
|
|
379
|
+
`:""}
|
|
380
|
+
`:""}
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div class="footer">
|
|
385
|
+
<p>Generated on ${r}</p>
|
|
386
|
+
${o.companyName?`<p>${o.companyName}</p>`:""}
|
|
387
|
+
</div>
|
|
388
|
+
</body>
|
|
389
|
+
</html>
|
|
390
|
+
`,p=window.open("","_blank");p&&(p.document.write(d),p.document.close(),p.onload=()=>{p.print()})},No=(t,o={})=>{const n=`${t.customerInfo?.firstName||""} ${t.customerInfo?.lastName||""}`.trim()||"Unknown Customer",s=t.id?.slice(0,8)||"—",r=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),u=t.reservations.reduce((h,i)=>h+(i.reservationPrice||0),0),l=t.reservations[0],d=t.status||"",p=Oe(t.metadata,o.metadataSchema,"order"),m=t.reservations.map((h,i)=>{const v=yo(h),a=[h.startTime,h.endTime].filter(Boolean).join(" - ")||"—",x=h.spots||1,A=Oe(h.reservationMetadata,o.metadataSchema,"reservation"),f=[h.reservationBasePrice!==void 0?`
|
|
391
|
+
<div class="price-breakdown-row">
|
|
392
|
+
<span>Base price</span>
|
|
393
|
+
<span>${te(h.reservationBasePrice)}</span>
|
|
394
|
+
</div>
|
|
395
|
+
`:"",h.reservationAddOnsPrice?`
|
|
396
|
+
<div class="price-breakdown-row">
|
|
397
|
+
<span>Add-ons</span>
|
|
398
|
+
<span>${te(h.reservationAddOnsPrice)}</span>
|
|
399
|
+
</div>
|
|
400
|
+
`:"",h.reservationAdjustments?.length?h.reservationAdjustments.map(_=>`
|
|
401
|
+
<div class="price-breakdown-row">
|
|
402
|
+
<span>${q(_.label||"Adjustment")}</span>
|
|
403
|
+
<span>${Qe(_)}</span>
|
|
404
|
+
</div>
|
|
405
|
+
`).join(""):""].join("");return`
|
|
406
|
+
<div class="reservation-card">
|
|
407
|
+
<div class="reservation-header">
|
|
408
|
+
<div>
|
|
409
|
+
<div class="reservation-title">Reservation ${i+1}</div>
|
|
410
|
+
${h.resourceName?`<div class="reservation-resource">${q(h.resourceName)}</div>`:""}
|
|
411
|
+
</div>
|
|
412
|
+
<div
|
|
413
|
+
class="status-badge small"
|
|
414
|
+
style="background-color: ${we(v)}20; color: ${we(v)};"
|
|
415
|
+
>
|
|
416
|
+
${q(Xe(v))}
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
<div class="reservation-grid">
|
|
420
|
+
<div>
|
|
421
|
+
<div class="info-label">Date</div>
|
|
422
|
+
<div class="info-value compact">${q(go(h.date))}</div>
|
|
423
|
+
</div>
|
|
424
|
+
<div>
|
|
425
|
+
<div class="info-label">Time</div>
|
|
426
|
+
<div class="info-value compact">${q(a)}</div>
|
|
427
|
+
</div>
|
|
428
|
+
<div>
|
|
429
|
+
<div class="info-label">Spots</div>
|
|
430
|
+
<div class="info-value compact">${x} ${x===1?"person":"people"}</div>
|
|
431
|
+
</div>
|
|
432
|
+
<div>
|
|
433
|
+
<div class="info-label">Price</div>
|
|
434
|
+
<div class="info-value compact">${te(h.reservationPrice)}</div>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
${h.pricingOption?.name?`
|
|
438
|
+
<div class="package-note">
|
|
439
|
+
<span>${q(h.pricingOption.name)}</span>
|
|
440
|
+
${h.pricingOption.duration?`<span>${yt(h.pricingOption.duration)}</span>`:""}
|
|
441
|
+
</div>
|
|
442
|
+
`:""}
|
|
443
|
+
${A.length?`
|
|
444
|
+
<div class="reservation-metadata">
|
|
445
|
+
<div class="metadata-title">Reservation Metadata</div>
|
|
446
|
+
<div class="metadata-list compact">
|
|
447
|
+
${xt(A,!0)}
|
|
448
|
+
</div>
|
|
449
|
+
</div>
|
|
450
|
+
`:""}
|
|
451
|
+
${f?`
|
|
452
|
+
<div class="reservation-price-breakdown">
|
|
453
|
+
<div class="price-breakdown-title">Price breakdown</div>
|
|
454
|
+
${f}
|
|
455
|
+
<div class="price-breakdown-row total">
|
|
456
|
+
<span>Reservation Total</span>
|
|
457
|
+
<span>${te(h.reservationPrice)}</span>
|
|
458
|
+
</div>
|
|
459
|
+
</div>
|
|
460
|
+
`:""}
|
|
461
|
+
</div>
|
|
462
|
+
`}).join(""),c=`
|
|
463
|
+
<!DOCTYPE html>
|
|
464
|
+
<html lang="en">
|
|
465
|
+
<head>
|
|
466
|
+
<meta charset="UTF-8">
|
|
467
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
468
|
+
<title>Order ${s}</title>
|
|
469
|
+
<style>
|
|
470
|
+
* {
|
|
471
|
+
margin: 0;
|
|
472
|
+
padding: 0;
|
|
473
|
+
box-sizing: border-box;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
body {
|
|
477
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
478
|
+
line-height: 1.6;
|
|
479
|
+
color: #1f2937;
|
|
480
|
+
background: #fff;
|
|
481
|
+
padding: 40px;
|
|
482
|
+
max-width: 800px;
|
|
483
|
+
margin: 0 auto;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.header {
|
|
487
|
+
display: flex;
|
|
488
|
+
justify-content: space-between;
|
|
489
|
+
align-items: flex-start;
|
|
490
|
+
gap: 24px;
|
|
491
|
+
margin-bottom: 40px;
|
|
492
|
+
padding-bottom: 20px;
|
|
493
|
+
border-bottom: 2px solid #e5e7eb;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.company-info {
|
|
497
|
+
display: flex;
|
|
498
|
+
align-items: center;
|
|
499
|
+
gap: 16px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.company-logo {
|
|
503
|
+
max-height: 50px;
|
|
504
|
+
max-width: 150px;
|
|
505
|
+
object-fit: contain;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.company-name {
|
|
509
|
+
font-size: 24px;
|
|
510
|
+
font-weight: 700;
|
|
511
|
+
color: #111827;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.document-info {
|
|
515
|
+
text-align: right;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.document-title {
|
|
519
|
+
font-size: 28px;
|
|
520
|
+
font-weight: 700;
|
|
521
|
+
color: #111827;
|
|
522
|
+
margin-bottom: 8px;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.booking-id {
|
|
526
|
+
font-size: 14px;
|
|
527
|
+
color: #6b7280;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.status-badge {
|
|
531
|
+
display: inline-block;
|
|
532
|
+
padding: 4px 12px;
|
|
533
|
+
border-radius: 9999px;
|
|
534
|
+
font-size: 12px;
|
|
535
|
+
font-weight: 600;
|
|
536
|
+
text-transform: uppercase;
|
|
537
|
+
margin-top: 8px;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.status-badge.small {
|
|
541
|
+
margin-top: 0;
|
|
542
|
+
white-space: nowrap;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.section {
|
|
546
|
+
margin-bottom: 32px;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.section-title {
|
|
550
|
+
font-size: 12px;
|
|
551
|
+
font-weight: 600;
|
|
552
|
+
text-transform: uppercase;
|
|
553
|
+
letter-spacing: 0.05em;
|
|
554
|
+
color: #6b7280;
|
|
555
|
+
margin-bottom: 12px;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.section-content {
|
|
559
|
+
background: #f9fafb;
|
|
560
|
+
border-radius: 8px;
|
|
561
|
+
padding: 20px;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.customer-name {
|
|
565
|
+
font-size: 18px;
|
|
566
|
+
font-weight: 600;
|
|
567
|
+
margin-bottom: 8px;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.contact-info {
|
|
571
|
+
font-size: 14px;
|
|
572
|
+
color: #4b5563;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.grid {
|
|
576
|
+
display: grid;
|
|
577
|
+
grid-template-columns: 1fr 1fr;
|
|
578
|
+
gap: 16px;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.info-card {
|
|
582
|
+
background: #f9fafb;
|
|
583
|
+
border-radius: 8px;
|
|
584
|
+
padding: 16px;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.info-label {
|
|
588
|
+
font-size: 12px;
|
|
589
|
+
color: #6b7280;
|
|
590
|
+
margin-bottom: 4px;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.info-value {
|
|
594
|
+
font-size: 16px;
|
|
595
|
+
font-weight: 600;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.info-value.compact {
|
|
599
|
+
font-size: 14px;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.metadata-list {
|
|
603
|
+
display: grid;
|
|
604
|
+
gap: 8px;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.metadata-list.compact {
|
|
608
|
+
gap: 4px;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.metadata-row {
|
|
612
|
+
display: flex;
|
|
613
|
+
justify-content: space-between;
|
|
614
|
+
gap: 16px;
|
|
615
|
+
padding: 8px 0;
|
|
616
|
+
border-bottom: 1px solid #e5e7eb;
|
|
617
|
+
font-size: 14px;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.metadata-row.compact {
|
|
621
|
+
padding: 4px 0;
|
|
622
|
+
font-size: 13px;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.metadata-row:last-child {
|
|
626
|
+
border-bottom: none;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.metadata-label {
|
|
630
|
+
color: #6b7280;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.metadata-value {
|
|
634
|
+
max-width: 60%;
|
|
635
|
+
font-weight: 600;
|
|
636
|
+
text-align: right;
|
|
637
|
+
overflow-wrap: anywhere;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.reservation-metadata {
|
|
641
|
+
margin-top: 12px;
|
|
642
|
+
padding-top: 12px;
|
|
643
|
+
border-top: 1px solid #e5e7eb;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.metadata-title {
|
|
647
|
+
font-size: 12px;
|
|
648
|
+
font-weight: 600;
|
|
649
|
+
color: #6b7280;
|
|
650
|
+
margin-bottom: 6px;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.reservation-list {
|
|
654
|
+
display: grid;
|
|
655
|
+
gap: 12px;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.reservation-card {
|
|
659
|
+
background: #f9fafb;
|
|
660
|
+
border-radius: 8px;
|
|
661
|
+
padding: 16px;
|
|
662
|
+
break-inside: avoid;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.reservation-header {
|
|
666
|
+
display: flex;
|
|
667
|
+
justify-content: space-between;
|
|
668
|
+
align-items: flex-start;
|
|
669
|
+
gap: 16px;
|
|
670
|
+
margin-bottom: 14px;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.reservation-title {
|
|
674
|
+
font-size: 16px;
|
|
675
|
+
font-weight: 600;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.reservation-resource {
|
|
679
|
+
font-size: 13px;
|
|
680
|
+
color: #6b7280;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
.reservation-grid {
|
|
684
|
+
display: grid;
|
|
685
|
+
grid-template-columns: repeat(4, 1fr);
|
|
686
|
+
gap: 12px;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
.package-note {
|
|
690
|
+
display: flex;
|
|
691
|
+
gap: 12px;
|
|
692
|
+
margin-top: 12px;
|
|
693
|
+
padding-top: 12px;
|
|
694
|
+
border-top: 1px solid #e5e7eb;
|
|
695
|
+
font-size: 13px;
|
|
696
|
+
color: #4b5563;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.reservation-price-breakdown {
|
|
700
|
+
margin-top: 12px;
|
|
701
|
+
padding-top: 12px;
|
|
702
|
+
border-top: 1px solid #e5e7eb;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.price-breakdown-title {
|
|
706
|
+
font-size: 12px;
|
|
707
|
+
font-weight: 600;
|
|
708
|
+
color: #6b7280;
|
|
709
|
+
margin-bottom: 6px;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.price-breakdown-row {
|
|
713
|
+
display: flex;
|
|
714
|
+
justify-content: space-between;
|
|
715
|
+
gap: 20px;
|
|
716
|
+
padding: 3px 0;
|
|
717
|
+
font-size: 13px;
|
|
718
|
+
color: #4b5563;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
.price-breakdown-row span:last-child {
|
|
722
|
+
font-weight: 500;
|
|
723
|
+
color: #1f2937;
|
|
724
|
+
text-align: right;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
.price-breakdown-row.total {
|
|
728
|
+
margin-top: 6px;
|
|
729
|
+
padding-top: 8px;
|
|
730
|
+
border-top: 1px solid #e5e7eb;
|
|
731
|
+
font-weight: 600;
|
|
732
|
+
color: #111827;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
.payment-row {
|
|
736
|
+
display: flex;
|
|
737
|
+
justify-content: space-between;
|
|
738
|
+
gap: 24px;
|
|
739
|
+
padding: 8px 0;
|
|
740
|
+
font-size: 14px;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
.payment-label {
|
|
744
|
+
color: #6b7280;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
.payment-value {
|
|
748
|
+
font-weight: 500;
|
|
749
|
+
text-align: right;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
.payment-value.green {
|
|
753
|
+
color: #16a34a;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.payment-value.orange {
|
|
757
|
+
color: #ea580c;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
.payment-divider {
|
|
761
|
+
border-top: 1px solid #e5e7eb;
|
|
762
|
+
margin: 12px 0;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.payment-total {
|
|
766
|
+
font-size: 16px;
|
|
767
|
+
font-weight: 600;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
.footer {
|
|
771
|
+
margin-top: 60px;
|
|
772
|
+
padding-top: 20px;
|
|
773
|
+
border-top: 1px solid #e5e7eb;
|
|
774
|
+
text-align: center;
|
|
775
|
+
font-size: 12px;
|
|
776
|
+
color: #9ca3af;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
@media print {
|
|
780
|
+
body {
|
|
781
|
+
padding: 20px;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
</style>
|
|
785
|
+
</head>
|
|
786
|
+
<body>
|
|
787
|
+
<div class="header">
|
|
788
|
+
<div class="company-info">
|
|
789
|
+
${o.companyLogo?`<img src="${bt(o.companyLogo)}" alt="Logo" class="company-logo" />`:""}
|
|
790
|
+
${o.companyName?`<span class="company-name">${q(o.companyName)}</span>`:""}
|
|
791
|
+
</div>
|
|
792
|
+
<div class="document-info">
|
|
793
|
+
<div class="document-title">Order</div>
|
|
794
|
+
<div class="booking-id">Order #${q(s)}</div>
|
|
795
|
+
<div
|
|
796
|
+
class="status-badge"
|
|
797
|
+
style="background-color: ${we(d)}20; color: ${we(d)};"
|
|
798
|
+
>
|
|
799
|
+
${q(Xe(d))}
|
|
800
|
+
</div>
|
|
801
|
+
</div>
|
|
802
|
+
</div>
|
|
803
|
+
|
|
804
|
+
<div class="section">
|
|
805
|
+
<div class="section-title">Customer</div>
|
|
806
|
+
<div class="section-content">
|
|
807
|
+
<div class="customer-name">${q(n)}</div>
|
|
808
|
+
<div class="contact-info">
|
|
809
|
+
${t.customerInfo?.email?`<div>Email: ${q(t.customerInfo.email)}</div>`:""}
|
|
810
|
+
${t.customerInfo?.phone?`<div>Phone: ${q(t.customerInfo.phone)}</div>`:""}
|
|
811
|
+
</div>
|
|
812
|
+
</div>
|
|
813
|
+
</div>
|
|
814
|
+
|
|
815
|
+
${Ze("Order Metadata",p)}
|
|
816
|
+
|
|
817
|
+
<div class="section">
|
|
818
|
+
<div class="section-title">Order Summary</div>
|
|
819
|
+
<div class="grid">
|
|
820
|
+
<div class="info-card">
|
|
821
|
+
<div class="info-label">Reservations</div>
|
|
822
|
+
<div class="info-value">${t.reservations.length}</div>
|
|
823
|
+
</div>
|
|
824
|
+
<div class="info-card">
|
|
825
|
+
<div class="info-label">Spots</div>
|
|
826
|
+
<div class="info-value">${t.totalSpots}</div>
|
|
827
|
+
</div>
|
|
828
|
+
<div class="info-card">
|
|
829
|
+
<div class="info-label">Ordered at</div>
|
|
830
|
+
<div class="info-value">${q(ho(t.createdAt))}</div>
|
|
831
|
+
</div>
|
|
832
|
+
${o.agendaName?`
|
|
833
|
+
<div class="info-card">
|
|
834
|
+
<div class="info-label">Service</div>
|
|
835
|
+
<div class="info-value">${q(o.agendaName)}</div>
|
|
836
|
+
</div>
|
|
837
|
+
`:""}
|
|
838
|
+
</div>
|
|
839
|
+
</div>
|
|
840
|
+
|
|
841
|
+
<div class="section">
|
|
842
|
+
<div class="section-title">Reservations</div>
|
|
843
|
+
<div class="reservation-list">
|
|
844
|
+
${m}
|
|
845
|
+
</div>
|
|
846
|
+
</div>
|
|
847
|
+
|
|
848
|
+
<div class="section">
|
|
849
|
+
<div class="section-title">Payment Summary</div>
|
|
850
|
+
<div class="section-content">
|
|
851
|
+
<div class="payment-row">
|
|
852
|
+
<span class="payment-label">Reservations</span>
|
|
853
|
+
<span class="payment-value">${te(u)}</span>
|
|
854
|
+
</div>
|
|
855
|
+
${l?.subtotal!==void 0&&l.subtotal!==t.totalPrice?`
|
|
856
|
+
<div class="payment-row">
|
|
857
|
+
<span class="payment-label">Subtotal</span>
|
|
858
|
+
<span class="payment-value">${te(l.subtotal)}</span>
|
|
859
|
+
</div>
|
|
860
|
+
`:""}
|
|
861
|
+
${t.adjustments?.length?t.adjustments.map(h=>`
|
|
862
|
+
<div class="payment-row">
|
|
863
|
+
<span class="payment-label">${q(h.label||"Adjustment")}</span>
|
|
864
|
+
<span class="payment-value">${Qe(h)}</span>
|
|
865
|
+
</div>
|
|
866
|
+
`).join(""):""}
|
|
867
|
+
${l?.discount?`
|
|
868
|
+
<div class="payment-row">
|
|
869
|
+
<span class="payment-label">Discount</span>
|
|
870
|
+
<span class="payment-value green">-${te(l.discount)}</span>
|
|
871
|
+
</div>
|
|
872
|
+
`:""}
|
|
873
|
+
|
|
874
|
+
<div class="payment-divider"></div>
|
|
875
|
+
|
|
876
|
+
<div class="payment-row payment-total">
|
|
877
|
+
<span>Order Total</span>
|
|
878
|
+
<span>${te(t.totalPrice)}</span>
|
|
879
|
+
</div>
|
|
880
|
+
|
|
881
|
+
${l?.amountPaid!==void 0||l?.amountDue!==void 0?`
|
|
882
|
+
<div class="payment-divider"></div>
|
|
883
|
+
|
|
884
|
+
${l?.amountPaid!==void 0?`
|
|
885
|
+
<div class="payment-row">
|
|
886
|
+
<span class="payment-label">Amount paid</span>
|
|
887
|
+
<span class="payment-value green">${te(l.amountPaid)}</span>
|
|
888
|
+
</div>
|
|
889
|
+
`:""}
|
|
890
|
+
|
|
891
|
+
${l?.amountDue!==void 0&&l.amountDue>0?`
|
|
892
|
+
<div class="payment-row">
|
|
893
|
+
<span class="payment-label">Amount due</span>
|
|
894
|
+
<span class="payment-value orange">${te(l.amountDue)}</span>
|
|
895
|
+
</div>
|
|
896
|
+
`:""}
|
|
897
|
+
`:""}
|
|
898
|
+
</div>
|
|
899
|
+
</div>
|
|
900
|
+
|
|
901
|
+
<div class="footer">
|
|
902
|
+
<p>Generated on ${r}</p>
|
|
903
|
+
${o.companyName?`<p>${q(o.companyName)}</p>`:""}
|
|
904
|
+
</div>
|
|
905
|
+
</body>
|
|
906
|
+
</html>
|
|
907
|
+
`,g=window.open("","_blank");g&&(g.document.write(c),g.document.close(),g.onload=()=>{g.print()})};function nt(t){const o=J.useModuleApi(),n=e.ref([]),s=e.ref(!1),r=async()=>{if(!t.value){n.value=[];return}s.value=!0;try{const u=await o.get(`/agendas/${t.value}/metadata-schema`);n.value=Array.isArray(u?.metadataSchema)?u.metadataSchema:[]}catch(u){console.error("Error loading metadata schema:",u),n.value=[]}finally{s.value=!1}};return e.watch(t,r,{immediate:!0}),{metadataSchema:n,isMetadataSchemaLoading:s,loadMetadataSchema:r}}const Co={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},Vo={class:"grid gap-2"},wo={class:"grid gap-2"},_o={class:"grid gap-2"},Do=e.defineComponent({__name:"CancelReservationDialog",emits:["confirm"],setup(t,{expose:o,emit:n}){const{config:s}=J.useModule(),{sendMail:r}=J.useMailer(s.mailAccount),u=n,l=e.ref(!1),d=e.ref(!1),p=e.ref(""),m=e.ref(""),c=e.ref(""),g=i=>{d.value=!s.mailAccount,l.value=!0,i&&(p.value=i.customerInfo?.email,m.value="Cancellation of your reservation - "+new Date(i.date)?.toDateString(),c.value=`Dear ${i.customerInfo?.firstName??""} ${i.customerInfo?.lastName??""},
|
|
908
|
+
|
|
909
|
+
We are writing to inform you that your reservation scheduled for ${new Date(i.date)?.toDateString()} at ${i.startTime} has been cancelled.
|
|
910
|
+
|
|
911
|
+
Please accept our sincere apologies for any inconvenience this may cause. We would be happy to help you find an alternative time that works for you.`)},h=()=>{if(!d.value){if(!p.value||!m.value||!c.value)return alert("Please fill in all the fields.");r({to:p.value,subject:m.value,body:c.value})}l.value=!1;const{$confetti:i}=useNuxtApp();i(),u("confirm")};return o({openDialog:g}),(i,v)=>{const a=e.resolveComponent("DialogTitle"),x=e.resolveComponent("DialogDescription"),A=e.resolveComponent("DialogHeader"),f=e.resolveComponent("Checkbox"),_=e.resolveComponent("Label"),M=e.resolveComponent("Input"),z=e.resolveComponent("Textarea"),P=e.resolveComponent("Button"),W=e.resolveComponent("DialogFooter"),E=e.resolveComponent("DialogScrollContent"),w=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(w,{open:l.value,"onUpdate:open":v[5]||(v[5]=$=>l.value=$)},{default:e.withCtx(()=>[e.createVNode(E,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(A,null,{default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[...v[6]||(v[6]=[e.createTextVNode(" Cancel Reservation ",-1)])]),_:1}),e.createVNode(x)]),_:1}),e.createElementVNode("div",Co,[e.createVNode(f,{modelValue:d.value,"onUpdate:modelValue":v[0]||(v[0]=$=>d.value=$),id:"cancel-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(s).mailAccount},null,8,["modelValue","disabled"]),e.createVNode(_,{for:"cancel-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...v[7]||(v[7]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":d.value}])},[e.createElementVNode("div",Vo,[e.createVNode(_,{for:"cancel-dialog-email"},{default:e.withCtx(()=>[...v[8]||(v[8]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":v[1]||(v[1]=$=>p.value=$),disabled:d.value,id:"cancel-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",wo,[e.createVNode(_,{for:"cancel-dialog-subject"},{default:e.withCtx(()=>[...v[9]||(v[9]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(M,{modelValue:m.value,"onUpdate:modelValue":v[2]||(v[2]=$=>m.value=$),disabled:d.value,id:"cancel-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",_o,[e.createVNode(_,{for:"cancel-dialog-body"},{default:e.withCtx(()=>[...v[10]||(v[10]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(z,{modelValue:c.value,"onUpdate:modelValue":v[3]||(v[3]=$=>c.value=$),disabled:d.value,id:"cancel-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(W,null,{default:e.withCtx(()=>[e.createVNode(P,{variant:"outline",onClick:v[4]||(v[4]=$=>l.value=!1)},{default:e.withCtx(()=>[...v[11]||(v[11]=[e.createTextVNode("Close",-1)])]),_:1}),e.createVNode(P,{variant:"destructive",onClick:h},{default:e.withCtx(()=>[...v[12]||(v[12]=[e.createTextVNode("Cancel reservation",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}}),Eo={key:0,class:"flex items-start gap-3 rounded-md border border-orange-200 bg-orange-50 p-4 text-sm text-orange-900 dark:border-orange-900/50 dark:bg-orange-950/30 dark:text-orange-200"},$o={class:"grid gap-4 py-4"},So={key:0,class:"grid gap-2"},Bo={class:"relative"},Ao={class:"grid gap-2"},Mo={key:0,class:"flex items-center gap-2 rounded-md border px-3 py-2"},Ro={key:0,class:"text-destructive"},Io={key:0,class:"text-destructive"},Fo={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},To={class:"grid gap-2"},jo={class:"grid gap-2"},zo={class:"grid gap-2"},Oo=e.defineComponent({__name:"CancelRefundReservationDialog",props:{isProcessing:{type:Boolean},hasRefundFlow:{type:Boolean},showRefundAmount:{type:Boolean},customFields:{}},emits:["confirm"],setup(t,{expose:o,emit:n}){const s=t,r=n,{config:u}=J.useModule(),l=e.ref(!1),d=e.ref(!1),p=e.ref(""),m=e.ref(""),c=e.ref(""),g=e.ref(0),h=e.ref("Reservation cancelled"),i=e.ref(""),v=e.ref({}),a=e.computed(()=>`€${(Number(g.value)||0).toFixed(2)}`),x=e.computed(()=>s.showRefundAmount!==!1),A=e.computed(()=>s.customFields||[]);e.watch(g,()=>{if(!x.value)return;const E=a.value;i.value&&c.value.includes(i.value)&&(c.value=c.value.replace(i.value,E)),i.value=E});const f=E=>{const w=Number(E?.reservationPrice??E?.pricingOption?.price??0),$=Number(E?.amountPaid??0),F=Number(E?.total??0);return $>0&&w>0?Math.min($,w):$>0?$:w>0?w:F>0?F:0},_=E=>E.defaultValue!==void 0?E.defaultValue:E.type==="number"?0:E.type==="checkbox"?!1:"",M=()=>{v.value=Object.fromEntries(A.value.filter(E=>E.key).map(E=>[E.key,_(E)]))},z=E=>{d.value=!u.mailAccount,g.value=f(E),i.value=a.value,h.value="Reservation cancelled",M(),l.value=!0,E&&(p.value=E.customerInfo?.email||"",m.value=`Cancellation and refund of your reservation - ${new Date(E.date)?.toDateString()}`,c.value=`Dear ${E.customerInfo?.firstName??""} ${E.customerInfo?.lastName??""},
|
|
912
|
+
|
|
913
|
+
We are writing to inform you that your reservation scheduled for ${new Date(E.date)?.toDateString()} at ${E.startTime} has been cancelled.
|
|
914
|
+
|
|
915
|
+
${x.value?`A refund of ${a.value} will be processed according to our refund policy.`:"We will process this cancellation according to our policy."}
|
|
916
|
+
|
|
917
|
+
Please accept our sincere apologies for any inconvenience this may cause.`)},P=()=>{l.value=!1},W=()=>{if(!s.hasRefundFlow)return;if(x.value&&(!g.value||g.value<=0))return alert("Please enter a refund amount.");if(!h.value)return alert("Please enter a refund reason.");if(!d.value&&(!p.value||!m.value||!c.value))return alert("Please fill in all the email fields.");const E=A.value.find(w=>{if(!w.required||!w.key)return!1;const $=v.value[w.key];return w.type==="checkbox"?$!==!0:$==null||$===""});if(E)return alert(`Please fill in ${E.label}.`);r("confirm",{amount:x.value?Number(g.value):void 0,reason:h.value,fields:{...v.value},fieldDefinitions:A.value,skipMail:d.value,email:p.value,subject:m.value,body:c.value})};return o({openDialog:z,closeDialog:P}),(E,w)=>{const $=e.resolveComponent("DialogTitle"),F=e.resolveComponent("DialogDescription"),ne=e.resolveComponent("DialogHeader"),L=e.resolveComponent("Label"),U=e.resolveComponent("Input"),K=e.resolveComponent("Checkbox"),k=e.resolveComponent("Textarea"),N=e.resolveComponent("Button"),Q=e.resolveComponent("DialogFooter"),X=e.resolveComponent("DialogScrollContent"),oe=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(oe,{open:l.value,"onUpdate:open":w[7]||(w[7]=S=>l.value=S)},{default:e.withCtx(()=>[e.createVNode(X,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(ne,null,{default:e.withCtx(()=>[e.createVNode($,null,{default:e.withCtx(()=>[...w[8]||(w[8]=[e.createTextVNode(" Cancel & Refund Reservation ",-1)])]),_:1}),e.createVNode(F,null,{default:e.withCtx(()=>[...w[9]||(w[9]=[e.createTextVNode(" Run the configured refund flow and cancel this reservation. ",-1)])]),_:1})]),_:1}),t.hasRefundFlow?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Eo,[e.createVNode(e.unref(I.AlertTriangle),{class:"mt-0.5 size-4 shrink-0"}),w[10]||(w[10]=e.createElementVNode("div",null,[e.createElementVNode("p",{class:"font-medium"},"No refund flow configured"),e.createElementVNode("p",{class:"mt-1 text-orange-800 dark:text-orange-300"}," Add one in this agenda's Refunds settings before processing refunds. ")],-1))])),e.createElementVNode("div",$o,[x.value?(e.openBlock(),e.createElementBlock("div",So,[e.createVNode(L,{for:"refund-dialog-amount"},{default:e.withCtx(()=>[...w[11]||(w[11]=[e.createTextVNode("Refund amount",-1)])]),_:1}),e.createElementVNode("div",Bo,[e.createVNode(e.unref(I.Receipt),{class:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.createVNode(U,{id:"refund-dialog-amount",modelValue:g.value,"onUpdate:modelValue":w[0]||(w[0]=S=>g.value=S),modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",class:"pl-9 no-spinner",disabled:t.isProcessing},null,8,["modelValue","disabled"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ao,[e.createVNode(L,{for:"refund-dialog-reason"},{default:e.withCtx(()=>[...w[12]||(w[12]=[e.createTextVNode("Reason",-1)])]),_:1}),e.createVNode(U,{id:"refund-dialog-reason",modelValue:h.value,"onUpdate:modelValue":w[1]||(w[1]=S=>h.value=S),disabled:t.isProcessing},null,8,["modelValue","disabled"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,S=>(e.openBlock(),e.createElementBlock("div",{key:S.id,class:"grid gap-2"},[S.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",Mo,[e.createVNode(K,{id:`refund-dialog-field-${S.id}`,modelValue:v.value[S.key],"onUpdate:modelValue":Y=>v.value[S.key]=Y,disabled:t.isProcessing},null,8,["id","modelValue","onUpdate:modelValue","disabled"]),e.createVNode(L,{for:`refund-dialog-field-${S.id}`,class:"text-sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.label),1),S.required?(e.openBlock(),e.createElementBlock("span",Ro," *")):e.createCommentVNode("",!0)]),_:2},1032,["for"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(L,{for:`refund-dialog-field-${S.id}`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.label),1),S.required?(e.openBlock(),e.createElementBlock("span",Io," *")):e.createCommentVNode("",!0)]),_:2},1032,["for"]),S.type==="textarea"?(e.openBlock(),e.createBlock(k,{key:0,id:`refund-dialog-field-${S.id}`,modelValue:v.value[S.key],"onUpdate:modelValue":Y=>v.value[S.key]=Y,placeholder:S.placeholder,disabled:t.isProcessing},null,8,["id","modelValue","onUpdate:modelValue","placeholder","disabled"])):S.type==="number"?(e.openBlock(),e.createBlock(U,{key:1,id:`refund-dialog-field-${S.id}`,modelValue:v.value[S.key],"onUpdate:modelValue":Y=>v.value[S.key]=Y,modelModifiers:{number:!0},type:"number",placeholder:S.placeholder,disabled:t.isProcessing,class:"no-spinner"},null,8,["id","modelValue","onUpdate:modelValue","placeholder","disabled"])):(e.openBlock(),e.createBlock(U,{key:2,id:`refund-dialog-field-${S.id}`,modelValue:v.value[S.key],"onUpdate:modelValue":Y=>v.value[S.key]=Y,type:"text",placeholder:S.placeholder,disabled:t.isProcessing},null,8,["id","modelValue","onUpdate:modelValue","placeholder","disabled"]))],64))]))),128))]),e.createElementVNode("div",Fo,[e.createVNode(K,{modelValue:d.value,"onUpdate:modelValue":w[2]||(w[2]=S=>d.value=S),id:"refund-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(u).mailAccount||t.isProcessing},null,8,["modelValue","disabled"]),e.createVNode(L,{for:"refund-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...w[13]||(w[13]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":d.value}])},[e.createElementVNode("div",To,[e.createVNode(L,{for:"refund-dialog-email"},{default:e.withCtx(()=>[...w[14]||(w[14]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(U,{modelValue:p.value,"onUpdate:modelValue":w[3]||(w[3]=S=>p.value=S),disabled:d.value||t.isProcessing,id:"refund-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",jo,[e.createVNode(L,{for:"refund-dialog-subject"},{default:e.withCtx(()=>[...w[15]||(w[15]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(U,{modelValue:m.value,"onUpdate:modelValue":w[4]||(w[4]=S=>m.value=S),disabled:d.value||t.isProcessing,id:"refund-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",zo,[e.createVNode(L,{for:"refund-dialog-body"},{default:e.withCtx(()=>[...w[16]||(w[16]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(k,{modelValue:c.value,"onUpdate:modelValue":w[5]||(w[5]=S=>c.value=S),disabled:d.value||t.isProcessing,id:"refund-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(N,{variant:"outline",onClick:w[6]||(w[6]=S=>l.value=!1),disabled:t.isProcessing},{default:e.withCtx(()=>[...w[17]||(w[17]=[e.createTextVNode("Close",-1)])]),_:1},8,["disabled"]),e.createVNode(N,{variant:"destructive",onClick:W,disabled:t.isProcessing||!t.hasRefundFlow},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.isProcessing?"Processing...":"Cancel & Refund"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}}),Po={class:"pb-4"},Lo={class:"mt-6 grid gap-4 md:grid-cols-3"},Uo={class:"space-y-2"},Ho={class:"space-y-2"},Wo={class:"space-y-2"},Ko={key:0,class:"text-xs text-muted-foreground"},Go={class:"mt-4 rounded-lg border bg-muted/30 p-4"},Yo={class:"mt-2 text-sm text-foreground"},Jo={key:0},Qo={key:1,class:"mt-4 text-sm text-red-500"},Xo=e.defineComponent({__name:"TransferReservationDialog",props:{agendaData:{}},emits:["transferred"],setup(t,{expose:o,emit:n}){const s=t,r=n,{config:u}=J.useModule(),{params:l}=J.useModuleRoute(),d=J.useFirebaseIntegration(u.project),p=e.ref(!1),m=e.ref(null),c=e.ref(""),g=e.ref(""),h=e.ref(""),i=e.ref(!1),v=e.ref(!1),a=e.ref(""),x=e.ref(""),A=e.ref(null),f=e.ref(null);let _=0;const M=/^([01]\d|2[0-3]):[0-5]\d$/,z=e.computed(()=>s.agendaData?.resources||[]),P=e.computed(()=>m.value?.resourceId||""),W=e.computed(()=>z.value.filter(C=>C.isActive!==!1||C.id===P.value)),E=e.computed(()=>z.value.find(C=>C.id===h.value)),w=e.computed(()=>E.value?.name??"No resource selected"),$=e.computed(()=>m.value?.agendaId||s.agendaData?.id||l.value?.id||l.id||""),F=e.computed(()=>{const C=Number(m.value?.spots);return Number.isFinite(C)&&C>0?C:1}),ne=e.computed(()=>{const C=Number(E.value?.capacity);return Number.isFinite(C)&&C>0?C:1}),L=e.computed(()=>{const C=Number(m.value?.pricingOption?.duration);if(Number.isFinite(C)&&C>0)return C;const V=U(m.value?.startTime),D=U(m.value?.endTime);return V===null||D===null||D<=V?0:D-V}),U=C=>{if(!C||!M.test(C))return null;const[V,D]=C.split(":").map(Number);return V*60+D},K=C=>{const V=(C%1440+1440)%1440,D=Math.floor(V/60),j=V%60;return`${D.toString().padStart(2,"0")}:${j.toString().padStart(2,"0")}`},k=C=>{if(!/^\d{4}-\d{2}-\d{2}$/.test(C))return null;const[V,D,j]=C.split("-").map(Number),H=new Date(V,D-1,j);return Number.isNaN(H.getTime())||H.getFullYear()!==V||H.getMonth()!==D-1||H.getDate()!==j?null:H},N=(C,V)=>(s.agendaData?.exceptions||[]).find(j=>V>=j.startDate&&V<=j.endDate?!j.resourceIds||j.resourceIds.length===0?!0:j.resourceIds.includes(C):!1)||null,Q=()=>{const C=E.value,V=k(c.value);if(!C||!V)return[];const D=N(C.id,c.value);if(D)return D.isClosed?[]:(D.timeslots||[]).map(H=>({start:H.startTime,end:H.endTime}));const j=V.getDay();return C.openingHours?.[j]||[]},X=e.computed(()=>{const C=E.value;if(!C)return[];const V=Number(C.interval)>0?Number(C.interval):60,D=L.value,j=new Set;for(const H of Q()){const Z=U(H.start),ee=U(H.end);if(Z===null||ee===null||ee<=Z)continue;const ue=D>0?ee-D:ee-V;for(let ae=Z;ae<=ue;ae+=V)j.add(K(ae))}return Array.from(j).sort((H,Z)=>(U(H)??0)-(U(Z)??0))}),oe=e.computed(()=>{if(L.value<=0)return"";const C=U(g.value);return C===null?"":K(C+L.value)}),S=e.computed(()=>!!(m.value?.id&&m.value?.res_id&&c.value&&h.value&&g.value&&oe.value&&M.test(g.value)&&X.value.includes(g.value))),Y=e.computed(()=>f.value!==null&&f.value>=F.value),ke=e.computed(()=>{if(!S.value)return"";if(v.value)return"Checking availability...";if(x.value)return x.value;if(f.value===null||A.value===null)return"";if(!Y.value){const V=Math.max(f.value,0);return`${V} ${V===1?"spot is":"spots are"} available. This reservation needs ${F.value}.`}const C=f.value-F.value;return`${f.value} of ${ne.value} ${ne.value===1?"spot is":"spots are"} available. ${C} ${C===1?"spot":"spots"} will remain.`}),pe=e.computed(()=>!!(S.value&&Y.value&&!v.value&&!i.value)),ie=()=>{x.value="",A.value=null,f.value=null},Ne=C=>["approved","needs_approval"].includes(C?.status),_e=(C,V,D,j)=>C<j&&V>D,De=async()=>{if(!S.value)return null;const C=U(g.value),V=U(oe.value);if(C===null||V===null||V<=C)return null;const D=`${h.value}_${c.value}`,j=[{field:"status",operator:"==",value:"confirmed"},{field:"flattenedReservationDates",operator:"array-contains-any",value:[D]}];$.value&&j.unshift({field:"agendaId",operator:"==",value:$.value});const H=await d.find(u.reservationsCollection,{filters:j}),Z=m.value?.id||m.value?.orderId,ee=m.value?.res_id;let ue=0;for(const b of H||[]){const y=b?.id||b?.orderId,R=b?.reservations||[];for(const T of R){if(T?.id===ee&&(!y||y===Z)||!Ne(T)||T?.date!==c.value||T?.resourceId!==h.value)continue;const se=U(T?.timeslot?.startTime),O=U(T?.timeslot?.endTime);if(se===null||O===null||O<=se||!_e(C,V,se,O))continue;const me=Number(T?.spots);ue+=Number.isFinite(me)&&me>0?me:1}}const ae=ne.value;return{reserved:ue,available:ae-ue}},ye=async()=>{const C=++_;if(ie(),!S.value)return v.value=!1,null;try{v.value=!0;const V=await De();return C!==_?null:V?(A.value=V.reserved,f.value=V.available,V):(x.value="Could not check availability for this selection.",null)}catch(V){return C!==_||(console.error("Error checking transfer availability:",V),x.value="Could not check availability for this selection."),null}finally{C===_&&(v.value=!1)}},Ee=C=>!C?.resourceId||!C?.date?"":`${C.resourceId}_${C.date}`,$e=C=>{const V=C?.timeslot?.startTime;return!C?.resourceId||!C?.date||!V?"":`${C.resourceId}_${C.date}_${String(V).replace(":","")}`},Se=C=>{const V=C?.id||C?.orderId;!C||!V||(m.value={...C,id:V},c.value=C.date||"",g.value=C.startTime||"",h.value=C.resourceId||W.value[0]?.id||"",i.value=!1,a.value="",ie(),p.value=!0,Ce(),ye())},Ce=()=>{X.value.includes(g.value)||(g.value=X.value[0]||"")},Be=async()=>{if(!pe.value){a.value=S.value?"Not enough spots are available for this transfer.":"Select a resource, date, and time before transferring.";return}try{i.value=!0,a.value="";const C=await ye();if(!C||C.available<F.value){a.value="Not enough spots are available for this transfer.";return}const V=m.value.id,D=m.value.res_id,j=await d.get(u.reservationsCollection,V),H=j?.reservations||[],Z=H.find(T=>T.id===D);if(!Z)throw new Error("Reservation not found");const ee=E.value,ue={...Z,date:c.value,resource:ee?{...Z.resource,avatarLabel:ee.avatarLabel||"",color:ee.color||"",description:ee.description||"",id:ee.id,name:ee.name||""}:Z.resource,resourceId:h.value,timeslot:{...Z.timeslot,startTime:g.value,endTime:oe.value||g.value}},ae=H.map(T=>T.id===D?ue:T),b=Array.from(new Set(ae.map(Ee).filter(Boolean))),y=ae.map($e).filter(Boolean),R={reservations:ae,flattenedReservationDates:b,flattenedReservations:y,updatedAt:new Date};await d.update(u.reservationsCollection,V,R),re.toast.success("Reservation transferred successfully"),r("transferred",{orderId:V,reservationId:D,reservation:ue,order:{...j,...R,id:V}}),p.value=!1}catch(C){console.error("Error transferring reservation:",C),a.value="Failed to transfer reservation.",re.toast.error("Failed to transfer reservation")}finally{i.value=!1}};return e.watch([h,c],()=>{p.value&&Ce()}),e.watch([h,c,g,oe],()=>{p.value&&ye()}),o({openDialog:Se}),(C,V)=>{const D=e.resolveComponent("DialogTitle"),j=e.resolveComponent("DialogDescription"),H=e.resolveComponent("DialogHeader"),Z=e.resolveComponent("Label"),ee=e.resolveComponent("SelectValue"),ue=e.resolveComponent("SelectTrigger"),ae=e.resolveComponent("SelectItem"),b=e.resolveComponent("SelectContent"),y=e.resolveComponent("Select"),R=e.resolveComponent("Input"),T=e.resolveComponent("Button"),se=e.resolveComponent("DialogFooter"),O=e.resolveComponent("DialogScrollContent"),me=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(me,{open:p.value,"onUpdate:open":V[4]||(V[4]=G=>p.value=G)},{default:e.withCtx(()=>[e.createVNode(O,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(H,null,{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[...V[5]||(V[5]=[e.createTextVNode(" Transfer Reservation ",-1)])]),_:1}),e.createVNode(j)]),_:1}),e.createElementVNode("div",Po,[V[10]||(V[10]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"}," This will transfer the reservation to another date, time or resource. ",-1)),e.createElementVNode("div",Lo,[e.createElementVNode("div",Uo,[e.createVNode(Z,{for:"transfer-reservation-resource"},{default:e.withCtx(()=>[...V[6]||(V[6]=[e.createTextVNode("Resource",-1)])]),_:1}),e.createVNode(y,{modelValue:h.value,"onUpdate:modelValue":V[0]||(V[0]=G=>h.value=G)},{default:e.withCtx(()=>[e.createVNode(ue,{id:"transfer-reservation-resource",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(ee,{placeholder:"Select a resource"})]),_:1}),e.createVNode(b,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,G=>(e.openBlock(),e.createBlock(ae,{key:G.id,value:G.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(G.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue"])]),e.createElementVNode("div",Ho,[e.createVNode(Z,{for:"transfer-reservation-date"},{default:e.withCtx(()=>[...V[7]||(V[7]=[e.createTextVNode("Date",-1)])]),_:1}),e.createVNode(R,{id:"transfer-reservation-date",modelValue:c.value,"onUpdate:modelValue":V[1]||(V[1]=G=>c.value=G),type:"date"},null,8,["modelValue"])]),e.createElementVNode("div",Wo,[e.createVNode(Z,{for:"transfer-reservation-hour"},{default:e.withCtx(()=>[...V[8]||(V[8]=[e.createTextVNode("Hour",-1)])]),_:1}),e.createVNode(y,{modelValue:g.value,"onUpdate:modelValue":V[2]||(V[2]=G=>g.value=G)},{default:e.withCtx(()=>[e.createVNode(ue,{id:"transfer-reservation-hour",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(ee,{placeholder:"Select an hour"})]),_:1}),e.createVNode(b,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,G=>(e.openBlock(),e.createBlock(ae,{key:G,value:G},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(G),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue"]),h.value&&c.value&&X.value.length===0?(e.openBlock(),e.createElementBlock("p",Ko," No times are available for this resource on the selected date. ")):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Go,[V[9]||(V[9]=e.createElementVNode("p",{class:"text-xs font-medium uppercase tracking-[0.2em] text-muted-foreground"}," Preview ",-1)),e.createElementVNode("p",Yo,[e.createTextVNode(" Reservation will be moved to "+e.toDisplayString(c.value||"no date selected")+" at "+e.toDisplayString(g.value||"no hour selected"),1),oe.value?(e.openBlock(),e.createElementBlock("span",Jo," - "+e.toDisplayString(oe.value),1)):e.createCommentVNode("",!0),e.createTextVNode(" in "+e.toDisplayString(w.value)+". ",1)])]),S.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["mt-4 rounded-lg border p-4 text-sm",{"bg-muted/30 text-muted-foreground":v.value,"border-red-200 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300":!v.value&&(x.value||!Y.value),"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-950/10 dark:text-green-300":!v.value&&!x.value&&Y.value}])},e.toDisplayString(ke.value),3)):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",Qo,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)]),e.createVNode(se,null,{default:e.withCtx(()=>[e.createVNode(T,{variant:"outline",disabled:i.value,onClick:V[3]||(V[3]=G=>p.value=!1)},{default:e.withCtx(()=>[...V[11]||(V[11]=[e.createTextVNode("Close",-1)])]),_:1},8,["disabled"]),e.createVNode(T,{disabled:!pe.value,onClick:Be},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.value?"Transferring...":"Transfer reservation"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}}),Zo={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},qo={class:"grid gap-2"},en={class:"grid gap-2"},tn={class:"grid gap-2"},on=e.defineComponent({__name:"ApproveReservationDialog",emits:["confirm"],setup(t,{expose:o,emit:n}){const{config:s}=J.useModule(),{sendMail:r}=J.useMailer(s.mailAccount),u=n,l=e.ref(!1),d=e.ref("approve"),p=e.ref(!1),m=e.ref(""),c=e.ref(""),g=e.ref(""),h=(v,a)=>{p.value=!s.mailAccount,l.value=!0,v&&(a||(a="approve"),d.value=a,m.value=v.customerInfo?.email,c.value="Confirmation: Your reservation for "+new Date(v.date)?.toDateString(),g.value=`Dear ${v.customerInfo?.firstName??""} ${v.customerInfo?.lastName??""},
|
|
918
|
+
|
|
919
|
+
This email confirms your reservation for ${new Date(v.date)?.toDateString()} at ${v.startTime}.
|
|
920
|
+
|
|
921
|
+
We've got everything ready for you and look forward to your visit! If you need to make any changes or have special requests, please let us know.`)},i=()=>{if(!p.value){if(!m.value||!c.value||!g.value)return alert("Please fill in all the fields.");r({to:m.value,subject:c.value,body:g.value})}l.value=!1;const{$confetti:v}=useNuxtApp();v(),u("confirm")};return o({openDialog:h}),(v,a)=>{const x=e.resolveComponent("DialogTitle"),A=e.resolveComponent("DialogDescription"),f=e.resolveComponent("DialogHeader"),_=e.resolveComponent("Checkbox"),M=e.resolveComponent("Label"),z=e.resolveComponent("Input"),P=e.resolveComponent("Textarea"),W=e.resolveComponent("Button"),E=e.resolveComponent("DialogFooter"),w=e.resolveComponent("DialogScrollContent"),$=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock($,{open:l.value,"onUpdate:open":a[5]||(a[5]=F=>l.value=F)},{default:e.withCtx(()=>[e.createVNode(w,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value==="approve"?"Approve Reservation":"Resend Confirmation Email"),1)]),_:1}),e.createVNode(A)]),_:1}),e.createElementVNode("div",Zo,[e.createVNode(_,{modelValue:p.value,"onUpdate:modelValue":a[0]||(a[0]=F=>p.value=F),id:"reject-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(s).mailAccount},null,8,["modelValue","disabled"]),e.createVNode(M,{for:"reject-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...a[6]||(a[6]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":p.value}])},[e.createElementVNode("div",qo,[e.createVNode(M,{for:"approve-dialog-email"},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(z,{modelValue:m.value,"onUpdate:modelValue":a[1]||(a[1]=F=>m.value=F),disabled:p.value,id:"approve-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",en,[e.createVNode(M,{for:"approve-dialog-subject"},{default:e.withCtx(()=>[...a[8]||(a[8]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(z,{modelValue:c.value,"onUpdate:modelValue":a[2]||(a[2]=F=>c.value=F),disabled:p.value,id:"approve-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",tn,[e.createVNode(M,{for:"approve-dialog-body"},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(P,{modelValue:g.value,"onUpdate:modelValue":a[3]||(a[3]=F=>g.value=F),disabled:p.value,id:"approve-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(E,null,{default:e.withCtx(()=>[e.createVNode(W,{variant:"outline",onClick:a[4]||(a[4]=F=>l.value=!1)},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode("Close",-1)])]),_:1}),e.createVNode(W,{onClick:i},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("Approve reservation",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}}),nn={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},an={class:"grid gap-2"},sn={class:"grid gap-2"},rn={class:"grid gap-2"},ln=e.defineComponent({__name:"RejectReservationDialog",emits:["confirm"],setup(t,{expose:o,emit:n}){const{config:s}=J.useModule(),{sendMail:r}=J.useMailer(s.mailAccount),u=n,l=e.ref(!1),d=e.ref(!1),p=e.ref(""),m=e.ref(""),c=e.ref(""),g=i=>{d.value=!s.mailAccount,l.value=!0,i&&(p.value=i.customerInfo?.email,m.value="Regarding your reservation request for "+new Date(i.date)?.toDateString(),c.value=`Dear ${i.customerInfo?.firstName??""} ${i.customerInfo?.lastName??""},
|
|
922
|
+
|
|
923
|
+
Thank you for your interest in booking with us. Unfortunately, we are unable to confirm your request for ${new Date(i.date)?.toDateString()} at ${i.startTime}.
|
|
924
|
+
|
|
925
|
+
We would love to see you another time!`)},h=()=>{if(!d.value){if(!p.value||!m.value||!c.value)return alert("Please fill in all the fields.");r({to:p.value,subject:m.value,body:c.value})}l.value=!1;const{$confetti:i}=useNuxtApp();i(),u("confirm")};return o({openDialog:g}),(i,v)=>{const a=e.resolveComponent("DialogTitle"),x=e.resolveComponent("DialogDescription"),A=e.resolveComponent("DialogHeader"),f=e.resolveComponent("Checkbox"),_=e.resolveComponent("Label"),M=e.resolveComponent("Input"),z=e.resolveComponent("Textarea"),P=e.resolveComponent("Button"),W=e.resolveComponent("DialogFooter"),E=e.resolveComponent("DialogScrollContent"),w=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(w,{open:l.value,"onUpdate:open":v[5]||(v[5]=$=>l.value=$)},{default:e.withCtx(()=>[e.createVNode(E,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(A,null,{default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[...v[6]||(v[6]=[e.createTextVNode(" Reject Reservation Request ",-1)])]),_:1}),e.createVNode(x)]),_:1}),e.createElementVNode("div",nn,[e.createVNode(f,{modelValue:d.value,"onUpdate:modelValue":v[0]||(v[0]=$=>d.value=$),id:"reject-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(s).mailAccount},null,8,["modelValue","disabled"]),e.createVNode(_,{for:"reject-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...v[7]||(v[7]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":d.value}])},[e.createElementVNode("div",an,[e.createVNode(_,{for:"reject-dialog-email"},{default:e.withCtx(()=>[...v[8]||(v[8]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":v[1]||(v[1]=$=>p.value=$),disabled:d.value,id:"reject-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",sn,[e.createVNode(_,{for:"reject-dialog-subject"},{default:e.withCtx(()=>[...v[9]||(v[9]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(M,{modelValue:m.value,"onUpdate:modelValue":v[2]||(v[2]=$=>m.value=$),disabled:d.value,id:"reject-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",rn,[e.createVNode(_,{for:"reject-dialog-body"},{default:e.withCtx(()=>[...v[10]||(v[10]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(z,{modelValue:c.value,"onUpdate:modelValue":v[3]||(v[3]=$=>c.value=$),disabled:d.value,id:"reject-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(W,null,{default:e.withCtx(()=>[e.createVNode(P,{variant:"outline",onClick:v[4]||(v[4]=$=>l.value=!1)},{default:e.withCtx(()=>[...v[11]||(v[11]=[e.createTextVNode("Close",-1)])]),_:1}),e.createVNode(P,{variant:"destructive",onClick:h},{default:e.withCtx(()=>[...v[12]||(v[12]=[e.createTextVNode("Reject reservation",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}}),cn={class:"flex items-start justify-between gap-3"},dn={class:"min-w-0"},un={class:"text-xs text-muted-foreground"},mn={key:0,class:"shrink-0 rounded-md bg-green-100 px-2 py-1 text-xs font-medium text-green-700 dark:bg-green-900/30 dark:text-green-300"},pn={class:"grid grid-cols-[110px_1fr] gap-3"},fn={class:"min-w-0 whitespace-pre-wrap break-words text-right"},vn={class:"text-muted-foreground"},gn={class:"min-w-0 break-words text-right"},hn={key:0,class:"grid grid-cols-[110px_1fr] gap-3"},yn={class:"min-w-0 break-words text-right"},kt=e.defineComponent({__name:"RefundDetailsDisplay",props:{refunds:{},compact:{type:Boolean,default:!1}},setup(t){const o=t,n=e.computed(()=>(Array.isArray(o.refunds)?o.refunds:[]).filter(Boolean).slice().reverse()),s=m=>{const c=Number(m);return Number.isNaN(c)?"-":`€${c.toFixed(2)}`},r=m=>{if(!m)return"-";const c=new Date(m);return Number.isNaN(c.getTime())?m:c.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})},u=m=>m===!0?"Yes":m===!1?"No":m==null||m===""?"-":typeof m=="object"?JSON.stringify(m):String(m),l=m=>{const c=m?.fields||{},g=Array.isArray(m?.fieldDefinitions)?m.fieldDefinitions:[],h=new Set,i=g.filter(a=>a?.key&&Object.prototype.hasOwnProperty.call(c,a.key)).map(a=>(h.add(a.key),{key:a.key,label:a.label||a.key,value:c[a.key]})),v=Object.entries(c).filter(([a])=>!h.has(a)).map(([a,x])=>({key:a,label:a,value:x}));return[...i,...v]},d=m=>m?.processedAt||m?.requestedAt,p=m=>m?.reason||m?.note||"-";return(m,c)=>n.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(t.compact?"space-y-2":"space-y-3")},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(g,h)=>(e.openBlock(),e.createElementBlock("div",{key:g.processedAt||g.requestedAt||h,class:e.normalizeClass(["rounded-lg border bg-background/70",t.compact?"p-3 space-y-2":"p-4 space-y-3"])},[e.createElementVNode("div",cn,[e.createElementVNode("div",dn,[e.createElementVNode("p",{class:e.normalizeClass(t.compact?"text-xs font-medium":"text-sm font-medium")},e.toDisplayString(g.hasAmount===!1?"Refund flow processed":"Refund processed"),3),e.createElementVNode("p",un,e.toDisplayString(r(d(g))),1)]),g.hasAmount!==!1?(e.openBlock(),e.createElementBlock("div",mn,e.toDisplayString(s(g.amount)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(t.compact?"grid gap-1.5 text-xs":"grid gap-2 text-sm")},[e.createElementVNode("div",pn,[c[0]||(c[0]=e.createElementVNode("span",{class:"text-muted-foreground"},"Reason",-1)),e.createElementVNode("span",fn,e.toDisplayString(p(g)),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l(g),i=>(e.openBlock(),e.createElementBlock("div",{key:i.key,class:"grid grid-cols-[110px_1fr] gap-3"},[e.createElementVNode("span",vn,e.toDisplayString(i.label),1),e.createElementVNode("span",gn,e.toDisplayString(u(i.value)),1)]))),128)),g.notification?(e.openBlock(),e.createElementBlock("div",hn,[c[1]||(c[1]=e.createElementVNode("span",{class:"text-muted-foreground"},"Email",-1)),e.createElementVNode("span",yn,e.toDisplayString(g.notification.skipped?"Skipped":g.notification.to||"Sent"),1)])):e.createCommentVNode("",!0)],2)],2))),128))],2)):e.createCommentVNode("",!0)}}),bn={key:0},xn={key:0,class:"flex items-center gap-1.5 flex-wrap"},kn={key:0,class:"space-y-2 mb-4"},Nn={class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"},Cn={key:1,class:"flex flex-wrap gap-2 mb-4"},Vn={key:1,class:"text-xs text-muted-foreground mr-0.5"},wn={key:2,class:"space-y-3"},_n={class:"bg-muted/30 rounded-lg p-4 space-y-2"},Dn={class:"text-muted-foreground flex items-center gap-1.5"},Me="appearance-none border-0 bg-transparent hover:bg-transparent h-4 p-0 text-inherit underline decoration-dotted underline-offset-2 decoration-current/40 transition-colors hover:decoration-current focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm disabled:cursor-not-allowed disabled:opacity-60",Ie=e.defineComponent({__name:"OrderMetadataDisplay",props:{metadata:{default:()=>({})},schema:{default:()=>[]},displayFilter:{default:void 0},scope:{default:void 0},compact:{type:Boolean,default:!1},enableActions:{type:Boolean,default:!1},actionsDisabled:{type:Boolean,default:!1}},emits:["run-action"],setup(t,{expose:o,emit:n}){const s=I.icons,r=t,u=n,l=x=>x&&s[x]||null,d=e.computed(()=>{if(!r.metadata)return[];const x=new Set(r.schema?.map(_=>_.key)||[]),A=(r.schema||[]).filter(_=>!(r.scope&&_.scope!==r.scope||r.displayFilter&&!r.displayFilter.includes(_.display)||r.metadata[_.key]===void 0||r.metadata[_.key]===null||_.display==="hidden"||r.metadata[_.key]===!1)).sort((_,M)=>(_.order||0)-(M.order||0)).map(_=>({..._,value:r.metadata[_.key]}));if(r.displayFilter&&!r.displayFilter.includes("field"))return A;const f=Object.entries(r.metadata).filter(([_,M])=>!x.has(_)&&M!==void 0&&M!==null&&M!==!1).map(([_,M])=>({id:`_fallback_${_}`,key:_,label:_.replace(/([A-Z])/g," $1").replace(/[_-]/g," ").replace(/^\w/,z=>z.toUpperCase()).trim(),display:"field",scope:"order",value:typeof M=="object"?JSON.stringify(M):String(M)}));return[...A,...f]}),p=e.computed(()=>d.value.filter(x=>x.display==="highlight")),m=e.computed(()=>d.value.filter(x=>x.display==="badge")),c=e.computed(()=>d.value.filter(x=>x.display==="field")),g=e.computed(()=>d.value.length>0),h=x=>Object.keys(x.action?.flow||{}).length>0,i=x=>r.enableActions&&h(x),v=x=>{!i(x)||r.actionsDisabled||u("run-action",{field:x,value:x.value})},a=(x,A)=>{i(x)&&(A.stopPropagation(),v(x))};return o({hasContent:g}),(x,A)=>g.value?(e.openBlock(),e.createElementBlock("div",bn,[t.compact?(e.openBlock(),e.createElementBlock("div",xn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,f=>(e.openBlock(),e.createElementBlock("span",{key:f.id,class:e.normalizeClass(["inline-flex items-center gap-1 px-2 py-0.5 text-xs font-bold rounded-md appearance-none border-0",f.color?"":"bg-primary/10 text-primary"]),style:e.normalizeStyle(f.color?{backgroundColor:f.color+"20",color:f.color}:{})},[l(f.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l(f.icon)),{key:0,size:12})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(f)?"button":"span"),{type:i(f)?"button":void 0,disabled:i(f)?t.actionsDisabled:void 0,class:e.normalizeClass(i(f)?Me:""),"aria-label":i(f)?`Run ${f.label} action`:void 0,onClick:_=>a(f,_)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value===!0?f.label:f.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))],6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,f=>(e.openBlock(),e.createElementBlock("span",{key:f.id,class:e.normalizeClass(["inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full appearance-none border-0",f.color?"":"bg-muted text-muted-foreground"]),style:e.normalizeStyle(f.color?{backgroundColor:f.color+"20",color:f.color}:{})},[l(f.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l(f.icon)),{key:0,size:10})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(f)?"button":"span"),{type:i(f)?"button":void 0,disabled:i(f)?t.actionsDisabled:void 0,class:e.normalizeClass(i(f)?Me:""),"aria-label":i(f)?`Run ${f.label} action`:void 0,onClick:_=>a(f,_)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value===!0?f.label:f.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))],6))),128))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[p.value.length?(e.openBlock(),e.createElementBlock("div",kn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:e.normalizeClass(["rounded-lg border-2 p-4 flex items-center gap-4 appearance-none",f.color?"":"border-primary/20 bg-primary/5"]),style:e.normalizeStyle(f.color?{borderColor:f.color+"40",backgroundColor:f.color+"08"}:{})},[e.createElementVNode("div",{class:e.normalizeClass(["h-12 w-12 rounded-xl flex items-center justify-center shrink-0",f.color?"":"bg-primary/10"]),style:e.normalizeStyle(f.color?{backgroundColor:f.color+"20"}:{})},[l(f.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l(f.icon)),{key:0,size:24,style:e.normalizeStyle(f.color?{color:f.color}:{}),class:e.normalizeClass(f.color?"":"text-primary")},null,8,["style","class"])):e.createCommentVNode("",!0)],6),e.createElementVNode("div",null,[e.createElementVNode("p",Nn,e.toDisplayString(f.label),1),f.value!==!0||i(f)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(f)?"button":"p"),{key:0,type:i(f)?"button":void 0,disabled:i(f)?t.actionsDisabled:void 0,class:e.normalizeClass(["text-2xl font-bold tracking-wider",i(f)?Me:""]),"aria-label":i(f)?`Run ${f.label} action`:void 0,onClick:_=>a(f,_)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value===!0?"✓":f.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"])):e.createCommentVNode("",!0)])],6))),128))])):e.createCommentVNode("",!0),m.value.length?(e.openBlock(),e.createElementBlock("div",Cn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,f=>(e.openBlock(),e.createElementBlock("span",{key:f.id,class:e.normalizeClass(["inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-full appearance-none border-0",f.color?"":"bg-muted text-muted-foreground"]),style:e.normalizeStyle(f.color?{backgroundColor:f.color+"20",color:f.color}:{})},[l(f.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l(f.icon)),{key:0,size:14})):e.createCommentVNode("",!0),f.label&&f.value!==!0?(e.openBlock(),e.createElementBlock("span",Vn,e.toDisplayString(f.label)+":",1)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(f)?"button":"span"),{type:i(f)?"button":void 0,disabled:i(f)?t.actionsDisabled:void 0,class:e.normalizeClass(i(f)?Me:""),"aria-label":i(f)?`Run ${f.label} action`:void 0,onClick:_=>a(f,_)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value===!0?f.label:f.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))],6))),128))])):e.createCommentVNode("",!0),c.value.length?(e.openBlock(),e.createElementBlock("div",wn,[A[0]||(A[0]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Additional Info",-1)),e.createElementVNode("div",_n,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:"flex justify-between gap-4 text-sm appearance-none"},[e.createElementVNode("span",Dn,[l(f.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l(f.icon)),{key:0,size:14})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(f.label),1)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(f)?"button":"span"),{type:i(f)?"button":void 0,disabled:i(f)?t.actionsDisabled:void 0,class:e.normalizeClass(["font-medium text-right break-words",i(f)?Me:""]),"aria-label":i(f)?`Run ${f.label} action`:void 0,onClick:_=>a(f,_)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value===!0?"✓":f.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))]))),128))])])):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0)}}),En={key:0,class:"space-y-6 py-4"},$n={class:"space-y-3"},Sn={class:"bg-muted/30 rounded-lg p-4 space-y-3"},Bn={class:"flex items-center gap-3"},An={class:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center"},Mn={class:"font-medium"},Rn={class:"grid gap-2 text-sm"},In={key:0,class:"flex items-center gap-2 text-muted-foreground"},Fn=["href"],Tn={key:1,class:"flex items-center gap-2 text-muted-foreground"},jn=["href"],zn={class:"space-y-3"},On={class:"grid grid-cols-2 gap-3"},Pn={class:"bg-muted/30 rounded-lg p-3"},Ln={class:"flex items-center gap-2 text-muted-foreground mb-1"},Un={class:"text-xs"},Hn={class:"font-medium"},Wn={class:"bg-muted/30 rounded-lg p-3"},Kn={class:"flex items-center gap-2 text-muted-foreground mb-1"},Gn={class:"font-medium"},Yn={key:0,class:"bg-muted/30 rounded-lg p-3 col-span-2"},Jn={class:"flex items-center gap-2 text-muted-foreground mb-1"},Qn={class:"font-medium truncate"},Xn={key:0,class:"space-y-3"},Zn={class:"bg-muted/30 rounded-lg p-4"},qn={class:"flex items-start justify-between"},ea={class:"flex items-start gap-3"},ta={class:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center mt-0.5"},oa={class:"font-medium"},na={class:"text-sm text-muted-foreground"},aa={class:"font-semibold"},sa={class:"space-y-3"},ra={class:"bg-muted/30 rounded-lg p-4 space-y-3"},la={class:"space-y-2 text-sm"},ia={class:"flex justify-between"},ca={key:0,class:"flex justify-between"},da={key:1,class:"grid"},ua={class:"text-muted-foreground"},ma={key:0},pa={key:1},fa={class:"flex justify-between font-semibold"},va={class:"flex justify-between font-semibold"},ga={class:"flex items-center gap-2"},ha={key:1,class:"space-y-2 text-sm"},ya={key:0,class:"flex justify-between"},ba={class:"text-muted-foreground flex items-center gap-1.5"},xa={class:"text-green-600 dark:text-green-400"},ka={key:1,class:"flex justify-between"},Na={class:"text-muted-foreground flex items-center gap-1.5"},Ca={class:"text-orange-600 dark:text-orange-400 font-medium"},Va={key:1,class:"space-y-3"},wa=e.defineComponent({__name:"ReservationDetailDialog",props:{agendaData:{},showOrderLink:{type:Boolean,default:!1},resources:{default:()=>[]}},emits:["cancelled","confirmed","rejected","transferred","openOrder"],setup(t,{expose:o,emit:n}){const s=t,{hasPermission:r}=J.useModulePermissions(),{params:u}=J.useModuleRoute(),{config:l}=J.useModule(),d=J.useFirebaseIntegration(l.project),p=J.useModuleApi(),{runFlow:m}=J.useFlowBuilder(),{sendMail:c}=J.useMailer(l.mailAccount),g=e.inject("event",e.ref(null)),h=e.computed(()=>{const b=Array.isArray(s.resources)?s.resources:[],y=Array.isArray(s.agendaData?.resources)?s.agendaData.resources:[],R=[...b,...y],T=new Set;return R.filter(se=>{const O=se?.id;return!O||T.has(String(O))?!1:(T.add(String(O)),!0)})}),i=n,v=e.ref(!1),a=e.ref(null),x=e.ref(!1),A=e.ref(!1),f=e.ref({}),_=e.ref(null),M=e.ref(!1),z=e.computed(()=>u.value?.id??u.id??""),{metadataSchema:P}=nt(z),W=e.computed(()=>a.value?.id||a.value?.orderId||""),E=e.computed(()=>Object.keys(f.value||{}).length>0),w=e.computed(()=>(_.value?.refundFlowEnabled??s.agendaData?.refundFlowEnabled)!==!1),$=e.computed(()=>E.value&&w.value),F=e.computed(()=>{const b=_.value?.refundDialog??s.agendaData?.refundDialog;return{showAmount:b?.showAmount!==!1,fields:Array.isArray(b?.fields)?b.fields:[]}}),ne=e.useTemplateRef("cancelReservationDialog"),L=e.useTemplateRef("cancelRefundReservationDialog"),U=e.useTemplateRef("approveReservationDialog"),K=e.useTemplateRef("rejectReservationDialog"),k=e.useTemplateRef("transferReservationDialog"),N=b=>{const y=b?.id||b?.orderId;!b||!y||(a.value={...b,id:y},v.value=!0)},Q=async()=>{if(z.value){_.value=null,f.value={},M.value=!0;try{const b=await p.get(`/agendas/${z.value}/refund-flow`);_.value=b||null,f.value=b?.refundFlow||s.agendaData?.refundFlow||{}}catch(b){console.error("Error loading refund flow:",b),f.value=s.agendaData?.refundFlow||{}}finally{M.value=!1}}};e.watch(z,Q,{immediate:!0});const X=e.computed(()=>a.value?.customerInfo&&`${a.value.customerInfo.firstName} ${a.value.customerInfo.lastName}`.trim()||"Unknown Customer"),oe=b=>{if(typeof b!="string")return!1;const y=b.trim().toLowerCase();return y.length>0&&y!=="unknown"&&y!=="unknown resource"},S=b=>b&&h.value.find(y=>String(y.id)===String(b))||null,Y=e.computed(()=>{const b=a.value?.resourceId||a.value?.resource?.id||g.value?.resourceId||g.value?.resource?.id,y=S(b),R=g.value?.resourceId||g.value?.resource?.id,T=!b||String(R)===String(b)?g.value?.resource:null,se=a.value?.resource?.name,O=T?.name;return{name:y?.name||(oe(se)?se:"")||(oe(O)?O:"")||(oe(a.value?.resourceName)?a.value.resourceName:""),color:y?.color||a.value?.resource?.color||T?.color||a.value?.resourceColor||"#6b7280"}}),ke=e.computed(()=>{let b=a.value?.status;const y=a.value?.reservationStatus;switch(b==="confirmed"&&["needs_approval","rejected","approved","cancelled"].includes(y)&&(b=y),b){case"pending":return{label:"Pending",class:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"};case"cancelled":return{label:"Cancelled",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"needs_approval":return{label:"Needs Approval",class:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"};case"rejected":return{label:"Rejected",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"approved":return{label:"Approved",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};case"confirmed":return{label:"Confirmed",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};default:return{label:b||"Unknown",class:"bg-muted text-muted-foreground"}}}),pe=e.computed(()=>a.value?.status==="cancelled"||a.value?.reservationStatus==="cancelled"),ie=b=>b==null||typeof b!="number"?"—":`€${b?.toFixed(2)}`,Ne=b=>{if(!b)return"—";if(b<60)return`${b} min`;const y=Math.floor(b/60),R=b%60;return R>0?`${y}h ${R}min`:`${y}h`},_e=()=>{if(!a.value)return;let b="";const y=g?.value?.date;if(y)try{b=new Date(y).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}catch{b=y}const R={date:b,resourceName:Y.value.name,metadataSchema:P.value};ko(a.value,R)},De=()=>{U.value?.openDialog(a.value)},ye=()=>{K.value?.openDialog(a.value)},Ee=()=>{U.value?.openDialog(a.value)},$e=()=>{ne.value?.openDialog(a.value)},Se=()=>{!E.value&&!M.value&&Q(),L.value?.openDialog(a.value)},Ce=async()=>{try{if(x.value||!a.value?.id)throw new Error("Invalid state");x.value=!0;let y=(await d.get(l.reservationsCollection,a.value.id))?.reservations||[];if(!y.find(R=>R.id===a.value.res_id))throw new Error("Reservation not found");y.find(R=>R.id===a.value.res_id).status="cancelled",await d.update(l.reservationsCollection,a.value.id,{reservations:y}),a.value.status="cancelled",a.value.reservationStatus="cancelled",re.toast.success("Reservation cancelled successfully"),i("cancelled"),v.value=!1}catch(b){console.error("Error cancelling reservation:",b),re.toast.error("Failed to cancel reservation")}finally{x.value=!1}},Be=b=>{try{return JSON.parse(JSON.stringify(b??null))}catch{return null}},C=b=>b===null||Array.isArray(b)?"object":typeof b,V=b=>b?.scope==="reservation"?a.value?.reservationMetadata||{}:a.value?.metadata||{},D=async({field:b,value:y})=>{const R=b?.action?.flow||{};if(!(!Object.keys(R).length||A.value)){A.value=!0;try{await m(R,[{id:"value",name:"value",type:C(y),value:y},{id:"field",name:"field",type:"object",value:{id:b.id,key:b.key,label:b.label,display:b.display,scope:b.scope}},{id:"metadata",name:"metadata",type:"object",value:V(b)},{id:"order",name:"order",type:"object",value:a.value||{}},{id:"reservation",name:"reservation",type:"object",value:a.value||{}},{id:"booking",name:"booking",type:"object",value:a.value||{}},{id:"agenda",name:"agenda",type:"object",value:s.agendaData||{}},{id:"customer",name:"customer",type:"object",value:a.value?.customerInfo||{}},{id:"orderId",name:"orderId",type:"string",value:W.value||""},{id:"reservationId",name:"reservationId",type:"string",value:a.value?.res_id||a.value?.reservationId||""}]),re.toast.success("Metadata action completed")}catch(T){console.error("Error running metadata action:",T),re.toast.error("Failed to run metadata action")}finally{A.value=!1}}},j=async b=>{try{if(x.value||!a.value?.id||!a.value?.res_id)throw new Error("Invalid state");if(!$.value)throw new Error("No active refund flow configured");x.value=!0;const y=a.value.id,R=a.value.res_id,T=await d.get(l.reservationsCollection,y),se=T?.reservations||[],O=se.find(Ae=>Ae.id===R);if(!O)throw new Error("Reservation not found");const me=new Date().toISOString(),G=F.value.showAmount,ce={amount:G?Number(b.amount)||0:null,hasAmount:G,reason:b.reason,fields:b.fields||{},fieldDefinitions:b.fieldDefinitions||[],requestedAt:me,notification:{skipped:b.skipMail,to:b.email,subject:b.subject,body:b.body}},Pe=await m(f.value,[{id:"agenda",name:"agenda",type:"object",value:s.agendaData||{}},{id:"order",name:"order",type:"object",value:{...T,id:y}},{id:"reservation",name:"reservation",type:"object",value:O},{id:"booking",name:"booking",type:"object",value:a.value},{id:"customer",name:"customer",type:"object",value:T?.customerInfo||a.value.customerInfo||{}},{id:"refund",name:"refund",type:"object",value:ce},{id:"refundFields",name:"refundFields",type:"object",value:ce.fields},{id:"refundHasAmount",name:"refundHasAmount",type:"boolean",value:ce.hasAmount},{id:"orderId",name:"orderId",type:"string",value:y},{id:"reservationId",name:"reservationId",type:"string",value:R},{id:"refundAmount",name:"refundAmount",type:"number",value:ce.amount||0}]),Ve={...ce,processedAt:new Date().toISOString(),flowResult:Be(Pe)};if(O.status="cancelled",O.refundStatus=ce.hasAmount?"refunded":"processed",O.refundedAt=Ve.processedAt,ce.hasAmount&&(O.refundedAmount=(Number(O.refundedAmount)||0)+(ce.amount||0)),O.refunds=[...Array.isArray(O.refunds)?O.refunds:[],Ve],await d.update(l.reservationsCollection,y,{reservations:se}),!b.skipMail)try{await c({to:b.email,subject:b.subject,body:b.body})}catch(Ae){console.error("Error sending refund email:",Ae),re.toast.warning("Refund processed, but the email could not be sent")}a.value.status="cancelled",a.value.reservationStatus="cancelled",a.value.refundStatus=ce.hasAmount?"refunded":"processed",a.value.refundedAt=Ve.processedAt,a.value.refunds=[...Array.isArray(a.value.refunds)?a.value.refunds:[],Ve],ce.hasAmount&&(a.value.refundedAmount=(Number(a.value.refundedAmount)||0)+(ce.amount||0)),re.toast.success("Reservation cancelled and refund flow completed"),i("cancelled"),L.value?.closeDialog(),v.value=!1}catch(y){console.error("Error cancelling reservation with refund:",y),re.toast.error(y instanceof Error&&y.message==="No active refund flow configured"?"No active refund flow configured":"Failed to cancel and refund reservation")}finally{x.value=!1}},H=async()=>{try{if(x.value||!a.value?.id)throw new Error("Invalid state");x.value=!0;let y=(await d.get(l.reservationsCollection,a.value.id))?.reservations||[];if(!y.find(R=>R.id===a.value.res_id))throw new Error("Reservation not found");y.find(R=>R.id===a.value.res_id).status="approved",await d.update(l.reservationsCollection,a.value.id,{reservations:y}),a.value.status="approved",re.toast.success("Reservation approved successfully"),i("confirmed"),v.value=!1}catch(b){console.error("Error approving reservation:",b),re.toast.error("Failed to approve reservation")}finally{x.value=!1}},Z=async()=>{try{if(x.value||!a.value?.id)throw new Error("Invalid state");x.value=!0;let y=(await d.get(l.reservationsCollection,a.value.id))?.reservations||[];if(!y.find(R=>R.id===a.value.res_id))throw new Error("Reservation not found");y.find(R=>R.id===a.value.res_id).status="rejected",await d.update(l.reservationsCollection,a.value.id,{reservations:y}),a.value.status="rejected",re.toast.success("Reservation rejected successfully"),i("rejected"),v.value=!1}catch(b){console.error("Error rejecting reservation:",b),re.toast.error("Failed to reject reservation")}finally{x.value=!1}},ee=()=>{k.value?.openDialog(a.value)},ue=b=>{const y=b?.reservation;a.value&&y&&(a.value={...a.value,date:y.date,endTime:y.timeslot?.endTime,resourceColor:y.resource?.color,resourceId:y.resourceId,resourceName:y.resource?.name,startTime:y.timeslot?.startTime}),i("transferred"),v.value=!1},ae=()=>{W.value&&(v.value=!1,i("openOrder",W.value))};return o({openDialog:N}),(b,y)=>{const R=e.resolveComponent("ResponsiveModalTitle"),T=e.resolveComponent("ResponsiveModalDescription"),se=e.resolveComponent("ResponsiveModalHeader"),O=e.resolveComponent("Separator"),me=e.resolveComponent("Button"),G=e.resolveComponent("DropdownMenuTrigger"),be=e.resolveComponent("DropdownMenuItem"),ce=e.resolveComponent("DropdownMenuGroup"),Pe=e.resolveComponent("DropdownMenuSeparator"),Ve=e.resolveComponent("DropdownMenuContent"),Ae=e.resolveComponent("DropdownMenu"),Nt=e.resolveComponent("ResponsiveModalFooter"),Ct=e.resolveComponent("ResponsiveModalScrollContent"),Vt=e.resolveComponent("ResponsiveModal");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Vt,{open:v.value,"onUpdate:open":y[0]||(y[0]=fe=>v.value=fe)},{default:e.withCtx(()=>[e.createVNode(Ct,{class:"sm:max-w-xl"},{default:e.withCtx(()=>[e.createVNode(se,null,{default:e.withCtx(()=>[e.createVNode(R,{class:"flex items-center gap-3"},{default:e.withCtx(()=>[y[1]||(y[1]=e.createElementVNode("span",null,"Reservation Details",-1)),e.createElementVNode("span",{class:e.normalizeClass(["px-2.5 py-1 text-xs font-medium rounded-full",ke.value.class])},e.toDisplayString(ke.value.label),3)]),_:1}),e.createVNode(T,null,{default:e.withCtx(()=>[e.createTextVNode(" Booking #"+e.toDisplayString(W.value.slice(0,8)||"—"),1)]),_:1})]),_:1}),a.value?(e.openBlock(),e.createElementBlock("div",En,[e.createVNode(Ie,{metadata:a.value.metadata,schema:e.unref(P),scope:"order","enable-actions":"","actions-disabled":A.value,onRunAction:D},null,8,["metadata","schema","actions-disabled"]),e.createVNode(Ie,{metadata:a.value.reservationMetadata,schema:e.unref(P),scope:"reservation","enable-actions":"","actions-disabled":A.value,onRunAction:D},null,8,["metadata","schema","actions-disabled"]),e.createElementVNode("div",$n,[y[2]||(y[2]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Customer",-1)),e.createElementVNode("div",Sn,[e.createElementVNode("div",Bn,[e.createElementVNode("div",An,[e.createVNode(e.unref(I.User),{size:20,class:"text-primary"})]),e.createElementVNode("div",null,[e.createElementVNode("p",Mn,e.toDisplayString(X.value),1)])]),e.createElementVNode("div",Rn,[a.value.customerInfo?.email?(e.openBlock(),e.createElementBlock("div",In,[e.createVNode(e.unref(I.Mail),{size:14}),e.createElementVNode("a",{href:`mailto:${a.value.customerInfo.email}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(a.value.customerInfo.email),9,Fn)])):e.createCommentVNode("",!0),a.value.customerInfo?.phone?(e.openBlock(),e.createElementBlock("div",Tn,[e.createVNode(e.unref(I.Phone),{size:14}),e.createElementVNode("a",{href:`tel:${a.value.customerInfo.phone}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(a.value.customerInfo.phone),9,jn)])):e.createCommentVNode("",!0)])])]),e.createElementVNode("div",zn,[y[5]||(y[5]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Reservation",-1)),e.createElementVNode("div",On,[e.createElementVNode("div",Pn,[e.createElementVNode("div",Ln,[e.createVNode(e.unref(I.Clock),{size:14}),e.createElementVNode("span",Un,e.toDisplayString(a.value.startTime)+" - "+e.toDisplayString(a.value.endTime),1)]),e.createElementVNode("p",Hn,e.toDisplayString(new Date(a.value.date).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})),1)]),e.createElementVNode("div",Wn,[e.createElementVNode("div",Kn,[e.createVNode(e.unref(I.Users),{size:14}),y[3]||(y[3]=e.createElementVNode("span",{class:"text-xs"},"Spots",-1))]),e.createElementVNode("p",Gn,e.toDisplayString(a.value.spots||1)+" "+e.toDisplayString(a.value.spots===1?"person":"people"),1)]),Y.value.name?(e.openBlock(),e.createElementBlock("div",Yn,[e.createElementVNode("div",Jn,[e.createElementVNode("span",{class:"w-3 h-3 rounded-full shrink-0",style:e.normalizeStyle({backgroundColor:Y.value.color})},null,4),y[4]||(y[4]=e.createElementVNode("span",{class:"text-xs"},"Resource",-1))]),e.createElementVNode("p",Qn,e.toDisplayString(Y.value.name),1)])):e.createCommentVNode("",!0)])]),a.value.pricingOption?(e.openBlock(),e.createElementBlock("div",Xn,[y[6]||(y[6]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Package",-1)),e.createElementVNode("div",Zn,[e.createElementVNode("div",qn,[e.createElementVNode("div",ea,[e.createElementVNode("div",ta,[e.createVNode(e.unref(I.Tag),{size:18,class:"text-primary"})]),e.createElementVNode("div",null,[e.createElementVNode("p",oa,e.toDisplayString(a.value.pricingOption.name),1),e.createElementVNode("p",na,e.toDisplayString(Ne(a.value.pricingOption.duration)),1)])]),e.createElementVNode("p",aa,e.toDisplayString(ie(a.value.pricingOption.price)),1)])])])):e.createCommentVNode("",!0),e.createElementVNode("div",sa,[y[13]||(y[13]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Payment",-1)),e.createElementVNode("div",ra,[e.createElementVNode("div",la,[e.createElementVNode("div",ia,[y[7]||(y[7]=e.createElementVNode("span",{class:"text-muted-foreground"},"Base price",-1)),e.createElementVNode("span",null,e.toDisplayString(ie(a.value.reservationBasePrice)),1)]),a.value.reservationAddOnsPrice?(e.openBlock(),e.createElementBlock("div",ca,[y[8]||(y[8]=e.createElementVNode("span",{class:"text-muted-foreground"},"Add-ons",-1)),e.createElementVNode("span",null,e.toDisplayString(ie(a.value.reservationAddOnsPrice)),1)])):e.createCommentVNode("",!0),a.value.reservationAdjustments&&a.value.reservationAdjustments.length?(e.openBlock(),e.createElementBlock("div",da,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.reservationAdjustments,fe=>(e.openBlock(),e.createElementBlock("div",{key:fe,class:"flex justify-between"},[e.createElementVNode("span",ua,e.toDisplayString(fe.label),1),fe.type=="percent"?(e.openBlock(),e.createElementBlock("span",ma,e.toDisplayString(fe.value)+"% ",1)):(e.openBlock(),e.createElementBlock("span",pa,e.toDisplayString(fe.value<0?"-":"+")+e.toDisplayString(ie(Math.abs(fe.value))),1))]))),128))])):e.createCommentVNode("",!0)]),e.createVNode(O),e.createElementVNode("div",fa,[y[9]||(y[9]=e.createElementVNode("span",null,"Reservation Total",-1)),e.createElementVNode("span",null,e.toDisplayString(ie(a.value.reservationPrice)),1)]),e.createVNode(O),e.createElementVNode("div",va,[e.createElementVNode("div",ga,[y[10]||(y[10]=e.createElementVNode("span",null,"Order Total",-1)),t.showOrderLink?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"text-[10px] uppercase bg-muted hover:bg-muted/50 px-2 py-1 rounded cursor-pointer",onClick:ae}," view order ")):e.createCommentVNode("",!0)]),e.createElementVNode("span",null,e.toDisplayString(ie(a.value.total)),1)]),a.value.amountPaid!==void 0||a.value.amountDue!==void 0?(e.openBlock(),e.createBlock(O,{key:0})):e.createCommentVNode("",!0),a.value.amountPaid!==void 0||a.value.amountDue!==void 0?(e.openBlock(),e.createElementBlock("div",ha,[a.value.amountPaid!==void 0?(e.openBlock(),e.createElementBlock("div",ya,[e.createElementVNode("span",ba,[e.createVNode(e.unref(I.CreditCard),{size:14}),y[11]||(y[11]=e.createTextVNode(" Amount paid ",-1))]),e.createElementVNode("span",xa,e.toDisplayString(ie(a.value.amountPaid)),1)])):e.createCommentVNode("",!0),a.value.amountDue!==void 0&&a.value.amountDue>0?(e.openBlock(),e.createElementBlock("div",ka,[e.createElementVNode("span",Na,[e.createVNode(e.unref(I.Receipt),{size:14}),y[12]||(y[12]=e.createTextVNode(" Amount due ",-1))]),e.createElementVNode("span",Ca,e.toDisplayString(ie(a.value.amountDue)),1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]),a.value.refunds?.length?(e.openBlock(),e.createElementBlock("div",Va,[y[14]||(y[14]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Refunds",-1)),e.createVNode(kt,{refunds:a.value.refunds},null,8,["refunds"])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(Nt,{class:"gap-2 sm:justify-between"},{default:e.withCtx(()=>[a.value?.status==="confirmed"&&a.value?.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(me,{variant:"destructive",onClick:ye},{default:e.withCtx(()=>[e.createVNode(e.unref(I.Ban),{size:16}),y[15]||(y[15]=e.createTextVNode(" Reject Reservation ",-1))]),_:1}),e.createVNode(me,{onClick:De},{default:e.withCtx(()=>[e.createVNode(e.unref(I.ClockCheck),{size:16}),y[16]||(y[16]=e.createTextVNode(" Approve Reservation ",-1))]),_:1})],64)):a.value?.status==="confirmed"&&a.value?.reservationStatus==="approved"?(e.openBlock(),e.createBlock(Ae,{key:1},{default:e.withCtx(()=>[e.createVNode(G,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(me,{variant:"outline",class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(I.MoreHorizontal),{size:16}),y[17]||(y[17]=e.createTextVNode(" Actions ",-1))]),_:1})]),_:1}),e.createVNode(Ve,{class:"w-60",align:"start"},{default:e.withCtx(()=>[e.createVNode(ce,null,{default:e.withCtx(()=>[e.createVNode(be,{onClick:ae,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(I.ExternalLink),{size:16,class:"text-muted-foreground"}),y[18]||(y[18]=e.createElementVNode("span",null,"View whole order",-1))]),_:1}),e.createVNode(be,{onClick:_e,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(I.Download),{size:16,class:"text-muted-foreground"}),y[19]||(y[19]=e.createElementVNode("span",null,"Download PDF",-1))]),_:1}),e.createVNode(be,{onClick:Ee,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(I.MailCheck),{size:16,class:"text-muted-foreground"}),y[20]||(y[20]=e.createElementVNode("span",null,"(Re)send Confirmation Mail",-1))]),_:1}),e.unref(r)("manage-reservations")?(e.openBlock(),e.createBlock(be,{key:0,onClick:ee,class:"gap-2 cursor-pointer",disabled:pe.value},{default:e.withCtx(()=>[e.createVNode(e.unref(I.CalendarClock),{size:16,class:"text-muted-foreground"}),y[21]||(y[21]=e.createElementVNode("span",null,"Transfer Date & Time",-1))]),_:1},8,["disabled"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(Pe),e.unref(r)("manage-reservations")?(e.openBlock(),e.createBlock(ce,{key:0},{default:e.withCtx(()=>[e.createVNode(be,{onClick:$e,class:"gap-2 cursor-pointer",variant:"destructive",disabled:pe.value},{default:e.withCtx(()=>[e.createVNode(e.unref(I.XCircle),{size:16}),y[22]||(y[22]=e.createElementVNode("span",null,"Cancel Reservation",-1))]),_:1},8,["disabled"]),$.value&&a.value?.total&&a.value.total>0?(e.openBlock(),e.createBlock(be,{key:0,onClick:Se,class:"gap-2 cursor-pointer text-orange-600 dark:text-orange-400 focus:text-orange-600 dark:focus:text-orange-400",disabled:pe.value},{default:e.withCtx(()=>[e.createVNode(e.unref(I.Gift),{class:"text-inherit",size:16}),y[23]||(y[23]=e.createElementVNode("span",null,"Cancel & Refund",-1))]),_:1},8,["disabled"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})]),_:1},8,["open"]),e.createVNode(Do,{ref_key:"cancelReservationDialog",ref:ne,onConfirm:Ce},null,512),e.createVNode(Oo,{ref_key:"cancelRefundReservationDialog",ref:L,"is-processing":x.value,"has-refund-flow":$.value,"show-refund-amount":F.value.showAmount,"custom-fields":F.value.fields,onConfirm:j},null,8,["is-processing","has-refund-flow","show-refund-amount","custom-fields"]),e.createVNode(on,{ref_key:"approveReservationDialog",ref:U,onConfirm:H},null,512),e.createVNode(ln,{ref_key:"rejectReservationDialog",ref:K,onConfirm:Z},null,512),e.createVNode(Xo,{ref_key:"transferReservationDialog",ref:k,"agenda-data":t.agendaData,onTransferred:ue},null,8,["agenda-data"])],64)}}}),_a={key:0,class:"space-y-6 py-4"},Da={class:"space-y-3"},Ea={class:"bg-muted/30 rounded-lg p-4 space-y-3"},$a={class:"flex items-center gap-3"},Sa={class:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center"},Ba={class:"font-medium"},Aa={class:"grid gap-2 text-sm"},Ma={key:0,class:"flex items-center gap-2 text-muted-foreground"},Ra=["href"],Ia={key:1,class:"flex items-center gap-2 text-muted-foreground"},Fa=["href"],Ta={class:"space-y-3"},ja={class:"grid grid-cols-2 gap-3"},za={class:"bg-muted/30 rounded-lg p-3"},Oa={class:"flex items-center gap-2 text-muted-foreground mb-1"},Pa={class:"font-medium"},La={class:"bg-muted/30 rounded-lg p-3"},Ua={class:"flex items-center gap-2 text-muted-foreground mb-1"},Ha={class:"font-medium"},Wa={class:"bg-muted/30 rounded-lg p-3 col-span-2"},Ka={class:"flex items-center gap-2 text-muted-foreground mb-1"},Ga={class:"font-medium"},Ya={class:"space-y-3"},Ja={class:"space-y-2"},Qa=["onClick"],Xa={class:"flex items-start justify-between gap-3"},Za={class:"min-w-0 flex-1 space-y-2"},qa={class:"flex items-center gap-2 flex-wrap"},es={key:0,class:"inline-flex items-center gap-1 text-xs text-muted-foreground"},ts={class:"grid gap-1 text-sm"},os={class:"flex items-center gap-2 text-muted-foreground"},ns={class:"flex items-center gap-2 text-muted-foreground"},as={class:"flex items-center gap-2 text-muted-foreground"},ss={key:0,class:"flex items-center gap-2 text-muted-foreground"},rs={class:"shrink-0 text-right flex items-center gap-2"},ls={class:"text-sm font-semibold"},is={class:"space-y-3"},cs={class:"bg-muted/30 rounded-lg p-4 space-y-3"},ds={class:"space-y-2 text-sm"},us={class:"flex justify-between"},ms={key:0,class:"flex justify-between"},ps={key:1,class:"grid gap-2"},fs={class:"text-muted-foreground"},vs={key:2,class:"flex justify-between text-green-600 dark:text-green-400"},gs={class:"flex justify-between font-semibold"},hs={class:"space-y-2 text-sm"},ys={key:0,class:"flex justify-between"},bs={class:"text-muted-foreground flex items-center gap-1.5"},xs={class:"text-green-600 dark:text-green-400"},ks={key:1,class:"flex justify-between"},Ns={class:"text-muted-foreground flex items-center gap-1.5"},Cs={class:"text-orange-600 dark:text-orange-400 font-medium"},Vs=e.defineComponent({__name:"OrderDetailDialog",props:{agendaData:{},resources:{default:()=>[]}},emits:["openReservation"],setup(t,{expose:o,emit:n}){const s=t,r=n,u=e.ref(!1),l=e.ref(null),d=e.ref(!1),{params:p}=J.useModuleRoute(),{runFlow:m}=J.useFlowBuilder(),c=e.computed(()=>p.value?.id??p.id??s.agendaData?.id??""),{metadataSchema:g}=nt(c),h=e.computed(()=>{const k=Array.isArray(s.resources)?s.resources:[],N=Array.isArray(s.agendaData?.resources)?s.agendaData.resources:[],Q=[...k,...N],X=new Set;return Q.filter(oe=>{const S=oe?.id;return!S||X.has(String(S))?!1:(X.add(String(S)),!0)})}),i=k=>{!k?.id||!k.reservations?.length||(l.value=k,u.value=!0)},v=e.computed(()=>{const k=l.value?.customerInfo;return k&&[k.firstName,k.lastName].filter(Boolean).join(" ")||"Unknown Customer"}),a=e.computed(()=>{const k=l.value?.reservations?.[0];return{subtotal:k?.subtotal,discount:k?.discount,amountPaid:k?.amountPaid,amountDue:k?.amountDue}}),x=e.computed(()=>l.value?.reservations.reduce((k,N)=>k+(N.reservationPrice||0),0)||0),A=k=>{if(typeof k!="string")return!1;const N=k.trim().toLowerCase();return N.length>0&&N!=="unknown"&&N!=="unknown resource"},f=k=>k&&h.value.find(N=>String(N.id)===String(k))||null,_=k=>{const N=k.resourceId||k.resource?.id,Q=f(N),X=k.resource?.name;return{name:Q?.name||(A(X)?X:"")||(A(k.resourceName)?k.resourceName:""),color:Q?.color||k.resource?.color||k.resourceColor||"#6b7280"}},M=e.computed(()=>l.value?.reservations.map(k=>{const N=_(k);return{...k,resourceName:N.name,resourceColor:N.color}})||[]),z=e.computed(()=>l.value?{...l.value,reservations:M.value}:null),P=k=>k==null||typeof k!="number"?"-":`€${k.toFixed(2)}`,W=k=>k.type==="percent"?`${k.value}%`:`${k.value<0?"-":"+"}${P(Math.abs(k.value))}`,E=k=>{if(!k)return"-";const N=new Date(k);return Number.isNaN(N.getTime())?k:N.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})},w=k=>{if(!k)return"-";const N=new Date(k);return Number.isNaN(N.getTime())?k:N.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})},$=k=>{switch(k){case"pending":return{label:"Pending",class:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"};case"cancelled":return{label:"Cancelled",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"needs_approval":return{label:"Needs Approval",class:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"};case"rejected":return{label:"Rejected",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"approved":return{label:"Approved",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};case"confirmed":return{label:"Confirmed",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};default:return{label:k||"Unknown",class:"bg-muted text-muted-foreground"}}},F=k=>{let N=k.status;const Q=k.reservationStatus;return N==="confirmed"&&["needs_approval","rejected","approved","cancelled"].includes(Q||"")&&(N=Q),$(N)},ne=k=>{const N=k.id||l.value?.id;N&&(u.value=!1,r("openReservation",{...k,id:N}))},L=()=>{z.value&&No(z.value,{agendaName:s.agendaData?.name,metadataSchema:g.value})},U=k=>k===null||Array.isArray(k)?"object":typeof k,K=async({field:k,value:N})=>{const Q=k?.action?.flow||{};if(!(!Object.keys(Q).length||d.value)){d.value=!0;try{await m(Q,[{id:"value",name:"value",type:U(N),value:N},{id:"field",name:"field",type:"object",value:{id:k.id,key:k.key,label:k.label,display:k.display,scope:k.scope}},{id:"metadata",name:"metadata",type:"object",value:l.value?.metadata||{}},{id:"order",name:"order",type:"object",value:z.value||l.value||{}},{id:"agenda",name:"agenda",type:"object",value:s.agendaData||{}},{id:"customer",name:"customer",type:"object",value:l.value?.customerInfo||{}},{id:"orderId",name:"orderId",type:"string",value:l.value?.id||""}]),re.toast.success("Metadata action completed")}catch(X){console.error("Error running metadata action:",X),re.toast.error("Failed to run metadata action")}finally{d.value=!1}}};return o({openDialog:i}),(k,N)=>{const Q=e.resolveComponent("ResponsiveModalTitle"),X=e.resolveComponent("ResponsiveModalDescription"),oe=e.resolveComponent("ResponsiveModalHeader"),S=e.resolveComponent("Separator"),Y=e.resolveComponent("Button"),ke=e.resolveComponent("DropdownMenuTrigger"),pe=e.resolveComponent("DropdownMenuLabel"),ie=e.resolveComponent("DropdownMenuItem"),Ne=e.resolveComponent("DropdownMenuGroup"),_e=e.resolveComponent("DropdownMenuSeparator"),De=e.resolveComponent("DropdownMenuSubTrigger"),ye=e.resolveComponent("DropdownMenuSubContent"),Ee=e.resolveComponent("DropdownMenuPortal"),$e=e.resolveComponent("DropdownMenuSub"),Se=e.resolveComponent("DropdownMenuContent"),Ce=e.resolveComponent("DropdownMenu"),Be=e.resolveComponent("ResponsiveModalFooter"),C=e.resolveComponent("ResponsiveModalScrollContent"),V=e.resolveComponent("ResponsiveModal");return e.openBlock(),e.createBlock(V,{open:u.value,"onUpdate:open":N[1]||(N[1]=D=>u.value=D)},{default:e.withCtx(()=>[e.createVNode(C,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(oe,null,{default:e.withCtx(()=>[e.createVNode(Q,{class:"flex items-center gap-3"},{default:e.withCtx(()=>[N[2]||(N[2]=e.createElementVNode("span",null,"Order Details",-1)),e.createElementVNode("span",{class:e.normalizeClass(["px-2.5 py-1 text-xs font-medium rounded-full",$(l.value?.status).class])},e.toDisplayString($(l.value?.status).label),3)]),_:1}),e.createVNode(X,null,{default:e.withCtx(()=>[e.createTextVNode(" Order #"+e.toDisplayString(l.value?.id?.slice(0,8)||"-"),1)]),_:1})]),_:1}),l.value?(e.openBlock(),e.createElementBlock("div",_a,[e.createVNode(Ie,{metadata:l.value.metadata,schema:e.unref(g),scope:"order","enable-actions":"","actions-disabled":d.value,onRunAction:K},null,8,["metadata","schema","actions-disabled"]),e.createElementVNode("div",Da,[N[3]||(N[3]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Customer",-1)),e.createElementVNode("div",Ea,[e.createElementVNode("div",$a,[e.createElementVNode("div",Sa,[e.createVNode(e.unref(I.User),{size:20,class:"text-primary"})]),e.createElementVNode("div",null,[e.createElementVNode("p",Ba,e.toDisplayString(v.value),1)])]),e.createElementVNode("div",Aa,[l.value.customerInfo?.email?(e.openBlock(),e.createElementBlock("div",Ma,[e.createVNode(e.unref(I.Mail),{size:14}),e.createElementVNode("a",{href:`mailto:${l.value.customerInfo.email}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(l.value.customerInfo.email),9,Ra)])):e.createCommentVNode("",!0),l.value.customerInfo?.phone?(e.openBlock(),e.createElementBlock("div",Ia,[e.createVNode(e.unref(I.Phone),{size:14}),e.createElementVNode("a",{href:`tel:${l.value.customerInfo.phone}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(l.value.customerInfo.phone),9,Fa)])):e.createCommentVNode("",!0)])])]),e.createElementVNode("div",Ta,[N[7]||(N[7]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Order Summary",-1)),e.createElementVNode("div",ja,[e.createElementVNode("div",za,[e.createElementVNode("div",Oa,[e.createVNode(e.unref(I.ShoppingBag),{size:14}),N[4]||(N[4]=e.createElementVNode("span",{class:"text-xs"},"Reservations",-1))]),e.createElementVNode("p",Pa,e.toDisplayString(l.value.reservations.length),1)]),e.createElementVNode("div",La,[e.createElementVNode("div",Ua,[e.createVNode(e.unref(I.Users),{size:14}),N[5]||(N[5]=e.createElementVNode("span",{class:"text-xs"},"Spots",-1))]),e.createElementVNode("p",Ha,e.toDisplayString(l.value.totalSpots),1)]),e.createElementVNode("div",Wa,[e.createElementVNode("div",Ka,[e.createVNode(e.unref(I.Clock),{size:14}),N[6]||(N[6]=e.createElementVNode("span",{class:"text-xs"},"Ordered at",-1))]),e.createElementVNode("p",Ga,e.toDisplayString(w(l.value.createdAt)),1)])])]),e.createElementVNode("div",Ya,[N[8]||(N[8]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Reservations",-1)),e.createElementVNode("div",Ja,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,D=>(e.openBlock(),e.createElementBlock("button",{key:D.res_id||D.id,type:"button",class:"w-full text-left bg-muted/30 rounded-lg p-4 transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:j=>ne(D)},[e.createElementVNode("div",Xa,[e.createElementVNode("div",Za,[e.createElementVNode("div",qa,[e.createElementVNode("span",{class:e.normalizeClass(["px-2 py-1 text-xs font-medium rounded-full",F(D).class])},e.toDisplayString(F(D).label),3),D.resourceName?(e.openBlock(),e.createElementBlock("span",es,[e.createElementVNode("span",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:D.resourceColor||"#6b7280"})},null,4),e.createTextVNode(" "+e.toDisplayString(D.resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ts,[e.createElementVNode("div",os,[e.createVNode(e.unref(I.Calendar),{size:14}),e.createElementVNode("span",null,e.toDisplayString(E(D.date)),1)]),e.createElementVNode("div",ns,[e.createVNode(e.unref(I.Clock),{size:14}),e.createElementVNode("span",null,e.toDisplayString(D.startTime||"-")+" - "+e.toDisplayString(D.endTime||"-"),1)]),e.createElementVNode("div",as,[e.createVNode(e.unref(I.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(D.spots||1)+" "+e.toDisplayString(D.spots===1?"person":"people"),1)]),D.pricingOption?(e.openBlock(),e.createElementBlock("div",ss,[e.createVNode(e.unref(I.Tag),{size:14}),e.createElementVNode("span",null,e.toDisplayString(D.pricingOption.name),1)])):e.createCommentVNode("",!0)]),e.createVNode(Ie,{metadata:D.reservationMetadata,schema:e.unref(g),"display-filter":["highlight","badge"],compact:""},null,8,["metadata","schema"]),D.refunds?.length?(e.openBlock(),e.createBlock(kt,{key:0,refunds:D.refunds,compact:""},null,8,["refunds"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",rs,[e.createElementVNode("div",null,[e.createElementVNode("p",ls,e.toDisplayString(P(D.reservationPrice)),1)]),e.createVNode(e.unref(I.ChevronRight),{size:16,class:"text-muted-foreground"})])])],8,Qa))),128))])]),e.createElementVNode("div",is,[N[15]||(N[15]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Payment",-1)),e.createElementVNode("div",cs,[e.createElementVNode("div",ds,[e.createElementVNode("div",us,[N[9]||(N[9]=e.createElementVNode("span",{class:"text-muted-foreground"},"Reservations",-1)),e.createElementVNode("span",null,e.toDisplayString(P(x.value)),1)]),a.value.subtotal!==void 0&&a.value.subtotal!==l.value.totalPrice?(e.openBlock(),e.createElementBlock("div",ms,[N[10]||(N[10]=e.createElementVNode("span",{class:"text-muted-foreground"},"Subtotal",-1)),e.createElementVNode("span",null,e.toDisplayString(P(a.value.subtotal)),1)])):e.createCommentVNode("",!0),l.value.adjustments&&l.value.adjustments.length?(e.openBlock(),e.createElementBlock("div",ps,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.adjustments,D=>(e.openBlock(),e.createElementBlock("div",{key:`${D.label}-${D.type}-${D.value}`,class:"flex justify-between"},[e.createElementVNode("span",fs,e.toDisplayString(D.label),1),e.createElementVNode("span",null,e.toDisplayString(W(D)),1)]))),128))])):e.createCommentVNode("",!0),a.value.discount?(e.openBlock(),e.createElementBlock("div",vs,[N[11]||(N[11]=e.createElementVNode("span",null,"Discount",-1)),e.createElementVNode("span",null,"-"+e.toDisplayString(P(a.value.discount)),1)])):e.createCommentVNode("",!0)]),e.createVNode(S),e.createElementVNode("div",gs,[N[12]||(N[12]=e.createElementVNode("span",null,"Order Total",-1)),e.createElementVNode("span",null,e.toDisplayString(P(l.value.totalPrice)),1)]),a.value.amountPaid!==void 0||a.value.amountDue!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(S),e.createElementVNode("div",hs,[a.value.amountPaid!==void 0?(e.openBlock(),e.createElementBlock("div",ys,[e.createElementVNode("span",bs,[e.createVNode(e.unref(I.CreditCard),{size:14}),N[13]||(N[13]=e.createTextVNode(" Amount paid ",-1))]),e.createElementVNode("span",xs,e.toDisplayString(P(a.value.amountPaid)),1)])):e.createCommentVNode("",!0),a.value.amountDue!==void 0&&a.value.amountDue>0?(e.openBlock(),e.createElementBlock("div",ks,[e.createElementVNode("span",Ns,[e.createVNode(e.unref(I.Receipt),{size:14}),N[14]||(N[14]=e.createTextVNode(" Amount due ",-1))]),e.createElementVNode("span",Cs,e.toDisplayString(P(a.value.amountDue)),1)])):e.createCommentVNode("",!0)])],64)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.createVNode(Be,{class:"gap-2 sm:justify-between"},{default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(Ce,{key:0},{default:e.withCtx(()=>[e.createVNode(ke,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(Y,{variant:"outline",class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(I.MoreHorizontal),{size:16}),N[16]||(N[16]=e.createTextVNode(" Actions ",-1))]),_:1})]),_:1}),e.createVNode(Se,{class:"w-60",align:"start"},{default:e.withCtx(()=>[e.createVNode(pe,{class:"text-xs text-muted-foreground font-normal"},{default:e.withCtx(()=>[...N[17]||(N[17]=[e.createTextVNode(" Reservation Actions ",-1)])]),_:1}),e.createVNode(Ne,null,{default:e.withCtx(()=>[e.createVNode(ie,{onClick:L,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(I.Download),{size:16,class:"text-muted-foreground"}),N[18]||(N[18]=e.createElementVNode("span",null,"Download PDF",-1))]),_:1})]),_:1}),e.createVNode(_e),e.createVNode(Ne,null,{default:e.withCtx(()=>[e.createVNode($e,null,{default:e.withCtx(()=>[e.createVNode(De,null,{default:e.withCtx(()=>[...N[19]||(N[19]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createVNode(Ee,null,{default:e.withCtx(()=>[e.createVNode(ye,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.reservations,D=>(e.openBlock(),e.createBlock(ie,{key:D.res_id||D.id,onClick:j=>ne(D)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(E(D.date))+" "+e.toDisplayString(D.startTime||"-"),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.createVNode(Y,{variant:"outline",onClick:N[0]||(N[0]=D=>u.value=!1)},{default:e.withCtx(()=>[...N[20]||(N[20]=[e.createTextVNode("Close",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}});exports.Fuse=he;exports._sfc_main=Ie;exports._sfc_main$1=wa;exports._sfc_main$2=Vs;exports.useAgendaMetadataSchema=nt;
|