import { A as A$1, m as me, v as ve } from './swiper-vue-DYDolirs.mjs';
import { u } from './Skeleton-Bnk8IDLx.mjs';
import { mergeProps, unref, withCtx, createVNode, toDisplayString, openBlock, createBlock, Fragment, renderList, useSSRContext, ref, computed, createTextVNode } from 'vue';
import { ssrRenderAttrs, ssrRenderList, ssrRenderComponent, ssrInterpolate, ssrRenderClass, ssrRenderAttr, ssrRenderTeleport } from 'vue/server-renderer';
import { d as cf, h as Ma, b as gs, a as Qt, i as Ts, g as $a, _ as Ps } from './server.mjs';
import { p } from './Modal-C67xWHXr.mjs';
import { l } from './Success-CcKbULjX.mjs';
import { p as pe } from './index-Dj5w-pp2.mjs';
import { a } from './NoData-S35t_fLa.mjs';
import '../_/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:fs';
import 'node:url';
import 'node:path';
import 'unhead';
import '@unhead/shared';
import 'vue-router';
import 'vue-rate';
import 'date-fns';
import '@hennge/vue3-pagination';
import 'axios';
import 'vue-social-sharing';
import './Backdrop-CxzzDpnH.mjs';
import './SvgIcon-C2791tkm.mjs';

