import{K as e,g as l,U as d,P as c,l as m}from"./index-CqfREQhZ.js";import{P as x,C as r,S as o}from"./AdminShell-Dht4Lyqh.js";import{O as h}from"./admin-B-WQz-EM.js";import{C as p}from"./circle-check-BTdJ3rF1.js";import{f as g}from"./products-Q1MHi1iw.js";import"./shopping-bag-CIMOvT4N.js";import"./package-D58BUA8K.js";import"./users-Bozo9HJ_.js";import"./star-DW-815Mn.js";import"./settings-Bm4D1Whm.js";import"./plus-DKTwDupB.js";function D(){const t=h.filter(s=>s.channel==="WhatsApp");return e.jsxs(e.Fragment,{children:[e.jsx(x,{title:"WhatsApp Orders",subtitle:`${t.length} incoming orders from WhatsApp`,actions:e.jsxs("a",{href:"https://wa.me/971508641669",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 bg-[#25D366] text-white px-4 h-10 rounded-full text-sm font-semibold hover:opacity-90",children:[e.jsx(l,{className:"w-4 h-4"})," Open WhatsApp"]})}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-4 mb-6",children:[e.jsx(r,{className:"p-5",children:e.jsx(i,{label:"Total WhatsApp Orders",value:t.length.toString(),I:l,color:"#25D366"})}),e.jsx(r,{className:"p-5",children:e.jsx(i,{label:"Pending Replies",value:t.filter(s=>s.status==="Pending").length.toString(),I:d,color:"#FF7A00"})}),e.jsx(r,{className:"p-5",children:e.jsx(i,{label:"Confirmed Orders",value:t.filter(s=>s.status!=="Pending"&&s.status!=="Cancelled").length.toString(),I:p,color:"#10b981"})})]}),e.jsx("div",{className:"grid lg:grid-cols-2 gap-4",children:t.map(s=>e.jsxs(r,{className:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-11 h-11 rounded-full bg-[#25D366]/10 grid place-items-center text-[#25D366]",children:e.jsx(l,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold",children:s.customer}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(c,{className:"w-3 h-3"})," ",s.phone]})]})]}),e.jsx(o,{status:s.status})]}),e.jsxs("div",{className:"rounded-xl bg-secondary p-3 text-sm mb-3",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-1",children:["Order ",s.id," · ",s.date]}),e.jsx("div",{className:"font-medium",children:s.product}),e.jsx("div",{className:"text-[#FF7A00] font-bold mt-1",children:g(s.amount)})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:["Confirm Order","Ask address","Send invoice","Out of stock"].map(a=>e.jsx("button",{className:"text-xs px-3 py-1.5 rounded-full bg-secondary hover:bg-[#002D72] hover:text-white transition",children:a},a))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("a",{href:`https://wa.me/${s.phone.replace(/\D/g,"")}`,target:"_blank",rel:"noreferrer",className:"flex-1 inline-flex items-center justify-center gap-2 h-10 rounded-xl bg-[#25D366] text-white font-semibold text-sm",children:[e.jsx(m,{className:"w-4 h-4"})," Open Chat"]}),e.jsx("button",{className:"px-4 h-10 rounded-xl bg-[#FF7A00] text-white font-semibold text-sm",children:"Confirm"})]})]},s.id))})]})}function i({label:t,value:s,I:a,color:n}){return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl grid place-items-center",style:{background:`${n}1a`,color:n},children:e.jsx(a,{className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:t}),e.jsx("div",{className:"text-2xl font-extrabold",children:s})]})]})}export{D as component};
