(()=>{var e={};e.id=137,e.ids=[137],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:e=>{"use strict";e.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28559:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(62688).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31921:(e,t,s)=>{Promise.resolve().then(s.bind(s,95821))},33873:e=>{"use strict";e.exports=require("path")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64147:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>v});var a=s(60687),r=s(43210),i=s(16189),n=s(44493),d=s(29523),o=s(35950),l=s(75479),p=s(52998),c=s(74865),m=s(16735),x=s(41862),u=s(28559),h=s(30474),g=s(85814),b=s.n(g),f=s(77313);function v(){let e=(0,i.useParams)(),t=(0,i.useRouter)();e?.id;let[s,g]=(0,r.useState)(null),[v,y]=(0,r.useState)(!0),[j,_]=(0,r.useState)(null);return v?(0,a.jsx)("div",{className:"min-h-screen flex justify-center items-center",children:(0,a.jsx)(x.A,{className:"h-8 w-8 animate-spin text-primary"})}):j||!s?(0,a.jsx)("div",{className:"min-h-screen pt-6 sm:pt-9 lg:pt-[55px]",children:(0,a.jsxs)(n.Zp,{className:"p-8 text-center max-w-2xl mx-auto",children:[(0,a.jsx)("p",{className:"text-red-500 mb-4",children:j||"الطلب غير موجود"}),(0,a.jsxs)(d.$,{onClick:()=>t.push("/order"),className:"flex-row-reverse",children:["العودة إلى الطلبات",(0,a.jsx)(u.A,{className:"ml-2 h-4 w-4"})]})]})}):(0,a.jsxs)("div",{className:"pt-6 sm:pt-9 lg:pt-[55px] space-y-[140px]",children:[(0,a.jsx)("div",{className:"px-4 md:px-6",children:(0,a.jsxs)("div",{className:"w-full max-w-[1240px] mx-auto",children:[(0,a.jsxs)(d.$,{variant:"ghost",onClick:()=>t.push("/order"),className:"mb-6 flex-row-reverse",children:["العودة إلى الطلبات",(0,a.jsx)(u.A,{className:"ml-2 h-4 w-4"})]}),(0,a.jsx)(n.Zp,{className:"mb-6 p-6 bg-gradient-to-r from-blue-50 to-indigo-50 border-2 border-blue-200",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-1",children:"رقم الطلب"}),(0,a.jsxs)("h2",{className:"text-2xl md:text-3xl font-bold text-gray-900",children:["#",s.order_number]}),(0,a.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:["تم الطلب في ",new Date(s.created_at).toLocaleString("ar-SA-u-ca-gregory",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})]}),(0,a.jsxs)("div",{className:"bg-white border-2 border-blue-300 rounded-lg p-3 mt-4",children:[(0,a.jsx)("p",{className:"text-xs text-gray-600 mb-1",children:"الرقم المرجعي"}),(0,a.jsx)("p",{className:"font-mono font-bold text-blue-600 text-lg",children:s.reference_number}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"استخدم هذا الرقم المرجعي لدعم العملاء"})]})]}),(0,a.jsxs)("div",{className:"text-left",children:[(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-1",children:"حالة الطلب"}),(0,a.jsx)("span",{className:`inline-block px-4 py-2 rounded-full text-sm font-semibold ${"delivered"===s.status?"bg-green-100 text-green-800":"shipped"===s.status?"bg-blue-100 text-blue-800":"processing"===s.status?"bg-yellow-100 text-yellow-800":"cancelled"===s.status?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:m.Q.getStatusDisplay(s.status)}),(0,a.jsxs)("p",{className:"text-sm text-gray-500 mt-2",children:["الدفع: ","card"===s.payment_method?"بطاقة":"الدفع عند الاستلام"]}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["حالة الدفع: ","paid"===s.payment_status?"مدفوع":"قيد الانتظار"]})]})]})}),(0,a.jsx)(p.R,{currentStatus:s.status,orderNumber:s.reference_number,orderDate:new Date(s.created_at).toLocaleString("ar-SA-u-ca-gregory",{year:"numeric",month:"short",day:"numeric"}),estimatedDelivery:new Date(new Date(s.created_at).getTime()+432e6).toLocaleDateString("ar-SA-u-ca-gregory",{year:"numeric",month:"short",day:"numeric"}),onExportInvoice:()=>{if(!s)return;let e=`
<!DOCTYPE html>
<html dir="rtl" lang="ar">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>فاتورة #${s.order_number}</title>
  <style>
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; padding: 40px; background: #f5f5f5; }
    .invoice { max-width: 800px; margin: 0 auto; background: white; padding: 40px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
    .header { border-bottom: 3px solid #2563eb; padding-bottom: 20px; margin-bottom: 30px; }
    .header h1 { color: #1e40af; font-size: 32px; margin-bottom: 10px; }
    .header .subtitle { color: #64748b; font-size: 14px; }
    .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 30px; }
    .info-box { background: #f8fafc; padding: 15px; border-radius: 8px; border-right: 4px solid #3b82f6; }
    .info-box h3 { color: #1e40af; font-size: 14px; margin-bottom: 8px; font-weight: 600; }
    .info-box p { color: #475569; font-size: 13px; line-height: 1.6; }
    .reference-box { background: #dbeafe; border: 2px solid #3b82f6; padding: 15px; border-radius: 8px; margin: 20px 0; text-align: center; }
    .reference-box .ref-label { color: #1e40af; font-size: 12px; margin-bottom: 5px; }
    .reference-box .ref-number { color: #1e40af; font-size: 24px; font-weight: bold; font-family: monospace; }
    table { width: 100%; border-collapse: collapse; margin: 20px 0; }
    thead { background: #f1f5f9; }
    th { padding: 12px; text-align: right; font-weight: 600; color: #1e293b; border-bottom: 2px solid #cbd5e1; }
    td { padding: 12px; text-align: right; border-bottom: 1px solid #e2e8f0; color: #475569; }
    tbody tr:hover { background: #f8fafc; }
    .totals { margin-top: 30px; border-top: 2px solid #e2e8f0; padding-top: 20px; }
    .totals-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
    .totals-row.total { font-size: 18px; font-weight: bold; color: #1e40af; border-top: 2px solid #3b82f6; margin-top: 10px; padding-top: 15px; }
    .footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid #e2e8f0; text-align: center; color: #64748b; font-size: 12px; }
    .status-badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
    .status-paid { background: #dcfce7; color: #166534; }
    .status-pending { background: #fef3c7; color: #92400e; }
    @media print {
      body { padding: 0; background: white; }
      .invoice { box-shadow: none; }
      @page { margin: 20mm; }
    }
  </style>
</head>
<body>
  <div class="invoice">
    <div class="header">
      <h1>فاتورة</h1>
      <p class="subtitle">رقم الطلب: #${s.order_number}</p>
      <p class="subtitle">تاريخ الإصدار: ${new Date(s.created_at).toLocaleDateString("ar-SA-u-ca-gregory",{year:"numeric",month:"long",day:"numeric"})}</p>
    </div>

    <div class="reference-box">
      <div class="ref-label">الرقم المرجعي</div>
      <div class="ref-number">${s.reference_number}</div>
    </div>

    <div class="info-grid">
      <div class="info-box">
        <h3>معلومات العميل</h3>
        <p><strong>${s.shipping_address.first_name} ${s.shipping_address.last_name}</strong></p>
        <p>${s.shipping_address.street}</p>
        <p>${s.shipping_address.city}, ${s.shipping_address.state} ${s.shipping_address.zip_code}</p>
        ${s.shipping_address.phone?`<p>هاتف: ${s.shipping_address.phone}</p>`:""}
      </div>

      <div class="info-box">
        <h3>معلومات الدفع</h3>
        <p><strong>طريقة الدفع:</strong> ${"card"===s.payment_method?"بطاقة ائتمان":"الدفع عند الاستلام"}</p>
        <p><strong>حالة الدفع:</strong> <span class="status-badge ${"paid"===s.payment_status?"status-paid":"status-pending"}">${"paid"===s.payment_status?"مدفوع":"قيد الانتظار"}</span></p>
        <p><strong>حالة الطلب:</strong> ${m.Q.getStatusDisplay(s.status)}</p>
      </div>
    </div>

    <table>
      <thead>
        <tr>
          <th>المنتج</th>
          <th>المواصفات</th>
          <th>الكمية</th>
          <th>السعر</th>
          <th>المجموع</th>
        </tr>
      </thead>
      <tbody>
        ${s.items.map(e=>`
          <tr>
            <td><strong>${e.product_variant.product.name}</strong></td>
            <td>الحجم: ${e.product_variant.size} | اللون: ${e.product_variant.color}</td>
            <td>${e.quantity}</td>
            <td>$${Number(e.price).toFixed(2)}</td>
            <td>$${(Number(e.price)*e.quantity).toFixed(2)}</td>
          </tr>
        `).join("")}
      </tbody>
    </table>

    <div class="totals">
      <div class="totals-row">
        <span>المجموع الفرعي:</span>
        <span>$${(Number(s.total_amount)+Number(s.discount_amount)).toFixed(2)}</span>
      </div>
      ${Number(s.discount_amount)>0?`
      <div class="totals-row">
        <span>الخصم:</span>
        <span style="color: #dc2626;">-$${Number(s.discount_amount).toFixed(2)}</span>
      </div>
      `:""}
      <div class="totals-row">
        <span>التوصيل:</span>
        <span>مجاني</span>
      </div>
      <div class="totals-row total">
        <span>الإجمالي:</span>
        <span>$${Number(s.total_amount).toFixed(2)}</span>
      </div>
    </div>

    <div class="footer">
      <p>شكراً لتسوقك معنا!</p>
      <p>للاستفسارات، يرجى التواصل معنا باستخدام الرقم المرجعي: ${s.reference_number}</p>
    </div>
  </div>
</body>
</html>
    `,t=new Blob([e],{type:"text/html"}),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=`invoice-${s.order_number}.html`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a);let i=window.open("","_blank");i&&(i.document.write(e),i.document.close())},createdAt:s.created_at}),(0,a.jsxs)(n.Zp,{className:"pl-[17px] pr-[21px] md:px-[22px] py-[26px] md:py-[30px]",children:[(0,a.jsxs)("div",{className:"space-y-[13px] md:space-y-10 mb-9 sm:mb-8",children:[(0,a.jsx)("h3",{className:"text-black text-[22px] sm:text-[30px] leading-[38px] font-bold",children:"عناصر الطلب"}),(0,a.jsx)("div",{className:"space-y-[17px] sm:space-y-7 lg:space-y-10",children:s.items.map(e=>(0,a.jsx)(c.A,{item:{id:e.id.toString(),title:e.product_variant.product.name,image:e.product_variant.product.image_url||"/api/placeholder/300/300",price:e.price,qty:e.quantity,rating:4.5,attributes:[`Size: ${e.product_variant.size}`,`Color: ${e.product_variant.color}`],status:s.status}},e.id))})]}),(0,a.jsx)(o.w,{className:"bg-[#D0D5DD]"}),(0,a.jsxs)("div",{className:"flex items-start gap-8 sm:gap-[50px] md:mt-8 my-6 md:mb-14",children:[(0,a.jsxs)("div",{className:"max-w-[524px] w-full",children:[(0,a.jsx)(l.LJ,{className:"text-[16px] sm:text-[20px] leading-[30px] font-bold mb-1.5",children:"طريقة الدفع"}),(0,a.jsxs)("div",{className:"flex items-center gap-[11px]",children:[(0,a.jsx)("h4",{className:"text-[#667085] text-[14px] leading-5 inter font-normal",children:"card"===s.payment_method?"بطاقة ائتمان":"الدفع عند الاستلام"}),"card"===s.payment_method&&(0,a.jsx)(h.default,{src:"/assets/icons/visa.svg",alt:"payment",width:34,height:24})]}),(0,a.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:["الحالة: ","paid"===s.payment_status?"مدفوع":"قيد الانتظار"]})]}),(0,a.jsxs)("div",{className:"max-w-[524px] w-full",children:[(0,a.jsx)(l.LJ,{className:"text-[16px] sm:text-[20px] leading-[30px] font-bold mb-0.5 sm:mb-1.5",children:"عنوان التوصيل"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"text-[#667085] text-[12px] sm:text-[14px] leading-5 font-normal mb-1.5",children:[s.shipping_address.first_name," ",s.shipping_address.last_name]}),(0,a.jsxs)(l.LJ,{className:"max-w-[215px] text-[14px] sm:text-[20px] leading-[22px] sm:leading-7 font-medium",children:[s.shipping_address.street,", ",s.shipping_address.city,", ",s.shipping_address.state," ",s.shipping_address.zip_code]}),s.shipping_address.phone&&(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:s.shipping_address.phone})]})]})]}),(0,a.jsx)(o.w,{className:"bg-[#D0D5DD]"}),(0,a.jsxs)("div",{className:"flex items-start gap-3 sm:gap-[50px] mt-6 sm:mt-8",children:[(0,a.jsxs)("div",{className:"max-w-[125px] sm:max-w-[558px] w-full space-y-1.5 sm:space-y-3",children:[(0,a.jsx)(l.LJ,{className:"text-[14px] sm:text-[20px] leading-[30px] font-medium inter",children:"تحتاج مساعدة؟"}),(0,a.jsx)("div",{className:"space-y-1.5 sm:space-y-3",children:[{href:"/order-issues",icon:"/assets/icons/info-circle.svg",alt:"info-circle",label:"مشاكل الطلب"},{href:"/delivery-info",icon:"/assets/icons/truck-time.svg",alt:"truck-time",label:"معلومات التوصيل"},{href:"/returns",icon:"/assets/icons/box-remove.svg",alt:"box-remove",label:"الإرجاع"}].map(e=>(0,a.jsxs)(b(),{href:e.href,className:"flex items-center gap-[5px] text-[10px] sm:text-[18px]",children:[(0,a.jsx)(h.default,{src:e.icon,alt:e.alt,width:17,height:17,className:"sm:w-[17px] w-[13px]"}),(0,a.jsx)(l.SA,{children:e.label}),(0,a.jsxs)("svg",{width:"25",height:"25",className:"sm:w-[25px] w-[13px]",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{d:"M15.9022 14.2196C15.8071 14.1244 15.747 13.9942 15.747 13.844L15.747 8.29435L10.1973 8.29435C9.90684 8.29435 9.66643 8.05393 9.66643 7.76343C9.66643 7.47292 9.90684 7.23251 10.1973 7.23251L16.2779 7.23251C16.5684 7.23251 16.8088 7.47292 16.8088 7.76343L16.8088 13.844C16.8088 14.1345 16.5684 14.3749 16.2779 14.3749C16.1326 14.3799 15.9974 14.3148 15.9022 14.2196Z",fill:"black"}),(0,a.jsx)("path",{d:"M7.38744 16.6538C7.18209 16.4485 7.18209 16.1079 7.38744 15.9025L15.817 7.47294C16.0224 7.26758 16.363 7.26758 16.5683 7.47294C16.7737 7.6783 16.7737 8.01889 16.5683 8.22424L8.13874 16.6538C7.93339 16.8592 7.5928 16.8592 7.38744 16.6538Z",fill:"black"})]})]},e.label))})]}),(0,a.jsxs)("div",{className:"max-w-[558px] w-full space-y-1.5 sm:space-y-3",children:[(0,a.jsx)(l.LJ,{className:"text-[14px] sm:text-[20px] leading-[30px] font-medium inter",children:"ملخص الطلب"}),(0,a.jsxs)("div",{className:"space-y-1.5 sm:space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(l.LJ,{className:"text-[12px] sm:text-[20px] leading-[30px] font-medium",children:"المجموع الفرعي"}),(0,a.jsxs)(l.LJ,{className:"text-[10px] sm:text-[20px] leading-[30px] font-medium",children:["$",(Number(s.total_amount)+Number(s.discount_amount)).toFixed(2)]})]}),Number(s.discount_amount)>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(l.SA,{children:"الخصم"}),(0,a.jsxs)(l.SA,{className:"text-[10px] sm:text-[18px]",children:["-$",Number(s.discount_amount).toFixed(2)]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(l.SA,{children:"التوصيل"}),(0,a.jsx)(l.SA,{className:"text-[10px] sm:text-[18px]",children:"$0.00"})]}),(0,a.jsx)(o.w,{}),(0,a.jsxs)("div",{className:"sm:mt-[3px] flex items-center justify-between font-semibold text-base",children:[(0,a.jsx)(l.LJ,{className:"text-[12px] sm:text-[20px] leading-[30px] font-medium",children:"الإجمالي"}),(0,a.jsxs)(l.LJ,{className:"text-[10px] sm:text-[20px] leading-[30px] font-bold",children:["$",Number(s.total_amount).toFixed(2)]})]})]})]})]})]})]})}),(0,a.jsx)(f.default,{})]})}},79551:e=>{"use strict";e.exports=require("url")},86327:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>n.a,__next_app__:()=>c,pages:()=>p,routeModule:()=>m,tree:()=>l});var a=s(65239),r=s(48088),i=s(88170),n=s.n(i),d=s(30893),o={};for(let e in d)0>["default","tree","pages","GlobalError","__next_app__","routeModule"].indexOf(e)&&(o[e]=()=>d[e]);s.d(t,o);let l={children:["",{children:["order",{children:["[id]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,95821)),"C:\\Users\\jaafa\\OneDrive\\Documents\\myProjects\\samer_api-front\\samer_webshop_v1\\src\\app\\order\\[id]\\page.tsx"]}]},{}]},{metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,70440))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(s.bind(s,94431)),"C:\\Users\\jaafa\\OneDrive\\Documents\\myProjects\\samer_api-front\\samer_webshop_v1\\src\\app\\layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,57398,23)),"next/dist/client/components/not-found-error"],forbidden:[()=>Promise.resolve().then(s.t.bind(s,89999,23)),"next/dist/client/components/forbidden-error"],unauthorized:[()=>Promise.resolve().then(s.t.bind(s,65284,23)),"next/dist/client/components/unauthorized-error"],metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,70440))).default(e)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]}.children,p=["C:\\Users\\jaafa\\OneDrive\\Documents\\myProjects\\samer_api-front\\samer_webshop_v1\\src\\app\\order\\[id]\\page.tsx"],c={require:s,loadChunk:()=>Promise.resolve()},m=new a.AppPageRouteModule({definition:{kind:r.RouteKind.APP_PAGE,page:"/order/[id]/page",pathname:"/order/[id]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:l}})},95821:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>a});let a=(0,s(12907).registerClientReference)(function(){throw Error("Attempted to call the default export of \"C:\\\\Users\\\\jaafa\\\\OneDrive\\\\Documents\\\\myProjects\\\\samer_api-front\\\\samer_webshop_v1\\\\src\\\\app\\\\order\\\\[id]\\\\page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\jaafa\\OneDrive\\Documents\\myProjects\\samer_api-front\\samer_webshop_v1\\src\\app\\order\\[id]\\page.tsx","default")},97073:(e,t,s)=>{Promise.resolve().then(s.bind(s,64147))}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),a=t.X(0,[447,726,658,458,191,113,20],()=>s(86327));module.exports=a})();