1import{z as y,d as n,H as T,m as q,x as B,o,c as G,w as k,a as e,l as M,s as R,u as C,L as z,M as A,e as a,b as f,f as i,g as L,F as j,h as $,t as h,n as D}from"./app-f77acba6.js";import{_ as E}from"./AppLayout-1cfc0b25.js";import{d as w}from"./index-a915e0aa.js";/* empty css */import"./logo-arrossaires-320e372a.js";import"./_plugin-vue_export-helper-c27b6911.js";var K=typeof y=="object"&&y&&y.Object===Object&&y,H=K,P=H,Q=typeof self=="object"&&self&&self.Object===Object&&self,J=P||Q||Function("return this")(),W=J,X=W,Y=X.Symbol,V=Y,N=V;N&&N.toStringTag;var U=V;U&&U.toStringTag;const Z={style:{display:"flex","flex-direction":"row",gap:"40px","align-items":"center"}},ee={style:{display:"flex","align-items":"center",gap:"8px"}},te={class:"search-container",style:{position:"relative",width:"100%"}},se={href:"/usuaris/create",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-1 px-2 rounded"},oe={key:0,class:"text-center my-4"},ae={key:1,class:"text-center my-4"},le={key:2,class:"table-container"},re={class:"table-auto w-full border-collapse",style:{"table-layout":"fixed"}},ne={class:"px-4 py-2"},ie={class:"px-4 py-2"},de={class:"px-4 py-2",style:{display:"flex",gap:"10px"}},ue=["href"],ce=["onClick"],pe={key:3,class:"pt-4 pb-4 flex justify-center",style:{position:"sticky",bottom:"0","background-color":"white"}},be=["disabled","onClick"],ye={key:4,class:"confirmation-modal"},fe={class:"bg-white w-1/3 mx-auto p-6 rounded-lg"},he={class:"mt-2 text-gray-700"},ke={__name:"Show",props:{users:Object,search:String},setup(r){const S=r,l=S.search?n(S.search):n(""),d=n(null),g=n(!1),u=n(!1),v=n(null),m=(c=null)=>{d.value=c,g.value=!g.value},F=()=>{d.value&&w.Inertia.delete(`/usuaris/remove/${d.value.id}`,{onSuccess:()=>{m(),d.value=null}})};T(l,()=>{l.value===""&&x()});const x=()=>{u.value=!0,w.Inertia.get("/usuaris",{search:l.value},{preserveState:!0,preserveScroll:!0,key:"user-search",replace:!1,onFinish:()=>{u.value=!1}})};q(()=>{v.value&&v.value.focus()});const I=()=>{l.value=""},O=c=>{u.value=!0,w.Inertia.get(c,{},{preserveState:!0,replace:!0,onFinish:()=>{u.value=!1}})};return(c,t)=>{const p=B("font-awesome-icon");return o(),G(E,{title:"Usuaris"},{header:k(()=>[e("div",Z,[t[2]||(t[2]=e("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Usuaris",-1)),e("div",ee,[e("div",te,[M(e("input",{type:"text",placeholder:"Cerca per nom",class:"border border-gray-300 rounded-lg p-2 pr-10 w-full","onUpdate:modelValue":t[0]||(t[0]=b=>z(l)?l.value=b:null),ref_key:"searchInputRef",ref:v,onKeyup:A(x,["enter"])},null,544),[[R,C(l)]]),C(l)?(o(),a("button",{key:0,onClick:I,class:"absolute right-2 top-1/2 transform -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-full p-1",style:{"line-height":"0"}},[f(p,{icon:"times"})])):i("",!0)]),e("button",{onClick:x,class:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"}," Cercar ")]),e("a",se,[f(p,{icon:"add"}),t[1]||(t[1]=L(" Afegir usuari "))])])]),default:k(()=>{var b;return[e("div",null,[u.value?(o(),a("div",oe,t[3]||(t[3]=[e("span",{class:"text-gray-800 font-bold"},"Carregant usuaris...",-1)]))):i("",!0),r.users.data.length==0?(o(),a("div",ae,t[4]||(t[4]=[e("span",{class:"text-gray-800 font-bold"},"No hi ha usuaris amb aquests valors de búsqueda",-1)]))):i("",!0),r.users.data.length>0?(o(),a("div",le,[e("table",re,[t[5]||(t[5]=e("thead",{style:{color:"white","font-size":"18px"}},[e("tr",{style:{"background-color":"#00b050"}},[e("th",{class:"px-4 py-2",style:{width:"60%"}},"Nom"),e("th",{class:"px-4 py-2",style:{width:"30%"}},"Rol"),e("th",{class:"px-4 py-2",style:{width:"10%"}},"Accions")])],-1)),e("tbody",null,[(o(!0),a(j,null,$(r.users.data,s=>{var _;return o(),a("tr",{key:s.id},[e("td",ne,h(s.name),1),e("td",ie,h(((_=s.roles[0])==null?void 0:_.name)||"Sin rol"),1),e("td",de,[e("a",{href:`/usuaris/show/${s.id}`,class:"text-indigo-600 hover:text-indigo-900"},[f(p,{icon:"edit"})],8,ue),e("a",{style:{cursor:"pointer"},onClick:ge=>m(s),class:"text-red-600 hover:text-red-900"},[f(p,{icon:"trash"})],8,ce)])])}),128))])])])):i("",!0),r.users.data.length>0?(o(),a("div",pe,[(o(!0),a(j,null,$(r.users.links,s=>(o(),a("button",{key:s.label,disabled:!s.url,onClick:_=>O(s.url),class:D(["px-4 py-2 mx-1 border rounded",{"bg-blue-500 text-white":s.active,"bg-gray-200 text-gray-600":!s.active}])},h(s.label==="pagination.previous"?"Anterior":s.label==="pagination.next"?"Següent":s.label),11,be))),128))])):i("",!0),g.value?(o(),a("div",ye,[e("div",fe,[t[6]||(t[6]=e("h2",{class:"text-xl font-semibold"},"Estàs segur que vols eliminar aquest usuari?",-1)),e("p",he,h((b=d.value)==null?void 0:b.name),1),e("div",{class:"flex justify-end mt-4"},[e("button",{class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 roun
1ded mr-2",onClick:F}," SÃ "),e("button",{class:"bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded",onClick:m}," No ")])])])):i("",!0)])]}),_:1})}}};export{ke 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.