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

    <div class="p-2 border border-neutral-100 rounded text-xs">
      <div class="font-black">${r("common.labels.created_date")}</div>
      <div class="mt-1">${q(new Date)}</div>
    </div>
  </header>`;let v="";const I=e=>{switch(e){case"added":return"check-circle";case"not_added":return"delete"}};w.value.forEach(e=>{const _=S(I(e.name));v+=`
    <div class="space-y-3">
      <h3 class="flex items-center gap-1.5 text-sm font-bold">
        <img src="${_}" class="size-3.5" />
        ${r(`shared.cart.add_bulk_items_to_cart_results_modal.groups.${e.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">
              ${r("shared.cart.add_bulk_items_to_cart_results_modal.labels.product_name")}
            </th>
            <th class="px-2.5 py-2 w-1/6">
              ${r("shared.cart.add_bulk_items_to_cart_results_modal.labels.sku")}
            </th>
            <th class="px-2.5 py-2 w-2/6">
              ${r("shared.cart.add_bulk_items_to_cart_results_modal.labels.quantity")}
            </th>
          </thead>

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

    <div>
      ${r("shared.layout.footer.asp_net_e_commerce_platform")}
      ${r("shared.layout.footer.by_virto")}
    </div>
  </div>`,i=window.open("","print");i.document.write(`
  <html style="${t}">
    <head>${l}</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">
        ${m}

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