@oneclick.dev/cms-core-modules 0.0.83 → 0.0.85
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-CxKirDdL.mjs → ContentEditor-C5ydvk8b.mjs} +7067 -5886
- package/dist/{ContentEditor-CRFkD4tE.js → ContentEditor-DiveHwSJ.js} +43 -43
- package/dist/{Create-CsqVYhPO.mjs → Create-6uT9HWar.mjs} +35 -35
- package/dist/{Create-ip0MnS0o.js → Create-DuZ5nZrX.js} +1 -1
- package/dist/{DateFormatter-CvOfaUnU.mjs → DateFormatter-2B0R-DY4.mjs} +204 -400
- package/dist/DateFormatter-DbtOLV0L.js +1 -0
- package/dist/{Detail-RMXFuSRQ.js → Detail-BZ-iE9vf.js} +1 -1
- package/dist/{Detail-B4b_FLDa.mjs → Detail-C1Blq61w.mjs} +90 -90
- package/dist/{Detail-BayNaAg9.js → Detail-C8wQiDcv.js} +1 -1
- package/dist/{Detail-CbLk1v37.mjs → Detail-CJVMJDP7.mjs} +17 -17
- package/dist/{Detail-CnK-qbhE.js → Detail-CPqug27l.js} +1 -1
- package/dist/Detail-CjuhjPby.js +1 -0
- package/dist/{Detail-U0mgLKt6.mjs → Detail-CtItxMX4.mjs} +62 -63
- package/dist/{Detail-CVgWHbMC.mjs → Detail-Dnpnmy4-.mjs} +158 -158
- package/dist/{Entries-D7MHylQE.mjs → Entries-BkOPae4R.mjs} +49 -49
- package/dist/Entries-CcEW98F5.js +1 -0
- package/dist/{Find-XPcJxeRH.mjs → Find-Bd1uLqSa.mjs} +55 -55
- package/dist/Find-D4Qa45qC.js +1 -0
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-CDc8MIq2.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-Bc946oSc.mjs} +1 -1
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-StaNp-3y.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js} +1 -1
- package/dist/{Overview-CwCAeBnX.js → Overview-CA8wh_BI.js} +1 -1
- package/dist/{Overview-CgViRnNc.mjs → Overview-D4MFwRI_.mjs} +67 -68
- package/dist/{Overview-B2bFNGhH.js → Overview-Da0XexiT.js} +1 -1
- package/dist/Overview-DeQQ0FY3.js +1 -0
- package/dist/{Overview--XpvBbqz.mjs → Overview-DoOASlNz.mjs} +1 -3
- package/dist/{Overview-Cczt_dcE.mjs → Overview-gJSvftdE.mjs} +34 -34
- package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-B7ks5mbf.mjs → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs} +0 -1
- package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Vxubki_v.js → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js} +1 -1
- package/dist/{SeoHealth-ZpvB7CS2.mjs → SeoHealth-Bc5chnaa.mjs} +14 -14
- package/dist/{SeoHealth-DFZ0LLBH.js → SeoHealth-BkpJ1F2Y.js} +1 -1
- package/dist/TableView-Ei_w_-bn.mjs +5745 -0
- package/dist/TableView-klOTPJKZ.js +4 -0
- package/dist/View-BaFlMcM6.js +1 -0
- package/dist/View-C4MBWRlA.mjs +28 -0
- package/dist/{agenda-Cl3s_FIE.mjs → agenda-C5grvzSa.mjs} +166 -169
- package/dist/agenda-DXMwVWpN.js +1 -0
- package/dist/{availability-B-tRp8hB.mjs → availability-C1NqOFsQ.mjs} +81 -81
- package/dist/{availability-BiBbzEIM.js → availability-D_wnfLsH.js} +1 -1
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-DQPSFSj7.mjs → exceptions-BIwMhYa4.mjs} +1 -1
- package/dist/{exceptions-BA3PsW4n.js → exceptions-Cn7zooEu.js} +1 -1
- package/dist/{index-CBC9dWZ9.js → index-C9pSS15N.js} +2 -2
- package/dist/{index-YOOlBEZB.mjs → index-MwjeLHPP.mjs} +3 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +23 -23
- package/dist/{orders-DZzdsHOW.mjs → orders-DhQ2EFXS.mjs} +157 -157
- package/dist/orders-V1pch_ih.js +1 -0
- package/dist/server-handlers.cjs.js +1 -1
- package/dist/server-handlers.mjs +142 -147
- package/package.json +2 -2
- package/dist/DateFormatter-ls6HfWpS.js +0 -1
- package/dist/Detail-BcboL7NF.js +0 -1
- package/dist/Entries-BPkZ7Jg5.js +0 -1
- package/dist/Find-Ds6OvuH6.js +0 -1
- package/dist/Overview-B-8TLLjh.js +0 -1
- package/dist/TableView-BUPPcHUW.mjs +0 -89505
- package/dist/TableView-CksiPsTL.js +0 -586
- package/dist/View-DDXN0tKD.mjs +0 -25
- package/dist/View-DfzaVOzS.js +0 -1
- package/dist/agenda-rlFma_wn.js +0 -1
- package/dist/floating-ui.dom-B9WYoHj2.js +0 -1
- package/dist/floating-ui.dom-fpIfhXTZ.mjs +0 -1291
- package/dist/index-DYpruS-A-Cw57iwdY.mjs +0 -4210
- package/dist/index-DYpruS-A-DwDXo9Tq.js +0 -88
- package/dist/index-YMaY4uuk-BgpTtr73.js +0 -1
- package/dist/index-YMaY4uuk-C_xV5K9Z.mjs +0 -1300
- package/dist/orders-tP4WdF5q.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function R(e,t){return e-t*Math.floor(e/t)}const Q=1721426;function E(e,t,r,n){t=j(e,t);let a=t-1,o=-2;return r<=2?o=0:T(t)&&(o=-1),Q-1+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)+Math.floor((367*r-362)/12+o+n)}function T(e){return e%4===0&&(e%100!==0||e%400===0)}function j(e,t){return e==="BC"?1-t:t}function $e(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const ye={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class v{fromJulianDay(t){let r=t,n=r-Q,a=Math.floor(n/146097),o=R(n,146097),c=Math.floor(o/36524),i=R(o,36524),l=Math.floor(i/1461),h=R(i,1461),M=Math.floor(h/365),w=a*400+c*100+l*4+M+(c!==4&&M!==4?1:0),[g,m]=$e(w),y=r-E(g,m,1,1),O=2;r<E(g,m,3,1)?O=0:T(m)&&(O=1);let z=Math.floor(((y+O)*12+373)/367),de=r-E(g,m,z,1)+1;return new p(g,m,z,de)}toJulianDay(t){return E(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return ye[T(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return T(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}function me(e,t){var r,n,a,o;return(o=(a=(r=e.isEqual)===null||r===void 0?void 0:r.call(e,t))!==null&&a!==void 0?a:(n=t.isEqual)===null||n===void 0?void 0:n.call(t,e))!==null&&o!==void 0?o:e.identifier===t.identifier}function be(e){return d(Date.now(),e)}function pe(e){return De(be(e))}function X(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function Me(e,t){return L(e)-L(t)}function L(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let P=null,we=!1;function _(){return P==null&&(P=new Intl.DateTimeFormat().resolvedOptions().timeZone),P}function ee(){return we}function D(e){e=f(e,new v);let t=j(e.era,e.year);return te(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function te(e,t,r,n,a,o,c){let i=new Date;return i.setUTCHours(n,a,o,c),i.setUTCFullYear(e,t-1,r),i.getTime()}function H(e,t){if(t==="UTC")return 0;if(e>0&&t===_()&&!ee())return new Date(e).getTimezoneOffset()*-6e4;let{year:r,month:n,day:a,hour:o,minute:c,second:i}=re(e,t);return te(r,n,a,o,c,i,0)-Math.floor(e/1e3)*1e3}const K=new Map;function re(e,t){let r=K.get(t);r||(r=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),K.set(t,r));let n=r.formatToParts(new Date(e)),a={};for(let o of n)o.type!=="literal"&&(a[o.type]=o.value);return{year:a.era==="BC"||a.era==="B"?-a.year+1:+a.year,month:+a.month,day:+a.day,hour:a.hour==="24"?0:+a.hour,minute:+a.minute,second:+a.second}}const G=864e5;function ge(e,t,r,n){return(r===n?[r]:[r,n]).filter(o=>ve(e,t,o))}function ve(e,t,r){let n=re(r,t);return e.year===n.year&&e.month===n.month&&e.day===n.day&&e.hour===n.hour&&e.minute===n.minute&&e.second===n.second}function u(e,t,r="compatible"){let n=x(e);if(t==="UTC")return D(n);if(t===_()&&r==="compatible"&&!ee()){n=f(n,new v);let l=new Date,h=j(n.era,n.year);return l.setFullYear(h,n.month-1,n.day),l.setHours(n.hour,n.minute,n.second,n.millisecond),l.getTime()}let a=D(n),o=H(a-G,t),c=H(a+G,t),i=ge(n,t,a-o,a-c);if(i.length===1)return i[0];if(i.length>1)switch(r){case"compatible":case"earlier":return i[0];case"later":return i[i.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(r){case"earlier":return Math.min(a-o,a-c);case"compatible":case"later":return Math.max(a-o,a-c);case"reject":throw new RangeError("No such absolute time found")}}function ne(e,t,r="compatible"){return new Date(u(e,t,r))}function d(e,t){let r=H(e,t),n=new Date(e+r),a=n.getUTCFullYear(),o=n.getUTCMonth()+1,c=n.getUTCDate(),i=n.getUTCHours(),l=n.getUTCMinutes(),h=n.getUTCSeconds(),M=n.getUTCMilliseconds();return new C(a<1?"BC":"AD",a<1?-a+1:a,o,c,t,r,i,l,h,M)}function De(e){return new p(e.calendar,e.era,e.year,e.month,e.day)}function x(e,t){let r=0,n=0,a=0,o=0;if("timeZone"in e)({hour:r,minute:n,second:a,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:r,minute:n,second:a,millisecond:o}=t),new S(e.calendar,e.era,e.year,e.month,e.day,r,n,a,o)}function f(e,t){if(me(e.calendar,t))return e;let r=t.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=t,n.era=r.era,n.year=r.year,n.month=r.month,n.day=r.day,b(n),n}function xe(e,t,r){if(e instanceof C)return e.timeZone===t?e:Se(e,t);let n=u(e,t,r);return d(n,t)}function Ie(e){let t=D(e)-e.offset;return new Date(t)}function Se(e,t){let r=D(e)-e.offset;return f(d(r,t),e.calendar)}const I=36e5;function B(e,t){let r=e.copy(),n="hour"in r?Te(r,t):0;F(r,t.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e),r.month+=t.months||0,q(r),ae(r),r.day+=(t.weeks||0)*7,r.day+=t.days||0,r.day+=n,Ce(r),r.calendar.balanceDate&&r.calendar.balanceDate(r),r.year<1&&(r.year=1,r.month=1,r.day=1);let a=r.calendar.getYearsInEra(r);if(r.year>a){var o,c;let l=(o=(c=r.calendar).isInverseEra)===null||o===void 0?void 0:o.call(c,r);r.year=a,r.month=l?1:r.calendar.getMonthsInYear(r),r.day=l?1:r.calendar.getDaysInMonth(r)}r.month<1&&(r.month=1,r.day=1);let i=r.calendar.getMonthsInYear(r);return r.month>i&&(r.month=i,r.day=r.calendar.getDaysInMonth(r)),r.day=Math.max(1,Math.min(r.calendar.getDaysInMonth(r),r.day)),r}function F(e,t){var r,n;!((r=(n=e.calendar).isInverseEra)===null||r===void 0)&&r.call(n,e)&&(t=-t),e.year+=t}function q(e){for(;e.month<1;)F(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,F(e,1)}function Ce(e){for(;e.day<1;)e.month--,q(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,q(e)}function ae(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function b(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),ae(e)}function oe(e){let t={};for(let r in e)typeof e[r]=="number"&&(t[r]=-e[r]);return t}function ce(e,t){return B(e,oe(t))}function J(e,t){let r=e.copy();return t.era!=null&&(r.era=t.era),t.year!=null&&(r.year=t.year),t.month!=null&&(r.month=t.month),t.day!=null&&(r.day=t.day),b(r),r}function U(e,t){let r=e.copy();return t.hour!=null&&(r.hour=t.hour),t.minute!=null&&(r.minute=t.minute),t.second!=null&&(r.second=t.second),t.millisecond!=null&&(r.millisecond=t.millisecond),Ye(r),r}function Ee(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Y(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Y(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Y(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Y(e.hour,24),t}function Ye(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Y(e,t){let r=e%t;return r<0&&(r+=t),r}function Te(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Ee(e)}function N(e,t,r,n){let a=e.copy();switch(t){case"era":{let i=e.calendar.getEras(),l=i.indexOf(e.era);if(l<0)throw new Error("Invalid era: "+e.era);l=$(l,r,0,i.length-1,n?.round),a.era=i[l],b(a);break}case"year":var o,c;!((o=(c=a.calendar).isInverseEra)===null||o===void 0)&&o.call(c,a)&&(r=-r),a.year=$(e.year,r,-1/0,9999,n?.round),a.year===-1/0&&(a.year=1),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e);break;case"month":a.month=$(e.month,r,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":a.day=$(e.day,r,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(a),b(a),a}function ie(e,t,r,n){let a=e.copy();switch(t){case"hour":{let o=e.hour,c=0,i=23;if(n?.hourCycle===12){let l=o>=12;c=l?12:0,i=l?23:11}a.hour=$(o,r,c,i,n?.round);break}case"minute":a.minute=$(e.minute,r,0,59,n?.round);break;case"second":a.second=$(e.second,r,0,59,n?.round);break;case"millisecond":a.millisecond=$(e.millisecond,r,0,999,n?.round);break;default:throw new Error("Unsupported field "+t)}return a}function $(e,t,r,n,a=!1){if(a){e+=Math.sign(t),e<r&&(e=n);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>n&&(e=r)}else e+=t,e<r?e=n-(r-e-1):e>n&&(e=r+(e-n-1));return e}function le(e,t){let r;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let a=B(x(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});r=u(a,e.timeZone)}else r=D(e)-e.offset;r+=t.milliseconds||0,r+=(t.seconds||0)*1e3,r+=(t.minutes||0)*6e4,r+=(t.hours||0)*36e5;let n=d(r,e.timeZone);return f(n,e.calendar)}function Ue(e,t){return le(e,oe(t))}function Be(e,t,r,n){switch(t){case"hour":{let a=0,o=23;if(n?.hourCycle===12){let y=e.hour>=12;a=y?12:0,o=y?23:11}let c=x(e),i=f(U(c,{hour:a}),new v),l=[u(i,e.timeZone,"earlier"),u(i,e.timeZone,"later")].filter(y=>d(y,e.timeZone).day===i.day)[0],h=f(U(c,{hour:o}),new v),M=[u(h,e.timeZone,"earlier"),u(h,e.timeZone,"later")].filter(y=>d(y,e.timeZone).day===h.day).pop(),w=D(e)-e.offset,g=Math.floor(w/I),m=w%I;return w=$(g,r,Math.floor(l/I),Math.floor(M/I),n?.round)*I+m,f(d(w,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return ie(e,t,r,n);case"era":case"year":case"month":case"day":{let a=N(x(e),t,r,n),o=u(a,e.timeZone);return f(d(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Oe(e,t,r){let n=x(e),a=U(J(n,t),t);if(a.compare(n)===0)return e;let o=u(a,e.timeZone,r);return f(d(o,e.timeZone),e.calendar)}const Re=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Pe=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/,se=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function ke(e){let t=e.match(Re);if(!t)throw se.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let r=new p(s(t[1],0,9999),s(t[2],1,12),1);return r.day=s(t[3],1,r.calendar.getDaysInMonth(r)),r}function Ae(e){let t=e.match(Pe);if(!t)throw se.test(e)?new Error(`Invalid ISO 8601 date time string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date time string: "+e);let r=s(t[1],-9999,9999),n=r<1?"BC":"AD",a=new S(n,r<1?-r+1:r,s(t[2],1,12),1,t[4]?s(t[4],0,23):0,t[5]?s(t[5],0,59):0,t[6]?s(t[6],0,59):0,t[7]?s(t[7],0,1/0)*1e3:0);return a.day=s(t[3],0,a.calendar.getDaysInMonth(a)),a}function s(e,t,r){let n=Number(e);if(n<t||n>r)throw new RangeError(`Value out of range: ${t} <= ${n} <= ${r}`);return n}function Ze(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function fe(e){let t=f(e,new v),r;return t.era==="BC"?r=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):r=String(t.year).padStart(4,"0"),`${r}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function he(e){return`${fe(e)}T${Ze(e)}`}function He(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let r=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),a=Math.floor(e%36e5%6e4/1e3),o=`${t}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`;return a!==0&&(o+=`:${String(a).padStart(2,"0")}`),o}function Fe(e){return`${he(e)}${He(e.offset)}[${e.timeZone}]`}function qe(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function V(e,t,r){qe(e,t),t.set(e,r)}function W(e){let t=typeof e[0]=="object"?e.shift():new v,r;if(typeof e[0]=="string")r=e.shift();else{let c=t.getEras();r=c[c.length-1]}let n=e.shift(),a=e.shift(),o=e.shift();return[t,r,n,a,o]}var je=new WeakMap;class p{copy(){return this.era?new p(this.calendar,this.era,this.year,this.month,this.day):new p(this.calendar,this.year,this.month,this.day)}add(t){return B(this,t)}subtract(t){return ce(this,t)}set(t){return J(this,t)}cycle(t,r,n){return N(this,t,r,n)}toDate(t){return ne(this,t)}toString(){return fe(this)}compare(t){return X(this,t)}constructor(...t){V(this,je,{writable:!0,value:void 0});let[r,n,a,o,c]=W(t);this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,b(this)}}var _e=new WeakMap;class S{copy(){return this.era?new S(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new S(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return B(this,t)}subtract(t){return ce(this,t)}set(t){return J(U(this,t),t)}cycle(t,r,n){switch(t){case"era":case"year":case"month":case"day":return N(this,t,r,n);default:return ie(this,t,r,n)}}toDate(t,r){return ne(this,t,r)}toString(){return he(this)}compare(t){let r=X(this,t);return r===0?Me(this,x(t)):r}constructor(...t){V(this,_e,{writable:!0,value:void 0});let[r,n,a,o,c]=W(t);this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,b(this)}}var Je=new WeakMap;class C{copy(){return this.era?new C(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new C(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return le(this,t)}subtract(t){return Ue(this,t)}set(t,r){return Oe(this,t,r)}cycle(t,r,n){return Be(this,t,r,n)}toDate(){return Ie(this)}toString(){return Fe(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-xe(t,this.timeZone).toDate().getTime()}constructor(...t){V(this,Je,{writable:!0,value:void 0});let[r,n,a,o,c]=W(t),i=t.shift(),l=t.shift();this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,this.timeZone=i,this.offset=l,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,b(this)}}let k=new Map;class Ne{format(t){return this.formatter.format(t)}formatToParts(t){return this.formatter.formatToParts(t)}formatRange(t,r){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(t,r);if(r<t)throw new RangeError("End date must be >= start date");return`${this.formatter.format(t)} – ${this.formatter.format(r)}`}formatRangeToParts(t,r){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(t,r);if(r<t)throw new RangeError("End date must be >= start date");let n=this.formatter.formatToParts(t),a=this.formatter.formatToParts(r);return[...n.map(o=>({...o,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...a.map(o=>({...o,source:"endRange"}))]}resolvedOptions(){let t=this.formatter.resolvedOptions();return ze()&&(this.resolvedHourCycle||(this.resolvedHourCycle=Le(t.locale,this.options)),t.hourCycle=this.resolvedHourCycle,t.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),t.calendar==="ethiopic-amete-alem"&&(t.calendar="ethioaa"),t}constructor(t,r={}){this.formatter=ue(t,r),this.options=r}}const Ve={true:{ja:"h11"},false:{}};function ue(e,t={}){if(typeof t.hour12=="boolean"&&We()){t={...t};let a=Ve[String(t.hour12)][e.split("-")[0]],o=t.hour12?"h12":"h23";t.hourCycle=a??o,delete t.hour12}let r=e+(t?Object.entries(t).sort((a,o)=>a[0]<o[0]?-1:1).join():"");if(k.has(r))return k.get(r);let n=new Intl.DateTimeFormat(e,t);return k.set(r,n),n}let A=null;function We(){return A==null&&(A=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),A}let Z=null;function ze(){return Z==null&&(Z=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),Z}function Le(e,t){if(!t.timeStyle&&!t.hour)return;e=e.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),e+=(e.includes("-u-")?"":"-u")+"-nu-latn";let r=ue(e,{...t,timeZone:void 0}),n=parseInt(r.formatToParts(new Date(2020,2,3,0)).find(o=>o.type==="hour").value,10),a=parseInt(r.formatToParts(new Date(2020,2,3,23)).find(o=>o.type==="hour").value,10);if(n===0&&a===23)return"h23";if(n===24&&a===23)return"h24";if(n===0&&a===11)return"h11";if(n===12&&a===11)return"h12";throw new Error("Unexpected hour cycle result")}exports.$14e0f24ef4ac5c92$export$aa8b41735afcabd2=_;exports.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3=pe;exports.$35ea8db9cb2ccb90$export$99faa760c7908e4f=p;exports.$fae977aafc393c5c$export$588937bcd60ade55=Ae;exports.$fae977aafc393c5c$export$6b862160d295c8e=ke;exports.$fb18d541ea1ad717$export$ad991b66133851cf=Ne;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B=require("./utils-D6CaKJbp.js"),u=require("@oneclick.dev/cms-kit"),d=require("./DateFormatter-ls6HfWpS.js"),G={class:"relative @container"},O={key:0,class:"max-w-5xl mx-auto mt-4"},R={class:"flex flex-row gap-4 justify-between mb-6"},W={class:"flex items-center"},Z={class:"text-lg font-semibold mx-2 uppercase"},K={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},Y={key:1,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},H={class:"font-medium mb-2 uppercase"},J={class:"mb-6"},Q={key:0},X={key:1},ee={key:2},te={class:"flex flex-wrap gap-12 mb-6"},oe={key:0,class:"grid gap-2"},le={class:"flex items-center gap-2"},ae={key:0,class:"text-lg"},ne={key:1,class:"text-lg"},se={key:1,class:"grid gap-2"},re={class:"flex items-center space-x-2"},de={class:"flex gap-4 mb-6"},ue={class:"flex flex-col"},ie={key:0,class:"-ml-2"},ce={key:1,class:"text-xs text-muted-foreground mt-2"},me={class:"flex flex-col"},pe={key:0,class:"-ml-2"},ve={key:1,class:"text-xs text-muted-foreground mt-2"},fe={class:"flex justify-end gap-2 mt-6"},xe=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(E){let i,x;const m=E,{log:Ve,logWarning:Ce,logError:Ne}=u.useLogs(),{params:V,navigateTo:C}=u.useModuleRoute(),{getModuleData:S}=u.useModuleStorage(),{confirm:T}=useConfirmation(),p=e.ref([]);p.value=([i,x]=e.withAsyncContext(()=>S("promo-types")),i=await i,x(),i||[]);const N=u.useFirebaseIntegration(m.config.project),o=e.ref(null),v=e.ref(!1),a=e.computed(()=>(o.value?.usageCount??0)>0),s=e.computed(()=>p.value.find(f=>f.key===o.value?.type)||null);u.useModuleBreadcrumbs(()=>[{text:"Promo codes list",href:o.value?.code?"/promo-codes":""},{text:o.value?.code||""}]);const g=new d.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),A=async()=>{o.value=await N.get(m.config.promoCodeCollection,V.value.promoCodeId),o.value.startsAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.startsAt?.replace(/\.\d{3}Z$/,"")),o.value.expiresAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.expiresAt?.replace(/\.\d{3}Z$/,""))},$=async()=>{await T(`Are you sure you want to delete the code "${o.value?.code}"?`)&&(await N.remove(m.config.promoCodeCollection,V.value.promoCodeId),C("/promo-codes"))};return A(),(f,t)=>{const r=e.resolveComponent("Button"),n=e.resolveComponent("Label"),k=e.resolveComponent("Input"),h=e.resolveComponent("SelectValue"),U=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),L=e.resolveComponent("Select"),j=e.resolveComponent("Switch"),_=e.resolveComponent("PopoverTrigger"),b=e.resolveComponent("Calendar"),y=e.resolveComponent("PopoverContent"),w=e.resolveComponent("Popover"),q=e.resolveComponent("Textarea"),z=e.resolveComponent("Loader2"),M=e.resolveComponent("CardContent"),F=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",G,[o.value?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",R,[e.createElementVNode("div",W,[e.createVNode(r,{variant:"ghost",onClick:t[0]||(t[0]=l=>e.unref(C)("/promo-codes"))},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(c.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Z,e.toDisplayString(o.value.code),1),o.value.expiresAt>new Date?(e.openBlock(),e.createElementBlock("span",K,"Active")):(e.openBlock(),e.createElementBlock("span",Y,"Expired"))])]),e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createElementVNode("h3",H,e.toDisplayString(o.value.code),1),e.createElementVNode("p",J,[t[14]||(t[14]=e.createTextVNode(" This promo code has been created on ",-1)),e.createElementVNode("strong",null,e.toDisplayString(new Date(o.value.createdAt).toLocaleString()),1),t[15]||(t[15]=e.createTextVNode(".",-1)),t[16]||(t[16]=e.createElementVNode("br",null,null,-1)),o.value.usageCount===1?(e.openBlock(),e.createElementBlock("span",Q,[...t[11]||(t[11]=[e.createTextVNode("It has been used ",-1),e.createElementVNode("strong",null,"1 time",-1),e.createTextVNode(", so you can't edit it.",-1)])])):o.value.usageCount>1?(e.openBlock(),e.createElementBlock("span",X,[t[12]||(t[12]=e.createTextVNode("It has been used ",-1)),e.createElementVNode("strong",null,e.toDisplayString(o.value.usageCount)+" times",1),t[13]||(t[13]=e.createTextVNode(", so you can't edit it.",-1))])):(e.openBlock(),e.createElementBlock("span",ee,"It has not been used yet."))]),e.createVNode(n,{for:"code",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Promo Code",-1)])]),_:1}),e.createVNode(k,{id:"code",modelValue:o.value.code,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value.code=l),disabled:a.value,class:"mb-6 uppercase"},null,8,["modelValue","disabled"]),e.createElementVNode("div",null,[t[27]||(t[27]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Value",-1)),e.createVNode(L,{modelValue:o.value.type,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value.type=l)},{default:e.withCtx(()=>[e.createVNode(U,{class:"w-[200px] mb-4",disabled:a.value},{default:e.withCtx(()=>[e.createVNode(h,{placeholder:"Select a promo type"})]),_:1},8,["disabled"]),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,l=>(e.openBlock(),e.createBlock(D,{key:l.key,value:l.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",te,[s.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(n,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",le,[s.value?.valuePrefix?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(s.value?.valuePrefix),1)):e.createCommentVNode("",!0),e.createVNode(k,{modelValue:o.value.value,"onUpdate:modelValue":t[3]||(t[3]=l=>o.value.value=l),id:"discountValue",disabled:a.value},null,8,["modelValue","disabled"]),s.value?.valueSuffix?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(s.value?.valueSuffix),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),s.value?.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(n,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",re,[e.createVNode(j,{id:"unlimitedUses",modelValue:o.value.unlimitedUses,"onUpdate:modelValue":t[4]||(t[4]=l=>o.value.unlimitedUses=l),disabled:a.value},null,8,["modelValue","disabled"]),e.createVNode(n,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)]),t[28]||(t[28]=e.createElementVNode("h3",{class:"font-medium"},"Availability",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"When will this code be available?",-1)),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.startsAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.startsAt?e.unref(g).format(o.value.startsAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.startsAt,"onUpdate:modelValue":t[5]||(t[5]=l=>o.value.startsAt=l),"initial-focus":"",minValue:e.unref(d.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.startsAt?(e.openBlock(),e.createElementBlock("div",ie,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[6]||(t[6]=l=>o.value.startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ce,"Not set - codes will be available immediately"))]),e.createElementVNode("div",me,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.expiresAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.expiresAt?e.unref(g).format(o.value.expiresAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.expiresAt,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value.expiresAt=l),"initial-focus":"",minValue:o.value.startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.expiresAt?(e.openBlock(),e.createElementBlock("div",pe,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[8]||(t[8]=l=>o.value.expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ve,"Not set - codes will never expire"))])]),e.createVNode(n,{for:"note",class:"text-lg font-medium"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Note",-1)])]),_:1}),e.createVNode(n,{for:"note",class:"font-normal text-sm text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Internal note, you can always edit this later",-1)])]),_:1}),e.createVNode(q,{modelValue:o.value.note,"onUpdate:modelValue":t[9]||(t[9]=l=>o.value.note=l),id:"note"},null,8,["modelValue"]),e.createElementVNode("div",fe,[e.createVNode(r,{variant:"destructive",onClick:t[10]||(t[10]=l=>$()),disabled:v.value},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Code ",-1)])]),_:1},8,["disabled"]),e.createVNode(r,{disabled:v.value},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(z,{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[26]||(t[26]=e.createTextVNode(" Update Code ",-1))]),_:1},8,["disabled"])])])]),_:1})]),_:1}),e.createTextVNode(" "+e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)])}}});exports.default=xe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B=require("./utils-D6CaKJbp.js"),u=require("@oneclick.dev/cms-kit"),d=require("./DateFormatter-DbtOLV0L.js"),G={class:"relative @container"},O={key:0,class:"max-w-5xl mx-auto mt-4"},R={class:"flex flex-row gap-4 justify-between mb-6"},W={class:"flex items-center"},Z={class:"text-lg font-semibold mx-2 uppercase"},K={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},Y={key:1,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},H={class:"font-medium mb-2 uppercase"},J={class:"mb-6"},Q={key:0},X={key:1},ee={key:2},te={class:"flex flex-wrap gap-12 mb-6"},oe={key:0,class:"grid gap-2"},le={class:"flex items-center gap-2"},ae={key:0,class:"text-lg"},ne={key:1,class:"text-lg"},se={key:1,class:"grid gap-2"},re={class:"flex items-center space-x-2"},de={class:"flex gap-4 mb-6"},ue={class:"flex flex-col"},ie={key:0,class:"-ml-2"},ce={key:1,class:"text-xs text-muted-foreground mt-2"},me={class:"flex flex-col"},pe={key:0,class:"-ml-2"},ve={key:1,class:"text-xs text-muted-foreground mt-2"},fe={class:"flex justify-end gap-2 mt-6"},xe=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(E){let i,x;const m=E,{log:Ve,logWarning:Ce,logError:Ne}=u.useLogs(),{params:V,navigateTo:C}=u.useModuleRoute(),{getModuleData:S}=u.useModuleStorage(),{confirm:T}=useConfirmation(),p=e.ref([]);p.value=([i,x]=e.withAsyncContext(()=>S("promo-types")),i=await i,x(),i||[]);const N=u.useFirebaseIntegration(m.config.project),o=e.ref(null),v=e.ref(!1),a=e.computed(()=>(o.value?.usageCount??0)>0),s=e.computed(()=>p.value.find(f=>f.key===o.value?.type)||null);u.useModuleBreadcrumbs(()=>[{text:"Promo codes list",href:o.value?.code?"/promo-codes":""},{text:o.value?.code||""}]);const g=new d.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),A=async()=>{o.value=await N.get(m.config.promoCodeCollection,V.value.promoCodeId),o.value.startsAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.startsAt?.replace(/\.\d{3}Z$/,"")),o.value.expiresAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.expiresAt?.replace(/\.\d{3}Z$/,""))},$=async()=>{await T(`Are you sure you want to delete the code "${o.value?.code}"?`)&&(await N.remove(m.config.promoCodeCollection,V.value.promoCodeId),C("/promo-codes"))};return A(),(f,t)=>{const r=e.resolveComponent("Button"),n=e.resolveComponent("Label"),k=e.resolveComponent("Input"),h=e.resolveComponent("SelectValue"),U=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),L=e.resolveComponent("Select"),j=e.resolveComponent("Switch"),_=e.resolveComponent("PopoverTrigger"),b=e.resolveComponent("Calendar"),y=e.resolveComponent("PopoverContent"),w=e.resolveComponent("Popover"),q=e.resolveComponent("Textarea"),z=e.resolveComponent("Loader2"),M=e.resolveComponent("CardContent"),F=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",G,[o.value?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",R,[e.createElementVNode("div",W,[e.createVNode(r,{variant:"ghost",onClick:t[0]||(t[0]=l=>e.unref(C)("/promo-codes"))},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(c.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Z,e.toDisplayString(o.value.code),1),o.value.expiresAt>new Date?(e.openBlock(),e.createElementBlock("span",K,"Active")):(e.openBlock(),e.createElementBlock("span",Y,"Expired"))])]),e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createElementVNode("h3",H,e.toDisplayString(o.value.code),1),e.createElementVNode("p",J,[t[14]||(t[14]=e.createTextVNode(" This promo code has been created on ",-1)),e.createElementVNode("strong",null,e.toDisplayString(new Date(o.value.createdAt).toLocaleString()),1),t[15]||(t[15]=e.createTextVNode(".",-1)),t[16]||(t[16]=e.createElementVNode("br",null,null,-1)),o.value.usageCount===1?(e.openBlock(),e.createElementBlock("span",Q,[...t[11]||(t[11]=[e.createTextVNode("It has been used ",-1),e.createElementVNode("strong",null,"1 time",-1),e.createTextVNode(", so you can't edit it.",-1)])])):o.value.usageCount>1?(e.openBlock(),e.createElementBlock("span",X,[t[12]||(t[12]=e.createTextVNode("It has been used ",-1)),e.createElementVNode("strong",null,e.toDisplayString(o.value.usageCount)+" times",1),t[13]||(t[13]=e.createTextVNode(", so you can't edit it.",-1))])):(e.openBlock(),e.createElementBlock("span",ee,"It has not been used yet."))]),e.createVNode(n,{for:"code",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Promo Code",-1)])]),_:1}),e.createVNode(k,{id:"code",modelValue:o.value.code,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value.code=l),disabled:a.value,class:"mb-6 uppercase"},null,8,["modelValue","disabled"]),e.createElementVNode("div",null,[t[27]||(t[27]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Value",-1)),e.createVNode(L,{modelValue:o.value.type,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value.type=l)},{default:e.withCtx(()=>[e.createVNode(U,{class:"w-[200px] mb-4",disabled:a.value},{default:e.withCtx(()=>[e.createVNode(h,{placeholder:"Select a promo type"})]),_:1},8,["disabled"]),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,l=>(e.openBlock(),e.createBlock(D,{key:l.key,value:l.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",te,[s.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(n,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",le,[s.value?.valuePrefix?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(s.value?.valuePrefix),1)):e.createCommentVNode("",!0),e.createVNode(k,{modelValue:o.value.value,"onUpdate:modelValue":t[3]||(t[3]=l=>o.value.value=l),id:"discountValue",disabled:a.value},null,8,["modelValue","disabled"]),s.value?.valueSuffix?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(s.value?.valueSuffix),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),s.value?.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(n,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",re,[e.createVNode(j,{id:"unlimitedUses",modelValue:o.value.unlimitedUses,"onUpdate:modelValue":t[4]||(t[4]=l=>o.value.unlimitedUses=l),disabled:a.value},null,8,["modelValue","disabled"]),e.createVNode(n,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)]),t[28]||(t[28]=e.createElementVNode("h3",{class:"font-medium"},"Availability",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"When will this code be available?",-1)),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.startsAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.startsAt?e.unref(g).format(o.value.startsAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.startsAt,"onUpdate:modelValue":t[5]||(t[5]=l=>o.value.startsAt=l),"initial-focus":"",minValue:e.unref(d.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.startsAt?(e.openBlock(),e.createElementBlock("div",ie,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[6]||(t[6]=l=>o.value.startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ce,"Not set - codes will be available immediately"))]),e.createElementVNode("div",me,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.expiresAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.expiresAt?e.unref(g).format(o.value.expiresAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.expiresAt,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value.expiresAt=l),"initial-focus":"",minValue:o.value.startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.expiresAt?(e.openBlock(),e.createElementBlock("div",pe,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[8]||(t[8]=l=>o.value.expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ve,"Not set - codes will never expire"))])]),e.createVNode(n,{for:"note",class:"text-lg font-medium"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Note",-1)])]),_:1}),e.createVNode(n,{for:"note",class:"font-normal text-sm text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Internal note, you can always edit this later",-1)])]),_:1}),e.createVNode(q,{modelValue:o.value.note,"onUpdate:modelValue":t[9]||(t[9]=l=>o.value.note=l),id:"note"},null,8,["modelValue"]),e.createElementVNode("div",fe,[e.createVNode(r,{variant:"destructive",onClick:t[10]||(t[10]=l=>$()),disabled:v.value},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Code ",-1)])]),_:1},8,["disabled"]),e.createVNode(r,{disabled:v.value},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(z,{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[26]||(t[26]=e.createTextVNode(" Update Code ",-1))]),_:1},8,["disabled"])])])]),_:1})]),_:1}),e.createTextVNode(" "+e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)])}}});exports.default=xe;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as B, inject as G, resolveComponent as c, openBlock as r, createBlock as
|
|
1
|
+
import { defineComponent as B, inject as G, resolveComponent as c, openBlock as r, createBlock as h, withCtx as l, createVNode as t, createElementVNode as s, createTextVNode as d, isRef as j, unref as e, createElementBlock as C, toDisplayString as y, createCommentVNode as g, withModifiers as Y, watch as Z, provide as R, computed as ee, ref as te, onMounted as le } from "vue";
|
|
2
2
|
import { u as E, a as N, t as oe, o as q, s as M, f as se } from "./vee-validate-zod-CcOwoF6y.mjs";
|
|
3
3
|
import { X as ne, ImagePlus as ie, Tag as ae, ChevronRight as re, Trash as ce, Loader2 as W } from "lucide-vue-next";
|
|
4
4
|
import { g as ue } from "./google-CvtuJwgk.mjs";
|
|
5
5
|
import { useModulePermissions as de, useModuleRoute as pe, useConfirmation as me, useFirebaseIntegration as fe, useModuleBreadcrumbs as _e } from "@oneclick.dev/cms-kit";
|
|
6
|
-
import { t as
|
|
6
|
+
import { t as P } from "./index-RLz1QPrf.mjs";
|
|
7
7
|
const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2" }, be = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "text-red-500 text-sm mt-1"
|
|
@@ -18,12 +18,12 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
18
18
|
setup(U) {
|
|
19
19
|
const p = G("sources");
|
|
20
20
|
G("defaultSource");
|
|
21
|
-
const { errors: m } = E(), { value:
|
|
21
|
+
const { errors: m } = E(), { value: b } = N("title"), { value: n } = N("description"), { value: f } = N("thumbnail"), S = (i) => {
|
|
22
22
|
f.value = i;
|
|
23
23
|
};
|
|
24
24
|
return (i, a) => {
|
|
25
|
-
const _ = c("Label"), V = c("Input"), T = c("Textarea"), I = c("Button"),
|
|
26
|
-
return r(),
|
|
25
|
+
const _ = c("Label"), V = c("Input"), T = c("Textarea"), I = c("Button"), v = c("MediaPickerDialog"), L = c("CardContent"), F = c("Card");
|
|
26
|
+
return r(), h(F, null, {
|
|
27
27
|
default: l(() => [
|
|
28
28
|
t(L, { class: "flex flex-col gap-4" }, {
|
|
29
29
|
default: l(() => [
|
|
@@ -42,10 +42,10 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
42
42
|
type: "text",
|
|
43
43
|
id: "title",
|
|
44
44
|
placeholder: "Summer collection",
|
|
45
|
-
modelValue: e(
|
|
46
|
-
"onUpdate:modelValue": a[0] || (a[0] = (
|
|
45
|
+
modelValue: e(b),
|
|
46
|
+
"onUpdate:modelValue": a[0] || (a[0] = (k) => j(b) ? b.value = k : null)
|
|
47
47
|
}, null, 8, ["modelValue"]),
|
|
48
|
-
e(m).title ? (r(),
|
|
48
|
+
e(m).title ? (r(), C("p", be, y(e(m).title), 1)) : g("", !0)
|
|
49
49
|
])
|
|
50
50
|
]),
|
|
51
51
|
s("div", ve, [
|
|
@@ -63,9 +63,9 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
63
63
|
id: "description",
|
|
64
64
|
placeholder: "Fresh, vibrant, and bold. The perfect collection for the summer season.",
|
|
65
65
|
modelValue: e(n),
|
|
66
|
-
"onUpdate:modelValue": a[1] || (a[1] = (
|
|
66
|
+
"onUpdate:modelValue": a[1] || (a[1] = (k) => j(n) ? n.value = k : null)
|
|
67
67
|
}, null, 8, ["modelValue"]),
|
|
68
|
-
e(m).description ? (r(),
|
|
68
|
+
e(m).description ? (r(), C("p", we, y(e(m).description), 1)) : g("", !0)
|
|
69
69
|
])
|
|
70
70
|
]),
|
|
71
71
|
s("div", ye, [
|
|
@@ -80,24 +80,24 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
80
80
|
])]),
|
|
81
81
|
_: 1
|
|
82
82
|
}),
|
|
83
|
-
e(f) ? (r(),
|
|
83
|
+
e(f) ? (r(), h(I, {
|
|
84
84
|
key: 0,
|
|
85
85
|
variant: "ghost",
|
|
86
86
|
size: "icon",
|
|
87
|
-
onClick: a[2] || (a[2] = (
|
|
87
|
+
onClick: a[2] || (a[2] = (k) => f.value = "")
|
|
88
88
|
}, {
|
|
89
89
|
default: l(() => [
|
|
90
90
|
t(e(ne), { class: "size-4" })
|
|
91
91
|
]),
|
|
92
92
|
_: 1
|
|
93
|
-
})) :
|
|
93
|
+
})) : g("", !0)
|
|
94
94
|
]),
|
|
95
95
|
s("div", ke, [
|
|
96
|
-
t(
|
|
96
|
+
t(v, {
|
|
97
97
|
sources: e(p),
|
|
98
98
|
maxFiles: 1,
|
|
99
99
|
"initial-value": e(f) ? [e(f)] : [],
|
|
100
|
-
onSubmit: a[4] || (a[4] = (
|
|
100
|
+
onSubmit: a[4] || (a[4] = (k) => S(k))
|
|
101
101
|
}, {
|
|
102
102
|
default: l(() => [
|
|
103
103
|
s("button", {
|
|
@@ -106,12 +106,12 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
106
106
|
tabindex: "-1",
|
|
107
107
|
class: "cursor-pointer block"
|
|
108
108
|
}, [
|
|
109
|
-
e(f) ? (r(),
|
|
109
|
+
e(f) ? (r(), C("img", {
|
|
110
110
|
key: 1,
|
|
111
111
|
src: e(f),
|
|
112
112
|
class: "size-42 rounded-md object-cover",
|
|
113
113
|
draggable: "false"
|
|
114
|
-
}, null, 8, $e)) : (r(),
|
|
114
|
+
}, null, 8, $e)) : (r(), h(I, {
|
|
115
115
|
key: 0,
|
|
116
116
|
variant: "outline",
|
|
117
117
|
class: "size-42 border-dashed cursor-pointer"
|
|
@@ -125,7 +125,7 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
125
125
|
]),
|
|
126
126
|
_: 1
|
|
127
127
|
}, 8, ["sources", "initial-value"]),
|
|
128
|
-
e(m).thumbnail ? (r(),
|
|
128
|
+
e(m).thumbnail ? (r(), C("p", Me, y(e(m).thumbnail), 1)) : g("", !0)
|
|
129
129
|
])
|
|
130
130
|
])
|
|
131
131
|
])
|
|
@@ -137,7 +137,7 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
}), Te = { class: "bg-white dark:bg-gray-50 border-4 dark:border-gray-600 p-4 rounded-lg mb-4" }, Ie = { class: "flex items-center gap-2 mb-2" },
|
|
140
|
+
}), Te = { class: "bg-white dark:bg-gray-50 border-4 dark:border-gray-600 p-4 rounded-lg mb-4" }, Ie = { class: "flex items-center gap-2 mb-2" }, ze = ["src"], Pe = { class: "text-[#1a0dab] text-lg" }, Ne = { class: "text-[#006621] text-[13px]" }, De = { class: "text-[#545454] text-[13px]" }, Ue = { class: "flex flex-col gap-4 mb-4" }, Fe = { class: "flex flex-col" }, je = {
|
|
141
141
|
key: 0,
|
|
142
142
|
class: "text-red-500 text-sm mt-1"
|
|
143
143
|
}, Be = { class: "flex flex-col gap-4 mb-4" }, Le = { class: "flex flex-col" }, Ee = {
|
|
@@ -155,15 +155,15 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
155
155
|
}, qe = /* @__PURE__ */ B({
|
|
156
156
|
__name: "SEO",
|
|
157
157
|
setup(U) {
|
|
158
|
-
const { errors: p } = E(), { value: m } = N("title"), { value:
|
|
159
|
-
function f(
|
|
160
|
-
return
|
|
158
|
+
const { errors: p } = E(), { value: m } = N("title"), { value: b } = N("slug"), { value: n } = N("seo");
|
|
159
|
+
function f(S) {
|
|
160
|
+
return S ? S.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/[-\s]+/g, "-") : "";
|
|
161
161
|
}
|
|
162
|
-
return Z(m, (
|
|
163
|
-
(!
|
|
164
|
-
}), (
|
|
162
|
+
return Z(m, (S, i) => {
|
|
163
|
+
(!b.value || f(i) === b.value) && (b.value = f(S)), (!n.value.title || i === n.value.title) && (n.value.title = S);
|
|
164
|
+
}), (S, i) => {
|
|
165
165
|
const a = c("Label"), _ = c("Input"), V = c("Textarea"), T = c("CardContent"), I = c("Card");
|
|
166
|
-
return r(),
|
|
166
|
+
return r(), h(I, null, {
|
|
167
167
|
default: l(() => [
|
|
168
168
|
t(T, null, {
|
|
169
169
|
default: l(() => [
|
|
@@ -175,11 +175,11 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
175
175
|
alt: "Google",
|
|
176
176
|
class: "w-16 pointer-events-none",
|
|
177
177
|
draggable: "false"
|
|
178
|
-
}, null, 8,
|
|
178
|
+
}, null, 8, ze),
|
|
179
179
|
i[3] || (i[3] = s("span", { class: "text-[#4186f5] font-medium text-xs" }, "Preview", -1))
|
|
180
180
|
]),
|
|
181
|
-
s("p",
|
|
182
|
-
s("p", Ne, y(e(
|
|
181
|
+
s("p", Pe, y(e(n).title), 1),
|
|
182
|
+
s("p", Ne, y(e(b)), 1),
|
|
183
183
|
s("p", De, y(e(n).description?.slice(0, 155)) + y(e(n).description?.length > 155 ? " ..." : ""), 1)
|
|
184
184
|
]),
|
|
185
185
|
s("div", Ue, [
|
|
@@ -196,10 +196,10 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
196
196
|
t(_, {
|
|
197
197
|
id: "slug",
|
|
198
198
|
placeholder: "t-shirt-with-red-heart",
|
|
199
|
-
modelValue: e(
|
|
200
|
-
"onUpdate:modelValue": i[0] || (i[0] = (
|
|
199
|
+
modelValue: e(b),
|
|
200
|
+
"onUpdate:modelValue": i[0] || (i[0] = (v) => j(b) ? b.value = v : null)
|
|
201
201
|
}, null, 8, ["modelValue"]),
|
|
202
|
-
e(p).slug ? (r(),
|
|
202
|
+
e(p).slug ? (r(), C("p", je, y(e(p).slug), 1)) : g("", !0)
|
|
203
203
|
])
|
|
204
204
|
]),
|
|
205
205
|
s("div", Be, [
|
|
@@ -217,9 +217,9 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
217
217
|
id: "meta-title",
|
|
218
218
|
placeholder: "T-shirt with red heart",
|
|
219
219
|
modelValue: e(n).title,
|
|
220
|
-
"onUpdate:modelValue": i[1] || (i[1] = (
|
|
220
|
+
"onUpdate:modelValue": i[1] || (i[1] = (v) => e(n).title = v)
|
|
221
221
|
}, null, 8, ["modelValue"]),
|
|
222
|
-
e(p).seo?.title ? (r(),
|
|
222
|
+
e(p).seo?.title ? (r(), C("p", Ee, y(e(p).seo.title), 1)) : g("", !0)
|
|
223
223
|
])
|
|
224
224
|
]),
|
|
225
225
|
s("div", Oe, [
|
|
@@ -237,10 +237,10 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
237
237
|
id: "meta-description",
|
|
238
238
|
placeholder: "Lovely T-shirt featuring a red heart",
|
|
239
239
|
modelValue: e(n).description,
|
|
240
|
-
"onUpdate:modelValue": i[2] || (i[2] = (
|
|
240
|
+
"onUpdate:modelValue": i[2] || (i[2] = (v) => e(n).description = v),
|
|
241
241
|
class: "mb-1 resize-none"
|
|
242
242
|
}, null, 8, ["modelValue"]),
|
|
243
|
-
e(p).seo?.description ? (r(),
|
|
243
|
+
e(p).seo?.description ? (r(), C("p", Ae, y(e(p).seo.description), 1)) : e(n).description.length < 155 ? (r(), C("p", Ge, y(e(n).description.length) + " characters", 1)) : (r(), C("p", Re, "Please keep it under 155 characters"))
|
|
244
244
|
])
|
|
245
245
|
])
|
|
246
246
|
]),
|
|
@@ -261,23 +261,23 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
261
261
|
__name: "Status",
|
|
262
262
|
setup(U) {
|
|
263
263
|
const { errors: p } = E(), { value: m } = N("status");
|
|
264
|
-
return (
|
|
265
|
-
const f = c("SelectValue"),
|
|
266
|
-
return r(),
|
|
264
|
+
return (b, n) => {
|
|
265
|
+
const f = c("SelectValue"), S = c("SelectTrigger"), i = c("SelectItem"), a = c("SelectGroup"), _ = c("SelectContent"), V = c("Select"), T = c("CardContent"), I = c("Card");
|
|
266
|
+
return r(), h(I, null, {
|
|
267
267
|
default: l(() => [
|
|
268
268
|
t(T, null, {
|
|
269
269
|
default: l(() => [
|
|
270
270
|
n[3] || (n[3] = s("p", { class: "text-md font-semibold mb-2" }, "Status", -1)),
|
|
271
271
|
t(V, {
|
|
272
272
|
modelValue: e(m),
|
|
273
|
-
"onUpdate:modelValue": n[0] || (n[0] = (
|
|
273
|
+
"onUpdate:modelValue": n[0] || (n[0] = (v) => j(m) ? m.value = v : null),
|
|
274
274
|
class: "w-full"
|
|
275
275
|
}, {
|
|
276
276
|
default: l(() => [
|
|
277
|
-
t(
|
|
277
|
+
t(S, { class: "w-full" }, {
|
|
278
278
|
default: l(() => [
|
|
279
279
|
s("div", We, [
|
|
280
|
-
e(m) === "published" ? (r(),
|
|
280
|
+
e(m) === "published" ? (r(), C("span", Xe)) : e(m) === "draft" ? (r(), C("span", He)) : g("", !0),
|
|
281
281
|
t(f, { placeholder: "Status" })
|
|
282
282
|
])
|
|
283
283
|
]),
|
|
@@ -336,7 +336,7 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
336
336
|
}
|
|
337
337
|
},
|
|
338
338
|
setup(U) {
|
|
339
|
-
const p = U, { hasPermission: m, hasAnyPermission:
|
|
339
|
+
const p = U, { hasPermission: m, hasAnyPermission: b } = de(), { params: n, navigateTo: f } = pe(), { confirm: S } = me(), i = fe(p.config.project);
|
|
340
340
|
R("sources", p.config.allowedMediaSources), R("defaultSource", p.config.defaultUploadMediaSource);
|
|
341
341
|
const a = ee(() => !n.value.collectionId || n.value.collectionId === "new"), _ = te(!1), V = oe(q({
|
|
342
342
|
id: M().optional(),
|
|
@@ -350,7 +350,7 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
350
350
|
description: M().optional()
|
|
351
351
|
}).optional(),
|
|
352
352
|
status: M()
|
|
353
|
-
})), { handleSubmit: T, errors: I, values:
|
|
353
|
+
})), { handleSubmit: T, errors: I, values: v, setValues: L } = se({
|
|
354
354
|
validationSchema: V,
|
|
355
355
|
initialValues: {
|
|
356
356
|
status: "draft",
|
|
@@ -362,59 +362,59 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
362
362
|
}
|
|
363
363
|
});
|
|
364
364
|
_e(() => [
|
|
365
|
-
{ text: a.value ? "New Collection" :
|
|
365
|
+
{ text: a.value ? "New Collection" : v.title || "Collection" }
|
|
366
366
|
]);
|
|
367
367
|
const F = T(async (u) => {
|
|
368
368
|
_.value = !0;
|
|
369
|
-
let o = await
|
|
369
|
+
let o = await k() || [];
|
|
370
370
|
if (a.value) {
|
|
371
371
|
let x = JSON.parse(JSON.stringify(u));
|
|
372
372
|
if (x.id = crypto.randomUUID(), await O(x.slug)) {
|
|
373
|
-
|
|
373
|
+
P.error("Collection with this slug already exists"), _.value = !1;
|
|
374
374
|
return;
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
|
|
376
|
+
const $ = [...o, x], w = p.config.collectionsCollection.split(":");
|
|
377
|
+
await i.update(w[0], null, { [w[1]]: $ }), f("/"), P.success("Collection created");
|
|
378
378
|
} else {
|
|
379
379
|
let x = JSON.parse(JSON.stringify(u));
|
|
380
|
-
const
|
|
381
|
-
await i.update(
|
|
380
|
+
const $ = o.map((z) => z.id === n.value.collectionId ? x : z), w = p.config.collectionsCollection.split(":");
|
|
381
|
+
await i.update(w[0], null, { [w[1]]: $ }), f("/"), P.success("Collection updated");
|
|
382
382
|
}
|
|
383
383
|
_.value = !1;
|
|
384
|
-
}),
|
|
384
|
+
}), k = async () => {
|
|
385
385
|
if (!p.config.collectionsCollection) return [];
|
|
386
386
|
const u = p.config.collectionsCollection.split(":");
|
|
387
387
|
return u.length !== 2 ? [] : (await i.get(u[0]))?.[u[1]] || [];
|
|
388
388
|
}, X = async () => {
|
|
389
|
-
const o = (await
|
|
389
|
+
const o = (await k()).find((x) => x.id === n.value.collectionId);
|
|
390
390
|
L(o);
|
|
391
391
|
}, H = async () => {
|
|
392
392
|
try {
|
|
393
|
-
let u = { ...
|
|
393
|
+
let u = { ...v }, o = u.slug + "-copy", x = 2;
|
|
394
394
|
for (; await O(o); )
|
|
395
395
|
o = u.slug + "-copy-" + x, x++;
|
|
396
396
|
u.id = crypto.randomUUID(), u.slug = o, u.status = "draft", u.title = u.title + " (copy)";
|
|
397
|
-
const
|
|
398
|
-
await i.update(
|
|
397
|
+
const w = [...await k() || [], u], z = p.config.collectionsCollection.split(":");
|
|
398
|
+
await i.update(z[0], null, { [z[1]]: w }), f(u.id), P.success("Collection duplicated");
|
|
399
399
|
} catch {
|
|
400
|
-
|
|
400
|
+
P.error("Failed to duplicate collection");
|
|
401
401
|
}
|
|
402
402
|
}, K = async () => {
|
|
403
|
-
if (await
|
|
403
|
+
if (await S("Are you sure you want to delete this collection?"))
|
|
404
404
|
try {
|
|
405
|
-
const o = await
|
|
405
|
+
const o = await k() || [];
|
|
406
406
|
if (o.length === 0 || !n.value.collectionId) throw new Error("Error loading values");
|
|
407
|
-
const x = o.filter((
|
|
408
|
-
await i.update(
|
|
407
|
+
const x = o.filter((w) => w.id !== n.value.collectionId), $ = p.config.collectionsCollection.split(":");
|
|
408
|
+
await i.update($[0], null, { [$[1]]: x }), f(""), P.success("Collection deleted");
|
|
409
409
|
} catch {
|
|
410
|
-
|
|
410
|
+
P.error("Failed to delete collection");
|
|
411
411
|
}
|
|
412
|
-
}, O = async (u) => !!(await
|
|
412
|
+
}, O = async (u) => !!(await k() || []).find((x) => x.slug === u);
|
|
413
413
|
return le(() => {
|
|
414
414
|
a.value || X();
|
|
415
415
|
}), (u, o) => {
|
|
416
|
-
const x = c("Button"),
|
|
417
|
-
return r(),
|
|
416
|
+
const x = c("Button"), $ = c("MenubarTrigger"), w = c("MenubarMenu"), z = c("MenubarShortcut"), D = c("MenubarItem"), J = c("MenubarSeparator"), A = c("MenubarContent"), Q = c("Menubar");
|
|
417
|
+
return r(), C("div", Qe, [
|
|
418
418
|
s("div", Ye, [
|
|
419
419
|
s("div", Ze, [
|
|
420
420
|
t(x, {
|
|
@@ -427,17 +427,17 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
427
427
|
_: 1
|
|
428
428
|
}),
|
|
429
429
|
t(e(re), { class: "size-3" }),
|
|
430
|
-
s("h1", et, y(a.value ? "New Collection" : e(
|
|
431
|
-
e(
|
|
430
|
+
s("h1", et, y(a.value ? "New Collection" : e(v).title), 1),
|
|
431
|
+
e(v).status === "published" ? (r(), C("span", tt, "Published")) : e(v).status === "draft" ? (r(), C("span", lt, "Draft")) : g("", !0)
|
|
432
432
|
]),
|
|
433
|
-
a.value ?
|
|
433
|
+
a.value ? g("", !0) : (r(), h(Q, {
|
|
434
434
|
key: 0,
|
|
435
435
|
class: "bg-sidebar"
|
|
436
436
|
}, {
|
|
437
437
|
default: l(() => [
|
|
438
|
-
e(m)("create-collection") ? (r(),
|
|
438
|
+
e(m)("create-collection") ? (r(), h(w, { key: 0 }, {
|
|
439
439
|
default: l(() => [
|
|
440
|
-
t(
|
|
440
|
+
t($, { onClick: H }, {
|
|
441
441
|
default: l(() => [...o[1] || (o[1] = [
|
|
442
442
|
d("Duplicate", -1)
|
|
443
443
|
])]),
|
|
@@ -445,10 +445,10 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
445
445
|
})
|
|
446
446
|
]),
|
|
447
447
|
_: 1
|
|
448
|
-
})) :
|
|
449
|
-
t(
|
|
448
|
+
})) : g("", !0),
|
|
449
|
+
t(w, null, {
|
|
450
450
|
default: l(() => [
|
|
451
|
-
t(
|
|
451
|
+
t($, null, {
|
|
452
452
|
default: l(() => [...o[2] || (o[2] = [
|
|
453
453
|
d("Preview", -1)
|
|
454
454
|
])]),
|
|
@@ -457,9 +457,9 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
457
457
|
]),
|
|
458
458
|
_: 1
|
|
459
459
|
}),
|
|
460
|
-
t(
|
|
460
|
+
t(w, null, {
|
|
461
461
|
default: l(() => [
|
|
462
|
-
t(
|
|
462
|
+
t($, null, {
|
|
463
463
|
default: l(() => [...o[3] || (o[3] = [
|
|
464
464
|
d("Share", -1)
|
|
465
465
|
])]),
|
|
@@ -470,7 +470,7 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
470
470
|
t(D, null, {
|
|
471
471
|
default: l(() => [
|
|
472
472
|
o[5] || (o[5] = d(" New Tab ", -1)),
|
|
473
|
-
t(
|
|
473
|
+
t(z, null, {
|
|
474
474
|
default: l(() => [...o[4] || (o[4] = [
|
|
475
475
|
d("⌘T", -1)
|
|
476
476
|
])]),
|
|
@@ -505,9 +505,9 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
505
505
|
]),
|
|
506
506
|
_: 1
|
|
507
507
|
}),
|
|
508
|
-
e(
|
|
508
|
+
e(b)("edit-collection", "delete-collection") ? (r(), h(w, { key: 1 }, {
|
|
509
509
|
default: l(() => [
|
|
510
|
-
t(
|
|
510
|
+
t($, null, {
|
|
511
511
|
default: l(() => [...o[9] || (o[9] = [
|
|
512
512
|
d("More actions", -1)
|
|
513
513
|
])]),
|
|
@@ -515,7 +515,7 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
515
515
|
}),
|
|
516
516
|
t(A, null, {
|
|
517
517
|
default: l(() => [
|
|
518
|
-
e(m)("delete-collection") ? (r(),
|
|
518
|
+
e(m)("delete-collection") ? (r(), h(D, {
|
|
519
519
|
key: 0,
|
|
520
520
|
variant: "destructive",
|
|
521
521
|
onClick: K
|
|
@@ -525,13 +525,13 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
525
525
|
o[10] || (o[10] = d(" Delete collection ", -1))
|
|
526
526
|
]),
|
|
527
527
|
_: 1
|
|
528
|
-
})) :
|
|
528
|
+
})) : g("", !0)
|
|
529
529
|
]),
|
|
530
530
|
_: 1
|
|
531
531
|
})
|
|
532
532
|
]),
|
|
533
533
|
_: 1
|
|
534
|
-
})) :
|
|
534
|
+
})) : g("", !0)
|
|
535
535
|
]),
|
|
536
536
|
_: 1
|
|
537
537
|
}))
|
|
@@ -545,37 +545,37 @@ const xe = { class: "flex flex-col gap-4" }, ge = { class: "flex flex-col gap-2"
|
|
|
545
545
|
t(Ke)
|
|
546
546
|
])
|
|
547
547
|
]),
|
|
548
|
-
e(
|
|
548
|
+
e(b)("create-collection", "edit-collection") ? (r(), C("div", it, [
|
|
549
549
|
s("div", at, [
|
|
550
|
-
a.value && e(m)("create-collection") ? (r(),
|
|
550
|
+
a.value && e(m)("create-collection") ? (r(), h(x, {
|
|
551
551
|
key: 0,
|
|
552
552
|
onClick: e(F),
|
|
553
553
|
disabled: _.value
|
|
554
554
|
}, {
|
|
555
555
|
default: l(() => [
|
|
556
|
-
_.value ? (r(),
|
|
556
|
+
_.value ? (r(), h(e(W), {
|
|
557
557
|
key: 0,
|
|
558
558
|
class: "size-4 animate-spin"
|
|
559
|
-
})) :
|
|
559
|
+
})) : g("", !0),
|
|
560
560
|
d(" " + y(_.value ? "Creating" : "Create") + " New Collection ", 1)
|
|
561
561
|
]),
|
|
562
562
|
_: 1
|
|
563
|
-
}, 8, ["onClick", "disabled"])) : e(m)("edit-collection") ? (r(),
|
|
563
|
+
}, 8, ["onClick", "disabled"])) : e(m)("edit-collection") ? (r(), h(x, {
|
|
564
564
|
key: 1,
|
|
565
565
|
onClick: e(F),
|
|
566
566
|
disabled: _.value
|
|
567
567
|
}, {
|
|
568
568
|
default: l(() => [
|
|
569
|
-
_.value ? (r(),
|
|
569
|
+
_.value ? (r(), h(e(W), {
|
|
570
570
|
key: 0,
|
|
571
571
|
class: "size-4 animate-spin"
|
|
572
|
-
})) :
|
|
572
|
+
})) : g("", !0),
|
|
573
573
|
d(" " + y(_.value ? "Saving" : "Save") + " Changes ", 1)
|
|
574
574
|
]),
|
|
575
575
|
_: 1
|
|
576
|
-
}, 8, ["onClick", "disabled"])) :
|
|
576
|
+
}, 8, ["onClick", "disabled"])) : g("", !0)
|
|
577
577
|
])
|
|
578
|
-
])) :
|
|
578
|
+
])) : g("", !0)
|
|
579
579
|
]);
|
|
580
580
|
};
|
|
581
581
|
}
|