@oneclick.dev/cms-core-modules 0.0.122 → 0.0.123
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-CoJjsV-m.js → ContentEditor-C-Wm48ai.js} +63 -59
- package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-MDGolnIP.mjs} +27596 -26138
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs} +530 -530
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
- package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
- package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
- package/dist/TableDataWidget-7qvC3Egd.js +1 -0
- package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
- package/dist/TableOverviewCard-AFq-puJs.js +1 -0
- package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
- package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
- package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
- package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
- package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
- package/dist/TableView-BkwoKREo.js +4 -0
- package/dist/TableView-C4Zyp8d7.mjs +8228 -0
- package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
- package/dist/agenda-r9Gl85GL.js +1 -0
- package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
- package/dist/dateRangePresets-CPWqst_x.js +1 -0
- package/dist/fuse-Deb-Iq39.mjs +1473 -0
- package/dist/fuse-_CGUd5Zq.js +1 -0
- package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
- package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +419 -109
- package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
- package/dist/orders-DUa2PVoa.js +1 -0
- package/dist/reports-ChCsd1Gk.mjs +1107 -0
- package/dist/reports-DmJPm8uP.js +158 -0
- package/dist/row-item-C1dUyimV.mjs +204 -0
- package/dist/row-item-Cyo3m3MZ.js +1 -0
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
- package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
- package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
- package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
- package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
- package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
- package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
- package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
- package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
- package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
- package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
- package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
- package/dist/src/table/index.d.ts +339 -0
- package/dist/src/table/tool-sandbox.d.ts +13 -0
- package/dist/src/table/tool-utils.d.ts +11 -0
- package/dist/src/table/tools.d.ts +333 -1
- package/dist/src/table/types.d.ts +79 -0
- package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
- package/dist/tool-sandbox-DoF1PsyS.js +115 -0
- package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
- package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
- package/package.json +17 -17
- package/src/table/tools.ts +304 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
- package/dist/TableView-Ctnep-Qu.mjs +0 -6247
- package/dist/TableView-DJqyJL9L.js +0 -4
- package/dist/agenda-B54F8cEr.js +0 -1
- package/dist/orders-BMosTk6r.js +0 -1
- package/dist/reports-BQT_GZzU.js +0 -158
- package/dist/reports-DksZCTOw.mjs +0 -837
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function y(s){return Array.isArray?Array.isArray(s):he(s)==="[object Array]"}function me(s){if(typeof s=="string")return s;if(typeof s=="bigint")return s.toString();const e=s+"";return e=="0"&&1/s==-1/0?"-0":e}function K(s){return s==null?"":me(s)}function C(s){return typeof s=="string"}function T(s){return typeof s=="number"}function Ce(s){return s===!0||s===!1||Ee(s)&&he(s)=="[object Boolean]"}function ue(s){return typeof s=="object"}function Ee(s){return ue(s)&&s!==null}function M(s){return s!=null}function $(s){return!s.trim().length}function he(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const Me="Incorrect 'index' type",_e=s=>`Invalid value for key ${s}`,Fe=s=>`Pattern length exceeds max of ${s}.`,De=s=>`Missing ${s} property in key`,Ie=s=>`Property 'weight' in key '${s}' must be a positive integer`,se=Object.prototype.hasOwnProperty;class Be{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(n=>{const i=ae(n);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight}),this._keys.forEach(n=>{n.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function ae(s){let e=null,t=null,n=null,i=1,r=null;if(C(s)||y(s))n=s,e=ne(s),t=H(s);else{if(!se.call(s,"name"))throw new Error(De("name"));const c=s.name;if(n=c,se.call(s,"weight")&&(i=s.weight,i<=0))throw new Error(Ie(c));e=ne(c),t=H(c),r=s.getFn}return{path:e,id:t,weight:i,src:n,getFn:r}}function ne(s){return y(s)?s:s.split(".")}function H(s){return y(s)?s.join("."):s}function Se(s,e){const t=[];let n=!1;const i=(r,c,h,o)=>{if(M(r))if(!c[h])t.push(o!==void 0?{v:r,i:o}:r);else{const l=c[h],u=r[l];if(!M(u))return;if(h===c.length-1&&(C(u)||T(u)||Ce(u)||typeof u=="bigint"))t.push(o!==void 0?{v:K(u),i:o}:K(u));else if(y(u)){n=!0;for(let f=0,d=u.length;f<d;f+=1)i(u[f],c,h+1,f)}else c.length&&i(u,c,h+1,o)}};return i(s,C(e)?e.split("."):e,0),n?t:t[0]}const ye={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},xe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(s,e)=>s.score===e.score?s.idx<e.idx?-1:1:s.score<e.score?-1:1},ve={location:0,threshold:.6,distance:100},ke={useExtendedSearch:!1,useTokenSearch:!1,getFn:Se,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},g=Object.freeze({...xe,...ye,...ve,...ke}),we=/[^ ]+/g;function be(s=1,e=3){const t=new Map,n=Math.pow(10,e);return{get(i){const r=i.match(we).length;if(t.has(r))return t.get(r);const c=1/Math.pow(r,.5*s),h=parseFloat(Math.round(c*n)/n);return t.set(r,h),h},clear(){t.clear()}}}class X{constructor({getFn:e=g.getFn,fieldNormWeight:t=g.fieldNormWeight}={}){this.norm=be(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,n)=>{this._keysMap[t.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,C(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();C(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}removeAll(e){for(let t=e.length-1;t>=0;t-=1)this.records.splice(e[t],1);for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i=t}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!M(e)||$(e))return;const n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){const n={i:t,$:{}};this.keys.forEach((i,r)=>{const c=i.getFn?i.getFn(e):this.getFn(e,i.path);if(M(c)){if(y(c)){const h=[];for(let o=0,l=c.length;o<l;o+=1){const u=c[o];if(M(u)){if(C(u)){if(!$(u)){const f={v:u,i:o,n:this.norm.get(u)};h.push(f)}}else if(M(u.v)){const f=C(u.v)?u.v:K(u.v);if(!$(f)){const d={v:f,i:u.i,n:this.norm.get(f)};h.push(d)}}}}n.$[r]=h}else if(C(c)&&!$(c)){const h={v:c,n:this.norm.get(c)};n.$[r]=h}}}),this.records.push(n)}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}}function le(s,e,{getFn:t=g.getFn,fieldNormWeight:n=g.fieldNormWeight}={}){const i=new X({getFn:t,fieldNormWeight:n});return i.setKeys(s.map(ae)),i.setSources(e),i.create(),i}function Le(s,{getFn:e=g.getFn,fieldNormWeight:t=g.fieldNormWeight}={}){const{keys:n,records:i}=s,r=new X({getFn:e,fieldNormWeight:t});return r.setKeys(n),r.setIndexRecords(i),r}function Oe(s=[],e=g.minMatchCharLength){const t=[];let n=-1,i=-1,r=0;for(let c=s.length;r<c;r+=1){const h=s[r];h&&n===-1?n=r:!h&&n!==-1&&(i=r-1,i-n+1>=e&&t.push([n,i]),n=-1)}return s[r-1]&&r-n>=e&&t.push([n,r-1]),t}const w=32;function Re(s,e,t,{location:n=g.location,distance:i=g.distance,threshold:r=g.threshold,findAllMatches:c=g.findAllMatches,minMatchCharLength:h=g.minMatchCharLength,includeMatches:o=g.includeMatches,ignoreLocation:l=g.ignoreLocation}={}){if(e.length>w)throw new Error(Fe(w));const u=e.length,f=s.length,d=Math.max(0,Math.min(n,f));let a=r,p=d;const A=(E,I)=>{const _=E/u;if(l)return _;const L=Math.abs(d-I);return i?_+L/i:L?1:_},m=h>1||o,D=m?Array(f):[];let B;for(;(B=s.indexOf(e,p))>-1;){const E=A(0,B);if(a=Math.min(E,a),p=B+u,m){let I=0;for(;I<u;)D[B+I]=1,I+=1}}p=-1;let S=[],k=1,R=u+f;const pe=1<<u-1;for(let E=0;E<u;E+=1){let I=0,_=R;for(;I<_;)A(E,d+_)<=a?I=_:R=_,_=Math.floor((R-I)/2+I);R=_;let L=Math.max(1,d-_+1);const W=c?f:Math.min(d+_,f)+u,b=Array(W+2);b[W+1]=(1<<E)-1;for(let F=W;F>=L;F-=1){const N=F-1,te=t[s[N]];if(m&&(D[N]=+!!te),b[F]=(b[F+1]<<1|1)&te,E&&(b[F]|=(S[F+1]|S[F])<<1|1|S[F+1]),b[F]&pe&&(k=A(E,N),k<=a)){if(a=k,p=N,p<=d)break;L=Math.max(1,2*d-p)}}if(A(E+1,d)>a)break;S=b}const j={isMatch:p>=0,score:Math.max(.001,k)};if(m){const E=Oe(D,h);E.length?o&&(j.indices=E):j.isMatch=!1}return j}function Ne(s){const e={};for(let t=0,n=s.length;t<n;t+=1){const i=s.charAt(t);e[i]=(e[i]||0)|1<<n-t-1}return e}function Z(s){if(s.length<=1)return s;s.sort((t,n)=>t[0]-n[0]||t[1]-n[1]);const e=[s[0]];for(let t=1,n=s.length;t<n;t+=1){const i=e[e.length-1],r=s[t];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):e.push(r)}return e}const fe={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},$e=new RegExp("["+Object.keys(fe).join("")+"]","g"),O=String.prototype.normalize?s=>s.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($e,e=>fe[e]):s=>s;class q{constructor(e,{location:t=g.location,threshold:n=g.threshold,distance:i=g.distance,includeMatches:r=g.includeMatches,findAllMatches:c=g.findAllMatches,minMatchCharLength:h=g.minMatchCharLength,isCaseSensitive:o=g.isCaseSensitive,ignoreDiacritics:l=g.ignoreDiacritics,ignoreLocation:u=g.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:i,includeMatches:r,findAllMatches:c,minMatchCharLength:h,isCaseSensitive:o,ignoreDiacritics:l,ignoreLocation:u},e=o?e:e.toLowerCase(),e=l?O(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const f=(a,p)=>{this.chunks.push({pattern:a,alphabet:Ne(a),startIndex:p})},d=this.pattern.length;if(d>w){let a=0;const p=d%w,A=d-p;for(;a<A;)f(this.pattern.substr(a,w),a),a+=w;if(p){const m=d-w;f(this.pattern.substr(m),m)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:i}=this.options;if(e=t?e:e.toLowerCase(),e=n?O(e):e,this.pattern===e){const A={isMatch:!0,score:0};return i&&(A.indices=[[0,e.length-1]]),A}const{location:r,distance:c,threshold:h,findAllMatches:o,minMatchCharLength:l,ignoreLocation:u}=this.options,f=[];let d=0,a=!1;this.chunks.forEach(({pattern:A,alphabet:m,startIndex:D})=>{const{isMatch:B,score:S,indices:k}=Re(e,A,m,{location:r+D,distance:c,threshold:h,findAllMatches:o,minMatchCharLength:l,includeMatches:i,ignoreLocation:u});B&&(a=!0),d+=S,B&&k&&f.push(...k)});const p={isMatch:a,score:a?d/this.chunks.length:1};return a&&i&&(p.indices=Z(f)),p}}class x{constructor(e){this.pattern=e}static isMultiMatch(e){return ie(e,this.multiRegex)}static isSingleMatch(e){return ie(e,this.singleRegex)}search(e){return{isMatch:!1,score:1}}}function ie(s,e){const t=s.match(e);return t?t[1]:null}class Te extends x{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class ze extends x{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Pe extends x{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class je extends x{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class We extends x{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Ke extends x{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class de extends x{constructor(e,{location:t=g.location,threshold:n=g.threshold,distance:i=g.distance,includeMatches:r=g.includeMatches,findAllMatches:c=g.findAllMatches,minMatchCharLength:h=g.minMatchCharLength,isCaseSensitive:o=g.isCaseSensitive,ignoreDiacritics:l=g.ignoreDiacritics,ignoreLocation:u=g.ignoreLocation}={}){super(e),this._bitapSearch=new q(e,{location:t,threshold:n,distance:i,includeMatches:r,findAllMatches:c,minMatchCharLength:h,isCaseSensitive:o,ignoreDiacritics:l,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class ge extends x{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,n;const i=[],r=this.pattern.length;for(;(n=e.indexOf(this.pattern,t))>-1;)t=n+r,i.push([n,t-1]);const c=!!i.length;return{isMatch:c,score:c?0:1,indices:i}}}const Q=[Te,ge,Pe,je,Ke,We,ze,de],re=Q.length,He="\0",Qe="|";function Ge(s){const e=[],t=s.length;let n=0;for(;n<t;){for(;n<t&&s[n]===" ";)n++;if(n>=t)break;let i=n;for(;i<t&&s[i]!==" "&&s[i]!=='"';)i++;if(i<t&&s[i]==='"'){for(i++;i<t;){if(s[i]==='"'){const r=i+1;if(r>=t||s[r]===" "){i++;break}if(s[r]==="$"&&(r+1>=t||s[r+1]===" ")){i+=2;break}}i++}e.push(s.substring(n,i)),n=i}else{for(;i<t&&s[i]!==" ";)i++;e.push(s.substring(n,i)),n=i}}return e}function Ye(s,e={}){return s.replace(/\\\|/g,He).split(Qe).map(n=>{const i=n.replace(/\u0000/g,"|"),r=Ge(i.trim()).filter(h=>h&&!!h.trim()),c=[];for(let h=0,o=r.length;h<o;h+=1){const l=r[h];let u=!1,f=-1;for(;!u&&++f<re;){const d=Q[f],a=d.isMultiMatch(l);a&&(c.push(new d(a,e)),u=!0)}if(!u)for(f=-1;++f<re;){const d=Q[f],a=d.isSingleMatch(l);if(a){c.push(new d(a,e));break}}}return c})}const Ue=new Set([de.type,ge.type]);class Ve{constructor(e,{isCaseSensitive:t=g.isCaseSensitive,ignoreDiacritics:n=g.ignoreDiacritics,includeMatches:i=g.includeMatches,minMatchCharLength:r=g.minMatchCharLength,ignoreLocation:c=g.ignoreLocation,findAllMatches:h=g.findAllMatches,location:o=g.location,threshold:l=g.threshold,distance:u=g.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:r,findAllMatches:h,ignoreLocation:c,location:o,threshold:l,distance:u},e=t?e:e.toLowerCase(),e=n?O(e):e,this.pattern=e,this.query=Ye(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:r}=this.options;e=i?e:e.toLowerCase(),e=r?O(e):e;let c=0;const h=[];let o=0,l=!1;for(let u=0,f=t.length;u<f;u+=1){const d=t[u];h.length=0,c=0,l=!1;for(let a=0,p=d.length;a<p;a+=1){const A=d[a],{isMatch:m,indices:D,score:B}=A.search(e);if(m){c+=1,o+=B;const S=A.constructor.type;S.startsWith("inverse")&&(l=!0),n&&(Ue.has(S)?h.push(...D):h.push(D))}else{o=0,c=0,h.length=0,l=!1;break}}if(c){const a={isMatch:!0,score:o/c};return l&&(a.hasInverse=!0),n&&(a.indices=Z(h)),a}}return{isMatch:!1,score:1}}}const G=[];function ee(...s){G.push(...s)}function z(s,e){for(let t=0,n=G.length;t<n;t+=1){const i=G[t];if(i.condition(s,e))return new i(s,e)}return new q(s,e)}const P={AND:"$and",OR:"$or"},Y={PATH:"$path",PATTERN:"$val"},U=s=>!!(s[P.AND]||s[P.OR]),Je=s=>!!s[Y.PATH],Xe=s=>!y(s)&&ue(s)&&!U(s),ce=s=>({[P.AND]:Object.keys(s).map(e=>({[e]:s[e]}))});function Ae(s,e,{auto:t=!0}={}){const n=i=>{if(C(i)){const o={keyId:null,pattern:i};return t&&(o.searcher=z(i,e)),o}const r=Object.keys(i),c=Je(i);if(!c&&r.length>1&&!U(i))return n(ce(i));if(Xe(i)){const o=c?i[Y.PATH]:r[0],l=c?i[Y.PATTERN]:i[o];if(!C(l))throw new Error(_e(o));const u={keyId:H(o),pattern:l};return t&&(u.searcher=z(l,e)),u}const h={children:[],operator:r[0]};return r.forEach(o=>{const l=i[o];y(l)&&l.forEach(u=>{h.children.push(n(u))})}),h};return U(s)||(s=ce(s)),n(s)}function V(s,{ignoreFieldNorm:e=g.ignoreFieldNorm}){let t=1;return s.forEach(({key:n,norm:i,score:r})=>{const c=n?n.weight:null;t*=Math.pow(r===0&&c?Number.EPSILON:r,(c||1)*(e?1:i))}),t}function Ze(s,{ignoreFieldNorm:e=g.ignoreFieldNorm}){s.forEach(t=>{t.score=V(t.matches,{ignoreFieldNorm:e})})}class qe{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){const t=this.heap;for(;e>0;){const n=e-1>>1;if(t[e].score<=t[n].score)break;const i=t[e];t[e]=t[n],t[n]=i,e=n}}_sinkDown(e){const t=this.heap,n=t.length;let i=e;do{e=i;const r=2*e+1,c=2*e+2;if(r<n&&t[r].score>t[i].score&&(i=r),c<n&&t[c].score>t[i].score&&(i=c),i!==e){const h=t[e];t[e]=t[i],t[i]=h}}while(i!==e)}}function et(s,e){const t=s.matches;e.matches=[],M(t)&&t.forEach(n=>{if(!M(n.indices)||!n.indices.length)return;const{indices:i,value:r}=n,c={indices:i,value:r};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function tt(s,e){e.score=s.score}function st(s,e,{includeMatches:t=g.includeMatches,includeScore:n=g.includeScore}={}){const i=[];return t&&i.push(et),n&&i.push(tt),s.map(r=>{const{idx:c}=r,h={item:e[c],refIndex:c};return i.length&&i.forEach(o=>{o(r,h)}),h})}const nt=/\b\w+\b/g;function J({isCaseSensitive:s=!1,ignoreDiacritics:e=!1}={}){return{tokenize(t){return s||(t=t.toLowerCase()),e&&(t=O(t)),t.match(nt)||[]}}}function it(s,e,t){const n=new Map,i=new Map;let r=0;function c(h,o,l,u){const f=t.tokenize(h);if(!f.length)return;r++;const d=new Map;for(const a of f)d.set(a,(d.get(a)||0)+1);for(const[a,p]of d){const A={docIdx:o,keyIdx:l,subIdx:u,tf:p};let m=n.get(a);m||(m=[],n.set(a,m)),m.push(A),i.set(a,(i.get(a)||0)+1)}}for(const h of s){const{i:o,v:l,$:u}=h;if(l!==void 0){c(l,o,-1,-1);continue}if(u)for(let f=0;f<e;f++){const d=u[f];if(d)if(Array.isArray(d))for(const a of d)c(a.v,o,f,a.i??-1);else c(d.v,o,f,-1)}}return{terms:n,fieldCount:r,df:i}}function rt(s,e,t,n){const{i,v:r,$:c}=e;function h(o,l,u){const f=n.tokenize(o);if(!f.length)return;s.fieldCount++;const d=new Map;for(const a of f)d.set(a,(d.get(a)||0)+1);for(const[a,p]of d){const A={docIdx:i,keyIdx:l,subIdx:u,tf:p};let m=s.terms.get(a);m||(m=[],s.terms.set(a,m)),m.push(A),s.df.set(a,(s.df.get(a)||0)+1)}}if(r!==void 0){h(r,-1,-1);return}if(c)for(let o=0;o<t;o++){const l=c[o];if(l)if(Array.isArray(l))for(const u of l)h(u.v,o,u.i??-1);else h(l.v,o,-1)}}function oe(s,e){for(const[t,n]of s.terms){const i=n.filter(c=>c.docIdx!==e),r=n.length-i.length;r>0&&(s.fieldCount-=r,s.df.set(t,(s.df.get(t)||0)-r),i.length===0?(s.terms.delete(t),s.df.delete(t)):s.terms.set(t,i))}}class v{constructor(e,t,n){this.options={...g,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Be(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;const t=this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options,n=z(e,t);return this._lastQuery=e,this._lastSearcher=n,n}setCollection(e,t){if(this._docs=e,t&&!(t instanceof X))throw new Error(Me);if(this._myIndex=t||le(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const n=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});this._invertedIndex=it(this._myIndex.records,this._myIndex.keys.length,n)}}add(e){if(M(e)&&(this._docs.push(e),this._myIndex.add(e),this._invertedIndex)){const t=this._myIndex.records[this._myIndex.records.length-1],n=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});rt(this._invertedIndex,t,this._myIndex.keys.length,n)}}remove(e=()=>!1){const t=[],n=[];for(let i=0,r=this._docs.length;i<r;i+=1)e(this._docs[i],i)&&(t.push(this._docs[i]),n.push(i));if(n.length){if(this._invertedIndex)for(const i of n)oe(this._invertedIndex,i);for(let i=n.length-1;i>=0;i-=1)this._docs.splice(n[i],1);this._myIndex.removeAll(n)}return t}removeAt(e){this._invertedIndex&&oe(this._invertedIndex,e);const t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),t}getIndex(){return this._myIndex}search(e,t){const{limit:n=-1}=t||{},{includeMatches:i,includeScore:r,shouldSort:c,sortFn:h,ignoreFieldNorm:o}=this.options;if(C(e)&&!e.trim()){let f=this._docs.map((d,a)=>({item:d,refIndex:a}));return T(n)&&n>-1&&(f=f.slice(0,n)),f}const l=T(n)&&n>0&&C(e);let u;if(l){const f=new qe(n);C(this._docs[0])?this._searchStringList(e,{heap:f,ignoreFieldNorm:o}):this._searchObjectList(e,{heap:f,ignoreFieldNorm:o}),u=f.extractSorted(h)}else u=C(e)?C(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),Ze(u,{ignoreFieldNorm:o}),c&&u.sort(h),T(n)&&n>-1&&(u=u.slice(0,n));return st(u,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){const i=this._getSearcher(e),{records:r}=this._myIndex,c=t?null:[];return r.forEach(({v:h,i:o,n:l})=>{if(!M(h))return;const{isMatch:u,score:f,indices:d}=i.searchIn(h);if(u){const a={item:h,idx:o,matches:[{score:f,value:h,norm:l,indices:d}]};t?(a.score=V(a.matches,{ignoreFieldNorm:n}),t.shouldInsert(a.score)&&t.insert(a)):c.push(a)}}),c}_searchLogical(e){const t=Ae(e,this.options),n=(h,o,l)=>{if(!("children"in h)){const{keyId:a,searcher:p}=h;let A;return a===null?(A=[],this._myIndex.keys.forEach((m,D)=>{A.push(...this._findMatches({key:m,value:o[D],searcher:p}))})):A=this._findMatches({key:this._keyStore.get(a),value:this._myIndex.getValueForItemAtKeyId(o,a),searcher:p}),A&&A.length?[{idx:l,item:o,matches:A}]:[]}const{children:u,operator:f}=h,d=[];for(let a=0,p=u.length;a<p;a+=1){const A=u[a],m=n(A,o,l);if(m.length)d.push(...m);else if(f===P.AND)return[]}return d},i=this._myIndex.records,r=new Map,c=[];return i.forEach(({$:h,i:o})=>{if(M(h)){const l=n(t,h,o);l.length&&(r.has(o)||(r.set(o,{idx:o,item:h,matches:[]}),c.push(r.get(o))),l.forEach(({matches:u})=>{r.get(o).matches.push(...u)}))}}),c}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){const i=this._getSearcher(e),{keys:r,records:c}=this._myIndex,h=t?null:[];return c.forEach(({$:o,i:l})=>{if(!M(o))return;const u=[];let f=!1,d=!1;if(r.forEach((a,p)=>{const A=this._findMatches({key:a,value:o[p],searcher:i});A.length?(u.push(...A),A[0].hasInverse&&(d=!0)):f=!0}),!(d&&f)&&u.length){const a={idx:l,item:o,matches:u};t?(a.score=V(a.matches,{ignoreFieldNorm:n}),t.shouldInsert(a.score)&&t.insert(a)):h.push(a)}}),h}_findMatches({key:e,value:t,searcher:n}){if(!M(t))return[];const i=[];if(y(t))t.forEach(({v:r,i:c,n:h})=>{if(!M(r))return;const{isMatch:o,score:l,indices:u,hasInverse:f}=n.searchIn(r);o&&i.push({score:l,key:e,value:r,idx:c,norm:h,indices:u,hasInverse:f})});else{const{v:r,n:c}=t,{isMatch:h,score:o,indices:l,hasInverse:u}=n.searchIn(r);h&&i.push({score:o,key:e,value:r,norm:c,indices:l,hasInverse:u})}return i}}class ct{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=J({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics});const n=this.analyzer.tokenize(e),i=t._invertedIndex,{df:r,fieldCount:c}=i;this.termSearchers=[],this.idfWeights=[];for(const h of n){this.termSearchers.push(new q(h,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));const o=r.get(h)||0,l=Math.log(1+(c-o+.5)/(o+.5));this.idfWeights.push(l)}}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};const t=[];let n=0,i=0,r=0;for(let o=0;o<this.termSearchers.length;o++){const l=this.termSearchers[o].searchIn(e),u=this.idfWeights[o];i+=u,l.isMatch&&(r++,n+=u*(1-l.score),l.indices&&t.push(...l.indices))}if(r===0)return{isMatch:!1,score:1};const c=i>0?1-n/i:0,h={isMatch:!0,score:Math.max(.001,c)};return this.options.includeMatches&&t.length&&(h.indices=Z(t)),h}}v.version="7.3.0";v.createIndex=le;v.parseIndex=Le;v.config=g;v.match=function(s,e,t){return z(s,{...g,...t}).searchIn(e)};v.parseQuery=Ae;ee(Ve);ee(ct);v.use=function(...s){s.forEach(e=>ee(e))};exports.Fuse=v;
|
|
@@ -7,8 +7,9 @@ import { Layers as $e, ChevronDown as vt, ChevronLeft as gt, ChevronRight as ht,
|
|
|
7
7
|
import { u as Dt } from "./index-hMp4p5qA.mjs";
|
|
8
8
|
import { X as St, b as He, a as Ct, c as wt, r as $t, D as be, $ as Be, O as ke, z as Ne, A as We } from "./index-cC_2cw31.mjs";
|
|
9
9
|
import { _ as Mt } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import { _ as
|
|
10
|
+
import { F as Rt } from "./fuse-Deb-Iq39.mjs";
|
|
11
|
+
import { u as Vt, _ as It, a as Tt, b as At } from "./OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs";
|
|
12
|
+
import { _ as Et } from "./NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs";
|
|
12
13
|
function zt({ x: g, y: x, w: a, h: y, tl: h = !1, tr: b = !1, bl: _ = !1, br: i = !1, r: l = 0 }) {
|
|
13
14
|
let c;
|
|
14
15
|
c = `M${g + l},${x}h${a - 2 * l}`;
|
|
@@ -842,7 +843,7 @@ const Bt = { "data-vis-component": "" }, Fe = /* @__PURE__ */ ge({
|
|
|
842
843
|
},
|
|
843
844
|
emits: ["resetSelectedResource"],
|
|
844
845
|
setup(g, { emit: x }) {
|
|
845
|
-
const a = g, y = x, { params: h } = Re(), { config: b } = Ve(), _ = Ie(b.project), i = P([]), l = P(!0), c = P(""), n = P(null), f = P(null), D = O(() => h.value?.id ?? h.id ?? a.agendaData?.id ?? ""), { metadataSchema: F } =
|
|
846
|
+
const a = g, y = x, { params: h } = Re(), { config: b } = Ve(), _ = Ie(b.project), i = P([]), l = P(!0), c = P(""), n = P(null), f = P(null), D = O(() => h.value?.id ?? h.id ?? a.agendaData?.id ?? ""), { metadataSchema: F } = Vt(D), T = O(() => ({
|
|
846
847
|
date: z(a.activeDate),
|
|
847
848
|
resource: null
|
|
848
849
|
}));
|
|
@@ -852,7 +853,7 @@ const Bt = { "data-vis-component": "" }, Fe = /* @__PURE__ */ ge({
|
|
|
852
853
|
return `${t}-${C}-${U}`;
|
|
853
854
|
}, J = O(() => {
|
|
854
855
|
let r = i.value;
|
|
855
|
-
return a.selectedResource && (r = r.filter((t) => t.resourceId === a.selectedResource)), c.value.trim() && (r = new
|
|
856
|
+
return a.selectedResource && (r = r.filter((t) => t.resourceId === a.selectedResource)), c.value.trim() && (r = new Rt(r, {
|
|
856
857
|
keys: [
|
|
857
858
|
"customerInfo.firstName",
|
|
858
859
|
"customerInfo.lastName",
|
|
@@ -1195,7 +1196,7 @@ const Bt = { "data-vis-component": "" }, Fe = /* @__PURE__ */ ge({
|
|
|
1195
1196
|
});
|
|
1196
1197
|
};
|
|
1197
1198
|
}
|
|
1198
|
-
}), za = { class: "@5xl:space-y-6" }, Oa = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Pa = { class: "text-2xl font-semibold tracking-tight" }, ja = { class: "flex flex-col md:flex-row gap-2" }, Ba = { class: "grid gap-6 md:grid-cols-2 lg:grid-cols-3" }, Na = { class: "md:col-span-2 lg:col-span-3" },
|
|
1199
|
+
}), za = { class: "@5xl:space-y-6" }, Oa = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Pa = { class: "text-2xl font-semibold tracking-tight" }, ja = { class: "flex flex-col md:flex-row gap-2" }, Ba = { class: "grid gap-6 md:grid-cols-2 lg:grid-cols-3" }, Na = { class: "md:col-span-2 lg:col-span-3" }, Za = /* @__PURE__ */ ge({
|
|
1199
1200
|
__name: "index",
|
|
1200
1201
|
setup(g) {
|
|
1201
1202
|
const { hasPermission: x } = at(), { params: a, resolvePath: y } = Re(), { config: h } = Ve(), b = Ie(h.project), _ = P(""), i = P(!0), l = P(/* @__PURE__ */ new Date()), c = P(null), n = P("stacked"), f = P(null), D = P([]);
|
|
@@ -1252,5 +1253,5 @@ const Bt = { "data-vis-component": "" }, Fe = /* @__PURE__ */ ge({
|
|
|
1252
1253
|
}
|
|
1253
1254
|
});
|
|
1254
1255
|
export {
|
|
1255
|
-
|
|
1256
|
+
Za as default
|
|
1256
1257
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("@oneclick.dev/cms-kit"),fe=require("./EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js"),C=require("./index-DtSvAFLL.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("@oneclick.dev/cms-kit"),fe=require("./EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js"),C=require("./index-DtSvAFLL.js"),oe=require("@oneclick.dev/cms-kit/charts"),E=require("lucide-vue-next"),pe=require("./index-CxETuRsG.js"),M=require("./index-D_nfGegA.js"),ve=require("./_plugin-vue_export-helper-BHFhmbuH.js"),ge=require("./fuse-_CGUd5Zq.js"),ne=require("./OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js"),he=require("./NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js");function xe({x:f,y:v,w:o,h:g,tl:p=!1,tr:h=!1,bl:x=!1,br:i=!1,r:l=0}){let c;c=`M${f+l},${v}h${o-2*l}`;let r=h?l:0,u=h?0:l;return c+=`a${r},${r} 0 0 1 ${r},${r}`,c+=`h${u}v${u}`,c+=`v${g-2*l}`,r=i?l:0,u=i?0:l,c+=`a${r},${r} 0 0 1 ${-r},${r}`,c+=`v${u}h${-u}`,c+=`h${2*l-o}`,r=x?l:0,u=x?0:l,c+=`a${r},${r} 0 0 1 ${-r},${-r}`,c+=`h${-u}v${-u}`,c+=`v${2*l-g}`,r=p?l:0,u=p?0:l,c+=`a${r},${r} 0 0 1 ${r},${-r}`,c+=`v${-u}h${u}`,c+="z",c}const ye=Object.assign(Object.assign({},M.XYComponentDefaultConfig),{color:void 0,groupMaxWidth:void 0,groupWidth:void 0,dataStep:void 0,groupPadding:.05,barPadding:0,roundedCorners:2,barMinHeight:2,cursor:null,orientation:M.Orientation.Vertical}),de=C.css`
|
|
2
2
|
label: grouped-bar-component;
|
|
3
|
-
`,
|
|
3
|
+
`,ke=C.injectGlobal`
|
|
4
4
|
:root {
|
|
5
5
|
--vis-grouped-bar-cursor: default;
|
|
6
6
|
--vis-grouped-bar-fill-color: var(--vis-color-main);
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
label: barGroup;
|
|
33
33
|
`,ue=C.css`
|
|
34
34
|
label: barGroupExit;
|
|
35
|
-
`,ke=Object.freeze(Object.defineProperty({__proto__:null,bar:ae,barGroup:se,barGroupExit:ue,globalStyles:ye,root:de},Symbol.toStringTag,{value:"Module"}));class me extends M.XYComponentCore{constructor(v){super(),this._defaultConfig=xe,this.config=this._defaultConfig,this.getAccessors=()=>C.isArray(this.config.y)?this.config.y:[this.config.y],this.events={},this._barData=[],v&&this.setConfig(v)}get bleed(){if(this._barData=this._getVisibleData(),this._barData.length===0)return{top:0,bottom:0,left:0,right:0};const v=!this.isVertical()&&this.dataScale.range()[0]>this.dataScale.range()[1],o=this.dataScale.domain(),g=this._getGroupWidth()/2,p=this._barData.map((z,w)=>C.getNumber(z,this.config.x,w)),h=C.min(p),x=C.max(p),i=this.dataScale(h),l=this.dataScale(x),c=this.dataScale.invert(i+(v?g:-g)),r=this.dataScale.invert(l+(v?-g:g)),u=c<=o[0]?this.dataScale(o[0])-this.dataScale(c):0,y=r>o[1]?this.dataScale(r)-this.dataScale(o[1]):0;return{top:this.isVertical()?0:v?-y:u,bottom:this.isVertical()?0:v?-u:y,left:this.isVertical()?u:0,right:this.isVertical()?y:0}}get dataScale(){return this.isVertical()?this.xScale:this.yScale}get valueScale(){return this.isVertical()?this.yScale:this.xScale}isVertical(){return this.config.orientation===M.Orientation.Vertical}_render(v){const{config:o}=this,g=C.isNumber(v)?v:o.duration,p=this._getGroupWidth(),h=this.getAccessors(),x=[-p/2,p/2],i=M.band().domain(M.range(h.length)).range(x).paddingInner(o.barPadding).paddingOuter(o.barPadding),l=this.g.selectAll(`.${se}`).data(this._barData,(B,D)=>{var R;return`${(R=C.getString(B,o.id,D))!==null&&R!==void 0?R:D}`}),c=(B,D)=>{const R=this.dataScale(C.getNumber(B,o.x,D)),N=this.isVertical()?R:0,T=this.isVertical()?0:R;return`translate(${N},${T})`},u=l.enter().append("g").attr("class",se).attr("transform",c).style("opacity",1).merge(l);C.smartTransition(u,g).attr("transform",c).style("opacity",1);const y=l.exit().attr("class",ue);C.smartTransition(y,g).style("opacity",0).remove(),C.smartTransition(y.selectAll(`.${ae}`),g).attr("transform",(B,D,R)=>this.isVertical()?`translate(0,${this.yScale(0)}) scale(1,0)`:`translate(${this.xScale(0)},0) scale(0,1)`);const z=i.bandwidth(),w=u.selectAll(`.${ae}`).data(B=>h.map(()=>B)),_=this._getValueAxisDirection(),q=w.enter().append("path").attr("class",ae).attr("d",(B,D)=>{const R=i(D),N=this.valueScale(0),T=z;return this._getBarPath(R,N,T,0,!1,_)}).style("fill",(B,D)=>C.getColor(B,o.color,D)).merge(w);C.smartTransition(q,g).attr("d",(B,D)=>{const R=i(D),N=z,T=C.getNumber(B,h[D]),m=T<0;let I=m?this.valueScale(0):this.valueScale(T||0),X=Math.abs(this.valueScale(0)-this.valueScale(T))||0;if(X<o.barMinHeight){const K=_===M.Direction.North?-1:1;I=this.valueScale(0)+K*o.barMinHeight,X=o.barMinHeight}return this._getBarPath(R,I,N,X,m,_)}).style("fill",(B,D)=>C.getColor(B,o.color,D)).style("cursor",(B,D)=>C.getString(B,o.cursor,D)),C.smartTransition(w.exit(),g).remove()}_getValueAxisDirection(){return this.valueScale.range()[0]>this.valueScale.range()[1]?M.Direction.North:M.Direction.South}_getVisibleData(){const{config:v,datamodel:{data:o}}=this,g=this._getGroupWidth(),p=o.length<2?0:g/2,h=this.dataScale,x=Math.abs(h.invert(p)-h.invert(0));return o?.filter((l,c)=>{const r=C.getNumber(l,v.x,c),u=h.domain(),y=+u[0],z=+u[1];return r>=y-x&&r<=z+x})}_getBarPath(v,o,g,p,h,x){const{config:i}=this,l=i.roundedCorners?C.isNumber(i.roundedCorners)?+i.roundedCorners:g/2:0,c=C.clamp(l,0,Math.min(p,g)/2),r=x===M.Direction.North,u=this.isVertical()&&h!==r,y=this.isVertical()&&h===r,z=!this.isVertical()&&h,w=!this.isVertical()&&!h;return he({x:this.isVertical()?v:o+(r?0:-p),y:this.isVertical()?o+(r?0:-p):v,w:this.isVertical()?g:p,h:this.isVertical()?p:g,tl:u||z,tr:u||w,bl:y||z,br:y||w,r:c})}_getGroupWidth(){const{config:v,datamodel:{data:o}}=this;if(C.isEmpty(o))return 0;if(v.groupWidth)return C.min([v.groupWidth,v.groupMaxWidth]);const g=this.dataScale.bandwidth,p=this.dataScale.domain?this.dataScale.domain():[];let x=1+(g?p.length:p[1]-p[0])/v.dataStep||!g&&o.filter((c,r)=>{const u=C.getNumber(c,v.x,r);return u>=p[0]&&u<=p[1]}).length||o.length;!g&&x>=2&&(x+=1);const l=(x<2?1:1-v.groupPadding)*(this.isVertical()?this._width:this._height)/x;return C.min([l,v.groupMaxWidth])}getValueScaleExtent(v){const{datamodel:o}=this,g=this.getAccessors(),p=v?this._getVisibleData():o.data,h=C.getMin(p,...g),x=C.getMax(p,...g);return[h>0?0:h,x<0?0:x]}getDataScaleExtent(){const{config:v,datamodel:o}=this;return C.getExtent(o.data,v.x)}getYDataExtent(v){return this.isVertical()?this.getValueScaleExtent(v):this.getDataScaleExtent()}getXDataExtent(){return this.isVertical()?this.getDataScaleExtent():this.getValueScaleExtent(!1)}}me.selectors=ke;const Ce={"data-vis-component":""},ie=e.defineComponent({__name:"index",props:{color:{},groupWidth:{},groupMaxWidth:{},dataStep:{},groupPadding:{},barPadding:{},roundedCorners:{type:[Number,Boolean]},barMinHeight:{},cursor:{},orientation:{},x:{},y:{},id:{type:Function},xScale:{type:[Object,Function]},yScale:{type:[Object,Function]},excludeFromDomainCalculation:{type:Boolean},duration:{},events:{},attributes:{},data:{}},setup(f,{expose:v}){const o=e.inject(C.o),g=f,p=e.computed(()=>o.data.value??g.data),h=C.m(g),x=e.ref();return e.onMounted(()=>{e.nextTick(()=>{var i;x.value=new me(h.value),(i=x.value)==null||i.setData(p.value),o.update(x.value)})}),e.onUnmounted(()=>{var i;(i=x.value)==null||i.destroy(),o.destroy()}),e.watch(h,(i,l)=>{var c;C.f(i,l)||(c=x.value)==null||c.setConfig(h.value)}),e.watch(p,()=>{var i;(i=x.value)==null||i.setData(p.value)}),v({component:x}),(i,l)=>(e.openBlock(),e.createElementBlock("div",Ce))}}),be={class:"flex flex-col sm:flex-row"},Ve=["data-active"],Se={class:"flex items-center gap-2"},we={class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},De={class:"block text-lg leading-none font-bold sm:text-3xl"},Ne={class:"mx-auto w-full max-w-sm mt-2 mb-8"},_e={class:"text-muted-foreground"},Be={class:"text-muted-foreground"},Ee={class:"grid"},$e={class:"flex gap-1 overflow-hidden max-w-80"},Me={class:"truncate"},Re=e.defineComponent({__name:"ResourceSelector",props:{resources:{type:Array,required:!0},totals:{type:Object,required:!0},viewMode:{type:String,required:!0},activeChart:{type:String,required:!1}},emits:["update:viewMode","update:activeChart"],setup(f,{emit:v}){const o=f,g=v,p=e.computed({get:()=>o.viewMode,set:c=>{g("update:viewMode",c)}}),h=e.computed({get:()=>o.activeChart,set:c=>{g("update:activeChart",c)}}),{width:x}=pe.useWindowSize(),i=e.computed(()=>x.value<640),l=e.ref(!1);return(c,r)=>{const u=e.resolveComponent("DrawerTitle"),y=e.resolveComponent("DrawerDescription"),z=e.resolveComponent("DrawerHeader"),w=e.resolveComponent("Button"),_=e.resolveComponent("DrawerFooter"),L=e.resolveComponent("DrawerContent"),q=e.resolveComponent("Drawer"),B=e.resolveComponent("DropdownMenuTrigger"),D=e.resolveComponent("DropdownMenuLabel"),R=e.resolveComponent("DropdownMenuItem"),N=e.resolveComponent("DropdownMenuContent"),T=e.resolveComponent("DropdownMenu");return e.openBlock(),e.createElementBlock("div",be,[f.resources.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,"data-active":f.viewMode==="stacked",class:"hover:bg-muted/50 flex flex-1 flex-col justify-center gap-2 border-t px-4 py-3 text-left sm:border-t-0 sm:border-l sm:px-6 sm:py-6 cursor-pointer select-none",onClick:r[0]||(r[0]=m=>l.value=!0),onContextmenu:r[1]||(r[1]=e.withModifiers(m=>l.value=!0,["prevent"]))},[e.createElementVNode("div",Se,[f.viewMode==="stacked"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(E.Layers),{class:"size-3 text-muted-foreground"}),r[6]||(r[6]=e.createElementVNode("span",{class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},"All Resources",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:"size-3 rounded-full mr-2",style:e.normalizeStyle({backgroundColor:f.resources.find(m=>m.id===f.activeChart)?.color||"#6b7280"})},null,4),e.createElementVNode("span",we,e.toDisplayString(f.resources.find(m=>m.id===f.activeChart)?.name||"Select Resource"),1)],64)),e.createVNode(e.unref(E.ChevronDown),{class:"ml-auto size-4"})]),e.createElementVNode("span",De,e.toDisplayString(f.viewMode==="stacked"?Object.values(f.totals).reduce((m,I)=>m+I,0).toLocaleString():(f.totals[f.activeChart]||0).toLocaleString()),1)],40,Ve)):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createBlock(q,{key:1,open:e.unref(l),"onUpdate:open":r[3]||(r[3]=m=>e.isRef(l)?l.value=m:null)},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[...r[7]||(r[7]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createVNode(y,null,{default:e.withCtx(()=>[...r[8]||(r[8]=[e.createTextVNode("Select the resources to display on the timeline.",-1)])]),_:1})]),_:1}),e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(w,{onClick:r[2]||(r[2]=m=>{p.value="stacked",h.value="",l.value=!1}),variant:f.viewMode==="stacked"?"secondary":"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",_e," All Resources ("+e.toDisplayString(Object.values(f.totals).reduce((m,I)=>m+I,0).toLocaleString())+") ",1)]),_:1},8,["variant"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.resources,m=>(e.openBlock(),e.createBlock(w,{key:m.id,onClick:I=>{p.value="single",h.value=m.id,l.value=!1},variant:f.viewMode==="single"&&f.activeChart===m.id?"secondary":"outline"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:m.color||"#6b7280"})},null,4),e.createElementVNode("span",Be,e.toDisplayString(m.name)+" ("+e.toDisplayString((f.totals[m.id]||0).toLocaleString())+") ",1)]),_:2},1032,["onClick","variant"]))),128))]),_:1})])]),_:1})]),_:1},8,["open"])):(e.openBlock(),e.createBlock(T,{key:2,open:e.unref(l),"onUpdate:open":r[5]||(r[5]=m=>e.isRef(l)?l.value=m:null)},{default:e.withCtx(()=>[e.createVNode(B,{"as-child":""},{default:e.withCtx(()=>[...r[9]||(r[9]=[e.createElementVNode("button",{tabindex:"-1",class:"size-0 opacity-0 self-end"},null,-1)])]),_:1}),e.createVNode(N,{align:"end"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[...r[10]||(r[10]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createElementVNode("div",Ee,[e.createVNode(R,{onClick:r[4]||(r[4]=m=>{p.value="stacked",h.value="",l.value=!1}),class:e.normalizeClass(f.viewMode==="stacked"?"bg-input":"")},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",null," All Resources ("+e.toDisplayString(Object.values(f.totals).reduce((m,I)=>m+I,0).toLocaleString())+") ",1)]),_:1},8,["class"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.resources,m=>(e.openBlock(),e.createBlock(R,{key:m.id,onClick:I=>{p.value="single",h.value=m.id,l.value=!1},class:e.normalizeClass(f.viewMode==="single"&&f.activeChart===m.id?"bg-input":"")},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:m.color||"#6b7280"})},null,4),e.createElementVNode("span",$e,[e.createElementVNode("span",Me,e.toDisplayString(m.name),1),e.createElementVNode("span",null,"("+e.toDisplayString((f.totals[m.id]||0).toLocaleString())+")",1)])]),_:2},1032,["onClick","class"]))),128))])]),_:1})]),_:1},8,["open"]))])}}}),Te={class:"flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6"},ze={class:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3"},Ie={class:"flex items-center gap-1"},Oe={class:"timeline-date-trigger"},Ae={key:1,class:"flex items-center justify-center px-6 py-4 text-muted-foreground text-sm"},Pe={key:0,class:"flex items-center justify-center h-[250px]"},je={key:1,class:"flex items-center justify-center h-[250px]"},Fe={key:2,class:"timeline-chart-scroll"},ce="#61616180",Le=36,We=e.defineComponent({__name:"Timeline",props:{modelValue:{},selectedResource:{},viewMode:{},agendaData:{},resources:{}},emits:["update:modelValue","update:selectedResource","update:viewMode"],setup(f,{emit:v}){const o=f,g=v,{params:p}=H.useModuleRoute(),{config:h}=H.useModule(),x=H.useFirebaseIntegration(h.project),i=e.ref([]),l=e.ref([]),c=e.ref(!0),r=e.ref(o.viewMode||"stacked"),u=e.ref(o.selectedResource||"");e.watch(r,n=>{g("update:viewMode",n)},{immediate:!0}),e.watch(u,n=>{g("update:selectedResource",r.value==="single"?n:null)}),e.watch(r,n=>{g("update:selectedResource",n==="single"?u.value:null)}),e.watch(()=>o.selectedResource,n=>{r.value==="single"&&n!==u.value&&(u.value=n||"")});const y=e.ref(o.modelValue||new Date),z=e.ref(null);e.watch(()=>o.modelValue,n=>{n&&n.getTime()!==y.value.getTime()&&(y.value=n)}),e.watch(y,n=>{g("update:modelValue",n)},{immediate:!0});const w=e.computed({get:()=>t(y.value),set:n=>{if(!n){y.value=new Date;return}y.value=new Date(`${n}T00:00:00`)}}),_=()=>{const n=z.value;if(n){if(typeof n.showPicker=="function"){n.showPicker();return}n.focus(),n.click()}},L=e.computed(()=>y.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})),q=()=>{const n=new Date(y.value);n.setDate(n.getDate()-1),y.value=n},B=()=>{const n=new Date(y.value);n.setDate(n.getDate()+1),y.value=n},D=()=>{y.value=new Date},R=e.computed(()=>(o.resources?.length||0)===0?10:Math.max(...(o.resources||[]).map(n=>n.capacity||10))),N=e.computed(()=>(o.resources?.length||0)===0?10:(o.resources||[]).reduce((n,d)=>n+(d.capacity||10),0)),T=e.computed(()=>(o.resources?.length||0)===0?60:Math.min(...(o.resources||[]).map(n=>n.interval||60))),m=e.computed(()=>{const n={total:{label:"Total Reservations",color:void 0}};return(o.resources||[]).forEach((d,a)=>{n[d.id]={label:d.name,color:d.color||`var(--chart-${a%5+1})`}}),n});e.watch(()=>o.resources,n=>{const d=n?.[0];d&&!u.value&&(u.value=d.id)},{immediate:!0});const I=e.computed(()=>[...o.resources||[]].sort((n,d)=>{const a=K.value[n.id]||0;return(K.value[d.id]||0)-a})),X=e.computed(()=>{const n=[];return T.value,i.value.forEach((d,a)=>{d.time.endsWith(":00")&&n.push(a)}),n}),K=e.computed(()=>{const n={};return o.resources?.forEach(d=>{n[d.id]=l.value.filter(a=>a.resourceId===d.id).reduce((a,V)=>a+(V.reserved||0),0)}),n}),re=e.computed(()=>i.value.reduce((n,d)=>Math.max(n,d.total||0),0)),ee=e.computed(()=>({minWidth:`max(100%, ${Math.max(i.value.length,1)*Le}px)`})),U=e.computed(()=>Math.max(N.value,re.value,1)),oe=(n,d)=>{const a=n[d];return typeof a=="number"?a:0},s=(n,d)=>{const a=I.value[d];return!a||oe(n,a.id)<=0?0:I.value.slice(d).reduce((V,O)=>V+oe(n,O.id),0)},t=n=>{const d=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),V=String(n.getDate()).padStart(2,"0");return`${d}-${a}-${V}`},b=n=>{const[d,a]=n.split(":").map(Number);return d*60+a},P=(n,d)=>(o.agendaData?.exceptions||[]).find(V=>d>=V.startDate&&d<=V.endDate?V.resourceIds===null?!0:V.resourceIds?.includes(n):!1)||null,j=e.computed(()=>{const n=t(y.value),d=y.value.getDay();let a=1440,V=0;if((o.resources||[]).forEach(Y=>{const A=P(Y.id,n);if(A){if(A.isClosed)return;A.timeslots.forEach(W=>{const k=b(W.startTime),S=b(W.endTime);a=Math.min(a,k),V=Math.max(V,S)})}else(Y.openingHours?.[d]||[]).forEach(k=>{const S=b(k.start),F=b(k.end);a=Math.min(a,S),V=Math.max(V,F)})}),a>=V)return{startMinutes:540,endMinutes:1020};const O=Math.floor(a/60)*60,J=Math.ceil(V/60)*60;return{startMinutes:O,endMinutes:J}}),$=()=>{const n=[],d=T.value,{startMinutes:a,endMinutes:V}=j.value;for(let O=a;O<V;O+=d){const J=Math.floor(O/60),Y=O%60,A=`${String(J).padStart(2,"0")}:${String(Y).padStart(2,"0")}`,W={time:A,label:A,total:0};o.resources?.forEach(k=>{W[k.id]=0}),n.push(W)}return n},G=async()=>{c.value=!0;try{const n=p.value.id,d=t(y.value),a=`${n}_${d}`,V=await x.get(h.reservedSpotsCollection,a);l.value=[];for(const A of o.resources||[]){const W=V?.[A.id]||{};Object.entries(W).forEach(([k,S])=>{const[F,Z]=k.split("-");l.value.push({resourceId:A.id,startTime:F,endTime:Z,reserved:S})})}const O=$(),J=T.value,{startMinutes:Y}=j.value;l.value.forEach(A=>{const W=b(A.startTime),k=b(A.endTime);for(let S=W;S<k;S+=J){const F=Math.floor((S-Y)/J);if(F>=0&&F<O.length){const Z=O[F][A.resourceId];if(typeof Z=="number"){const le=Number(A.reserved)||0;O[F][A.resourceId]=Z+le,O[F].total+=le}}}}),i.value=O}catch(n){console.error("Error loading reservation data:",n),i.value=$(),l.value=[]}finally{c.value=!1}};return(async()=>await G())(),e.watch(y,()=>{G()}),e.watch(()=>o.resources,()=>{(o.resources?.length||0)>0&&G()}),(n,d)=>{const a=e.resolveComponent("CardTitle"),V=e.resolveComponent("Button"),O=e.resolveComponent("CardDescription"),J=e.resolveComponent("CardHeader"),Y=e.resolveComponent("ChartContainer"),A=e.resolveComponent("CardContent"),W=e.resolveComponent("Card");return e.openBlock(),e.createBlock(W,{class:"pt-0 pb-4 -mx-6 mt-6 rounded-none border-b-0 border-x-0 @5xl:mx-0 @5xl:mt-0 @5xl:pb-0 @5xl:rounded-xl @5xl:border-x-[1px]"},{default:e.withCtx(()=>[e.createVNode(J,{class:"flex flex-col items-stretch border-b !p-0 sm:flex-row"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[e.createElementVNode("div",ze,[e.createVNode(a,null,{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createElementVNode("div",Ie,[e.createVNode(V,{variant:"outline",size:"icon",class:"size-8",onClick:q},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ChevronLeft),{size:16})]),_:1}),e.createVNode(V,{variant:"outline",size:"sm",class:"h-8 px-3 text-xs",onClick:D},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(V,{variant:"outline",size:"icon",class:"size-8",onClick:B},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ChevronRight),{size:16})]),_:1})])]),e.createVNode(O,null,{default:e.withCtx(()=>[e.createElementVNode("div",Oe,[e.createVNode(V,{type:"button",variant:"outline",onClick:_},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CalendarIcon),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(L)),1)]),_:1}),e.withDirectives(e.createElementVNode("input",{ref_key:"dateInputRef",ref:z,"onUpdate:modelValue":d[0]||(d[0]=k=>e.isRef(w)?w.value=k:null),type:"date",class:"timeline-date-picker","aria-label":"Select reservation date"},null,512),[[e.vModelText,e.unref(w)]])])]),_:1})]),(f.resources?.length||0)>0?(e.openBlock(),e.createBlock(Re,{key:0,resources:f.resources||[],totals:e.unref(K),viewMode:e.unref(r),"onUpdate:viewMode":d[1]||(d[1]=k=>e.isRef(r)?r.value=k:null),activeChart:e.unref(u),"onUpdate:activeChart":d[2]||(d[2]=k=>e.isRef(u)?u.value=k:null)},null,8,["resources","totals","viewMode","activeChart"])):(e.openBlock(),e.createElementBlock("div",Ae," No resources configured "))]),_:1}),e.createVNode(A,{class:"px-2 sm:p-6"},{default:e.withCtx(()=>[e.unref(c)?(e.openBlock(),e.createElementBlock("div",Pe,[...d[5]||(d[5]=[e.createElementVNode("div",{class:"text-muted-foreground"},"Loading...",-1)])])):(f.resources?.length||0)===0?(e.openBlock(),e.createElementBlock("div",je,[...d[6]||(d[6]=[e.createElementVNode("div",{class:"text-muted-foreground"},"No resources to display",-1)])])):(e.openBlock(),e.createElementBlock("div",Fe,[e.unref(r)==="stacked"?(e.openBlock(),e.createBlock(Y,{key:0,config:e.unref(m),style:e.normalizeStyle(e.unref(ee)),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(M.$),{data:e.unref(i),margin:{left:-24},"y-domain":[0,e.unref(U)]},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(I),(k,S)=>(e.openBlock(),e.createBlock(e.unref(ie),{key:k.id,x:(F,Z)=>Z,y:F=>s(F,S),color:F=>oe(F,k.id)>0?e.unref(m)[k.id]?.color:ce,"bar-padding":.1,"rounded-corners":2},null,8,["x","y","color"]))),128)),e.createVNode(e.unref(M.O),{type:"x",x:(k,S)=>S,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(X),"tick-format":k=>e.unref(i)[k]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(M.O),{type:"y","num-ticks":3,"tick-line":!1,"domain-line":!1}),e.createVNode(e.unref(M.z)),e.createVNode(e.unref(M.A),{template:e.unref(ne.componentToString)(e.unref(m),e.unref(ne.ChartTooltipContent),{labelFormatter(k){if(k instanceof Date)return"";const S=Math.round(k);return S>=0&&S<e.unref(i).length&&e.unref(i)[S]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config","style"])):(e.openBlock(),e.createBlock(Y,{key:e.unref(u),config:e.unref(m),style:e.normalizeStyle(e.unref(ee)),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(M.$),{data:e.unref(i),margin:{left:-24},"y-domain":[0,e.unref(R)]},{default:e.withCtx(()=>[e.createVNode(e.unref(ie),{x:(k,S)=>S,y:k=>k[e.unref(u)]||0,color:k=>k[e.unref(u)]>0?e.unref(m)[e.unref(u)]?.color:ce,"bar-padding":.1,"rounded-corners":!1},null,8,["x","y","color"]),e.createVNode(e.unref(M.O),{type:"x",x:(k,S)=>S,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(X),"tick-format":k=>e.unref(i)[k]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(M.O),{type:"y","num-ticks":3,"tick-line":!1,"domain-line":!1}),e.createVNode(e.unref(M.z)),e.createVNode(e.unref(M.A),{template:e.unref(ne.componentToString)(e.unref(m),e.unref(ne.ChartTooltipContent),{labelFormatter(k){if(k instanceof Date)return"";const S=Math.round(k);return S>=0&&S<e.unref(i).length&&e.unref(i)[S]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config","style"]))]))]),_:1})]),_:1})}}}),qe=ve._export_sfc(We,[["__scopeId","data-v-a654ef37"]]),Ge={class:"flex flex-row items-center justify-between gap-2"},He={class:"relative mb-4"},Ue={class:"flex gap-1 mb-4 flex-wrap select-none"},Ye={key:0,class:"mb-3 text-sm text-muted-foreground"},Xe={key:1,class:"flex items-center justify-center py-8"},Je={key:2,class:"flex flex-col items-center gap-2 text-center py-8 text-muted-foreground"},Ke={key:3,class:"text-center py-8 text-muted-foreground"},Qe={key:4,class:"-mx-6 @5xl:mx-0 @5xl:space-y-2"},Ze=["onClick"],et={class:"flex items-start justify-between"},tt={class:"flex-1"},ot={class:"font-medium"},nt={class:"text-sm text-muted-foreground"},at={class:"text-sm text-muted-foreground"},rt={class:"flex items-center gap-4 flex-wrap"},st={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},lt={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},it={key:0,class:"flex items-center gap-1 mt-1 text-xs text-muted-foreground"},ct={class:"text-right"},dt={key:0,class:"inline-block px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},ut={key:1,class:"inline-block px-2 py-1 text-xs rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"},mt={key:2,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},ft={key:3,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},pt={key:4,class:"inline-block px-2 py-1 text-xs rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"},vt={key:5,class:"text-sm font-medium mt-1"},gt=e.defineComponent({__name:"BookingsList",props:{agendaData:{},activeDate:{},selectedResource:{},resources:{}},emits:["resetSelectedResource"],setup(f,{emit:v}){const o=f,g=v,{params:p}=H.useModuleRoute(),{config:h}=H.useModule(),x=H.useFirebaseIntegration(h.project),i=e.ref([]),l=e.ref(!0),c=e.ref(""),r=e.ref(null),u=e.ref(null),y=e.computed(()=>p.value?.id??p.id??o.agendaData?.id??""),{metadataSchema:z}=te.useAgendaMetadataSchema(y),w=e.computed(()=>({date:_(o.activeDate),resource:null}));e.provide("event",w);const _=s=>{const t=s.getFullYear(),b=String(s.getMonth()+1).padStart(2,"0"),P=String(s.getDate()).padStart(2,"0");return`${t}-${b}-${P}`},L=e.computed(()=>{let s=i.value;return o.selectedResource&&(s=s.filter(t=>t.resourceId===o.selectedResource)),c.value.trim()&&(s=new te.Fuse(s,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(c.value).map(b=>b.item)),s}),q=e.computed(()=>L.value.filter(s=>N.value.includes(s.reservationStatus))),B=e.computed(()=>{let s=JSON.parse(JSON.stringify(i.value));return o.selectedResource&&(s=s.filter(t=>t.resourceId===o.selectedResource)),s.some(t=>t.reservationStatus==="approved"||t.reservationStatus==="needs_approval")}),D=e.computed(()=>{const s=i.value.filter(t=>t.reservationStatus==="approved"||t.reservationStatus==="needs_approval");return{spots:s.reduce((t,b)=>t+(b.spots||0),0),bookings:s.length}}),R=()=>{c.value=""},N=e.ref(["needs_approval","approved"]),T=s=>{N.value.includes(s)?N.value=N.value.filter(t=>t!==s):N.value.push(s)},m=(s,t,b=t.date)=>{const P=o.resources.find($=>$.id===t.resourceId),j=s.id||s.orderId||t.orderId||"";return{customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:t.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:j,res_id:t.id,resourceId:t.resourceId,spots:t.spots,date:b,createdAt:s.createdAt,startTime:t.timeslot?.startTime,endTime:t.timeslot?.endTime,reservationPrice:t.totalPrice,reservationBasePrice:t.basePrice,reservationAddOnsPrice:t.addOnsPrice,orderReservationCount:Array.isArray(s.reservations)?s.reservations.length:void 0,pricingOptionId:t.pricingOptionId,pricingOption:t.pricingOption,resourceName:P?.name,resourceColor:P?.color,metadata:s.metadata||{},reservationMetadata:t.metadata||{},refundStatus:t.refundStatus,refundedAt:t.refundedAt,refundedAmount:t.refundedAmount,refunds:Array.isArray(t.refunds)?t.refunds:[],adjustments:s.adjustments||[],reservationAdjustments:t.adjustments||[]}},I=async()=>{await e.nextTick(),await new Promise(s=>{if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>s());return}s()})},X=async s=>{const t=await x.get(h.reservationsCollection,s);if(!t)return;const b={...t,id:t.id||s},P=(b.reservations||[]).map(j=>m(b,j));P.length&&(await I(),u.value?.openDialog({id:b.id,customerInfo:b.customerInfo,status:b.status,createdAt:b.createdAt,metadata:b.metadata||{},reservations:P,adjustments:b.adjustments||[],totalPrice:typeof b.total=="number"?b.total:P.reduce((j,$)=>j+($.reservationPrice||0),0),totalSpots:P.reduce((j,$)=>j+($.spots||0),0)}))},K=async s=>{await I(),r.value?.openDialog(s)},re=s=>s.orderReservationCount===1&&typeof s.total=="number"?s.total:typeof s.reservationPrice=="number"?s.reservationPrice:null,ee=s=>{const t=re(s);return t===null?null:`€${t.toFixed(2)}`},U=async()=>{l.value=!0,i.value=[];try{const s=p.value.id,t=_(o.activeDate),b=new Set;o.resources?.forEach($=>{const G=`${$.id}_${t}`;b.add(G)});const P=await x.find(h.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:s},{field:"status",operator:"==",value:"confirmed"},{field:"flattenedReservationDates",operator:"array-contains-any",value:Array.from(b)}]});let j=[];P.forEach($=>{($.reservations?.filter(Q=>Q.date===t)||[]).forEach(Q=>{j.push(m($,Q,t))})}),i.value=j.sort(($,G)=>$.startTime?.localeCompare(G.startTime||"")||0)}catch(s){console.error("Error loading orders:",s),i.value=[]}finally{l.value=!1}};return(async()=>await U())(),e.watch(()=>o.activeDate,()=>{U()}),(s,t)=>{const b=e.resolveComponent("Badge"),P=e.resolveComponent("CardTitle"),j=e.resolveComponent("CardDescription"),$=e.resolveComponent("Button"),G=e.resolveComponent("CardHeader"),Q=e.resolveComponent("Input"),n=e.resolveComponent("CardContent"),d=e.resolveComponent("Card");return e.openBlock(),e.createBlock(d,{class:"-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]"},{default:e.withCtx(()=>[e.createVNode(G,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[e.createElementVNode("div",null,[e.createVNode(P,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[t[9]||(t[9]=e.createTextVNode(" Bookings ",-1)),e.unref(D).bookings>0?(e.openBlock(),e.createBlock(b,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(D).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(j,{class:"flex items-center gap-2 mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(e.unref(D).spots)+" total spots",1)]),_:1})]),e.createVNode($,{variant:"ghost",size:"icon",onClick:U,disabled:e.unref(l)},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(l)})},null,8,["class"])]),_:1},8,["disabled"])])]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createElementVNode("div",He,[e.createVNode(e.unref(E.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(Q,{modelValue:e.unref(c),"onUpdate:modelValue":t[0]||(t[0]=a=>e.isRef(c)?c.value=a:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(c)?(e.openBlock(),e.createBlock($,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:R},{default:e.withCtx(()=>[e.createVNode(e.unref(E.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ue,[f.agendaData.needsApproval?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:t[1]||(t[1]=a=>T("needs_approval")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("needs_approval")}])},[e.unref(N).includes("needs_approval")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Needs Approval ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="needs_approval").length)+") ",1)],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:t[2]||(t[2]=a=>T("approved")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("approved")}])},[e.unref(N).includes("approved")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Approved ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="approved").length)+") ",1)],2),f.agendaData.needsApproval?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:t[3]||(t[3]=a=>T("rejected")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("rejected")}])},[e.unref(N).includes("rejected")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Rejected ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="rejected").length)+") ",1)],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:t[4]||(t[4]=a=>T("cancelled")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("cancelled")}])},[e.unref(N).includes("cancelled")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Cancelled ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="cancelled").length)+") ",1)],2)]),e.unref(c)?(e.openBlock(),e.createElementBlock("div",Ye," Showing "+e.toDisplayString(e.unref(q).length)+" of "+e.toDisplayString(e.unref(i).length)+" bookings ",1)):e.createCommentVNode("",!0),e.unref(l)?(e.openBlock(),e.createElementBlock("div",Xe,[...t[10]||(t[10]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(q).length===0?(e.openBlock(),e.createElementBlock("div",Je,[t[13]||(t[13]=e.createTextVNode(" No bookings for this day ",-1)),e.unref(B)?(e.openBlock(),e.createBlock($,{key:0,onClick:t[5]||(t[5]=a=>{N.value=["needs_approval","approved"],c.value=""})},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Reset filters",-1)])]),_:1})):e.createCommentVNode("",!0),f.selectedResource!==null?(e.openBlock(),e.createBlock($,{key:1,onClick:t[6]||(t[6]=a=>g("resetSelectedResource"))},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Reset resource filter",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.unref(q).length===0?(e.openBlock(),e.createElementBlock("div",Ke," No bookings match your search ")):(e.openBlock(),e.createElementBlock("div",Qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(q),a=>(e.openBlock(),e.createElementBlock("div",{key:a.res_id||a.id,class:"px-6 @5xl:px3 py-3 border-t last:border-b @5xl:border @5xl:rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:V=>e.unref(r)?.openDialog(a)},[e.createElementVNode("div",et,[e.createElementVNode("div",tt,[e.createElementVNode("div",ot,e.toDisplayString(a.customerInfo.firstName+" "+a.customerInfo.lastName||"Unknown Customer"),1),e.createElementVNode("div",nt,e.toDisplayString(a.customerInfo?.email),1),e.createElementVNode("div",at,e.toDisplayString(a.customerInfo?.phone),1),e.createElementVNode("div",rt,[e.createElementVNode("div",st,[e.createVNode(e.unref(E.Clock),{size:12}),e.createElementVNode("span",null,e.toDisplayString(a.startTime)+" - "+e.toDisplayString(a.endTime),1)]),e.createElementVNode("div",lt,[e.createVNode(e.unref(E.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(a.spots)+" "+e.toDisplayString(a.spots===1?"spot":"spots"),1)]),a.resourceName?(e.openBlock(),e.createElementBlock("div",it,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:a.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(a.resourceName),1)])):e.createCommentVNode("",!0)]),e.createVNode(te._sfc_main,{metadata:{...a.metadata,...a.reservationMetadata},schema:e.unref(z),"display-filter":["highlight","badge"],compact:"",class:"mt-1"},null,8,["metadata","schema"])]),e.createElementVNode("div",ct,[a.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",dt,"Needs Approval")):a.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",ut,"Approved")):a.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",mt,"Rejected")):a.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",ft,"Cancelled")):(e.openBlock(),e.createElementBlock("span",pt,"Pending")),ee(a)?(e.openBlock(),e.createElementBlock("div",vt,e.toDisplayString(ee(a)),1)):e.createCommentVNode("",!0)])])],8,Ze))),128))]))]),_:1}),e.createVNode(te._sfc_main$1,{ref_key:"reservationDetailDialog",ref:r,agendaData:f.agendaData,resources:f.resources,"show-order-link":"",onCancelled:U,onConfirmed:U,onRejected:U,onTransferred:U,onOpenOrder:t[7]||(t[7]=a=>X(a))},null,8,["agendaData","resources"]),e.createVNode(te._sfc_main$2,{ref_key:"orderDetailDialog",ref:u,agendaData:f.agendaData,resources:f.resources,onOpenReservation:t[8]||(t[8]=a=>K(a))},null,8,["agendaData","resources"])]),_:1})}}}),ht={class:"@5xl:space-y-6"},xt={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},yt={class:"text-2xl font-semibold tracking-tight"},kt={class:"flex flex-col md:flex-row gap-2"},Ct={class:"grid gap-6 md:grid-cols-2 lg:grid-cols-3"},bt={class:"md:col-span-2 lg:col-span-3"},Vt=e.defineComponent({__name:"index",setup(f){const{hasPermission:v}=H.useModulePermissions(),{params:o,resolvePath:g}=H.useModuleRoute(),{config:p}=H.useModule(),h=H.useFirebaseIntegration(p.project),x=e.ref(""),i=e.ref(!0),l=e.ref(new Date),c=e.ref(null),r=e.ref("stacked"),u=e.ref(null),y=e.ref([]);return(async()=>{try{const w=await h.get(p.agendaCollection,o.value.id);x.value=w?.serviceName||"",u.value=w,y.value=w?.resources?.filter(_=>_.isActive)||[]}catch(w){console.error("Error loading data:",w)}finally{i.value=!1}})(),(w,_)=>(e.openBlock(),e.createBlock(fe._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",ht,[e.createElementVNode("div",xt,[e.createElementVNode("div",null,[e.createElementVNode("h1",yt,e.toDisplayString(e.unref(x)||"Dashboard"),1),_[4]||(_[4]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," Overview and analytics for your booking service ",-1))]),e.createElementVNode("div",kt,[e.unref(v)("manage-reservations")?(e.openBlock(),e.createBlock(ge._sfc_main,{key:0,"agenda-data":e.unref(u)},null,8,["agenda-data"])):e.createCommentVNode("",!0)])]),e.createVNode(qe,{modelValue:e.unref(l),"onUpdate:modelValue":_[0]||(_[0]=L=>e.isRef(l)?l.value=L:null),"view-mode":e.unref(r),"onUpdate:viewMode":_[1]||(_[1]=L=>e.isRef(r)?r.value=L:null),"selected-resource":e.unref(c),"onUpdate:selectedResource":_[2]||(_[2]=L=>e.isRef(c)?c.value=L:null),"agenda-data":e.unref(u),resources:e.unref(y)},null,8,["modelValue","view-mode","selected-resource","agenda-data","resources"]),e.createElementVNode("div",Ct,[e.createElementVNode("div",bt,[e.unref(y).length>0?(e.openBlock(),e.createBlock(gt,{key:0,"agenda-data":e.unref(u),"active-date":e.unref(l),"selected-resource":e.unref(c),resources:e.unref(y),onResetSelectedResource:_[3]||(_[3]=L=>c.value=null)},null,8,["agenda-data","active-date","selected-resource","resources"])):e.createCommentVNode("",!0)])])])]),_:1}))}});exports.default=Vt;
|
|
35
|
+
`,Ce=Object.freeze(Object.defineProperty({__proto__:null,bar:ae,barGroup:se,barGroupExit:ue,globalStyles:ke,root:de},Symbol.toStringTag,{value:"Module"}));class me extends M.XYComponentCore{constructor(v){super(),this._defaultConfig=ye,this.config=this._defaultConfig,this.getAccessors=()=>C.isArray(this.config.y)?this.config.y:[this.config.y],this.events={},this._barData=[],v&&this.setConfig(v)}get bleed(){if(this._barData=this._getVisibleData(),this._barData.length===0)return{top:0,bottom:0,left:0,right:0};const v=!this.isVertical()&&this.dataScale.range()[0]>this.dataScale.range()[1],o=this.dataScale.domain(),g=this._getGroupWidth()/2,p=this._barData.map((z,w)=>C.getNumber(z,this.config.x,w)),h=C.min(p),x=C.max(p),i=this.dataScale(h),l=this.dataScale(x),c=this.dataScale.invert(i+(v?g:-g)),r=this.dataScale.invert(l+(v?-g:g)),u=c<=o[0]?this.dataScale(o[0])-this.dataScale(c):0,y=r>o[1]?this.dataScale(r)-this.dataScale(o[1]):0;return{top:this.isVertical()?0:v?-y:u,bottom:this.isVertical()?0:v?-u:y,left:this.isVertical()?u:0,right:this.isVertical()?y:0}}get dataScale(){return this.isVertical()?this.xScale:this.yScale}get valueScale(){return this.isVertical()?this.yScale:this.xScale}isVertical(){return this.config.orientation===M.Orientation.Vertical}_render(v){const{config:o}=this,g=C.isNumber(v)?v:o.duration,p=this._getGroupWidth(),h=this.getAccessors(),x=[-p/2,p/2],i=M.band().domain(M.range(h.length)).range(x).paddingInner(o.barPadding).paddingOuter(o.barPadding),l=this.g.selectAll(`.${se}`).data(this._barData,(B,D)=>{var R;return`${(R=C.getString(B,o.id,D))!==null&&R!==void 0?R:D}`}),c=(B,D)=>{const R=this.dataScale(C.getNumber(B,o.x,D)),N=this.isVertical()?R:0,T=this.isVertical()?0:R;return`translate(${N},${T})`},u=l.enter().append("g").attr("class",se).attr("transform",c).style("opacity",1).merge(l);C.smartTransition(u,g).attr("transform",c).style("opacity",1);const y=l.exit().attr("class",ue);C.smartTransition(y,g).style("opacity",0).remove(),C.smartTransition(y.selectAll(`.${ae}`),g).attr("transform",(B,D,R)=>this.isVertical()?`translate(0,${this.yScale(0)}) scale(1,0)`:`translate(${this.xScale(0)},0) scale(0,1)`);const z=i.bandwidth(),w=u.selectAll(`.${ae}`).data(B=>h.map(()=>B)),_=this._getValueAxisDirection(),q=w.enter().append("path").attr("class",ae).attr("d",(B,D)=>{const R=i(D),N=this.valueScale(0),T=z;return this._getBarPath(R,N,T,0,!1,_)}).style("fill",(B,D)=>C.getColor(B,o.color,D)).merge(w);C.smartTransition(q,g).attr("d",(B,D)=>{const R=i(D),N=z,T=C.getNumber(B,h[D]),m=T<0;let I=m?this.valueScale(0):this.valueScale(T||0),X=Math.abs(this.valueScale(0)-this.valueScale(T))||0;if(X<o.barMinHeight){const K=_===M.Direction.North?-1:1;I=this.valueScale(0)+K*o.barMinHeight,X=o.barMinHeight}return this._getBarPath(R,I,N,X,m,_)}).style("fill",(B,D)=>C.getColor(B,o.color,D)).style("cursor",(B,D)=>C.getString(B,o.cursor,D)),C.smartTransition(w.exit(),g).remove()}_getValueAxisDirection(){return this.valueScale.range()[0]>this.valueScale.range()[1]?M.Direction.North:M.Direction.South}_getVisibleData(){const{config:v,datamodel:{data:o}}=this,g=this._getGroupWidth(),p=o.length<2?0:g/2,h=this.dataScale,x=Math.abs(h.invert(p)-h.invert(0));return o?.filter((l,c)=>{const r=C.getNumber(l,v.x,c),u=h.domain(),y=+u[0],z=+u[1];return r>=y-x&&r<=z+x})}_getBarPath(v,o,g,p,h,x){const{config:i}=this,l=i.roundedCorners?C.isNumber(i.roundedCorners)?+i.roundedCorners:g/2:0,c=C.clamp(l,0,Math.min(p,g)/2),r=x===M.Direction.North,u=this.isVertical()&&h!==r,y=this.isVertical()&&h===r,z=!this.isVertical()&&h,w=!this.isVertical()&&!h;return xe({x:this.isVertical()?v:o+(r?0:-p),y:this.isVertical()?o+(r?0:-p):v,w:this.isVertical()?g:p,h:this.isVertical()?p:g,tl:u||z,tr:u||w,bl:y||z,br:y||w,r:c})}_getGroupWidth(){const{config:v,datamodel:{data:o}}=this;if(C.isEmpty(o))return 0;if(v.groupWidth)return C.min([v.groupWidth,v.groupMaxWidth]);const g=this.dataScale.bandwidth,p=this.dataScale.domain?this.dataScale.domain():[];let x=1+(g?p.length:p[1]-p[0])/v.dataStep||!g&&o.filter((c,r)=>{const u=C.getNumber(c,v.x,r);return u>=p[0]&&u<=p[1]}).length||o.length;!g&&x>=2&&(x+=1);const l=(x<2?1:1-v.groupPadding)*(this.isVertical()?this._width:this._height)/x;return C.min([l,v.groupMaxWidth])}getValueScaleExtent(v){const{datamodel:o}=this,g=this.getAccessors(),p=v?this._getVisibleData():o.data,h=C.getMin(p,...g),x=C.getMax(p,...g);return[h>0?0:h,x<0?0:x]}getDataScaleExtent(){const{config:v,datamodel:o}=this;return C.getExtent(o.data,v.x)}getYDataExtent(v){return this.isVertical()?this.getValueScaleExtent(v):this.getDataScaleExtent()}getXDataExtent(){return this.isVertical()?this.getDataScaleExtent():this.getValueScaleExtent(!1)}}me.selectors=Ce;const be={"data-vis-component":""},ie=e.defineComponent({__name:"index",props:{color:{},groupWidth:{},groupMaxWidth:{},dataStep:{},groupPadding:{},barPadding:{},roundedCorners:{type:[Number,Boolean]},barMinHeight:{},cursor:{},orientation:{},x:{},y:{},id:{type:Function},xScale:{type:[Object,Function]},yScale:{type:[Object,Function]},excludeFromDomainCalculation:{type:Boolean},duration:{},events:{},attributes:{},data:{}},setup(f,{expose:v}){const o=e.inject(C.o),g=f,p=e.computed(()=>o.data.value??g.data),h=C.m(g),x=e.ref();return e.onMounted(()=>{e.nextTick(()=>{var i;x.value=new me(h.value),(i=x.value)==null||i.setData(p.value),o.update(x.value)})}),e.onUnmounted(()=>{var i;(i=x.value)==null||i.destroy(),o.destroy()}),e.watch(h,(i,l)=>{var c;C.f(i,l)||(c=x.value)==null||c.setConfig(h.value)}),e.watch(p,()=>{var i;(i=x.value)==null||i.setData(p.value)}),v({component:x}),(i,l)=>(e.openBlock(),e.createElementBlock("div",be))}}),Ve={class:"flex flex-col sm:flex-row"},Se=["data-active"],we={class:"flex items-center gap-2"},De={class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},Ne={class:"block text-lg leading-none font-bold sm:text-3xl"},_e={class:"mx-auto w-full max-w-sm mt-2 mb-8"},Be={class:"text-muted-foreground"},Ee={class:"text-muted-foreground"},$e={class:"grid"},Me={class:"flex gap-1 overflow-hidden max-w-80"},Re={class:"truncate"},Te=e.defineComponent({__name:"ResourceSelector",props:{resources:{type:Array,required:!0},totals:{type:Object,required:!0},viewMode:{type:String,required:!0},activeChart:{type:String,required:!1}},emits:["update:viewMode","update:activeChart"],setup(f,{emit:v}){const o=f,g=v,p=e.computed({get:()=>o.viewMode,set:c=>{g("update:viewMode",c)}}),h=e.computed({get:()=>o.activeChart,set:c=>{g("update:activeChart",c)}}),{width:x}=pe.useWindowSize(),i=e.computed(()=>x.value<640),l=e.ref(!1);return(c,r)=>{const u=e.resolveComponent("DrawerTitle"),y=e.resolveComponent("DrawerDescription"),z=e.resolveComponent("DrawerHeader"),w=e.resolveComponent("Button"),_=e.resolveComponent("DrawerFooter"),L=e.resolveComponent("DrawerContent"),q=e.resolveComponent("Drawer"),B=e.resolveComponent("DropdownMenuTrigger"),D=e.resolveComponent("DropdownMenuLabel"),R=e.resolveComponent("DropdownMenuItem"),N=e.resolveComponent("DropdownMenuContent"),T=e.resolveComponent("DropdownMenu");return e.openBlock(),e.createElementBlock("div",Ve,[f.resources.length>1?(e.openBlock(),e.createElementBlock("button",{key:0,"data-active":f.viewMode==="stacked",class:"hover:bg-muted/50 flex flex-1 flex-col justify-center gap-2 border-t px-4 py-3 text-left sm:border-t-0 sm:border-l sm:px-6 sm:py-6 cursor-pointer select-none",onClick:r[0]||(r[0]=m=>l.value=!0),onContextmenu:r[1]||(r[1]=e.withModifiers(m=>l.value=!0,["prevent"]))},[e.createElementVNode("div",we,[f.viewMode==="stacked"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(E.Layers),{class:"size-3 text-muted-foreground"}),r[6]||(r[6]=e.createElementVNode("span",{class:"block text-muted-foreground text-xs mr-2 max-w-[120px] truncate"},"All Resources",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:"size-3 rounded-full mr-2",style:e.normalizeStyle({backgroundColor:f.resources.find(m=>m.id===f.activeChart)?.color||"#6b7280"})},null,4),e.createElementVNode("span",De,e.toDisplayString(f.resources.find(m=>m.id===f.activeChart)?.name||"Select Resource"),1)],64)),e.createVNode(e.unref(E.ChevronDown),{class:"ml-auto size-4"})]),e.createElementVNode("span",Ne,e.toDisplayString(f.viewMode==="stacked"?Object.values(f.totals).reduce((m,I)=>m+I,0).toLocaleString():(f.totals[f.activeChart]||0).toLocaleString()),1)],40,Se)):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createBlock(q,{key:1,open:e.unref(l),"onUpdate:open":r[3]||(r[3]=m=>e.isRef(l)?l.value=m:null)},{default:e.withCtx(()=>[e.createVNode(L,null,{default:e.withCtx(()=>[e.createElementVNode("div",_e,[e.createVNode(z,null,{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[...r[7]||(r[7]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createVNode(y,null,{default:e.withCtx(()=>[...r[8]||(r[8]=[e.createTextVNode("Select the resources to display on the timeline.",-1)])]),_:1})]),_:1}),e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(w,{onClick:r[2]||(r[2]=m=>{p.value="stacked",h.value="",l.value=!1}),variant:f.viewMode==="stacked"?"secondary":"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",Be," All Resources ("+e.toDisplayString(Object.values(f.totals).reduce((m,I)=>m+I,0).toLocaleString())+") ",1)]),_:1},8,["variant"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.resources,m=>(e.openBlock(),e.createBlock(w,{key:m.id,onClick:I=>{p.value="single",h.value=m.id,l.value=!1},variant:f.viewMode==="single"&&f.activeChart===m.id?"secondary":"outline"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:m.color||"#6b7280"})},null,4),e.createElementVNode("span",Ee,e.toDisplayString(m.name)+" ("+e.toDisplayString((f.totals[m.id]||0).toLocaleString())+") ",1)]),_:2},1032,["onClick","variant"]))),128))]),_:1})])]),_:1})]),_:1},8,["open"])):(e.openBlock(),e.createBlock(T,{key:2,open:e.unref(l),"onUpdate:open":r[5]||(r[5]=m=>e.isRef(l)?l.value=m:null)},{default:e.withCtx(()=>[e.createVNode(B,{"as-child":""},{default:e.withCtx(()=>[...r[9]||(r[9]=[e.createElementVNode("button",{tabindex:"-1",class:"size-0 opacity-0 self-end"},null,-1)])]),_:1}),e.createVNode(N,{align:"end"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[...r[10]||(r[10]=[e.createTextVNode("Resources",-1)])]),_:1}),e.createElementVNode("div",$e,[e.createVNode(R,{onClick:r[4]||(r[4]=m=>{p.value="stacked",h.value="",l.value=!1}),class:e.normalizeClass(f.viewMode==="stacked"?"bg-input":"")},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Layers),{class:"size-3 text-muted-foreground"}),e.createElementVNode("span",null," All Resources ("+e.toDisplayString(Object.values(f.totals).reduce((m,I)=>m+I,0).toLocaleString())+") ",1)]),_:1},8,["class"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.resources,m=>(e.openBlock(),e.createBlock(R,{key:m.id,onClick:I=>{p.value="single",h.value=m.id,l.value=!1},class:e.normalizeClass(f.viewMode==="single"&&f.activeChart===m.id?"bg-input":"")},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"size-3 rounded-full",style:e.normalizeStyle({backgroundColor:m.color||"#6b7280"})},null,4),e.createElementVNode("span",Me,[e.createElementVNode("span",Re,e.toDisplayString(m.name),1),e.createElementVNode("span",null,"("+e.toDisplayString((f.totals[m.id]||0).toLocaleString())+")",1)])]),_:2},1032,["onClick","class"]))),128))])]),_:1})]),_:1},8,["open"]))])}}}),ze={class:"flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6"},Ie={class:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3"},Oe={class:"flex items-center gap-1"},Ae={class:"timeline-date-trigger"},Pe={key:1,class:"flex items-center justify-center px-6 py-4 text-muted-foreground text-sm"},je={key:0,class:"flex items-center justify-center h-[250px]"},Fe={key:1,class:"flex items-center justify-center h-[250px]"},Le={key:2,class:"timeline-chart-scroll"},ce="#61616180",We=36,qe=e.defineComponent({__name:"Timeline",props:{modelValue:{},selectedResource:{},viewMode:{},agendaData:{},resources:{}},emits:["update:modelValue","update:selectedResource","update:viewMode"],setup(f,{emit:v}){const o=f,g=v,{params:p}=H.useModuleRoute(),{config:h}=H.useModule(),x=H.useFirebaseIntegration(h.project),i=e.ref([]),l=e.ref([]),c=e.ref(!0),r=e.ref(o.viewMode||"stacked"),u=e.ref(o.selectedResource||"");e.watch(r,n=>{g("update:viewMode",n)},{immediate:!0}),e.watch(u,n=>{g("update:selectedResource",r.value==="single"?n:null)}),e.watch(r,n=>{g("update:selectedResource",n==="single"?u.value:null)}),e.watch(()=>o.selectedResource,n=>{r.value==="single"&&n!==u.value&&(u.value=n||"")});const y=e.ref(o.modelValue||new Date),z=e.ref(null);e.watch(()=>o.modelValue,n=>{n&&n.getTime()!==y.value.getTime()&&(y.value=n)}),e.watch(y,n=>{g("update:modelValue",n)},{immediate:!0});const w=e.computed({get:()=>t(y.value),set:n=>{if(!n){y.value=new Date;return}y.value=new Date(`${n}T00:00:00`)}}),_=()=>{const n=z.value;if(n){if(typeof n.showPicker=="function"){n.showPicker();return}n.focus(),n.click()}},L=e.computed(()=>y.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})),q=()=>{const n=new Date(y.value);n.setDate(n.getDate()-1),y.value=n},B=()=>{const n=new Date(y.value);n.setDate(n.getDate()+1),y.value=n},D=()=>{y.value=new Date},R=e.computed(()=>(o.resources?.length||0)===0?10:Math.max(...(o.resources||[]).map(n=>n.capacity||10))),N=e.computed(()=>(o.resources?.length||0)===0?10:(o.resources||[]).reduce((n,d)=>n+(d.capacity||10),0)),T=e.computed(()=>(o.resources?.length||0)===0?60:Math.min(...(o.resources||[]).map(n=>n.interval||60))),m=e.computed(()=>{const n={total:{label:"Total Reservations",color:void 0}};return(o.resources||[]).forEach((d,a)=>{n[d.id]={label:d.name,color:d.color||`var(--chart-${a%5+1})`}}),n});e.watch(()=>o.resources,n=>{const d=n?.[0];d&&!u.value&&(u.value=d.id)},{immediate:!0});const I=e.computed(()=>[...o.resources||[]].sort((n,d)=>{const a=K.value[n.id]||0;return(K.value[d.id]||0)-a})),X=e.computed(()=>{const n=[];return T.value,i.value.forEach((d,a)=>{d.time.endsWith(":00")&&n.push(a)}),n}),K=e.computed(()=>{const n={};return o.resources?.forEach(d=>{n[d.id]=l.value.filter(a=>a.resourceId===d.id).reduce((a,V)=>a+(V.reserved||0),0)}),n}),re=e.computed(()=>i.value.reduce((n,d)=>Math.max(n,d.total||0),0)),ee=e.computed(()=>({minWidth:`max(100%, ${Math.max(i.value.length,1)*We}px)`})),U=e.computed(()=>Math.max(N.value,re.value,1)),te=(n,d)=>{const a=n[d];return typeof a=="number"?a:0},s=(n,d)=>{const a=I.value[d];return!a||te(n,a.id)<=0?0:I.value.slice(d).reduce((V,O)=>V+te(n,O.id),0)},t=n=>{const d=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),V=String(n.getDate()).padStart(2,"0");return`${d}-${a}-${V}`},b=n=>{const[d,a]=n.split(":").map(Number);return d*60+a},P=(n,d)=>(o.agendaData?.exceptions||[]).find(V=>d>=V.startDate&&d<=V.endDate?V.resourceIds===null?!0:V.resourceIds?.includes(n):!1)||null,j=e.computed(()=>{const n=t(y.value),d=y.value.getDay();let a=1440,V=0;if((o.resources||[]).forEach(Y=>{const A=P(Y.id,n);if(A){if(A.isClosed)return;A.timeslots.forEach(W=>{const k=b(W.startTime),S=b(W.endTime);a=Math.min(a,k),V=Math.max(V,S)})}else(Y.openingHours?.[d]||[]).forEach(k=>{const S=b(k.start),F=b(k.end);a=Math.min(a,S),V=Math.max(V,F)})}),a>=V)return{startMinutes:540,endMinutes:1020};const O=Math.floor(a/60)*60,J=Math.ceil(V/60)*60;return{startMinutes:O,endMinutes:J}}),$=()=>{const n=[],d=T.value,{startMinutes:a,endMinutes:V}=j.value;for(let O=a;O<V;O+=d){const J=Math.floor(O/60),Y=O%60,A=`${String(J).padStart(2,"0")}:${String(Y).padStart(2,"0")}`,W={time:A,label:A,total:0};o.resources?.forEach(k=>{W[k.id]=0}),n.push(W)}return n},G=async()=>{c.value=!0;try{const n=p.value.id,d=t(y.value),a=`${n}_${d}`,V=await x.get(h.reservedSpotsCollection,a);l.value=[];for(const A of o.resources||[]){const W=V?.[A.id]||{};Object.entries(W).forEach(([k,S])=>{const[F,Z]=k.split("-");l.value.push({resourceId:A.id,startTime:F,endTime:Z,reserved:S})})}const O=$(),J=T.value,{startMinutes:Y}=j.value;l.value.forEach(A=>{const W=b(A.startTime),k=b(A.endTime);for(let S=W;S<k;S+=J){const F=Math.floor((S-Y)/J);if(F>=0&&F<O.length){const Z=O[F][A.resourceId];if(typeof Z=="number"){const le=Number(A.reserved)||0;O[F][A.resourceId]=Z+le,O[F].total+=le}}}}),i.value=O}catch(n){console.error("Error loading reservation data:",n),i.value=$(),l.value=[]}finally{c.value=!1}};return(async()=>await G())(),e.watch(y,()=>{G()}),e.watch(()=>o.resources,()=>{(o.resources?.length||0)>0&&G()}),(n,d)=>{const a=e.resolveComponent("CardTitle"),V=e.resolveComponent("Button"),O=e.resolveComponent("CardDescription"),J=e.resolveComponent("CardHeader"),Y=e.resolveComponent("ChartContainer"),A=e.resolveComponent("CardContent"),W=e.resolveComponent("Card");return e.openBlock(),e.createBlock(W,{class:"pt-0 pb-4 -mx-6 mt-6 rounded-none border-b-0 border-x-0 @5xl:mx-0 @5xl:mt-0 @5xl:pb-0 @5xl:rounded-xl @5xl:border-x-[1px]"},{default:e.withCtx(()=>[e.createVNode(J,{class:"flex flex-col items-stretch border-b !p-0 sm:flex-row"},{default:e.withCtx(()=>[e.createElementVNode("div",ze,[e.createElementVNode("div",Ie,[e.createVNode(a,null,{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createElementVNode("div",Oe,[e.createVNode(V,{variant:"outline",size:"icon",class:"size-8",onClick:q},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ChevronLeft),{size:16})]),_:1}),e.createVNode(V,{variant:"outline",size:"sm",class:"h-8 px-3 text-xs",onClick:D},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(V,{variant:"outline",size:"icon",class:"size-8",onClick:B},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ChevronRight),{size:16})]),_:1})])]),e.createVNode(O,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ae,[e.createVNode(V,{type:"button",variant:"outline",onClick:_},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CalendarIcon),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(L)),1)]),_:1}),e.withDirectives(e.createElementVNode("input",{ref_key:"dateInputRef",ref:z,"onUpdate:modelValue":d[0]||(d[0]=k=>e.isRef(w)?w.value=k:null),type:"date",class:"timeline-date-picker","aria-label":"Select reservation date"},null,512),[[e.vModelText,e.unref(w)]])])]),_:1})]),(f.resources?.length||0)>0?(e.openBlock(),e.createBlock(Te,{key:0,resources:f.resources||[],totals:e.unref(K),viewMode:e.unref(r),"onUpdate:viewMode":d[1]||(d[1]=k=>e.isRef(r)?r.value=k:null),activeChart:e.unref(u),"onUpdate:activeChart":d[2]||(d[2]=k=>e.isRef(u)?u.value=k:null)},null,8,["resources","totals","viewMode","activeChart"])):(e.openBlock(),e.createElementBlock("div",Pe," No resources configured "))]),_:1}),e.createVNode(A,{class:"px-2 sm:p-6"},{default:e.withCtx(()=>[e.unref(c)?(e.openBlock(),e.createElementBlock("div",je,[...d[5]||(d[5]=[e.createElementVNode("div",{class:"text-muted-foreground"},"Loading...",-1)])])):(f.resources?.length||0)===0?(e.openBlock(),e.createElementBlock("div",Fe,[...d[6]||(d[6]=[e.createElementVNode("div",{class:"text-muted-foreground"},"No resources to display",-1)])])):(e.openBlock(),e.createElementBlock("div",Le,[e.unref(r)==="stacked"?(e.openBlock(),e.createBlock(Y,{key:0,config:e.unref(m),style:e.normalizeStyle(e.unref(ee)),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(M.$),{data:e.unref(i),margin:{left:-24},"y-domain":[0,e.unref(U)]},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(I),(k,S)=>(e.openBlock(),e.createBlock(e.unref(ie),{key:k.id,x:(F,Z)=>Z,y:F=>s(F,S),color:F=>te(F,k.id)>0?e.unref(m)[k.id]?.color:ce,"bar-padding":.1,"rounded-corners":2},null,8,["x","y","color"]))),128)),e.createVNode(e.unref(M.O),{type:"x",x:(k,S)=>S,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(X),"tick-format":k=>e.unref(i)[k]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(M.O),{type:"y","num-ticks":3,"tick-line":!1,"domain-line":!1}),e.createVNode(e.unref(M.z)),e.createVNode(e.unref(M.A),{template:e.unref(oe.componentToString)(e.unref(m),e.unref(oe.ChartTooltipContent),{labelFormatter(k){if(k instanceof Date)return"";const S=Math.round(k);return S>=0&&S<e.unref(i).length&&e.unref(i)[S]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config","style"])):(e.openBlock(),e.createBlock(Y,{key:e.unref(u),config:e.unref(m),style:e.normalizeStyle(e.unref(ee)),class:"aspect-auto h-[250px] w-full",cursor:""},{default:e.withCtx(()=>[e.createVNode(e.unref(M.$),{data:e.unref(i),margin:{left:-24},"y-domain":[0,e.unref(R)]},{default:e.withCtx(()=>[e.createVNode(e.unref(ie),{x:(k,S)=>S,y:k=>k[e.unref(u)]||0,color:k=>k[e.unref(u)]>0?e.unref(m)[e.unref(u)]?.color:ce,"bar-padding":.1,"rounded-corners":!1},null,8,["x","y","color"]),e.createVNode(e.unref(M.O),{type:"x",x:(k,S)=>S,"tick-line":!1,"domain-line":!1,"grid-line":!1,"tick-values":e.unref(X),"tick-format":k=>e.unref(i)[k]?.time||""},null,8,["x","tick-values","tick-format"]),e.createVNode(e.unref(M.O),{type:"y","num-ticks":3,"tick-line":!1,"domain-line":!1}),e.createVNode(e.unref(M.z)),e.createVNode(e.unref(M.A),{template:e.unref(oe.componentToString)(e.unref(m),e.unref(oe.ChartTooltipContent),{labelFormatter(k){if(k instanceof Date)return"";const S=Math.round(k);return S>=0&&S<e.unref(i).length&&e.unref(i)[S]?.time||""}}),color:"#0000"},null,8,["template"])]),_:1},8,["data","y-domain"])]),_:1},8,["config","style"]))]))]),_:1})]),_:1})}}}),Ge=ve._export_sfc(qe,[["__scopeId","data-v-a654ef37"]]),He={class:"flex flex-row items-center justify-between gap-2"},Ue={class:"relative mb-4"},Ye={class:"flex gap-1 mb-4 flex-wrap select-none"},Xe={key:0,class:"mb-3 text-sm text-muted-foreground"},Je={key:1,class:"flex items-center justify-center py-8"},Ke={key:2,class:"flex flex-col items-center gap-2 text-center py-8 text-muted-foreground"},Qe={key:3,class:"text-center py-8 text-muted-foreground"},Ze={key:4,class:"-mx-6 @5xl:mx-0 @5xl:space-y-2"},et=["onClick"],tt={class:"flex items-start justify-between"},ot={class:"flex-1"},nt={class:"font-medium"},at={class:"text-sm text-muted-foreground"},rt={class:"text-sm text-muted-foreground"},st={class:"flex items-center gap-4 flex-wrap"},lt={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},it={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},ct={key:0,class:"flex items-center gap-1 mt-1 text-xs text-muted-foreground"},dt={class:"text-right"},ut={key:0,class:"inline-block px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},mt={key:1,class:"inline-block px-2 py-1 text-xs rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"},ft={key:2,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},pt={key:3,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},vt={key:4,class:"inline-block px-2 py-1 text-xs rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"},gt={key:5,class:"text-sm font-medium mt-1"},ht=e.defineComponent({__name:"BookingsList",props:{agendaData:{},activeDate:{},selectedResource:{},resources:{}},emits:["resetSelectedResource"],setup(f,{emit:v}){const o=f,g=v,{params:p}=H.useModuleRoute(),{config:h}=H.useModule(),x=H.useFirebaseIntegration(h.project),i=e.ref([]),l=e.ref(!0),c=e.ref(""),r=e.ref(null),u=e.ref(null),y=e.computed(()=>p.value?.id??p.id??o.agendaData?.id??""),{metadataSchema:z}=ne.useAgendaMetadataSchema(y),w=e.computed(()=>({date:_(o.activeDate),resource:null}));e.provide("event",w);const _=s=>{const t=s.getFullYear(),b=String(s.getMonth()+1).padStart(2,"0"),P=String(s.getDate()).padStart(2,"0");return`${t}-${b}-${P}`},L=e.computed(()=>{let s=i.value;return o.selectedResource&&(s=s.filter(t=>t.resourceId===o.selectedResource)),c.value.trim()&&(s=new ge.Fuse(s,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(c.value).map(b=>b.item)),s}),q=e.computed(()=>L.value.filter(s=>N.value.includes(s.reservationStatus))),B=e.computed(()=>{let s=JSON.parse(JSON.stringify(i.value));return o.selectedResource&&(s=s.filter(t=>t.resourceId===o.selectedResource)),s.some(t=>t.reservationStatus==="approved"||t.reservationStatus==="needs_approval")}),D=e.computed(()=>{const s=i.value.filter(t=>t.reservationStatus==="approved"||t.reservationStatus==="needs_approval");return{spots:s.reduce((t,b)=>t+(b.spots||0),0),bookings:s.length}}),R=()=>{c.value=""},N=e.ref(["needs_approval","approved"]),T=s=>{N.value.includes(s)?N.value=N.value.filter(t=>t!==s):N.value.push(s)},m=(s,t,b=t.date)=>{const P=o.resources.find($=>$.id===t.resourceId),j=s.id||s.orderId||t.orderId||"";return{customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:t.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:j,res_id:t.id,resourceId:t.resourceId,spots:t.spots,date:b,createdAt:s.createdAt,startTime:t.timeslot?.startTime,endTime:t.timeslot?.endTime,reservationPrice:t.totalPrice,reservationBasePrice:t.basePrice,reservationAddOnsPrice:t.addOnsPrice,orderReservationCount:Array.isArray(s.reservations)?s.reservations.length:void 0,pricingOptionId:t.pricingOptionId,pricingOption:t.pricingOption,resourceName:P?.name,resourceColor:P?.color,metadata:s.metadata||{},reservationMetadata:t.metadata||{},refundStatus:t.refundStatus,refundedAt:t.refundedAt,refundedAmount:t.refundedAmount,refunds:Array.isArray(t.refunds)?t.refunds:[],adjustments:s.adjustments||[],reservationAdjustments:t.adjustments||[]}},I=async()=>{await e.nextTick(),await new Promise(s=>{if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>s());return}s()})},X=async s=>{const t=await x.get(h.reservationsCollection,s);if(!t)return;const b={...t,id:t.id||s},P=(b.reservations||[]).map(j=>m(b,j));P.length&&(await I(),u.value?.openDialog({id:b.id,customerInfo:b.customerInfo,status:b.status,createdAt:b.createdAt,metadata:b.metadata||{},reservations:P,adjustments:b.adjustments||[],totalPrice:typeof b.total=="number"?b.total:P.reduce((j,$)=>j+($.reservationPrice||0),0),totalSpots:P.reduce((j,$)=>j+($.spots||0),0)}))},K=async s=>{await I(),r.value?.openDialog(s)},re=s=>s.orderReservationCount===1&&typeof s.total=="number"?s.total:typeof s.reservationPrice=="number"?s.reservationPrice:null,ee=s=>{const t=re(s);return t===null?null:`€${t.toFixed(2)}`},U=async()=>{l.value=!0,i.value=[];try{const s=p.value.id,t=_(o.activeDate),b=new Set;o.resources?.forEach($=>{const G=`${$.id}_${t}`;b.add(G)});const P=await x.find(h.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:s},{field:"status",operator:"==",value:"confirmed"},{field:"flattenedReservationDates",operator:"array-contains-any",value:Array.from(b)}]});let j=[];P.forEach($=>{($.reservations?.filter(Q=>Q.date===t)||[]).forEach(Q=>{j.push(m($,Q,t))})}),i.value=j.sort(($,G)=>$.startTime?.localeCompare(G.startTime||"")||0)}catch(s){console.error("Error loading orders:",s),i.value=[]}finally{l.value=!1}};return(async()=>await U())(),e.watch(()=>o.activeDate,()=>{U()}),(s,t)=>{const b=e.resolveComponent("Badge"),P=e.resolveComponent("CardTitle"),j=e.resolveComponent("CardDescription"),$=e.resolveComponent("Button"),G=e.resolveComponent("CardHeader"),Q=e.resolveComponent("Input"),n=e.resolveComponent("CardContent"),d=e.resolveComponent("Card");return e.openBlock(),e.createBlock(d,{class:"-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]"},{default:e.withCtx(()=>[e.createVNode(G,null,{default:e.withCtx(()=>[e.createElementVNode("div",He,[e.createElementVNode("div",null,[e.createVNode(P,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[t[9]||(t[9]=e.createTextVNode(" Bookings ",-1)),e.unref(D).bookings>0?(e.openBlock(),e.createBlock(b,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(D).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(j,{class:"flex items-center gap-2 mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(e.unref(D).spots)+" total spots",1)]),_:1})]),e.createVNode($,{variant:"ghost",size:"icon",onClick:U,disabled:e.unref(l)},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(l)})},null,8,["class"])]),_:1},8,["disabled"])])]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[e.createVNode(e.unref(E.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(Q,{modelValue:e.unref(c),"onUpdate:modelValue":t[0]||(t[0]=a=>e.isRef(c)?c.value=a:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(c)?(e.openBlock(),e.createBlock($,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:R},{default:e.withCtx(()=>[e.createVNode(e.unref(E.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ye,[f.agendaData.needsApproval?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:t[1]||(t[1]=a=>T("needs_approval")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("needs_approval")}])},[e.unref(N).includes("needs_approval")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Needs Approval ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="needs_approval").length)+") ",1)],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:t[2]||(t[2]=a=>T("approved")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("approved")}])},[e.unref(N).includes("approved")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Approved ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="approved").length)+") ",1)],2),f.agendaData.needsApproval?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:t[3]||(t[3]=a=>T("rejected")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("rejected")}])},[e.unref(N).includes("rejected")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Rejected ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="rejected").length)+") ",1)],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:t[4]||(t[4]=a=>T("cancelled")),class:e.normalizeClass(["flex gap-1.5 items-center px-3 py-1.5 rounded-full text-sm bg-muted",{"opacity-50 hover:opacity-75":!e.unref(N).includes("cancelled")}])},[e.unref(N).includes("cancelled")?(e.openBlock(),e.createBlock(e.unref(E.Eye),{key:0,size:12})):(e.openBlock(),e.createBlock(e.unref(E.EyeOff),{key:1,size:12})),e.createTextVNode(" Cancelled ("+e.toDisplayString(e.unref(i).filter(a=>a.reservationStatus==="cancelled").length)+") ",1)],2)]),e.unref(c)?(e.openBlock(),e.createElementBlock("div",Xe," Showing "+e.toDisplayString(e.unref(q).length)+" of "+e.toDisplayString(e.unref(i).length)+" bookings ",1)):e.createCommentVNode("",!0),e.unref(l)?(e.openBlock(),e.createElementBlock("div",Je,[...t[10]||(t[10]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(q).length===0?(e.openBlock(),e.createElementBlock("div",Ke,[t[13]||(t[13]=e.createTextVNode(" No bookings for this day ",-1)),e.unref(B)?(e.openBlock(),e.createBlock($,{key:0,onClick:t[5]||(t[5]=a=>{N.value=["needs_approval","approved"],c.value=""})},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Reset filters",-1)])]),_:1})):e.createCommentVNode("",!0),f.selectedResource!==null?(e.openBlock(),e.createBlock($,{key:1,onClick:t[6]||(t[6]=a=>g("resetSelectedResource"))},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Reset resource filter",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.unref(q).length===0?(e.openBlock(),e.createElementBlock("div",Qe," No bookings match your search ")):(e.openBlock(),e.createElementBlock("div",Ze,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(q),a=>(e.openBlock(),e.createElementBlock("div",{key:a.res_id||a.id,class:"px-6 @5xl:px3 py-3 border-t last:border-b @5xl:border @5xl:rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:V=>e.unref(r)?.openDialog(a)},[e.createElementVNode("div",tt,[e.createElementVNode("div",ot,[e.createElementVNode("div",nt,e.toDisplayString(a.customerInfo.firstName+" "+a.customerInfo.lastName||"Unknown Customer"),1),e.createElementVNode("div",at,e.toDisplayString(a.customerInfo?.email),1),e.createElementVNode("div",rt,e.toDisplayString(a.customerInfo?.phone),1),e.createElementVNode("div",st,[e.createElementVNode("div",lt,[e.createVNode(e.unref(E.Clock),{size:12}),e.createElementVNode("span",null,e.toDisplayString(a.startTime)+" - "+e.toDisplayString(a.endTime),1)]),e.createElementVNode("div",it,[e.createVNode(e.unref(E.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(a.spots)+" "+e.toDisplayString(a.spots===1?"spot":"spots"),1)]),a.resourceName?(e.openBlock(),e.createElementBlock("div",ct,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:a.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(a.resourceName),1)])):e.createCommentVNode("",!0)]),e.createVNode(ne._sfc_main,{metadata:{...a.metadata,...a.reservationMetadata},schema:e.unref(z),"display-filter":["highlight","badge"],compact:"",class:"mt-1"},null,8,["metadata","schema"])]),e.createElementVNode("div",dt,[a.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",ut,"Needs Approval")):a.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",mt,"Approved")):a.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",ft,"Rejected")):a.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",pt,"Cancelled")):(e.openBlock(),e.createElementBlock("span",vt,"Pending")),ee(a)?(e.openBlock(),e.createElementBlock("div",gt,e.toDisplayString(ee(a)),1)):e.createCommentVNode("",!0)])])],8,et))),128))]))]),_:1}),e.createVNode(ne._sfc_main$1,{ref_key:"reservationDetailDialog",ref:r,agendaData:f.agendaData,resources:f.resources,"show-order-link":"",onCancelled:U,onConfirmed:U,onRejected:U,onTransferred:U,onOpenOrder:t[7]||(t[7]=a=>X(a))},null,8,["agendaData","resources"]),e.createVNode(ne._sfc_main$2,{ref_key:"orderDetailDialog",ref:u,agendaData:f.agendaData,resources:f.resources,onOpenReservation:t[8]||(t[8]=a=>K(a))},null,8,["agendaData","resources"])]),_:1})}}}),xt={class:"@5xl:space-y-6"},yt={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},kt={class:"text-2xl font-semibold tracking-tight"},Ct={class:"flex flex-col md:flex-row gap-2"},bt={class:"grid gap-6 md:grid-cols-2 lg:grid-cols-3"},Vt={class:"md:col-span-2 lg:col-span-3"},St=e.defineComponent({__name:"index",setup(f){const{hasPermission:v}=H.useModulePermissions(),{params:o,resolvePath:g}=H.useModuleRoute(),{config:p}=H.useModule(),h=H.useFirebaseIntegration(p.project),x=e.ref(""),i=e.ref(!0),l=e.ref(new Date),c=e.ref(null),r=e.ref("stacked"),u=e.ref(null),y=e.ref([]);return(async()=>{try{const w=await h.get(p.agendaCollection,o.value.id);x.value=w?.serviceName||"",u.value=w,y.value=w?.resources?.filter(_=>_.isActive)||[]}catch(w){console.error("Error loading data:",w)}finally{i.value=!1}})(),(w,_)=>(e.openBlock(),e.createBlock(fe._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",xt,[e.createElementVNode("div",yt,[e.createElementVNode("div",null,[e.createElementVNode("h1",kt,e.toDisplayString(e.unref(x)||"Dashboard"),1),_[4]||(_[4]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," Overview and analytics for your booking service ",-1))]),e.createElementVNode("div",Ct,[e.unref(v)("manage-reservations")?(e.openBlock(),e.createBlock(he._sfc_main,{key:0,"agenda-data":e.unref(u)},null,8,["agenda-data"])):e.createCommentVNode("",!0)])]),e.createVNode(Ge,{modelValue:e.unref(l),"onUpdate:modelValue":_[0]||(_[0]=L=>e.isRef(l)?l.value=L:null),"view-mode":e.unref(r),"onUpdate:viewMode":_[1]||(_[1]=L=>e.isRef(r)?r.value=L:null),"selected-resource":e.unref(c),"onUpdate:selectedResource":_[2]||(_[2]=L=>e.isRef(c)?c.value=L:null),"agenda-data":e.unref(u),resources:e.unref(y)},null,8,["modelValue","view-mode","selected-resource","agenda-data","resources"]),e.createElementVNode("div",bt,[e.createElementVNode("div",Vt,[e.unref(y).length>0?(e.openBlock(),e.createBlock(ht,{key:0,"agenda-data":e.unref(u),"active-date":e.unref(l),"selected-resource":e.unref(c),resources:e.unref(y),onResetSelectedResource:_[3]||(_[3]=L=>c.value=null)},null,8,["agenda-data","active-date","selected-resource","resources"])):e.createCommentVNode("",!0)])])])]),_:1}))}});exports.default=St;
|