PageSourceSearch

https://intranet.arrossaires.com/build/assets/List-5e8ddd22.js

js arrossaires.com collected 2026-09-24 10:02:04 UTC 5,194 bytes, 1 lines download raw bytes

1import{d as r,H as I,m as L,x as j,o as s,c as C,w as S,a as e,l as B,s as Y,u as b,L as A,M as H,e as a,b as m,f as d,g as R,F as $,h as N,t as g,n as T}from"./app-f77acba6.js";import{_ as q}from"./AppLayout-1cfc0b25.js";import{d as _}from"./index-a915e0aa.js";import{d as z}from"./index-c9776e66.js";/* empty css                                                                  *//* empty css            */import"./logo-arrossaires-320e372a.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./index-f73a96cb.js";const E={style:{display:"flex","flex-direction":"row",gap:"40px","align-items":"center"}},K={style:{display:"flex","align-items":"center",gap:"8px"}},O={class:"search-container",style:{position:"relative",width:"100%"}},P={key:0,href:"/comunicats/create",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-1 px-2 rounded"},Q={style:{"min-height":"80vh",display:"flex","flex-direction":"column","justify-content":"space-between"}},U={class:"table-container"},G={key:0,class:"table-auto w-full border-collapse",style:{"table-layout":"fixed"}},J={class:"px-4 py-2"},W={class:"px-4 py-2"},X={class:"px-4 py-2",style:{display:"flex",gap:"10px"}},Z=["href"],ee=["href"],te=["onClick"],se={key:1,class:"text-center text-gray-500",style:{margin:"40px"}},oe={class:"pt-4 pb-4 flex justify-center",style:{position:"sticky",bottom:"0","background-color":"white"}},ae=["disabled","onClick"],le={key:0,class:"confirmation-modal"},ne={class:"bg-white w-1/3 mx-auto p-6 rounded-lg"},ie={class:"mt-2 text-gray-700"},fe={__name:"List",props:{comunicats:Object,search:String},setup(u){const w=u,l=w.search?r(w.search):r(""),i=r(null),y=r(!1),p=r(!1),f=r(null),x=(n=null)=>{i.value=n,y.value=!y.value},D=()=>{i.value&&(console.log("selectedcomunicat",i.value.id),_.Inertia.delete(`/comunicats/remove/${i.value.id}`,{onSuccess:()=>{x(),i.value=null}}))};I(l,()=>{l.value===""&&v()});const v=()=>{p.value=!0,_.Inertia.get("/comunicats",{search:l.value},{preserveState:!0,preserveScroll:!0,key:"user-search",replace:!1,onFinish:()=>{p.value=!1}})};L(()=>{f.value&&f.value.focus()});const M=()=>{l.value=""},V=n=>{p.value=!0,_.Inertia.get(n,{},{preserveState:!0,replace:!0,onFinish:()=>{p.value=!1}})};return(n,o)=>{const c=j("font-awesome-icon");return s(),C(q,{title:"Comunicats"},{header:S(()=>[e("div",E,[o[2]||(o[2]=e("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Comunicats",-1)),e("div",K,[e("div",O,[B(e("input",{type:"text",placeholder:"Cerca per nom",class:"border border-gray-300 rounded-lg p-2 pr-10 w-full","onUpdate:modelValue":o[0]||(o[0]=h=>A(l)?l.value=h:null),ref_key:"searchInputRef",ref:f,onKeyup:H(v,["enter"])},null,544),[[Y,b(l)]]),b(l)?(s(),a("button",{key:0,onClick:M,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"}},[m(c,{icon:"times"})])):d("",!0)]),e("button",{onClick:v,class:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"}," Cercar ")]),n.$page.props.auth.user.all_permissions.includes("circulars.manage.all")?(s(),a("a",P,[m(c,{icon:"add"}),o[1]||(o[1]=R(" Afegir comunicat "))])):d("",!0)])]),default:S(()=>{var h,k;return[e("div",Q,[e("div",U,[((h=u.comunicats.data)==null?void 0:h.length)>0?(s(),a("table",G,[o[3]||(o[3]=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%"}},"Data"),e("th",{class:"px-4 py-2",style:{width:"10%"}},"Accions")])],-1)),e("tbody",null,[(s(!0),a($,null,N(u.comunicats.data,t=>(s(),a("tr",{key:t.id},[e("td",J,g(t.name),1),e("td",W,g(b(z.format)(new Date(t.send_at),"DD-MM-YYYY HH:mm")),1),e("td",X,[e("a",{href:`/comunicats/details/${t.id}`,class:"text-indigo-600 hover:text-indigo-900"},[m(c,{icon:"eye"})],8,Z),e("a",{href:`/comunicats/show/${t.id}`,class:"text-indigo-600 hover:text-indigo-900"},[n.$page.props.auth.user.all_permissions.includes("circulars.manage.all")?(s(),C(c,{key:0,icon:"edit"})):d("",!0)],8,ee),n.$page.props.auth.user.all_permissions.includes("circulars.destroy.all")?(s(),a("a",{key:0,style:{cursor:"pointer"},onClick:F=>x(t),class:"text-red-600 hover:text-red-900"},[m(c,{icon:"trash"})],8,te)):d("",!0)])]))),128))])])):(s(),a("p",se,"No tens cap comunicat."))]),e("div",oe,[(s(!0),a($,null,N(u.comunicats.links,t=>(s(),a("button",{key:t.label,disabled:!t.url,onClick:F=>V(t.url),class:T(["px-4 py-2 mx-1 border rounded",{"bg-blue-500 text-white":t.active,"bg-gray-200 text-gray-600":!t.active}])},g(t.label==="pagination.previous"?"Anterior":t.label==="pagination.next"?"Següent":t.label),11,ae))),128))]),y.value?(s(),a("div",le,[e("div",ne,[o[4]||(o[4]=e("h2",{class:"text-xl font-semibold"},"Estàs segur que vols eliminar aquest comunicat?",-1)),e("p",ie,g((k=i.value)==null?void 0:k.title),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:D}," Sí "),e("button",{class:"bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded",onClick:x}," No ")])])])):d("",!0)])]}),_:1})}}};export{fe 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.