1import{N as ae,r as f,$ as H,E as O,d as K,s as G,f as q,c as I,o,k as S,w as v,e as a,j as s,t as i,a as r,b as w,m as D,V as j,W as F,Q as M,B as Q,n as $,l as L,Z as se,q as le,a8 as E,a2 as oe,U as ie,R as re,K as ne,L as de}from"./-6Lls737.js";import{_ as ce}from"./DnEzZ4vY.js";import{_ as ue}from"./DTkNhqIJ.js";import{_ as P}from"./C9IHJtY7.js";import{u as pe,P as be}from"./BOQtyHmD.js";import{_ as fe}from"./i-JovrxE.js";import"./CiiYzqQD.js";import"./DSV61gAW.js";import"./DlAUqK2U.js";import"./B5spvOTL.js";import"./CI1rb40-.js";const W=ae("availability",()=>{const A=f(null),h=f(!1);async function _(){var u;A.value=(u=(await H(O.USER.AVAILABILITY.GET)).response)==null?void 0:u.results}async function C(u){h.value=!0;const n=await H(O.USER.AVAILABILITY.POST,{method:"post",body:{dates:u}});return h.value=!1,n}return{availability:A,fetchAvailability:_,updateAvailability:C,updateAvailabilityLoading:h}}),ve={class:"grid grid-cols-2 gap-2"},me=s("button",{class:"button-secondary button-xs col-span-2"},"Contact Support",-1),ye=s("h5",{class:"text-xl font-semibold text-black"},"Availability",-1),he={key:0,class:"text-sm text-dark-grey"},_e={key:1,class:"text-sm text-dark-grey"},ge={class:"flex flex-col border-t border-x-grey-1 mt-4"},xe={class:"flex items-center py-4 border-b border-x-grey-1"},ke={class:"text-x-grey-15 text-sm mr-auto"},De={class:"flex items-center py-4 border-b border-x-grey-1"},Ae=s("span",{class:"text-x-grey-15 text-sm mr-auto"},"Cost",-1),Ce={key:0,class:"text-sm text-black"},we={key:0,class:"text-sm text-black ml-2"},$e={key:2,class:"border border-x-gold bg-x-gold-1 p-3 rounded-xl text-xs text-black mt-4"},Pe=s("strong",null,"unlimited",-1),Se=K({__name:"ConfirmAvailabilityModal",props:{purchaseDetails:{}},emits:["close","confirm"],setup(A,{emit:h}){const{purchaseDetails:_}=A,C=W(),{updateAvailabilityLoading:u}=G(C),{t:n}=q(),m=h;f(!1);const g=I(()=>_.userHasGold||_.totalPrice<=_.availableCredits);return(d,y)=>(o(),S(a(ue),{onOutsideClick:y[2]||(y[2]=x=>m("close"))},{header:v(()=>[s("button",{onClick:y[0]||(y[0]=x=>m("close")),class:"button-secondary button-xxs"},i(a(n)("home.cancel")),1)]),footer:v(()=>[s("div",ve,[g.value?(o(),S(a(P),{key:1,class:"col-span-2 font-semibold",onClick:y[1]||(y[1]=Q(x=>m("confirm"),["prevent"])),variant:"outline",size:"sm",loading:a(u),disabled:a(u)},{default:v(()=>[D(" Confirm Availability ")]),_:1},8,["loading","disabled"])):(o(),r(M,{key:0},[w(a(P),{variant:"outline",size:"sm",component:"NuxtLink",to:a(j)(a(F).UPGRADE_BUY_CREDITS)},{default:v(()=>[D(i(a(n)("product.buyCredits")),1)]),_:1},8,["to"]),w(a(P),{variant:"outline",size:"sm",color:"gold",component:"NuxtLink",to:a(j)(a(F).CHECKOUT_BUY_GOLD)},{default:v(()=>[D(i(a(n)("product.upgradeGoldDesktop")),1)]),_:1},8,["to"])],64)),me])]),default:v(()=>[s("div",null,[ye,g.value?(o(),r("p",_e,"You are setting your availability, and you will be seen as available today on platform.")):(o(),r("p",he,"You are trying to set availability, it costs 2 credits per day. You donât have available coins on balance.")),s("div",ge,[s("div",xe,[s("span",ke,i(a(n)("account.creditBreakdown.availableCredits")),1),s("span",{class:$(["text-sm text-black capitalize",{"text-x-red":!g.value}])},i(d.purchaseDetails.availableCredits??0)+" "+i(a(n)("product.credits")),3)]),s("div",De,[Ae,d.purchaseDetails.userHasGold?(o(),r("span",Ce," Included with Gold ")):(o(),r(M,{key:1},[s("span",{class:$(["text-sm text-black",{"text-x-grey-19 line-through":d.purchaseDetails.discount}])},i(d.purchaseDetails.discount?d.purchaseDetails.totalPrice+d.purchaseDetails.discount:d.purchaseDetails.totalPrice)+" "+i(a(n)("product.credits")),3),d.purchaseDetails.discount?(o(),r("span",we,i(d.purchaseDetails.totalPrice)+" "+i(a(n)("product.credits")),1)):L("",!0)],64))])]),g.value?L("",!0):(o(),r("div",$e,[D(" Upgrade to a Gold profile, which provides "),Pe,D(" usage of the available today feature ")]))])]),_:1}))}}),Me={key:0},Le={key:1,class:"container-sm my-0 md:my-6 max-md:px-0"},Te={class:"md:bg-white p-2 md:p-4 md:shadow md:rounded-2xl"},Ue={class:"grid gap-3 md:gap-4 md:grid-cols-2"},Be=["id","disabled","value"],Ee=["for"],Ge={class:"flex flex-col w-full"},Ie={class:"font-semibold text-black text-sm"},Ye={class:"flex flex-col w-full text-right"},Ve={class:"font-semibold text-black text-sm"},Ze=K({__name:"availability",setup(A){const h=ie(),{t:_,locale:C}=q(),u=se(),{currentUser:n}=G(u),m=W(),{availability:g,updateAvailabilityLoading:d}=G(m),y=pe(),x=f(!1),p=f([]),T=f([]),Y=f(!0),k=f(null),V=f({totalPrice:0,discount:0,availableCredits:0,userHasGold:!1});
1le(async()=>{var e;if(await m.fetchAvailability(),k.value=(e=await y.getProductsByType(be.AVAILABLE_TODAY_PAID))==null?void 0:e[0],!k.value){E.error();return}z(),Y.value=!1});function z(){var l;let e=h();e.locale(C.value??"de"),T.value=[];for(let t=0;t<7;t++){const c=e.format("YYYY-MM-DD"),b=e.format("MMMM"),ee={weekDay:e.format("dddd"),monthDay:e.format("DD"),displayDate:e.format("MMMM DD"),fullDate:c,month:b,isDisabled:(l=g.value)==null?void 0:l.some(te=>te.date===c),dayjs:e.clone()};T.value.push(ee),e=e.add(1,"days")}}const U=I(()=>{var e;return(e=n.value)==null?void 0:e.isGold}),B=I(()=>!g.value.some(e=>e.is_free));function N(e){var t,c,b;if(U.value)return 0;const l=(t=k.value)==null?void 0:t.price;return B.value&&(p.value.length<1||((b=(c=p.value)==null?void 0:c[0])==null?void 0:b.date)===e)?0:l}function Z(e){const l=N(e);return l&&l>0?`${l} ${_("product.credits")}`:"Free"}async function J(){var l;const{error:e}=await m.updateAvailability((l=p.value)==null?void 0:l.flatMap(t=>t.date));e&&E.error(),x.value=!1,await m.fetchAvailability(),R()>0&&await u.fetchUser(),p.value=[],z()}function X(){var t,c,b;if(!((t=p.value)==null?void 0:t.length))return;const l=R();V.value={totalPrice:l,availableCredits:(c=n.value)==null?void 0:c.credits,discount:B.value?(b=k.value)==null?void 0:b.price:0,userHasGold:U.value},x.value=!0}function R(){if(!k.value)return E.error(),0;if(U.value)return 0;let e=p.value.length;return B.value&&(e-=1),e*k.value.price}return(e,l)=>(o(),r(M,null,[w(a(ce),{title:"Availability",description:"Simply select days you are available and click âConfirm Availabilityâ button"},{actions:v(()=>[w(a(P),{onClick:l[0]||(l[0]=Q(t=>X(),["prevent"])),class:"max-md:w-full",variant:"outline",size:"sm",disabled:a(d)||p.value.length<=0,loading:a(d)},{default:v(()=>[D(" Confirm Availability ")]),_:1},8,["disabled","loading"])]),default:v(()=>[Y.value?(o(),r("div",Me,[w(a(fe),{"full-page":""})])):(o(),r("div",Le,[s("div",Te,[s("div",Ue,[(o(!0),r(M,null,re(T.value,(t,c)=>(o(),r("div",null,[ne(s("input",{type:"checkbox",id:c,class:"peer hidden",disabled:t.isDisabled,value:{date:t.fullDate},"onUpdate:modelValue":l[1]||(l[1]=b=>p.value=b)},null,8,Be),[[de,p.value]]),s("label",{for:c,class:$(["flex items-center gap-4 h-full bg-x-grey-2 p-4 rounded-2xl border border-transparent cursor-pointer peer-checked:shadow-green peer-checked:border-x-green peer-checked:bg-white peer-disabled:bg-white peer-disabled:border peer-disabled:border-x-grey-1 peer-disabled:cursor-default",{"before:shrink-0 before:content-[''] before:block before:w-4 before:h-4 before:bg-white before:rounded before:shadow-[inset_0_0_0_1px_rgba(229,231,235,1)] peer-checked:before:shadow-none peer-checked:before:bg-x-green peer-checked:before:bg-check-white peer-checked:before:bg-center peer-checked:before:bg-no-repeat":!t.isDisabled}])},[s("span",Ge,[s("span",Ie,i(t.weekDay),1),t.isDisabled?L("",!0):(o(),r("span",{key:0,class:$(["text-dark-grey text-sm capitalize",{"text-x-green-3 font-semibold":!N(t.fullDate)}])},i(Z(t.fullDate)),3))]),s("span",Ye,[s("span",Ve,i(t.displayDate),1),s("span",{class:$(["text-dark-grey text-sm",{"text-x-green-3 font-semibold":t.isDisabled}])},i(t.isDisabled?"Available":"Unavailable"),3)])],10,Ee)]))),256))])])]))]),_:1}),(o(),S(oe,{to:"body"},[x.value?(o(),S(Se,{key:0,"purchase-details":V.value,onClose:l[2]||(l[2]=t=>x.value=!1),onConfirm:J},null,8,["purchase-details"])):L("",!0)]))],64))}});export{Ze as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.