import{cv as R,cw as B,ae as j,cx as V,bR as M,cy as H,cz as U}from"./index-CsCqMgta.js";import{M as L,aX as S,$ as z,E as D,U as p,R as b,O as c,V as d,X as f,N as g,P as C,Q as T,W as s,Y as a,e as x,Z as y,a8 as F}from"./vendor-CsGITfgk.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 O={class:"flex items-center gap-x-2.5"},W={class:"truncate text-sm font-bold normal-case"},X={class:"max-h-80 overflow-y-auto rounded-[inherit] md:max-h-72"},Y={class:"w-full md:table"},Q={class:"top-0 hidden bg-neutral-50 text-sm font-black md:sticky md:table-row"},Z={class:"table-cell border-b px-4 py-2.5"},G={class:"table-cell border-b px-4 py-2.5"},J={class:"table-cell border-b px-4 py-2.5 text-right"},K={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=L({__name:"add-bulk-items-to-cart-results-modal",props:{listName:{},items:{default:()=>[]}},emits:["confirm"],setup($){const h=$,{items:n}=S(h),k=B(n,{productIdProperty:"productId"}),{logoUrl:N}=j(),{d:q,t:r}=z(),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="${H(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 _=U(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 E=`
  <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>

        ${E}
      </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"),E=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(V),{to:{name:x(M).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(V),{variant:"outline",onClick:l[0]||(l[0]=_=>P())},{default:d(()=>[y(a(t.$t("common.buttons.print")),1)]),_:1}),f(x(V),{onClick:_=>{e(),t.$emit("confirm")}},{default:d(()=>[y(a(t.$t("common.buttons.ok")),1)]),_:1},8,["onClick"])]),default:d(()=>[f(E,{class:"flex flex-col gap-y-4"},{default:d(()=>[(c(!0),g(C,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"})):F("",!0)]),"header-content":d(()=>[s("div",O,[s("span",W,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",X,[s("ul",Y,[s("li",Q,[s("div",Z,a(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.sku")),1),s("div",G,a(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.product_name")),1),s("div",J,a(t.$t("shared.cart.add_bulk_items_to_cart_results_modal.labels.quantity")),1)]),(c(!0),g(C,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",K,[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-bOj6vcQV.js.map
