import{_ as j}from"./nuxt-img.5794c753.js";import{_ as I}from"./nuxt-link.c9b26643.js";import{f as T,i as D,j as z,o as l,c as i,h as t,a as e,b as m,w,t as r,F as B,l as F,v as P,x as E,m as p,d as b,p as R,e as V,n as U,_ as $}from"./entry.e3d56a0f.js";import{u as q}from"./CartStore.9cb77b1c.js";import{u as K}from"./OrdersStore.86dbdced.js";import{u as A}from"./CurrenciesStore.217a14b2.js";import{u as G,a as M}from"./UserStore.fc763f7b.js";const h=_=>(R("data-v-342bf8b4"),_=_(),V(),_),Q={class:"px-3 bg-black py-16"},Y={key:0,class:"container max-w-screen-sm mx-auto border border-white border-opacity-10"},H={class:"bg-color3 text-white px-3 lg:px-10 py-12 flex justify-end relative"},J={class:"bg-black rounded-b-md flex items-center justify-center text-white absolute top-0 left-0 ml-3 lg:ml-10 p-3 lg:p-6"},W={class:"text-xs font-medium"},X={class:"mb-2"},Z=h(()=>e("div",{class:"bg-color3 text-white px-3 lg:px-10 border-b border-gray-100 border-opacity-10"},[e("p",{class:"text-xs font-medium leading-5 mb-6"}," Thank you! Your order has been confirmed and will be shipped shortly.Please allow 2-3 working day to process and get your order delivered to your doorstep. Our team will contact you prior to the delivery. "),e("p",{class:"text-xs font-medium text-gray-600 pb-6"}," - Erosha Traders Team - ")],-1)),ee={class:"px-3 py-6 lg:px-12 b text-xs font-medium leading-7 grid grid-cols-3 gap-4 border-b text-white border-white border-opacity-10"},te=h(()=>e("div",null,[e("p",null," Name : "),e("p",null," Addresss : "),e("p",null," Phone Number : "),e("p",null," Email : "),e("p",null," Payment method : ")],-1)),se={class:"col-span-2"},oe={class:"py-12 pb-9"},re={class:""},ae={class:"text-sm capitalize font-medium"},ne={class:"my-2 text-gray-500 font-medium"},ce={key:0,class:"capitalize text-xs"},le={key:1,class:"capitalize text-xs my-0.5"},ie={class:"capitalize text-xs mt-0.5 mb-3"},de={key:0},pe={key:0,class:"text-sm font-medium"},_e={class:"text-gray-600 line-through"},ue={key:1,class:"text-sm font-medium"},me={class:"bg-color3 text-white px-3 py-6 lg:px-12 text-xs font-medium leading-7 flex items-center space-x-10 justify-end"},he=h(()=>e("div",null,[e("p",null," Gross Total : "),e("p",null," Shipping Cost : "),e("p",null," Discounts : "),e("p",null," Net Total : ")],-1)),xe={class:"border-t text-center border-gray-400 bg-color3 text-white border-opacity-10 px-3 py-6 lg:px-12 text-xs font-medium leading-7"},be=h(()=>e("p",null," If there is any concern on your billing information please contact us ",-1)),ye=T({__name:"receipt",setup(_){const a=K(),x=q();D();const k=A(),y=G(),S=U(),g=M();let f=n=>n?Number(n.toString().split("%")[0])>0:0,d=n=>{let s=k.currency_info;return new Intl.NumberFormat("en-US",{style:"currency",currency:s.code||"LKR"}).format(n*(s.rate||1))},L=()=>{for(let n=0;n<x.cart.length;n++){let s=x.cart[n];x.remove_from_cart(s.id)}O(),N("complete_order")},C=n=>{let s=n;if(s.discount.includes("%")){let c=Number(s.discount.toString().split("%")[0]),u=(s.web_price||s.sp)*(c/100);return((s.web_price||s.sp)-u).toFixed(2)}else{let c=Number(s.discount);return((s.web_price||s.sp)-c).toFixed(2)}},O=()=>{let n=a.list[0];window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"purchase",ecommerce:{items:n.post.updated_cart,currency:"LKR",transaction_id:n.checkOut_res.order_id}})},N=async n=>{let s=a.list[0],c={ipg:s.post.payment.name,cart:s.post.updated_cart,user_hash:y.user_hash,cart_hash:y.cart_hash,jwt:g.user.length>0?g.user[0].user_jwt:"",first_name:s.post.first_name,last_name:s.post.last_name,company:"",address:s.post.address_line_one,address_line_two:"",city:s.post.city.city,country:s.post.country,contact_no1:s.post.contact_number,contact_no2:s.post.contact_number_2,email:s.post.email,meta_data:{}};$fetch(`${S.public.apiBaseUrl}/ecommerce_activity`,{method:"POST",headers:{"Content-Type":"application/json"},body:{type:n,json:c}})};return z(()=>{L()}),(n,s)=>{const c=j,u=I;return l(),i("div",Q,[t(a).list.length?(l(),i("div",Y,[e("div",H,[e("div",J,[m(u,{to:"/"},{default:w(()=>[m(c,{src:"https://greencoding.b-cdn.net/eroshatraders.lk/assets/latestlogo.jpg",class:"w-32 lg:w-[200px] object-cover"})]),_:1})]),e("div",W,[e("p",X," Order ID : "+r(t(a).list[0].checkOut_res.order_id),1),e("p",null," Placed On : "+r(new Date(t(a).list[0].checkOut_res.date).toLocaleDateString()+" at "+new Date(t(a).list[0].checkOut_res.date).toLocaleTimeString()),1)])]),Z,e("div",ee,[te,e("div",se,[e("p",null,r(t(a).list[0].post.first_name)+" "+r(t(a).list[0].post.last_name),1),e("p",null,r(t(a).list[0].post.address_line_one)+", "+r(t(a).list[0].post.city.city)+", "+r(t(a).list[0].post.delivery_area.district),1),e("p",null,r(t(a).list[0].post.contact_number),1),e("p",null,r(t(a).list[0].post.email),1),e("p",null,r(t(a).list[0].post.payment.name),1)])]),e("div",oe,[(l(!0),i(B,null,F(t(a).list[0].post.updated_cart,o=>{var v;return P((l(),i("div",{key:o.id,class:"flex space-x-3 mb-4 px-3 text-white"},[e("div",null,[m(c,{format:"webp",src:`${o.product_img}`,height:"125",width:"100",class:"small_img",quality:"80",sizes:"sm:100px md:100px lg:100px",loading:"lazy",alt:"image"},null,8,["src"])]),e("div",re,[e("p",ae,r(((v=o.bundle_name)==null?void 0:v.toLowerCase())||o.master_title.toLowerCase()),1),e("div",ne,[o.var_lab1?(l(),i("p",ce,r(o.var_lab1.toLowerCase())+" : "+r(o.var_val1.toLowerCase()),1)):p("",!0),o.var_lab2?(l(),i("p",le,r(o.var_lab2.toLowerCase())+" : "+r(o.var_val2.toLowerCase()),1)):p("",!0),e("p",ie,[o.bundle_name?(l(),i("span",de,"Bundle")):p("",!0),b(" Quantity : "+r(o.qty),1)])]),t(f)(o.discount)?(l(),i("div",pe,[e("p",null,[b(r(t(d)(t(C)(o)))+" ",1),e("sup",_e,r(t(d)(o.web_price||o.sp)),1)])])):p("",!0),t(f)(o.discount)?p("",!0):(l(),i("div",ue,[e("p",null,r(t(d)(o.bundle_price||o.web_price||o.sp)),1)]))])])),[[E,!o.bundle_name||o.bundle_name&&o.bundle_prods]])}),128))]),e("div",me,[he,e("div",null,[e("p",null,r(t(d)(t(a).list[0].checkOut_res.gross)),1),e("p",null,r(t(d)(t(a).list[0].checkOut_res.delivery)),1),e("p",null,r(t(d)(t(a).list[0].checkOut_res.discount)),1),e("p",null,r(t(d)(t(a).list[0].checkOut_res.amount)),1)])]),e("div",xe,[be,m(u,{to:"/",class:"bg-blue-600 text-white px-8 py-2 inline-block mx-auto mt-4"},{default:w(()=>[b(" Back to home ")]),_:1})])])):p("",!0)])}}});const Ce=$(ye,[["__scopeId","data-v-342bf8b4"]]);export{Ce as default};
