import{Z as b,i as w,k as m,r as d,c as r,a,b as t,t as s,F as v,j as g,h as y,o as i}from"./app-CK3cEAAe.js";import{I as k,h as x}from"./moment-BywspGD9.js";import{S as $,t as A,p as C}from"./SearchInput-C5NjNnwl.js";import{L as V}from"./Layout-DIVdUaBZ.js";import{m as N}from"./mapValues-BykAXOI1.js";import{_ as S}from"./FlashMessages-ByEdcHWZ.js";const B={components:{SearchInput:$,Head:b,Icon:k,Link:w},layout:V,props:{filters:Object,users:Array,title:String},data(){return{form:{search:this.filters.search,role:this.filters.role}}},watch:{form:{deep:!0,handler:A(function(){this.$inertia.get(this.route("users"),C(this.form),{preserveState:!0})},150)}},methods:{approveAccount(e){m.get(this.route("pending.active",{id:e})).then(n=>{window.location.reload()})},removeAccount(e){m.get(this.route("pending.decline",{id:e})).then(n=>{window.location.reload()})},reset(){this.form=N(this.form,()=>null)}},created(){this.moment=x}},I={class:"flex items-center justify-between mb-6"},L={class:"bg-white rounded-md shadow overflow-x-auto"},j={class:"w-full whitespace-nowrap"},z={class:"text-left font-bold"},H={class:"pb-4 pt-6 px-6"},E={class:"pb-4 pt-6 px-6"},F={class:"pb-4 pt-6 px-6"},R={class:"pb-4 pt-6 px-6"},U={class:"pb-4 pt-6 px-6"},D={class:"pb-4 pt-6 px-6"},O={class:"pb-4 pt-6 px-6"},P={class:"border-t"},Z={class:"border-t"},q={class:"border-t"},G={class:"border-t"},J={class:"border-t capitalize"},K={class:"border-t capitalize"},M={class:"border-t capitalize"},Q={class:"action flex"},T={key:0};function W(e,n,c,X,h,l){const _=d("Head"),u=d("search-input"),p=d("icon");return i(),r("div",null,[a(_,{title:e.$t(c.title)},null,8,["title"]),t("div",I,[a(u,{modelValue:h.form.search,"onUpdate:modelValue":n[0]||(n[0]=o=>h.form.search=o),class:"mr-4 w-full max-w-md",onReset:l.reset},null,8,["modelValue","onReset"])]),t("div",L,[t("table",j,[t("tbody",null,[t("tr",z,[t("th",H,s(e.$t("Name")),1),t("th",E,s(e.$t("Email")),1),t("th",F,s(e.$t("Phone")),1),t("th",R,s(e.$t("City")),1),t("th",U,s(e.$t("Address")),1),t("th",D,s(e.$t("Updated")),1),t("th",O,s(e.$t("Action")),1)]),(i(!0),r(v,null,g(c.users,o=>(i(),r("tr",{key:o.id,class:"hover:bg-gray-100 focus-within:bg-gray-100"},[t("td",P,s(o.first_name)+" "+s(o.last_name),1),t("td",Z,s(o.email),1),t("td",q,s(o.phone),1),t("td",G,s(e.$t(o.city)),1),t("td",J,s(o.address),1),t("td",K,s(e.moment(o.created_at).fromNow()),1),t("td",M,[t("div",Q,[a(p,{name:"tick",onClick:f=>l.approveAccount(o.id),class:"ml-2 w-7 h-7 cursor-pointer"},null,8,["onClick"]),a(p,{name:"cross",onClick:f=>l.removeAccount(o.id),class:"ml-2 w-7 h-7 cursor-pointer"},null,8,["onClick"])])])]))),128)),c.users.length===0?(i(),r("tr",T,n[1]||(n[1]=[t("td",{class:"px-6 py-4 border-t",colspan:"7"},"No users found.",-1)]))):y("",!0)])])])])}const rt=S(B,[["render",W]]);export{rt as default};
