import{_ as k}from"./ByXs6QR-.js";import{_ as L}from"./DuhDFJjj.js";import{p as B}from"./BzJae4DI.js";import{u as D}from"./7pZkuj9N.js";import{_ as A,a as I,c,e as m,d as N,f as _,w as p,r as f,i as V,s as v,u as x,o as d,b as o,t as n,F as K,g as M,G as O,K as T,J as y,E as b}from"./Bgmy51Qv.js";import{u as E}from"./BHvLfWtM.js";import{r as F}from"./hSbGpNHU.js";import{_ as J,a as R}from"./Z4eZ-m2s.js";import{b as U}from"./BehSO1Q_.js";import{P as q}from"./BN9nKHgW.js";import"./D_7E8SMU.js";import"./CnTHyurX.js";import"./DJbnGWvO.js";import"./AmaTRG5a.js";const G={setup(){const{getRequest:e}=D(),t=V(),{posPublicKey:s}=v(t),i=x(),{setting:r}=v(i);return{posPublicKey:s,setting:r,getRequest:e}},name:"posOrders",data(){return{order:null,validLicence:!1,loading:!1,orderByOrders:{payment_method:{title:this.$t("fSale.pMethod")},admin_id:{title:this.$t("fSale.user")},created_at:{title:this.$t("category.date")}}}},components:{PosOrdered:q,ListPage:R,InlinePopOver:k,Spinner:I,TableSort:J},mixins:[E,F,U],computed:{currencyIcon(){var e;return((e=this.setting)==null?void 0:e.currency_icon)||"$"}},methods:{userStr(e){var t,s,i,r;return((s=(t=e==null?void 0:e.pos_order)==null?void 0:t.admin)==null?void 0:s.name)??((r=(i=e==null?void 0:e.pos_order)==null?void 0:i.admin)==null?void 0:r.email)??"n/a"},customerStr(e){var t,s;return((t=e==null?void 0:e.user)==null?void 0:t.name)??((s=e==null?void 0:e.user)==null?void 0:s.email)??this.$t("ship.wc")},voucherStr(e){var t;return e!=null&&e.voucher?`${((t=e.voucher)==null?void 0:t.title)||""}`:this.$t("prod.na")},deleteAll(){this.$refs.bulkDelete.closePop(),this.deleteBulk()}},async mounted(){const e=window.location.hostname;if(this.posPublicKey){let t=B(this.posPublicKey);const s=JSON.parse(t),i=!(s!=null&&s.p)||(s==null?void 0:s.p)&&(s==null?void 0:s.p)==="pos-ishop";(e.includes("admin.ishop.cholobangla.com")||e.includes("localhost")||e.includes("127.0.0.1")||t.includes(e)&&i)&&(this.validLicence=!0)}else(e.includes("admin.ishop.cholobangla.com")||e.includes("localhost")||e.includes("127.0.0.1"))&&(this.validLicence=!0)}},H={key:0},z={class:"dply-felx gap-10 j-left f-wrap mb-15"},Q={class:"lite-bold"},W=["value"],X={class:"ellipsis mx-w-150x"},Y={class:"ellipsis mx-w-150x"},Z={class:"mn-w-90x"},j={class:"mn-w-90x"},ee={class:"ptb-10"},te=["onClick"],oe=["onClick"];function se(e,t,s,i,r,a){const g=f("pos-ordered"),S=f("table-sort"),$=k,w=L,P=f("list-page");return r.validLicence?(d(),c("div",H,[r.order?(d(),N(g,{key:0,order:r.order,onClose:t[0]||(t[0]=u=>r.order=null)},null,8,["order"])):m("",!0),_(P,{ref:"listPage","list-api":"getPosOrders","delete-api":"deletePosOrders","route-name":"pos",name:e.$t("fSale.orderD"),"order-options":r.orderByOrders,gate:"pos",onList:t[4]||(t[4]=u=>e.itemList=u)},{"table-top":p(({orderOptions:u})=>[o("div",z,[_(S,{"order-by-options":u},null,8,["order-by-options"]),_($,{arrow:!0,class:"bulk-action mt-md-10",ref:"bulkDelete"},{button:p(()=>[y(n(e.$t("title.act")),1)]),content:p(()=>[o("button",{onClick:t[1]||(t[1]=b((...l)=>a.deleteAll&&a.deleteAll(...l),["prevent"])),class:"outline-btn"},n(e.$t("category.delete")),1)]),_:1},512)])]),table:p(({list:u})=>[o("tr",Q,[o("th",null,[o("input",{type:"checkbox",onChange:t[2]||(t[2]=(...l)=>e.checkAll&&e.checkAll(...l))},null,32)]),o("th",null,n(e.$t("fSale.orderUp")),1),o("th",null,n(e.$t("fSale.voucher")),1),o("th",null,n(e.$t("ship.cs")),1),o("th",null,n(e.$t("fSale.user")),1),o("th",null,n(e.$t("fSale.amount"))+"("+n(a.currencyIcon)+")",1),o("th",null,n(e.$t("category.created")),1),t[5]||(t[5]=o("th",null,null,-1))]),(d(!0),c(K,null,M(u,(l,C)=>(d(),c("tr",{key:C},[o("td",null,[O(o("input",{type:"checkbox",value:l.order.id,"onUpdate:modelValue":t[3]||(t[3]=h=>e.cbList=h)},null,8,W),[[T,e.cbList]])]),o("td",null,[_(w,{class:"dply-felx j-left link",to:`/orders/${l.order.id}`},{default:p(()=>[y(" #"+n(l.order.order),1)]),_:2},1032,["to"])]),o("td",null,n(a.voucherStr(l.order)),1),o("td",null,[o("span",X,n(a.customerStr(l.order)),1)]),o("td",null,[o("span",Y,n(a.userStr(l.order)),1)]),o("td",Z,n(l.order.total_amount),1),o("td",j,n(l.order.created),1),o("td",ee,[e.$can("pos","view")?(d(),c("button",{key:0,onClick:b(h=>r.order=l.order,["prevent"]),class:"lite-btn"},n(e.$t("fSale.view")),9,te)):m("",!0),e.$can("pos","delete")?(d(),c("button",{key:1,onClick:b(h=>e.$refs.listPage.deleteItem(l.order.id),["prevent"]),class:"delete-btn lite-btn"},n(e.$t("category.delete")),9,oe)):m("",!0)])]))),128))]),_:1},8,["name","order-options"])])):m("",!0)}const ve=A(G,[["render",se]]);export{ve as default};