const O = {};
const P = O.setup;
O.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("components/Shared/OrdersSkelton.vue"), P ? P(e2, t2) : undefined;
};
const A = cf(O, [["ssrRender", function(e2, t2, s2, a2) {
  const i2 = u;
  t2(`<div${ssrRenderAttrs(mergeProps({ class: "grid grid-cols-1 md:grid-cols-2 gap-8" }, a2))}><!--[-->`), ssrRenderList(4, (e3) => {
    t2('<div class="flex flex-wrap gap-y-3 items-center justify-between bg-white p-4 shadow-md rounded-lg gap-4"><div class="flex flex-wrap gap-4">'), t2(ssrRenderComponent(i2, { class: "h-[80px] w-[80px]" }, null, s2)), t2('<div class="flex flex-col space-y-2">'), t2(ssrRenderComponent(i2, { class: "h-[20px] w-[150px]" }, null, s2)), t2(ssrRenderComponent(i2, { class: "h-[20px] w-[100px]" }, null, s2)), t2('</div></div><div class="space-y-2">'), t2(ssrRenderComponent(i2, { class: "h-[40px] w-[100px]" }, null, s2)), t2(ssrRenderComponent(i2, { class: "h-[40px] w-[100px]" }, null, s2)), t2("</div></div>");
  }), t2("<!--]--></div>");
}]]), D = { __name: "ProfileOrderCard", __ssrInlineRender: true, props: { order: { type: Object, required: true } }, emits: ["refresh"], setup(e2, { emit: t2 }) {
  const s2 = e2;
  $a();
  const r2 = Qt().$axios, a2 = ref(false), m2 = ref(false), x2 = () => {
    r2(`orders/${s2.order.id}/cancel`, { method: "POST" }).then((e3) => {
      b2("refresh"), a2.value = false, m2.value = true, pe.success(e3.data.message);
    }).catch((e3) => {
      pe.error(e3.response.data.message);
    });
  }, b2 = t2, g2 = computed(() => {
    switch (s2.order.status) {
      case "confirmed":
        return "bg-[#EDF8F8] text-[#1DA3A3]";
      case "processing":
        return "bg-[#FFF4ED] text-[#DF600F]";
      case "in_the_way":
        return "bg-[#EDF9FF] text-[#1268BF]";
      case "delivered":
      case "accepted":
        return "bg-[#F1FCF6] text-[#13CC68]";
      case "cancelled":
      case "rejected":
      case "returned":
        return "bg-[#FDF2F2] text-[#E63939]";
      default:
        return "bg-[#F9F9F9] text-[#333]";
    }
  });
  return (t3, s3, r3, i2) => {
    var l2, b3, T2, F2, _2;
    const k2 = Ps, I2 = p, C2 = l;
    s3(`<div${ssrRenderAttrs(mergeProps({ class: "border border-[#EEEEEE] p-4 bg-white" }, i2))}><div class="flex justify-between items-center mb-4"><span class="text-primary font-medium">${ssrInterpolate(t3.$t("TITLES.order"))}: ${ssrInterpolate(e2.order.id)}</span><span class="${ssrRenderClass([unref(g2), "px-2.5 py-1.5 font-semibold !text-sm"])}">${ssrInterpolate(t3.$t(`TITLES.${e2.order.status}`))}</span></div><div class="flex items-center border-b pb-4 border-[#EEEEEE] mb-4 justify-between gap-4"><p class="text-[#A1A1A1] font-medium !text-sm">${ssrInterpolate(e2.order.created_at)}</p><div class="flex items-center gap-1"><span class="text-primary font-semibold">${ssrInterpolate(e2.order.total)}</span><span class="text-primary font-medium !text-sm">${ssrInterpolate(t3.$t("TITLES.egp"))}</span></div></div><div class="flex items-center gap-4 border-b pb-4 border-[#EEEEEE] mb-4"><!--[-->`), ssrRenderList(null == (l2 = e2.order.images) ? undefined : l2.slice(0, 3), (t4) => {
      s3(`<img${ssrRenderAttr("src", t4.media)}${ssrRenderAttr("alt", e2.order.id)} class="w-20 h-20 object-cover rounded">`);
    }), s3("<!--]-->"), (null == (T2 = null == (b3 = e2.order) ? undefined : b3.images) ? undefined : T2.length) > 3 ? s3(`<span class="text-[#A1A1A1] font-medium">${ssrInterpolate((null == (_2 = null == (F2 = e2.order) ? undefined : F2.images) ? undefined : _2.length) - 3)}+</span>`) : s3("<!---->"), s3('</div><div class="flex items-center justify-center gap-4">'), s3(ssrRenderComponent(k2, { to: t3.localePath(`/order/tracking-order/${e2.order.id}`), class: "base-btn !text-sm lg:!text-base !h-11 lg:!h-14 flex-1 !font-medium" }, { default: withCtx((e3, s4, r4, a3) => {
      if (!s4) return [createTextVNode(toDisplayString(t3.$t("TITLES.details")), 1)];
      s4(`${ssrInterpolate(t3.$t("TITLES.details"))}`);
    }), _: 1 }, r3)), "cancelled" === e2.order.status || "pending" != e2.order.status && "accepted" != e2.order.status ? s3("<!---->") : s3(`<button class="base-btn !text-sm lg:!text-base !h-11 lg:!h-14 flex-1 border border-[#FC1B1B] !font-medium !bg-white !text-[#FC1B1B]">${ssrInterpolate(t3.$t("TITLES.cancel_order"))}</button>`), s3("</div>"), unref(a2) ? ssrRenderTeleport(s3, (e3) => {
      e3(ssrRenderComponent(I2, { onClose: (e4) => a2.value = false, class: "[&_h2]:!m-0" }, { default: withCtx((e4, s4, r4, o2) => {
        if (!s4) return [createVNode("p", { class: "font-medium text-primary text-xl mb-10" }, toDisplayString(t3.$t("TITLES.order_cancelation_sureness")), 1), createVNode("div", { class: "flex items-center justify-center gap-6" }, [createVNode("button", { onClick: (e5) => a2.value = false, class: "base-btn !h-14 flex-1 !font-medium" }, toDisplayString(t3.$t("TITLES.keep_the_order")), 9, ["onClick"]), createVNode("button", { onClick: x2, class: "base-btn !h-14 flex-1 !font-medium !bg-[#F94031] !text-white" }, toDisplayString(t3.$t("TITLES.cancel_order")), 1)])];
        s4(`<p class="font-medium text-primary text-xl mb-10"${o2}>${ssrInterpolate(t3.$t("TITLES.order_cancelation_sureness"))}</p><div class="flex items-center justify-center gap-6"${o2}><button class="base-btn !h-14 flex-1 !font-medium"${o2}>${ssrInterpolate(t3.$t("TITLES.keep_the_order"))}</button><button class="base-btn !h-14 flex-1 !font-medium !bg-[#F94031] !text-white"${o2}>${ssrInterpolate(t3.$t("TITLES.cancel_order"))}</button></div>`);
      }), _: 1 }, r3));
    }, "body", false, r3) : s3("<!---->"), unref(m2) ? ssrRenderTeleport(s3, (e3) => {
      e3(ssrRenderComponent(C2, { class: "[&_h2]:!font-Montserrat [&_h2]:!not-italic [&_h2]:!font-semibold", onClose: (e4) => m2.value = false, title: t3.$t("TITLES.cancel_order"), desc: t3.$t("TITLES.canceled_successfully") }, null, r3));
    }, "body", false, r3) : s3("<!---->"), s3("</div>");
  };
} }, M = D.setup;
D.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("components/Shared/ProfileOrderCard.vue"), M ? M(e2, t2) : undefined;
};
const R = { __name: "my-orders", __ssrInlineRender: true, setup(r2) {
  const a2 = Ma(), { t: i2 } = gs(), l2 = Qt().$axios, { data: c2, status: w2, refresh: E2 } = Ts("my-orders", () => l2("orders", { params: { type: a2.query.status } }).then((e2) => e2.data).catch((e2) => e2), { watch: () => [a2.query.status] }), T2 = [{ id: "confirmed", name: i2("TITLES.pending") }, { id: "processing", name: i2("TITLES.processing") }, { id: "in_the_way", name: i2("TITLES.in_the_way") }, { id: "delivered", name: i2("TITLES.delivered") }, { id: "cancelled", name: i2("TITLES.cancelled") }, { id: "rejected", name: i2("TITLES.rejected") }, { id: "returned", name: i2("TITLES.returned") }];
  return (r3, a3, i3, l3) => {
    const F2 = me, _2 = ve, S2 = A, k2 = D, I2 = a;
    a3(`<div${ssrRenderAttrs(mergeProps({ class: "bg-[#F6F7FC] p-4 lg:p-6 h-fit" }, l3))}><h3 class="font-bold text-xl lg:mb-10 mb-6">${ssrInterpolate(r3.$t("TITLES.my_orders"))}</h3><div>`), a3(ssrRenderComponent(F2, { "slides-per-view": 3.4, breakpoints: { 0: { slidesPerView: 2.1, spaceBetween: 10 }, 768: { slidesPerView: 3.4, spaceBetween: 10 }, 1024: { slidesPerView: 3.4, spaceBetween: 24 }, 1200: { slidesPerView: 4.4, spaceBetween: 24 } }, modules: ["SwiperFreeMode" in r3 ? r3.SwiperFreeMode : unref(A$1)], freeMode: true, watchSlidesProgress: true, class: "!py-4 !px-4 lg:!px-6 bg-[#FEFEFE] mb-6 lg:mb-10" }, { default: withCtx((e2, t2, s2, a4) => {
      if (!t2) return [createVNode(_2, null, { default: withCtx(() => [createVNode("button", { onClick: (e3) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: undefined }) }), class: ["w-full break-words !text-sm lg:!text-base", ["px-6 py-3", r3.$route.query.status ? "bg-[#F6F7FC] select-none  text-[#404040] hover:bg-opacity-80 transition-all" : "bg-primary text-white"]] }, toDisplayString(r3.$t("TITLES.all_orders")), 11, ["onClick"])]), _: 1 }), (openBlock(), createBlock(Fragment, null, renderList(T2, (e3) => createVNode(_2, { key: e3 }, { default: withCtx(() => [createVNode("button", { onClick: (t3) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: e3.id }) }), class: ["w-full lg:whitespace-nowrap break-words !text-sm lg:!text-base select-none", ["px-6 py-3", r3.$route.query.status == e3.id ? "bg-primary text-white" : "bg-[#F6F7FC] text-[#404040] select-none  hover:bg-opacity-80 transition-all"]] }, toDisplayString(e3.name), 11, ["onClick"])]), _: 2 }, 1024)), 64))];
      t2(ssrRenderComponent(_2, null, { default: withCtx((e3, t3, s3, a5) => {
        if (!t3) return [createVNode("button", { onClick: (e4) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: undefined }) }), class: ["w-full break-words !text-sm lg:!text-base", ["px-6 py-3", r3.$route.query.status ? "bg-[#F6F7FC] select-none  text-[#404040] hover:bg-opacity-80 transition-all" : "bg-primary text-white"]] }, toDisplayString(r3.$t("TITLES.all_orders")), 11, ["onClick"])];
        t3(`<button class="${ssrRenderClass([["px-6 py-3", r3.$route.query.status ? "bg-[#F6F7FC] select-none  text-[#404040] hover:bg-opacity-80 transition-all" : "bg-primary text-white"], "w-full break-words !text-sm lg:!text-base"])}"${a5}>${ssrInterpolate(r3.$t("TITLES.all_orders"))}</button>`);
      }), _: 1 }, s2, a4)), t2("<!--[-->"), ssrRenderList(T2, (e3) => {
        t2(ssrRenderComponent(_2, { key: e3 }, { default: withCtx((t3, s3, a5, o2) => {
          if (!s3) return [createVNode("button", { onClick: (t4) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: e3.id }) }), class: ["w-full lg:whitespace-nowrap break-words !text-sm lg:!text-base select-none", ["px-6 py-3", r3.$route.query.status == e3.id ? "bg-primary text-white" : "bg-[#F6F7FC] text-[#404040] select-none  hover:bg-opacity-80 transition-all"]] }, toDisplayString(e3.name), 11, ["onClick"])];
          s3(`<button class="${ssrRenderClass([["px-6 py-3", r3.$route.query.status == e3.id ? "bg-primary text-white" : "bg-[#F6F7FC] text-[#404040] select-none  hover:bg-opacity-80 transition-all"], "w-full lg:whitespace-nowrap break-words !text-sm lg:!text-base select-none"])}"${o2}>${ssrInterpolate(e3.name)}</button>`);
        }), _: 2 }, s2, a4));
      }), t2("<!--]-->");
    }), _: 1 }, i3)), "pending" === unref(w2) ? (a3("<div>"), a3(ssrRenderComponent(S2, null, null, i3)), a3("</div>")) : "success" === unref(w2) ? (a3("<div>"), unref(c2).data && unref(c2).data.length ? (a3('<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 gap-2 xl:grid-cols-2 lg:gap-4"><!--[-->'), ssrRenderList(unref(c2).data, (e2) => {
      a3(ssrRenderComponent(k2, { key: e2.id, order: e2, onRefresh: unref(E2) }, null, i3));
    }), a3("<!--]--></div>")) : (a3("<div>"), a3(ssrRenderComponent(I2, { class: "!min-h-[320px]" }, null, i3)), a3("</div>")), a3("</div>")) : a3("<!---->"), a3("</div></div>");
  };
} }, V = R.setup;
R.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("pages/profile/my-orders.vue"), V ? V(e2, t2) : undefined;
};

export { R as default };
//# sourceMappingURL=my-orders-COYZ_Wov.mjs.map
