import{i as b,Z as w,r as d,c as r,o as a,a as i,b as t,f as v,t as s,F as g,j as y,k as m}from"./app-BhD6J0Va.js";import{I as k,h as x}from"./moment-DeOISj6Y.js";import{t as $,S as A,p as C}from"./SearchInput-BhrnFjZw.js";import{L as V}from"./Layout-BNWXhjq5.js";import{m as N}from"./mapValues-DT3qyRA0.js";import{_ as S}from"./FlashMessages-DW2Y2mP0.js";const B={components:{SearchInput:A,Head:w,Icon:k,Link:b},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:$(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,p,l){const _=d("Head"),u=d("search-input"),h=d("icon");return a(),r("div",null,[i(_,{title:e.$t(c.title)},null,8,["title"]),t("div",I,[i(u,{modelValue:p.form.search,"onUpdate:modelValue":n[0]||(n[0]=o=>p.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)]),(a(!0),r(g,null,y(c.users,o=>(a(),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,[i(h,{name:"tick",onClick:f=>l.approveAccount(o.id),class:"ml-2 w-7 h-7 cursor-pointer"},null,8,["onClick"]),i(h,{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?(a(),r("tr",T,[...n[1]||(n[1]=[t("td",{class:"px-6 py-4 border-t",colspan:"7"},"No users found.",-1)])])):v("",!0)])])])])}const rt=S(B,[["render",W]]);export{rt as default};
