import { h as Ma, g as $a, f as au, b as Qs, a as Qt, i as wn, _ as An } from './server.mjs';
import { g } from './SvgIcon-DmMp038e.mjs';
import { b } from './breadcrumb-WIdlJL1E.mjs';
import { ref, mergeProps, unref, withCtx, createVNode, createTextVNode, toDisplayString, openBlock, createBlock, Fragment, renderList, withDirectives, isRef, vModelRadio, createCommentVNode, vModelText, useSSRContext, computed } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrInterpolate, ssrRenderList, ssrRenderAttr, ssrRenderTeleport, ssrRenderClass, ssrIncludeBooleanAttr, ssrLooseEqual } from 'vue/server-renderer';
import { h, B, I } from './Cash-BtGJ4ZLT.mjs';
import { p } from './Modal-CVXpm7Mt.mjs';
import { l } from './Success-CPwGoGGk.mjs';
import { p as pe } from './index-Dj5w-pp2.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';

const R = { __name: "OrderTracking", __ssrInlineRender: true, props: { status: { type: String, default: "pending", validator: (e2) => ["pending", "accepted", "in_the_way", "delivered", "cancelled", "rejected"].includes(e2) } }, setup(t2) {
  const s2 = t2, a2 = { pending: { badge: "bg-[#EDF8F8] text-[#1DA3A3]" }, accepted: { badge: "bg-[#FFF4ED] text-[#DF600F]" }, in_the_way: { badge: "bg-[#EDF9FF] text-[#1268BF]" }, delivered: { badge: "bg-[#F1FCF6] text-[#13CC68]" }, cancelled: { badge: "bg-[#FFE9E9] text-[#FF4D4D]" }, rejected: { badge: "bg-[#FFE9E9] text-[#FF4D4D]" } }, { t: r2 } = Qs(), l2 = { pending: r2("TITLES.booking_confirmed"), accepted: r2("TITLES.processing"), in_the_way: r2("TITLES.in_the_way"), delivered: r2("TITLES.delivered"), cancelled: r2("TITLES.cancelled"), rejected: r2("TITLES.rejected") }, d2 = computed(() => l2[s2.status]), o2 = { pending: 1, accepted: 2, in_the_way: 3, delivered: 4, cancelled: -1, rejected: -1 }, n2 = computed(() => "cancelled" === s2.status || "rejected" === s2.status ? -1 : o2[s2.status]);
  return (e2, s3, r3, l3) => {
    const o3 = g;
    s3(`<div${ssrRenderAttrs(l3)}><div class="flex justify-between items-center mb-10"><h2 class="text-xl font-bold">${ssrInterpolate(e2.$t("TITLES.order_details"))}</h2><div class="${ssrRenderClass(["px-6 py-3 text-xl font-medium", a2[t2.status].badge])}">${ssrInterpolate(unref(d2))}</div></div>`), "cancelled" !== t2.status && "rejected" !== t2.status ? (s3(`<div class="bg-[#F9F9F9] p-8"><h2 class="font-bold text-xl sm:text-2xl mb-6">${ssrInterpolate(e2.$t("TITLES.track_your_order"))}</h2><div class="flex gap-8 relative justify-between px-8 py-6 bg-white border border-[#E4E7ED] items-center">`), ["cancelled", "rejected"].includes(t2.status) ? s3("<!---->") : (s3(`<!--[--><div class="flex flex-col items-center z-10 w-1/4"><div class="${ssrRenderClass(["size-20 rounded-lg flex items-center justify-center mb-4", unref(n2) >= 1 ? "bg-primary text-primary" : "bg-[#F2F4F6] text-[#626364]"])}">`), unref(n2) >= 1 ? s3(ssrRenderComponent(o3, { name: "confirmed", class: "[&_path]:fill-white" }, null, r3)) : s3(ssrRenderComponent(o3, { name: "confirmed", class: "[&_path]:fill-primary" }, null, r3)), s3(`</div><span class="${ssrRenderClass([[unref(n2) >= 1 ? " text-primary" : " text-[#626364]"], "font-medium text-center"])}">${ssrInterpolate(e2.$t("TITLES.booking_confirmed"))}</span></div><div class="flex flex-col items-center z-10 w-1/4"><div class="${ssrRenderClass(["size-20 rounded-lg flex items-center justify-center mb-4", unref(n2) >= 2 ? "bg-primary text-primary" : "bg-[#F2F4F6] text-[#626364]"])}">`), unref(n2) >= 2 ? s3(ssrRenderComponent(o3, { name: "processing", class: "[&_path]:fill-white" }, null, r3)) : s3(ssrRenderComponent(o3, { name: "processing", class: "[&_path]:fill-[#626364]" }, null, r3)), s3(`</div><span class="${ssrRenderClass([[unref(n2) >= 2 ? " text-primary" : " text-[#626364]"], "font-medium text-center"])}">${ssrInterpolate(e2.$t("TITLES.processing"))}</span></div><div class="flex flex-col items-center z-10 w-1/4"><div class="${ssrRenderClass(["size-20 rounded-lg flex items-center justify-center mb-4", unref(n2) >= 3 ? "bg-primary text-primary" : "bg-[#F2F4F6] text-[#626364]"])}">`), unref(n2) >= 3 ? s3(ssrRenderComponent(o3, { name: "inTheWay", class: "[&_path]:fill-white" }, null, r3)) : s3(ssrRenderComponent(o3, { name: "inTheWay", class: "[&_path]:fill-[#626364]" }, null, r3)), s3(`</div><span class="${ssrRenderClass([[unref(n2) >= 3 ? " text-primary" : " text-[#626364]"], "font-medium text-center"])}">${ssrInterpolate(e2.$t("TITLES.in_the_way"))}</span></div><div class="flex flex-col items-center z-10 w-1/4"><div class="${ssrRenderClass(["size-20 rounded-lg flex items-center justify-center mb-4", unref(n2) >= 4 ? "bg-primary text-primary" : "bg-[#F2F4F6] text-[#626364]"])}">`), unref(n2) >= 4 ? s3(ssrRenderComponent(o3, { name: "delivered", class: "[&_path]:fill-white" }, null, r3)) : s3(ssrRenderComponent(o3, { name: "delivered", class: "[&_path]:fill-[#626364]" }, null, r3)), s3(`</div><span class="${ssrRenderClass([[unref(n2) >= 4 ? " text-primary" : " text-[#626364]"], "font-medium text-center"])}">${ssrInterpolate(e2.$t("TITLES.delivered"))}</span></div><div class="absolute top-[40%] -translate-y-1/2 left-[12.5%] w-[25%] h-px border-t border-dashed border-[#D1D1D6] z-0"></div>`), unref(n2) >= 2 ? s3('<div class="absolute top-[40%] -translate-y-1/2 left-[12.5%] w-[25%] h-px border-t border-dashed border-black z-1"></div>') : s3("<!---->"), s3('<div class="absolute top-[40%] -translate-y-1/2 left-[37.5%] w-[25%] h-px border-t border-dashed border-[#D1D1D6] z-0"></div>'), unref(n2) >= 3 ? s3('<div class="absolute top-[40%] -translate-y-1/2 left-[37.5%] w-[25%] h-px border-t border-dashed border-black z-1"></div>') : s3("<!---->"), s3('<div class="absolute top-[40%] -translate-y-1/2 left-[62.5%] w-[25%] h-px border-t border-dashed border-[#D1D1D6] z-0"></div>'), unref(n2) >= 4 ? s3('<div class="absolute top-[40%] -translate-y-1/2 left-[62.5%] w-[25%] h-px border-t border-dashed border-black z-1"></div>') : s3("<!---->"), s3("<!--]-->")), ["cancelled", "rejected"].includes(t2.status) ? s3(`<div class="absolute inset-0 bg-[#FFE9E9]/10 flex items-center justify-center"><div class="bg-[#FFE9E9] px-4 py-2 rounded-md text-[#FF4D4D] font-medium">${ssrInterpolate(unref(d2))}</div></div>`) : s3("<!---->"), s3("</div></div>")) : s3("<!---->"), s3("</div>");
  };
} }, G = R.setup;
R.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("components/Shared/OrderTracking.vue"), G ? G(e2, t2) : undefined;
};
const H = { __name: "index", __ssrInlineRender: true, setup(n2) {
  const c2 = Ma();
  $a();
  const G2 = au(), { t: H2 } = Qs(), J2 = ref([{ name: H2("NAV.home"), to: "/" }, { name: H2("TITLES.order_details"), to: "", disabled: true }, { name: H2("TITLES.track_your_order"), to: `/order/tracking-order/${c2.params.slug}`, disabled: true }]), K = Qt().$axios, { data: N, status: P, refresh: q } = wn("order-details", () => K(`orders/${c2.params.slug}`).then((e2) => e2.data.data).catch((e2) => e2.response.data)), Q = ref(false), X = ref(false), Y = () => {
    K(`orders/${c2.params.slug}/cancel`, { method: "POST" }).then((e2) => {
      Q.value = false, X.value = true, pe.success(e2.data.message), q();
    }).catch((e2) => {
      pe.error(e2.response.data.message);
    });
  }, Z = ref(false), ee = ref(""), te = ref("");
  return Qt(), (e2, t2, s2, a2) => {
    var _a;
    var r2, l2, n3, c3;
    const u2 = An, M2 = g, H3 = b, K2 = R, q2 = I, se = p, ae = l;
    t2(`<div${ssrRenderAttrs(mergeProps({ class: "my-16 container" }, a2))}><div data-aos="fade-right" class="flex mb-10 items-center gap-5 flex-wrap">`), t2(ssrRenderComponent(u2, { to: unref(G2)("/cart"), class: "justify-center flex items-center border border-[#E1E1E1] size-12 rounded-full" }, { default: withCtx((e3, t3, s3, a3) => {
      if (!t3) return [createVNode(M2, { name: "arrow-left", class: "[&_path]:fill-primary scale-[.60]" })];
      t3(ssrRenderComponent(M2, { name: "arrow-left", class: "[&_path]:fill-primary scale-[.60]" }, null, s3, a3));
    }), _: 1 }, s2)), t2(ssrRenderComponent(H3, { items: unref(J2) }, null, s2)), t2("</div>"), "success" == unref(P) ? (t2('<div class="grid grid-cols-1 lg:grid-cols-12 gap-10">'), unref(N) ? (t2('<!--[--><div data-aos="fade-right" class="lg:col-span-8 space-y-10">'), t2(ssrRenderComponent(K2, { status: unref(N).status }, null, s2)), t2(`<div class="p-4 lg:p-8 bg-[#F9F9F9]"><h2 class="font-bold text-xl sm:text-2xl mb-6 pb-6 border-b border-[#D1D1D6]">${ssrInterpolate(e2.$t("TITLES.order_details"))}</h2><div class="flex justify-between mb-8 font-medium text-lg items-center gap-4 flex-wrap"><div>${ssrInterpolate(e2.$t("TITLES.order"))} : ${ssrInterpolate(unref(N).order_no)}</div></div><div class="space-y-8"><!--[-->`), ssrRenderList(unref(N).products, (e3) => {
      t2(ssrRenderComponent(q2, { key: e3.id, product: e3, status: unref(N).status, "show-action": false }, null, s2));
    }), t2(`<!--]--></div></div></div><div data-aos="fade-left" class="lg:col-span-4"><div class="bg-[#F9F9F9] px-6 pt-6 mb-10 pb-10"><h3 class="font-bold text-xl sm:text-2xl mb-6">${ssrInterpolate(e2.$t("TITLES.order_summary"))}</h3><div class="border border-[#E4E7ED0] p-4"><div class="flex font-semibold text-lg mb-4 pb-4 border-b-[1.5px] border-dashed border-[#D7D7E0] items-center gap-4 justify-between"><h4>${ssrInterpolate(e2.$t("TITLES.product_price"))}</h4><div class="font-bold text-xl whitespace-nowrap">${ssrInterpolate(e2.$n(unref(N).sub_total))} ${ssrInterpolate(e2.$t("TITLES.egp"))}</div></div><div class="flex font-medium text-lg mb-4 items-center gap-4 justify-between"><h4 class="text-[#797979]">${ssrInterpolate(e2.$t("TITLES.vat"))} (%)</h4><div class="text-xl whitespace-nowrap">${ssrInterpolate(e2.$n(unref(N).vat_value))} ${ssrInterpolate(e2.$t("TITLES.egp"))}</div></div><div class="flex font-medium text-lg mb-4 items-center gap-4 justify-between"><h4 class="text-[#797979]">${ssrInterpolate(e2.$t("TITLES.shipping"))} :</h4><div class="text-xl whitespace-nowrap">${ssrInterpolate((_a = e2.$n(+unref(N).shipping_value)) != null ? _a : 0)} ${ssrInterpolate(e2.$t("TITLES.egp"))}</div></div><div class="flex font-semibold text-2xl mt-4 pt-4 border-t border-[#D1D1D6] items-center gap-4 justify-between"><h4>${ssrInterpolate(e2.$t("TITLES.total"))}</h4><div class="font-bold text-xl whitespace-nowrap">${ssrInterpolate(e2.$n(+unref(N).total))} ${ssrInterpolate(e2.$t("TITLES.egp"))}</div></div></div></div><div class="bg-[#F9F9F9] p-6 mb-10"><h3 class="font-bold text-xl sm:text-2xl mb-6">${ssrInterpolate(e2.$t("TITLES.payment_method"))}</h3><div class="flex items-center gap-6"><div class="w-[112px] h-[56px] flex items-center justify-center bg-white">`), "online" == unref(N).payment_type ? t2(`<img${ssrRenderAttr("src", h)} alt="mastercard">`) : t2("<!---->"), "cash" == unref(N).payment_type ? t2(`<img${ssrRenderAttr("src", B)} alt="mastercard">`) : t2("<!---->"), t2(`</div><span class="font-semibold text-xl">${ssrInterpolate(e2.$t(`TITLES.${unref(N).payment_type}`))}</span></div></div><div class="bg-[#F9F9F9] p-6 mb-10"><h3 class="font-bold text-xl sm:text-2xl mb-6">${ssrInterpolate(e2.$t("TITLES.address_details"))}</h3><div class="flex items-center gap-4">`), t2(ssrRenderComponent(M2, { name: "location-dot", class: "flex-shrink-0" }, null, s2)), t2(`<div><p class="font-semibold mb-2 text-lg">${ssrInterpolate(null == (r2 = unref(N).address) ? undefined : r2.first_name)} ${ssrInterpolate(null == (l2 = unref(N).address) ? undefined : l2.last_name)}</p><p class="text-[#737679]">${ssrInterpolate(null == (n3 = unref(N).address) ? undefined : n3.street_address)}, ${ssrInterpolate(null == (c3 = unref(N).address) ? undefined : c3.zip_code)}</p></div></div></div>`), "cancelled" === unref(N).status || "pending" !== unref(N).status && "accepted" !== unref(N).status ? t2("<!---->") : t2(`<button class="base-btn w-full !h-14 border-[1.5px] !bg-white !text-[#FC1B1B] border-[#FC1B1B]">${ssrInterpolate(e2.$t("TITLES.cancel_order"))}</button>`), "delivered" === unref(N).status ? t2(`<button class="base-btn w-full !h-14 mb-4">${ssrInterpolate(e2.$t("TITLES.repeat_order"))}</button>`) : t2("<!---->"), "delivered" === unref(N).status ? t2(ssrRenderComponent(u2, { to: unref(G2)(`/order/tracking-order/${e2.$route.params.slug}/return`), class: "base-btn w-full !h-14" }, { default: withCtx((t3, s3, a3, r3) => {
      if (!s3) return [createTextVNode(toDisplayString(e2.$t("TITLES.return_order")), 1)];
      s3(`${ssrInterpolate(e2.$t("TITLES.return_order"))}`);
    }), _: 1 }, s2)) : t2("<!---->"), t2("</div><!--]-->")) : t2("<!---->"), t2("</div>")) : t2("<!---->"), unref(Q) ? ssrRenderTeleport(t2, (t3) => {
      t3(ssrRenderComponent(se, { onClose: (e3) => Q.value = false, class: "[&_h2]:!m-0" }, { default: withCtx((t4, s3, a3, r3) => {
        if (!s3) return [createVNode("p", { class: "font-medium text-primary text-xl mb-10" }, toDisplayString(e2.$t("TITLES.order_cancelation_sureness")), 1), createVNode("div", { class: "flex items-center justify-center gap-6" }, [createVNode("button", { onClick: (e3) => Q.value = false, class: "base-btn !h-14 flex-1 !font-medium" }, toDisplayString(e2.$t("TITLES.keep_the_order")), 9, ["onClick"]), createVNode("button", { onClick: Y, class: "base-btn !h-14 flex-1 !font-medium !bg-[#F94031] !text-white" }, toDisplayString(e2.$t("TITLES.cancel_order")), 1)])];
        s3(`<p class="font-medium text-primary text-xl mb-10"${r3}>${ssrInterpolate(e2.$t("TITLES.order_cancelation_sureness"))}</p><div class="flex items-center justify-center gap-6"${r3}><button class="base-btn !h-14 flex-1 !font-medium"${r3}>${ssrInterpolate(e2.$t("TITLES.keep_the_order"))}</button><button class="base-btn !h-14 flex-1 !font-medium !bg-[#F94031] !text-white"${r3}>${ssrInterpolate(e2.$t("TITLES.cancel_order"))}</button></div>`);
      }), _: 1 }, s2));
    }, "body", false, s2) : t2("<!---->"), unref(Z) ? ssrRenderTeleport(t2, (t3) => {
      t3(ssrRenderComponent(se, { onClose: (e3) => Z.value = false, class: "[&_h2]:!m-0" }, { default: withCtx((t4, s3, a3, r3) => {
        if (!s3) return [createVNode("p", { class: "font-semibold text-primary text-xl mb-10" }, " Select the reason for cancellation. "), createVNode("div", { class: "space-y-6" }, [(openBlock(true), createBlock(Fragment, null, renderList(e2.reasons, (e3, t5) => (openBlock(), createBlock("div", { key: t5, class: ["border bg-white cursor-pointer transition-all", unref(ee) === e3 ? "border-[#707070]" : "border-[#E1E1E1]"], onClick: (t6) => ee.value = e3 }, [createVNode("label", { class: "flex items-center w-full cursor-pointer p-4" }, [createVNode("div", { class: "relative me-3" }, [withDirectives(createVNode("input", { type: "radio", id: `reason-${t5}`, value: e3, "onUpdate:modelValue": (e4) => isRef(ee) ? ee.value = e4 : null, class: "opacity-0 absolute h-6 w-6 cursor-pointer" }, null, 8, ["id", "value", "onUpdate:modelValue"]), [[vModelRadio, unref(ee)]]), createVNode("div", { class: ["w-6 h-6 border-[1.5px] rounded-full", unref(ee) === e3 ? "border-black" : "border-[#E1E1E1]"] }, [unref(ee) === e3 ? (openBlock(), createBlock("div", { key: 0, class: "w-4 h-4 bg-black rounded-full absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2" })) : createCommentVNode("", true)], 2)]), createVNode("span", { class: "flex-grow" }, toDisplayString(e3), 1)])], 10, ["onClick"]))), 128)), createVNode("div", null, [withDirectives(createVNode("textarea", { "onUpdate:modelValue": (e3) => isRef(te) ? te.value = e3 : null, placeholder: "Write the reason here", class: "w-full p-4 border border-[#D6D6E0] resize-none h-24 outline-none" }, null, 8, ["onUpdate:modelValue"]), [[vModelText, unref(te)]])])]), createVNode("div", { class: "flex items-center justify-center gap-6 mt-6" }, [createVNode("button", { onClick: (e3) => (Z.value = false, X.value = true), class: "base-btn w-full !h-14 flex-1 !font-medium" }, " Confirmation ", 8, ["onClick"])])];
        s3(`<p class="font-semibold text-primary text-xl mb-10"${r3}> Select the reason for cancellation. </p><div class="space-y-6"${r3}><!--[-->`), ssrRenderList(e2.reasons, (e3, t5) => {
          s3(`<div class="${ssrRenderClass([unref(ee) === e3 ? "border-[#707070]" : "border-[#E1E1E1]", "border bg-white cursor-pointer transition-all"])}"${r3}><label class="flex items-center w-full cursor-pointer p-4"${r3}><div class="relative me-3"${r3}><input type="radio"${ssrRenderAttr("id", `reason-${t5}`)}${ssrRenderAttr("value", e3)}${ssrIncludeBooleanAttr(ssrLooseEqual(unref(ee), e3)) ? " checked" : ""} class="opacity-0 absolute h-6 w-6 cursor-pointer"${r3}><div class="${ssrRenderClass([unref(ee) === e3 ? "border-black" : "border-[#E1E1E1]", "w-6 h-6 border-[1.5px] rounded-full"])}"${r3}>`), unref(ee) === e3 ? s3(`<div class="w-4 h-4 bg-black rounded-full absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"${r3}></div>`) : s3("<!---->"), s3(`</div></div><span class="flex-grow"${r3}>${ssrInterpolate(e3)}</span></label></div>`);
        }), s3(`<!--]--><div${r3}><textarea placeholder="Write the reason here" class="w-full p-4 border border-[#D6D6E0] resize-none h-24 outline-none"${r3}>${ssrInterpolate(unref(te))}</textarea></div></div><div class="flex items-center justify-center gap-6 mt-6"${r3}><button class="base-btn w-full !h-14 flex-1 !font-medium"${r3}> Confirmation </button></div>`);
      }), _: 1 }, s2));
    }, "body", false, s2) : t2("<!---->"), unref(X) ? ssrRenderTeleport(t2, (t3) => {
      t3(ssrRenderComponent(ae, { class: "[&_h2]:!font-Montserrat [&_h2]:!not-italic [&_h2]:!font-semibold", onClose: (e3) => X.value = false, title: e2.$t("TITLES.cancel_order"), desc: e2.$t("TITLES.canceled_successfully") }, null, s2));
    }, "body", false, s2) : t2("<!---->"), t2("</div>");
  };
} }, J = H.setup;
H.setup = (e2, t2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("pages/order/tracking-order/[slug]/index.vue"), J ? J(e2, t2) : undefined;
};

export { H as default };
//# sourceMappingURL=index-BqS234gG.mjs.map
