import{_ as b,x as v,aB as x,r as F,cs as N,e as r,o as d,g as I,c as t,w as a,i as u,t as k,F as C,p as $,al as D,aq as V,bB as R,b as z,a as J,f as m,J as i,aC as Q,bd as U,M as j,q as G,aw as H}from"./app-DGDivIsO.js";import{P as g}from"./PaymentStatus-DFh8-zEw.js";import{S as M,b as K,a as L,M as W,O as X}from"./OrderDetails-DKtopJws.js";import{c as h}from"./cart-C-GPgQf0.js";const Y=v({props:["order"],components:{EyeOutlined:x,StopOutlined:M,OrderStatus:K,PaymentStatus:g,OrderDetails:L},setup(){const{formatAmountCurrency:e}=h(),s=F(!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:N}}});function Z(e,s,o,p,w,S){const _=r("eye-outlined"),f=$,l=r("OrderDetails"),y=D;return d(),I(C,null,[t(f,{onClick:e.showModal},{default:a(()=>[t(_),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(Y,[["render",Z]]),te=v({props:["data"],emits:["reloadOrders"],components:{EyeOutlined:x,DeleteOutlined:V,MoreOutlined:W,StopOutlined:M,DownloadOutlined:R,PaymentStatus:g,OrderStatus:X,OrderDetailsModal:ee},setup(e,{emit:s}){const{t:o}=z(),{formatDateTime:p}=J(),{formatAmountCurrency:w}=h();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(Q),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"),U.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:p}}});function oe(e,s,o,p,w,S){const _=r("PaymentStatus"),f=r("OrderStatus"),l=r("OrderDetailsModal"),y=r("stop-outlined"),O=$,T=r("download-outlined"),P=j,q=r("more-outlined"),A=G,B=H;return d(),m(B,{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(_,{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(A,{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:E=>e.cancelOrder(n.unique_id)},{default:a(()=>[t(y),u(" Cancel Order ")]),_:2},1032,["onClick"])):i("",!0),t(O,{onClick:E=>e.downloadInvoice(n.unique_id)},{default:a(()=>[t(T),u(" Download Invoice ")]),_:2},1032,["onClick"])]),_:2},1024)]),default:a(()=>[t(q,{style:{fontSize:"16px"}})]),_:2},1024)):i("",!0)]),_:1},8,["columns","row-key","data-source"])}const re=b(te,[["render",oe]]);export{re as O};
