1import{d as E,X as Q,r as g,g as R,o as w,h as U,b as t,w as l,a as f,i as s,j as $,t as q,c as j,Q as z,l as D,m as G,q as O,s as M,x as X,v as Y,z as Z,A as F,Y as H,Z as J,B as K,$ as L}from"./BiuSYKi9.js";import{_ as T}from"./I_2hiIoe.js";import"./BSbP7tAa.js";const W={class:"q-pa-md"},ee={class:"row items-center q-gutter-x-sm"},ne=["href"],oe={class:"row items-center justify-between q-mb-md"},ae={class:"text-h6"},te=` 2query AdminConsignors($first: Int, $skip: Int, $search: String, $sortBy: String, $descending: Boolean) { 3 consignors(first: $first, skip: $skip, search: $search, sortBy: $sortBy, descending: $descending) { 4 pageInfo { totalCount } 5 edges { 6 node { 7 id 8 name 9 firstName 10 lastName 11 email 12 phone 13 paymentPreference 14 address 15 itemCount 16 } 17 } 18 } 19}`,de=E({__name:"consignors",setup(se){const b=Q(),h=g([]),p=g(""),v=g(!1),a=g({sortBy:"name",descending:!1,page:1,rowsPerPage:25,rowsNumber:0}),x=[{name:"actions",label:"",field:"id",align:"left"},{name:"name",label:"Name",field:"name",sortable:!0,align:"left"},{name:"email",label:"E-mail",field:"email",sortable:!0,align:"left"},{name:"phone",label:"Phone",field:"phone",sortable:!0,align:"left"},{name:"paymentPreference",label:"Payment Preference",field:"paymentPreference",sortable:!0,align:"left"},{name:"itemCount",label:"Items",field:"itemCount",sortable:!0,align:"right"},{name:"address",label:"Address",field:"address",align:"left"}],u=async e=>{var n,r,c,d,_;v.value=!0;try{const{data:m}=await G(te,{first:e.rowsPerPage,skip:e.rowsPerPage*(e.page-1),search:p.value.trim()||null,sortBy:e.sortBy,descending:e.descending},!0);h.value=(((r=(n=m.value)==null?void 0:n.consignors)==null?void 0:r.edges)||[]).map(y=>y.node),a.value.rowsNumber=((_=(d=(c=m.value)==null?void 0:c.consignors)==null?void 0:d.pageInfo)==null?void 0:_.totalCount)||0}catch{b.notify({type:"negative",message:"Could not load consignors"})}finally{v.value=!1}};async function N(e){const{page:n,rowsPerPage:r,sortBy:c,descending:d}=e.pagination;a.value={...a.value,page:n,rowsPerPage:r,sortBy:c,descending:d},await u(a.value)}const P=()=>{a.value.page=1,u(a.value)},i=R({open:!1,consignor:{}}),C=e=>{i.consignor=e?{id:e.id,firstName:e.firstName,lastName:e.lastName,email:e.email,phone:e.phone||"",paymentPreference:e.paymentPreference,address:e.address||""}:{firstName:"",lastName:"",email:"",phone:"",paymentPreference:"",address:""},i.open=!0},B=()=>{i.open=!1,b.notify({type:"positive",message:"Consignor saved"}),u(a.value)};return u(a.value),(e,n)=>{const r=O,c=M,d=X,_=Y,m=Z,y=F,k=H,V=T,S=J,I=K,A=L;return w(),U("div",W,[t(y,{flat:"",title:"Consignors",rows:s(h),columns:x,"rows-per-page-options":[10,25,50,100],"row-key":"id",loading:s(v),pagination:s(a),"onUpdate:pagination":n[2]||(n[2]=o=>$(a)?a.value=o:null),"binary-state-sort":"",onRequest:N},{"top-right":l(()=>[f("section",ee,[t(c,{outlined:"",debounce:"300",modelValue:s(p),"onUpdate:modelValue":[n[0]||(n[0]=o=>$(p)?p.value=o:null),P],placeholder:"Search name, email or phone",dense:""},{append:l(()=>[t(r,{name:"search"})]),_:1},8,["modelValue"]),t(d,{vertical:""}),t(_,{label:"Add new Consignor",onClick:n[1]||(n[1]=o=>C(null)),variant:"primary"})])]),"body-cell-actions":l(o=>[t(m,{props:o},{default:l(()=>[t(_,{round:"",icon:"edit",size:"sm",onClick:ie=>C(o.row),variant:"primary"},null,8,["onClick"])]),_:2},1032,["props"])]),"body-cell-email":l(o=>[t(m,{props:o},{default:l(()=>[f("a",{href:`mailto:${o.row.email}`},q(o.row.email),9,ne)]),_:2},1032,["props"])]),_:1},8,["rows","loading","pagination"]),s(i).open?(w(),j(I,{key:0,modelValue:s(i).open,"onUpdate:modelValue":n[3]||(n[3]=o=>s(i).open=o)},{default:l(()=>[t(S,{style:{"min-width":"360px","max-width":"520px"},class:"q-pa-md"},{default:l(()=>[f("div",oe,[f("div",ae,q(s(i).consignor.id?"Edit Consignor":"New Consignor"),1),z(t(k,{flat:"",round:"",dense:"",icon:"close","aria-label":"Close"},null,512),[[A]])]),t(V,{consignor:s(i).consignor,onSave:B},null,8,["consignor"])]),_:1})]),_:1},8,["modelValue"])):D("",!0)])}}});export{de as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.