import{_ as F}from"./Select.440bd64c.js";import{_ as U}from"./Input.7105798b.js";import $ from"./Icon.1464d3c9.js";import{_ as z}from"./Button.c35f3c05.js";import{_ as G}from"./List.2d6b7481.js";import{_ as H}from"./card.924cd882.js";import{u as I,bG as M,bF as P,bE as j,aL as m,bu as J,bq as K,c as Q,a as t,b as r,ba as n,ah as V,bz as T,w as A,bD as W,o as X}from"./entry.816e6e91.js";import"./Button.8c8352d3.js";import"./nuxt-link.0e2876ca.js";import"./Badge.73ba16f1.js";import"./Table.e164c81e.js";import"./index.84e04faa.js";import"./Pagination.967f26ab.js";import"./Textarea.7637503b.js";import"./Modal.5478da99.js";import"./use-outside-click.3870bf81.js";import"./useToast.95f42666.js";const Y={class:"row mx-0"},Z={class:"col-lg-4 col-md-6 col-10 mb-4"},ee={class:"col-lg-4 col-md-6 col-10 mb-4"},te=["onSubmit"],oe={class:"row"},se={class:"col-10"},ae={class:"col-2"},re={class:"col-lg-12"},Ve={__name:"index",async setup(ne){var f,v;let l,h;I({title:"Orders List"});const k=M();k.pageName="Orders List";const c=P(),b=j(),w=["all","created","inProgress","invoiced","delivered","credit","delivered","canceled"],_=m("all");let g=m(""),u=m(1);u.value=((f=c.query)==null?void 0:f.page)||1;const{data:p,pending:C,execute:L}=([l,h]=J(()=>W({url:"orders/search/10",method:"post"},{immediate:!1,body:{key:g},query:{page:u}})),l=await l,h(),l);K(()=>c.query,(s,a)=>{var i,d;g.value=((i=c.query)==null?void 0:i.search)||"",u.value=((d=c.query)==null?void 0:d.page)||1,a==null&&!(s!=null&&s.search)&&L()},{immediate:!0});const O=s=>{b.push({path:"/admin/orders/filtered-orders",query:{status:s.target.value}})};let o=m("");o.value=(v=c.query)==null?void 0:v.search;const B=()=>{b.push({query:{page:1,search:o.value}})};return(s,a)=>{const i=F,d=U,N=$,R=z,D=G,E=H;return X(),Q("div",Y,[t("div",Z,[r(i,{options:w,modelValue:n(_),"onUpdate:modelValue":a[0]||(a[0]=e=>V(_)?_.value=e:null),onChange:O},null,8,["modelValue"])]),t("div",ee,[t("form",{onSubmit:T(B,["prevent"])},[t("div",oe,[t("div",se,[r(d,{placeholder:"Search by customer id, mobile number, username",modelValue:n(o),"onUpdate:modelValue":a[1]||(a[1]=e=>V(o)?o.value=e:o=e)},null,8,["modelValue"])]),t("div",ae,[r(R,{color:"dark",type:"submit"},{default:A(()=>[r(N,{name:"material-symbols:search"})]),_:1})])])],40,te)]),t("div",re,[r(E,{bodyClasses:"mt-2"},{body:A(()=>{var e,y,x,q,S;return[r(D,{pending:n(C),data:(e=n(p))==null?void 0:e.data,page:(x=(y=n(p))==null?void 0:y.meta)==null?void 0:x.current_page,total:(S=(q=n(p))==null?void 0:q.meta)==null?void 0:S.total},null,8,["pending","data","page","total"])]}),_:1})])])}}};export{Ve as default};
