import { z, h as he, g as ge } from './swiper-vue-DHAv4051.mjs';
import { d } from './Skeleton-BBJiWBrY.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 uf, h as Ma, b as Qs, a as Qt, i as wn, g as $a, _ as An } from './server.mjs';
import { p } from './Modal-CVXpm7Mt.mjs';
import { l } from './Success-CPwGoGGk.mjs';
import { p as pe } from './index-Dj5w-pp2.mjs';
import { a } from './NoData-DiE8X5YK.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-Ez8lg5QV.mjs';
import './SvgIcon-BKMVrGmr.mjs';

const A = {};
const D = A.setup;
A.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("components/Shared/OrdersSkelton.vue"), D ? D(e2, t2) : undefined;
};
const B = uf(A, [["ssrRender", function(e2, t2, s2, o2) {
  const i2 = d;
  t2(`<div${ssrRenderAttrs(mergeProps({ class: "grid grid-cols-1 md:grid-cols-2 gap-8" }, o2))}><!--[-->`), 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] rounded-md" }, 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>");
}]]), M = { __name: "ProfileOrderCard", __ssrInlineRender: true, props: { order: { type: Object, required: true } }, emits: ["refresh"], setup(e2, { emit: t2 }) {
  const s2 = e2;
  $a();
  const r2 = Qt().$axios, o2 = ref(false), m2 = ref(false), x2 = () => {
    r2(`orders/${s2.order.id}/cancel`, { method: "POST" }).then((e3) => {
      b2("refresh"), o2.value = false, m2.value = true, pe.success(e3.data.message);
    }).catch((e3) => {
      pe.error(e3.response.data.message);
    });
  }, b2 = t2, f2 = 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":
        return "bg-[#F1FCF6] text-[#13CC68]";
      case "cancelled":
        return "bg-[#FDF2F2] text-[#E63939]";
      default:
        return "bg-[#F9F9F9] text-[#333]";
    }
  });
  return (t3, s3, r3, i2) => {
    var n2, b3, T2, _2, w2;
    const C2 = An, I2 = p, L2 = 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(f2), "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 == (n2 = e2.order.images) ? undefined : n2.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 == (w2 = null == (_2 = e2.order) ? undefined : _2.images) ? undefined : w2.length) - 3)}+</span>`) : s3("<!---->"), s3('</div><div class="flex items-center justify-center gap-4">'), s3(ssrRenderComponent(C2, { to: t3.localePath(`/order/tracking-order/${e2.order.id}`), class: "base-btn !text-base !h-14 flex-1 !font-medium" }, { default: withCtx((e3, s4, r4, o3) => {
      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-base !h-14 flex-1 border border-[#FC1B1B] !font-medium !bg-white !text-[#FC1B1B]">${ssrInterpolate(t3.$t("TITLES.cancel_order"))}</button>`), s3("</div>"), unref(o2) ? ssrRenderTeleport(s3, (e3) => {
      e3(ssrRenderComponent(I2, { onClose: (e4) => o2.value = false, class: "[&_h2]:!m-0" }, { default: withCtx((e4, s4, r4, a2) => {
        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) => o2.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"${a2}>${ssrInterpolate(t3.$t("TITLES.order_cancelation_sureness"))}</p><div class="flex items-center justify-center gap-6"${a2}><button class="base-btn !h-14 flex-1 !font-medium"${a2}>${ssrInterpolate(t3.$t("TITLES.keep_the_order"))}</button><button class="base-btn !h-14 flex-1 !font-medium !bg-[#F94031] !text-white"${a2}>${ssrInterpolate(t3.$t("TITLES.cancel_order"))}</button></div>`);
      }), _: 1 }, r3));
    }, "body", false, r3) : s3("<!---->"), unref(m2) ? ssrRenderTeleport(s3, (e3) => {
      e3(ssrRenderComponent(L2, { 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>");
  };
} }, P = M.setup;
M.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("components/Shared/ProfileOrderCard.vue"), P ? P(e2, t2) : undefined;
};
const R = { __name: "my-orders", __ssrInlineRender: true, setup(r2) {
  const o2 = Ma(), { t: i2 } = Qs(), n2 = Qt().$axios, { data: c2, status: F2, refresh: E2 } = wn("my-orders", () => n2("orders", { params: { type: o2.query.status } }).then((e2) => e2.data).catch((e2) => e2), { watch: () => [o2.query.status] }), T2 = [{ id: "confirmed", name: i2("TITLES.confirmed") }, { 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") }];
  return (r3, o3, i3, n3) => {
    const _2 = he, w2 = ge, S2 = B, C2 = M, I2 = a;
    o3(`<div${ssrRenderAttrs(mergeProps({ class: "bg-[#F6F7FC] p-6 h-fit" }, n3))}><h3 class="font-bold text-xl mb-10">${ssrInterpolate(r3.$t("TITLES.my_orders"))}</h3><div>`), o3(ssrRenderComponent(_2, { "slides-per-view": 3.4, "space-between": "24", modules: ["SwiperFreeMode" in r3 ? r3.SwiperFreeMode : unref(z)], "free-mode": true, class: "!py-4 !px-6 bg-[#FEFEFE] mb-10" }, { default: withCtx((e2, t2, s2, o4) => {
      if (!t2) return [createVNode(w2, null, { default: withCtx(() => [createVNode("button", { onClick: (e3) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: undefined }) }), class: ["w-full", ["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(w2, { key: e3 }, { default: withCtx(() => [createVNode("button", { onClick: (t3) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: e3.id }) }), class: ["w-full", ["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(w2, null, { default: withCtx((e3, t3, s3, o5) => {
        if (!t3) return [createVNode("button", { onClick: (e4) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: undefined }) }), class: ["w-full", ["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"])}"${o5}>${ssrInterpolate(r3.$t("TITLES.all_orders"))}</button>`);
      }), _: 1 }, s2, o4)), t2("<!--[-->"), ssrRenderList(T2, (e3) => {
        t2(ssrRenderComponent(w2, { key: e3 }, { default: withCtx((t3, s3, o5, a2) => {
          if (!s3) return [createVNode("button", { onClick: (t4) => r3.$router.push({ query: Object.assign({}, r3.$route.query, { status: e3.id }) }), class: ["w-full", ["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"])}"${a2}>${ssrInterpolate(e3.name)}</button>`);
        }), _: 2 }, s2, o4));
      }), t2("<!--]-->");
    }), _: 1 }, i3)), "pending" === unref(F2) ? (o3("<div>"), o3(ssrRenderComponent(S2, null, null, i3)), o3("</div>")) : "success" === unref(F2) ? (o3("<div>"), unref(c2).data && unref(c2).data.length ? (o3('<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 gap-2 xl:grid-cols-2 lg:gap-8"><!--[-->'), ssrRenderList(unref(c2).data, (e2) => {
      o3(ssrRenderComponent(C2, { key: e2.id, order: e2, onRefresh: unref(E2) }, null, i3));
    }), o3("<!--]--></div>")) : (o3("<div>"), o3(ssrRenderComponent(I2, { class: "!min-h-[300px]" }, null, i3)), o3("</div>")), o3("</div>")) : o3("<!---->"), o3("</div></div>");
  };
} }, G = R.setup;
R.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("pages/profile/my-orders.vue"), G ? G(e2, t2) : undefined;
};

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