import{bR as j,ao as A,a2 as H,bS as E,bT as L,bU as M}from"./index-Dqv5IkpS.js";import{K as R,aZ as S,Z as U,B as D,S as p,P as b,M as m,T as n,V as f,L as g,N as T,O as N,U as e,W as s,b as $,X as x,a7 as F}from"./vendor-bSWkQivH.js";function rt(w,h){return w.map(r=>{var y;return{productExists:!!r.product,productId:r.productId,name:r.name,sku:r.sku,quantity:r.quantity,slug:(y=r.product)==null?void 0:y.slug,isAddedToCart:!h.validationErrors.some(k=>k.objectType==j.CatalogProduct&&k.objectId===r.productId)}})}const W={class:"flex items-center gap-x-2.5"},O={class:"truncate text-sm font-bold normal-case"},Z={class:"max-h-80 overflow-y-auto rounded-[inherit] md:max-h-72"},z={class:"w-full md:table"},K={class:"top-0 hidden bg-neutral-50 text-sm font-black md:sticky md:table-row"},X={class:"table-cell border-b px-4 py-2.5"},Y={class:"table-cell border-b px-4 py-2.5"},G={class:"table-cell border-b px-4 py-2.5 text-right"},J={class:"flex w-3/5 flex-col pr-3 md:table-cell md:w-auto md:px-4 md:py-2.5 md:align-middle"},Q={class:"text-neutral-400 md:hidden"},tt={class:"font-bold max-lg:break-all"},et={class:"order-first mb-2.5 line-clamp-2 w-full shrink-0 md:mb-0 md:line-clamp-none md:table-cell md:w-auto md:px-4 md:py-2.5 md:align-middle"},st={key:1},at={class:"flex w-2/5 flex-col md:table-cell md:w-auto md:px-4 md:py-2.5 md:text-right md:align-middle"},lt={class:"text-neutral-400 md:hidden"},ot={class:"font-bold"},ct=R({__name:"add-bulk-items-to-cart-results-modal",props:{listName:{},items:{default:()=>[]}},emits:["confirm"],setup(w){const h=w,{items:r}=S(h),y=A(r,{productIdProperty:"productId"}),{logoUrl:k}=H(),{d:q,t:c}=U(),I=D(()=>{const t=[],o=[],d=[];return h.items.forEach(_=>{_.isAddedToCart?o.push(_):d.push(_)}),o.length&&t.push({name:"added",items:o}),d.length&&t.push({name:"not_added",items:d}),t});function B(t){let o="";return t.forEach(d=>{o+=`
    <tr class="even:bg-neutral-50">
      <td class="px-2.5 py-2">${d.name}</td>
      <td class="px-2.5 py-2">${d.sku}</td>
      <td class="px-2.5 py-2">${d.quantity}</td>
    </tr>`}),o}function P(){var a;const t=(a=document.documentElement.attributes.getNamedItem("style"))==null?void 0:a.textContent,o=Array.from(document.head.querySelectorAll("link[rel=stylesheet], style")).map(l=>l.outerHTML).join(""),_=`
  <header class="flex justify-between items-start">
    <img class="h-7" src="${L(k.value)}" alt="">

    <div class="p-2 border border-neutral-100 rounded text-xs">
      <div class="font-black">${c("common.labels.created_date")}</div>
      <div class="mt-1">${q(new Date)}</div>
    </div>
  </header>`;let v="";const V=l=>{switch(l){case"added":return"check-circle";case"not_added":return"delete"}};I.value.forEach(l=>{const i=M(V(l.name));v+=`
    <div class="space-y-3">
      <h3 class="flex items-center gap-1.5 text-sm font-bold">
        <img src="${i}" class="size-3.5" />
        ${c(`shared.cart.add_bulk_items_to_cart_results_modal.groups.${l.name}`)}
      </h3>

      <div class="overflow-hidden border border-neutral-100 rounded">
        <table class="w-full border-collapse text-xs">
          <thead class="bg-neutral-50 font-bold text-left">
            <th class="px-2.5 py-2 w-1/2">
              ${c("shared.cart.add_bulk_items_to_cart_results_modal.labels.product_name")}
            </th>
            <th class="px-2.5 py-2 w-1/6">
              ${c("shared.cart.add_bulk_items_to_cart_results_modal.labels.sku")}
            </th>
            <th class="px-2.5 py-2 w-2/6">
              ${c("shared.cart.add_bulk_items_to_cart_results_modal.labels.quantity")}
            </th>
          </thead>

          ${B(l.items)}
        </table>
      </div>
    </div>`});const C=`
  <div class="flex items-center justify-between py-3 text-xs">
    <div>
      &copy;
      ${new Date().getFullYear()}
      <strong>${c("shared.layout.footer.company_name")}</strong>.
      ${c("shared.layout.footer.all_rights_reserved")}
    </div>

    <div>
      ${c("shared.layout.footer.asp_net_e_commerce_platform")}
      ${c("shared.layout.footer.by_virto")}
    </div>
  </div>`,u=window.open("","print");u.document.write(`
  <html style="${t}">
    <head>${o}</head>
    <body class="font-lato">
      <div class="flex flex-col mx-auto h-full min-h-screen w-full max-w-[1024px] p-6 print:p-0">
        ${_}

        <div class="grow mt-6 px-4 space-y-6">
          <h2 class="text-xl font-bold uppercase">
            ${h.listName}
          </h2>

          ${v}
        </div>

        ${C}
      </div>
    </body>
  </html>`),u.onload=()=>{setTimeout(()=>{u.print(),u.close()},500)},u.document.close(),u.focus()}return(t,o)=>{const d=p("VcIcon"),_=p("VcBadge"),v=p("router-link"),V=p("VcExpansionPanel"),C=p("VcExpansionPanels"),u=p("VcModal");return m(),b(u,{title:t.$t("shared.cart.add_bulk_items_to_cart_results_modal.title"),"max-width":"50rem","is-mobile-fullscreen":"",dividers:""},{actions:n(({close:a})=>[f($(E),{to:{name:"Cart"},class:"max-xs:!min-w-full xs:me-auto",onClick:l=>a()},{default:n(()=>[x(s(t.$t("common.buttons.view_cart")),1)]),_:2},1032,["onClick"]),f($(E),{variant:"outline",onClick:o[0]||(o[0]=l=>P())},{default:n(()=>[x(s(t.$t("common.buttons.print")),1)]),_:1}),f($(E),{onClick:l=>{a(),t.$emit("confirm")}},{default:n(()=>[x(s(t.$t("common.buttons.ok")),1)]),_:2},1032,["onClick"])]),default:n(()=>[f(C,{class:"flex flex-col gap-y-4"},{default:n(()=>[(m(!0),g(T,null,N(I.value,(a,l)=>(m(),b(V,{key:a.name,expanded:!l&&I.value.length===1},{icon:n(()=>[a.name==="added"?(m(),b(d,{key:0,class:"fill-success",name:"check-circle"})):a.name==="not_added"?(m(),b(d,{key:1,class:"fill-danger",name:"delete"})):F("",!0)]),"header-content":n(()=>[e("div",W,[e("span",O,s(t.$t(`shared.cart.add_bulk_items_to_cart_results_modal.groups.${a.name}`)),1),f(_,{class:"flex-none",variant:"outline",rounded:""},{default:n(()=>[x(s(a.items.length),1)]),_:2},1024)])]),default:n(()=>[e("div",Z,[e("ul",z,[e("li",K,[e("div",X,s(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.sku")),1),e("div",Y,s(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.product_name")),1),e("div",G,s(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.quantity")),1)]),(m(!0),g(T,null,N(a.items,i=>(m(),g("li",{key:i.sku,class:"flex flex-wrap border-b px-4 py-2.5 text-sm last:border-0 md:table-row md:border-0 md:p-0 md:odd:bg-neutral-50"},[e("div",J,[e("span",Q,s(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.sku")),1),e("span",tt,s(i.sku),1)]),e("div",et,[i.productExists?(m(),b(v,{key:0,to:$(y)[i.productId],target:"_blank",class:"font-bold text-[--link-color] hover:text-[--link-hover-color]"},{default:n(()=>[x(s(i.name),1)]),_:2},1032,["to"])):(m(),g("div",st,s(i.name),1))]),e("div",at,[e("span",lt,s(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.quantity")),1),e("span",ot,s(t.$n(i.quantity)),1)])]))),128))])])]),_:2},1032,["expanded"]))),128))]),_:1})]),_:1},8,["title"])}}});export{ct as _,rt as g};
//# sourceMappingURL=add-bulk-items-to-cart-results-modal.vue_vue_type_script_setup_true_lang-EP6VKEGj.js.map
