2 lines
2.5 KiB
JavaScript
2 lines
2.5 KiB
JavaScript
import{g as h,r as _,u as y,c as m,o as b,d as l,l as p,w as C,F as w,f as v,$,b as r,m as B,e as n,t as N,i as S,M as T,h as f,z as V,s as q}from"./index-BmU8V2V2.js";import{S as A}from"./SectionTitle-CrHOP_mf.js";import{P as I}from"./PdfDownload-B_7ePhU0.js";import{I as M}from"./IconoLlama-BavanhPF.js";import"./SecondaryButton-CAqGmnmb.js";const j=async()=>{try{const{data:i}=await h.get("/comunicados-all");return i}catch(i){throw console.log(i),new Error("Error getting comunicados")}},F={class:"mx-auto py-8 px-4 sm:px-6 lg:px-8 max-w-5xl"},L=["onClick"],U={class:"flex items-center"},z={key:0,xmlns:"http://www.w3.org/2000/svg",class:"flex-shrink-0 h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},E={key:1,xmlns:"http://www.w3.org/2000/svg",class:"flex-shrink-0 h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},P={key:0,class:"space-y-4"},H={__name:"LatestNewsView",setup(i){const c="https://www.gasesdeloriente.com.co",d=$(),a=_(null),{data:u}=y({queryKey:["comunicados"],queryFn:()=>j(),staleTime:1e3*60}),k=m(()=>{var s;return((s=u==null?void 0:u.value)==null?void 0:s.categorias)||[]}),g=m(()=>q.contrast),x=s=>{a.value=a.value===s?null:s};return b(()=>{const s=d.query.categoria,o=d.query.comunicado;s&&(a.value=Number(s),setTimeout(()=>{const t=document.querySelector(`#comunicado-${o}`);t==null||t.scrollIntoView({behavior:"smooth",block:"start"})},300))}),(s,o)=>(r(),l("div",F,[p(A,null,{default:C(()=>o[0]||(o[0]=[B("Comunicados informativos")])),_:1}),(r(!0),l(w,null,v(k.value,t=>(r(),l("div",{key:t.categoria_id,class:"select-none"},[n("div",{class:S([{"bg-black":g.value,"bg-white":!g.value},"text-lg font-bold mb-4 cursor-pointer shadow-lg p-4 rounded-lg flex items-center justify-between"]),onClick:e=>x(t.categoria_id)},[n("div",U,[p(M),n("span",null,N(t.categoria_nombre),1)]),a.value===t.categoria_id?(r(),l("svg",z,o[1]||(o[1]=[n("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 15l7-7 7 7"},null,-1)]))):(r(),l("svg",E,o[2]||(o[2]=[n("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])))],10,L),a.value===t.categoria_id?(r(),l("div",P,[(r(!0),l(w,null,v(t.comunicados,e=>(r(),T(I,{key:e.id,title:e==null?void 0:e.title,id:"comunicado-"+(e==null?void 0:e.id),description:e.description,imageSrc:`${f(c)}/${e.imagen}`,imageAlt:e.title,buttonText:e.text_button,fileUrl:`${f(c)}/${e.archivo}`},null,8,["title","id","description","imageSrc","imageAlt","buttonText","fileUrl"]))),128))])):V("",!0)]))),128))]))}};export{H as default};
|