1import{z as A,k as i,m as n,l,t as s,e as g,V as W,v as y,aE as O,r as L,L as U,ac as K,a as E,cK as x,cL as G,N as q,j as e,F as B,q as j,x as R,R as z,P,U as H,T as J,y as p,cM as Q,bA as X,A as Y,B as Z,K as ee,ai as te,f as oe,bo as N}from"./_TN_iw76.js";import{_ as ae}from"./DuCIFoNU.js";import{_ as ie}from"./BnlyUCVD.js";const le=["for"],se={class:"pickup-option-selector"},re=["id","checked","value"],ne={class:"pickup-office-name notranslate",translate:"no"},ce={class:"m-0 notranslate",translate:"no"},de={class:"pickup-office-type"},ue=A({__name:"item",props:{location:{type:Object,required:!0}},emits:["change"],setup(c,{emit:m}){const h=m;return(d,t)=>{const v=W;return i(),n("label",{class:"pickup-option",for:`pickup-location-${c.location.id}`},[l("div",se,[l("input",{id:`pickup-location-${c.location.id}`,type:"radio",class:"selected-pickup-location",name:"delivery-location-id",checked:c.location.selected,value:c.location.id,autocomplete:"off",onChange:t[0]||(t[0]=$=>h("change",c.location))},null,40,re)]),l("div",ne,s(c.location.title.fi),1),l("address",ce,s(c.location.address.street)+", "+s(c.location.address.zipcode)+" "+s(c.location.address.city),1),l("div",de,[c.location.private?(i(),g(v,{key:0,icon:"fas fa-building",title:d.$t("v1.views.checkout.deliveryLocation.private")},null,8,["title"])):c.location.parcelLocker?(i(),g(v,{key:1,icon:"fas fa-box",title:d.$t("v1.views.checkout.deliveryLocation.parcelLocker")},null,8,["title"])):(i(),g(v,{key:2,icon:"fas fa-store-alt",title:d.$t("v1.views.checkout.deliveryLocation.pickupPoint")},null,8,["title"])),c.location.wheelchairAccess?(i(),g(v,{key:3,icon:"fas fa-wheelchair",title:d.$t("v1.views.checkout.deliveryLocation.wheelchairAccess")},null,8,["title"])):y("",!0)])],8,le)}}}),ve={key:0,class:"alert alert-warning",role:"status"},pe={key:1,class:"content"},he={key:0,class:"alert alert-warning",role:"status"},ye=["aria-labelledby","aria-label"],me={key:2,class:"pickup-location-loader"},fe={class:"d-flex align-items-center justify-content-end"},ke=A({__name:"pickupLocation",props:{max:{type:Number,required:!0},deliveryMethod:{type:Object,required:!0},labelledBy:{type:String,required:!1,default:""}},setup(c){const m=O(),h=c,d=L(""),t=L([]),v=L(h.max),$=p(()=>h.deliveryMethod.pickupServiceType===2&&t.value.length===v.value),k=L(!1),{order:w}=U(m),M=K(),{t:S}=E(),_=L(!1),b=async()=>{try{_.value=!1,k.value=!0,t.value=await Q(d.value,v.value),_.value=t.value?.length===0}catch{M.danger(S("v1.views.checkout.pickupLocationFetchError"))}finally{k.value=!1}},V=o=>{t.value=t.value?.map(u=>(u.selected=u.id===o.id,u))??[],m.updatePickupLocation(o)},{pause:C,resume:F}=x(v,async o=>{v.value=o<=h.max?h.max:o,await b()},{eventFilter:G(500)});async function T(){C(),t.value=[],v.value=h.max,await b(),F()}async function I(){t.value=[],await b()}q(()=>h.deliveryMethod?.id,async(o,u)=>{o!==u&&T()},{immediate:!0});const a=X(I,200);return q(()=>[w.value.customers.delivery.address.zipcode,w.value.customers.invoicing.address.zipcode],([o,u])=>{(o.length>0?o:u)?.length==5?a():(t.value=[],_.value=!0)}),(o,u)=>{const D=ue,r=ae;return c.deliveryMethod.pickupServiceType<=0?(i(),n("div",ve,s(o.$t("v1.views.checkout.deliveryLocation.pickupServiceError")),1)):(i(),n("div",pe,[e(_)?(i(),n("div",he,s(o.$t("v1.views.checkout.deliveryLocation.deliveryOptionsError"))+" "+s(o.$t("v1.views.checkout.deliveryLocation.tryAgain")),1)):e(t).length>0?(i(),n("div",{key:1,class:"pickups-options",role:"radiogroup","aria-labelledby":c.labelledBy||void 0,"aria-label":c.labelledBy?void 0:o.$t("pickup_location_selection")},[(i(!0),n(B,null,j(e(t),f=>(i(),g(D,{key:f.id,location:f,onChange:Re=>V(f)},null,8,["location","onChange"]))),128))],8,ye)):y("",!0),e(k)?(i(),n("div",me,[R(r,{size:"xl"})])):y("",!0),l("div",fe,[e($)?(i(),n("button",{key:0,type:"button",class:"btn btn-secondary ml-2",onClick:u[0]||(u[0]=z(f=>v.value+=c.max,["prevent"]))},s(o.$t("v1.views.checkout.deliveryLocation.showMore")),1)):y("",!0),l("button",{class:"btn btn-secondary ml-2",onClick:z(b,["prevent"])},s(o.$t("search")),1)]),P(l("input",{"onUpdate:modelValue":u[1]||(u[1]=f=>J(d)?d.value=f:null),class:"form-control d-none"},null,512),[[H,e(d)]])]))}}}),_e={key:0,class:"mb-3"},be={class:"title-row section-group-title h5"},ge={class:"form-group"},$e={for:"order_delivery_date",class:"sr-only"},we=["min","value"],Le={class:"form-text"},Se={key:1,class:"mb-3",role:"radiogroup","aria-labelledby":"partial-delivery-title"},Ie={id:"partial-delivery-title",class:"title-row section-group-title h5"},De={class:"form-check"},Me={for:"partial_delivery_0",class:"form-check-label"},Ve={class:"form-check"},Ce={for:"partial_delivery_1",class:"form-check-label"},Fe={class:"form-text"},Te={key:2,class:"delivery-method-group delivery-method-group-misc"},Be={key:0,class:"title-row section-group-title h5"},Pe={key:0,class:"alert alert-success"},Ae={key:1,class:"alert alert-info"},qe=["aria-label"],ze=["id","value","checked"],Ne=["for"],Oe={key:0,class:"form-text mt-0 mb-1"},Ue={key:2,id:"pickup-locations",class:"mt-3"},Ee=["id"],je={key:3,class:"alert alert-success"},Ge=A({__name:"deliveryMethodList",setup(c){const m=Y(Z,null),{locale:h}=E(),d=O(),{order:t}=U(d),{userVatOn:v}=ee(),$=p(()=>t.value.paymentVatOn),k=p(()=>t.value?.deliveryMethodList.filter(a=>a.id===t?.value?.deliveryMethod?.id).shift()),w=p(()=>m?.value?.delivery_date??!1),M=p(()=>Number.parseInt(m?.value?.number_of_pick_up_points)||5),S=te(),_=p(()=>t.value.events.filter(a=>a.type==="delivered")[0]?.date),b=p(()=>$.value?t.value.freeFreightInfo?.limit.valueWithVat:t.value.freeFreightInfo?.limit.value),V=p(()=>new Date().toLocaleDateString("en-CA")),C=p(()=>{switch(Number.parseInt(m?.value?.delivery_method_show_vat_by)){case 1:return!0;case 2:return!1;default:return $.value&&v.value}}),F=p(()=>t.value.cart?.cartItems.reduce((a,o)=>a+(o.amount??0),0)??0),T=p(()=>t.value.cart?.cartItems?.every(a=>"stocks"in a?a.stocks.total>0:!0)??!1),I=p(()=>F.value>1&&!T.value&&(m?.value?.allow_partial_delivery??!1));return(a,o)=>{const u=ke,D=ie;
1return i(),g(D,{id:"checkout-delivery",title:a.$t("delivery_method")},{default:oe(()=>[e(w)?(i(),n("div",_e,[l("h3",be,s(a.$t("requested_delivery_date")),1),l("div",ge,[l("label",$e,s(a.$t("requested_delivery_date")),1),l("input",{id:"order_delivery_date",type:"date",class:"form-control",min:e(V),value:e(_),name:"order_delivery_date",onBlur:o[0]||(o[0]=(...r)=>e(d).update&&e(d).update(...r))},null,40,we),l("small",Le,s(a.$t("requested_delivery_text")),1)])])):y("",!0),e(I)?(i(),n("div",Se,[l("h3",Ie,s(a.$t("partial_delivery_title")),1),l("div",De,[P(l("input",{id:"partial_delivery_0","onUpdate:modelValue":o[1]||(o[1]=r=>e(t).partialDelivery=r),type:"radio",class:"form-check-input",name:"partial_delivery",value:!1,autocomplete:"off",onInput:o[2]||(o[2]=(...r)=>e(d).update&&e(d).update(...r))},null,544),[[N,e(t).partialDelivery]]),l("label",Me,s(a.$t("partial_delivery_option_0")),1)]),l("div",Ve,[P(l("input",{id:"partial_delivery_1","onUpdate:modelValue":o[3]||(o[3]=r=>e(t).partialDelivery=r),type:"radio",class:"form-check-input",name:"partial_delivery",value:!0,autocomplete:"off",onInput:o[4]||(o[4]=(...r)=>e(d).update&&e(d).update(...r))},null,544),[[N,e(t).partialDelivery]]),l("label",Ce,s(a.$t("partial_delivery_option_1")),1)]),l("small",Fe,s(a.$t("partial_delivery_info")),1)])):y("",!0),e(t).deliveryMethodList&&e(t).deliveryMethodList.length>0?(i(),n("div",Te,[e(w)||e(I)?(i(),n("h3",Be,s(a.$t("v1.views.checkout.deliveryMethod.select")),1)):y("",!0),e(t).deliveryMethod?.id.length>0&&e(t).freeFreightInfo?(i(),n(B,{key:1},[e(t).freeFreightInfo.overlimit?(i(),n("div",Pe,s(a.$t("v1.views.checkout.freefreight.overlimit",{limit:a.$n(e(b),"currency")})),1)):(i(),n("div",Ae,s(a.$t("v1.views.checkout.freefreight.missing",{missing:a.$n(e(t).freeFreightInfo.missing,"currency")})),1))],64)):y("",!0),l("div",{role:"radiogroup","aria-label":a.$t("v1.views.checkout.deliveryMethod.select")},[(i(!0),n(B,null,j(e(t).deliveryMethodList,r=>(i(),n("div",{key:r.id,class:"form-check"},[l("input",{id:"input-delivery-method-"+r.id,class:"form-check-input",type:"radio",value:r.id,checked:e(t).deliveryMethod?.id===r.id,name:"delivery_method",onChange:o[5]||(o[5]=(...f)=>e(d).update&&e(d).update(...f))},null,40,ze),l("label",{for:"input-delivery-method-"+r.id,class:"form-check-label"},s(r.title[e(h)]??"")+" "+s(a.$n(e(C)?r.price.valueWithVat:r.price.value,"currency")),9,Ne),r.text?(i(),n("small",Oe,s(r.text[e(h)]),1)):y("",!0)]))),128))],8,qe),e(k)?.pickupServiceType&&e(k)?.pickupServiceType>0?(i(),n("div",Ue,[l("h3",{id:e(S),class:"title-row section-group-title h5"},s(a.$t("pickup_location_selection")),9,Ee),R(u,{max:e(M),"delivery-method":e(k),"labelled-by":e(S)},null,8,["max","delivery-method","labelled-by"])])):y("",!0)])):(i(),n("div",je,s(a.$t("no_delivery_methods_available")),1))]),_:1},8,["title"])}}});export{Ge 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.