import{_ as b,d as v,aw as x,f as E,bN as V,r,o as d,c as I,a as t,w as a,l as u,t as k,G as C,O as $,X as D,aA as F,bl as Q,Y as R,b as z,i as m,k as i,aH as G,ax as H,P as J,Q as U,J as X}from"./app-DyK1k-lL.js";import{P as g}from"./PaymentStatus-CT64-ujw.js";import{S as h,b as Y,a as j,M as K,O as L}from"./OrderDetails-COtylp4R.js";import{c as M}from"./cart-CAxtMcfK.js";const W=v({props:["order"],components:{EyeOutlined:x,StopOutlined:h,OrderStatus:Y,PaymentStatus:g,OrderDetails:j},setup(){const{formatAmountCurrency:e}=M(),s=E(!1);return{visible:s,showModal:()=>{s.value=!0},columns:[{title:"#",dataIndex:"id"},{title:"Product",dataIndex:"product_id"},{title:"Quantity",dataIndex:"quantity"},{title:"Price",dataIndex:"unit_price"},{title:"Total",dataIndex:"subtotal"}],formatAmountCurrency:e,buildAddress:V}}});function Z(e,s,o,_,w,S){const p=r("eye-outlined"),f=$,l=r("OrderDetails"),y=D;return d(),I(C,null,[t(f,{onClick:e.showModal},{default:a(()=>[t(p),u(" "+k(e.$t("stock.view_order")),1)]),_:1},8,["onClick"]),t(y,{open:e.visible,"onUpdate:open":s[0]||(s[0]=O=>e.visible=O),width:"70%",footer:!1},{title:a(()=>[u(k(e.order.invoice_number),1)]),default:a(()=>[t(l,{order:e.order},null,8,["order"])]),_:1},8,["open"])],64)}const ee=b(W,[["render",Z]]),te=v({props:["data"],emits:["reloadOrders"],components:{EyeOutlined:x,DeleteOutlined:F,MoreOutlined:K,StopOutlined:h,DownloadOutlined:Q,PaymentStatus:g,OrderStatus:L,OrderDetailsModal:ee},setup(e,{emit:s}){const{t:o}=R(),{formatDateTime:_}=z(),{formatAmountCurrency:w}=M();return{columns:[{title:"Date",dataIndex:"order_date"},{title:"Total",dataIndex:"total"},{title:"Order Status",dataIndex:"order_status"},{title:"Payment Status",dataIndex:"payment_status"},{title:"Action",dataIndex:"action"}],cancelOrder:l=>{D.confirm({title:o("common.delete")+"?",icon:t(G),content:o("stock.order_cancel_message"),centered:!0,okText:o("common.yes"),okType:"danger",cancelText:o("common.no"),onOk(){axiosFront.post(`front/self/cancel-order/${l}`).then(y=>{s("reloadOrders"),H.success({message:o("common.success"),description:o("stock.order_canceled"),placement:"bottomRight"})})},onCancel(){}})},downloadInvoice:l=>{window.location.href=window.config.path+"/api/v1/pdf/"+l},formatAmountCurrency:w,formatDateTime:_}}});function oe(e,s,o,_,w,S){const p=r("PaymentStatus"),f=r("OrderStatus"),l=r("OrderDetailsModal"),y=r("stop-outlined"),O=$,T=r("download-outlined"),P=J,A=r("more-outlined"),N=U,q=X;return d(),m(q,{columns:e.columns,"row-key":c=>c.id,"data-source":e.data,pagination:!1},{bodyCell:a(({column:c,record:n})=>[c.dataIndex==="order_date"?(d(),I(C,{key:0},[u(k(e.formatDateTime(n.order_date)),1)],64)):i("",!0),c.dataIndex==="total"?(d(),I(C,{key:1},[u(k(e.formatAmountCurrency(n.total)),1)],64)):i("",!0),c.dataIndex==="payment_status"?(d(),m(p,{key:2,paymentStatus:n.payment_status},null,8,["paymentStatus"])):i("",!0),c.dataIndex==="order_status"?(d(),m(f,{key:3,data:n},null,8,["data"])):i("",!0),c.dataIndex==="action"?(d(),m(N,{key:4,placement:"bottomRight"},{overlay:a(()=>[t(P,null,{default:a(()=>[t(l,{order:n},null,8,["order"]),n.order_status=="ordered"&&!n.cancelled?(d(),m(O,{key:0,onClick:B=>e.cancelOrder(n.unique_id)},{default:a(()=>[t(y),u(" Cancel Order ")]),_:2},1032,["onClick"])):i("",!0),t(O,{onClick:B=>e.downloadInvoice(n.unique_id)},{default:a(()=>[t(T),u(" Download Invoice ")]),_:2},1032,["onClick"])]),_:2},1024)]),default:a(()=>[t(A,{style:{fontSize:"16px"}})]),_:2},1024)):i("",!0)]),_:1},8,["columns","row-key","data-source"])}const re=b(te,[["render",oe]]);export{re as O};
