import{_ as V,g as C,d as j,o as u,c as p,a as e,t,B as f,j as D,h as v,w as O,i as I,s as N,x as B,H as S,b as A,an as F,F as H,l as M,p as P,r as h}from"./app-B-4i4xU3.js";const z={class:"p-2 md:px-4 md:py-3 bg-white dark:bg-slate-800 rounded-lg border border-slate-100 dark:border-slate-700 flex gap-2 lg:gap-4 flex-col lg:flex-row items-center justify-between"},E={class:"w-full lg:w-[15%] flex flex-col overflow-hidden"},T={class:"flex gap-2"},q={class:"text-sm sm:text-base font-normal shrink-0"},L={class:"text-slate-500"},Q=["src"],R={class:"text-red-500 text-sm font-semibold"},U={class:"grow flex w-full gap-2 items-center justify-between"},Y={class:"flex flex-col"},G={class:"flex gap-1 justify-between"},J={class:"text-sm sm:text-base font-normal shrink-0"},K={class:"text-slate-500"},W={class:"text-blue-500"},X={class:"inline-flex gap-2 text-xs sm:text-sm leading-tight text-ellipsis"},Z={class:"text-slate-500 shrink-0"},ee={class:"text-slate-950 dark:text-white whitespace-nowrap text-ellipsis overflow-hidden"},te={class:"text-sm sm:text-base font-normal xl:w-20"},se={class:"text-slate-500"},oe={class:"text-slate-950 dark:text-white"},ae={class:"text-sm sm:text-base font-normal xl:w-36"},le={class:"text-slate-500"},re={class:"text-slate-950 dark:text-white"},de={class:"hidden lg:block xl:w-28"},ne={class:"hidden lg:block xl:w-28"},ie={class:"flex items-center justify-end gap-2"},ce={__name:"DigitalProductOrderItem",props:{order:Object},setup(w){const o=w,d=C();return(a,_)=>{var l,r,m,c,s,x,g,n,b,k,y,$;const i=j("router-link");return u(),p("div",z,[e("div",E,[e("div",T,[e("div",q,[e("span",L,[e("img",{src:o.order.products[0].thumbnail,alt:"product",class:"w-14 h-14 rounded-full object-cover"},null,8,Q)]),e("span",R,t((l=o.order)==null?void 0:l.products[0].name),1)])])]),e("div",U,[e("div",Y,[e("div",G,[e("div",J,[e("span",K,t(a.$t("Order ID")),1),e("span",W,t((r=o.order)==null?void 0:r.order_code),1)]),e("div",{class:f(["text-xs sm:text-sm font-normal px-1.5 py-0.5 rounded-[10px] inline-block lg:hidden text-ellipsis overflow-hidden",(m=o.order)==null?void 0:m.order_status])},t((c=o.order)==null?void 0:c.order_status),3)]),e("div",X,[e("span",Z,t(a.$t("Placed on")),1),e("span",ee,t((s=o.order)==null?void 0:s.placed_at),1)])]),e("div",te,[e("span",se,t(a.$t("QTY"))+": ",1),e("span",oe,t((x=o.order)==null?void 0:x.quantity),1)]),e("div",ae,[e("span",le,t(a.$t("Amount"))+": ",1),e("span",re,t(D(d).showCurrency((g=o.order)==null?void 0:g.amount)),1)]),e("div",de,[e("div",{class:f(["text-xs font-normal px-1.5 py-0.2 rounded-[10px] inline-block",(n=o.order)==null?void 0:n.order_status])},t((b=o.order)==null?void 0:b.order_status),3)]),e("div",ne,[e("div",{class:f(["text-xs font-normal px-1.5 py-0.2 rounded-[10px] inline-block",((k=o.order)!=null&&k.products[0].is_digital,"bg-blue-500 text-white")])},t((y=o.order)!=null&&y.products[0].is_digital?a.$t("E-Product"):a.$t("Physical Product")),3)]),e("div",ie,[v(i,{to:"/digital-product-order-history/"+(($=o.order)==null?void 0:$.id),class:"text-slate-500 text-sm sm:text-base font-normal leading-normal"},{default:O(()=>[I(t(a.$t("View Details")),1)]),_:1},8,["to"])])])])}}},ue=V(ce,[["__scopeId","data-v-3905d745"]]),pe={class:"px-2 pt-2 md:px-4 md:pt-4 lg:px-6 lg:pt-6"},_e={class:"p-4 lg:p-6 bg-white dark:bg-slate-800 rounded-xl flex flex-col gap-3"},xe={key:0},he={key:0,class:"px-2 md:px-4 lg:px-6 mt-4"},me={class:"bg-white dark:bg-slate-800 p-3 rounded-xl flex justify-between items-center w-full gap-4 flex-wrap"},ge={class:"text-slate-800 dark:text-slate-100 text-base font-normal leading-normal"},fe={__name:"DigitalProductOrderHistory",setup(w){const o=N(),d=B(),a=h("digital"),_=h([]),i=h(20),l=h(1),r=h(10),m=s=>{l.value=s,c()};S(a,()=>{l.value=1,c()}),A(()=>{c()});const c=async()=>{axios.get("/orders",{params:{order_status:a.value,page:l.value,per_page:r.value},headers:{Authorization:d.token}}).then(s=>{i.value=s.data.data.total,_.value=s.data.data.orders}).catch(s=>{s.response.status===401&&(d.token=null,d.user=null,d.addresses=[],d.favoriteProducts=0,o.push("/"))})};return(s,x)=>{const g=j("vue-awesome-paginate");return u(),p("div",null,[v(F,{title:s.$t("My Digital Products")},null,8,["title"]),e("div",pe,[e("div",_e,[(u(!0),p(H,null,M(_.value,n=>(u(),p("div",{key:n.id},[v(ue,{order:n},null,8,["order"])]))),128)),_.value.length==0?(u(),p("div",xe,[e("p",null,t(s.$t("No Order Found")),1)])):P("",!0)])]),i.value>r.value?(u(),p("div",he,[e("div",me,[e("div",ge,t(s.$t("Showing"))+" "+t(r.value*(l.value-1)+1)+" "+t(s.$t("to"))+" "+t(r.value*(l.value-1)+_.value.length)+" "+t(s.$t("of"))+" "+t(i.value)+" "+t(s.$t("results")),1),e("div",null,[v(g,{"total-items":i.value,"items-per-page":r.value,type:"button","max-pages-shown":3,modelValue:l.value,"onUpdate:modelValue":x[0]||(x[0]=n=>l.value=n),"hide-prev-next-when-ends":!0,onClick:m},null,8,["total-items","items-per-page","modelValue"])])])])):P("",!0)])}}};export{fe as default};
