1import{j as e}from"./forms-CQIHuKgG.js";import{r as a,u as t,t as s}from"./i18n-Da3IOi1c.js";import{F as l,C as i,R as n,a as r}from"./ui-C0dJowBQ.js";import{L as o,z as d,e as c,Z as u,_ as m}from"./index-DlMCzIyi.js";import{I as g}from"./ItemAviso-CapfxMeU.js";import{l as p,f as v}from"./contentUtils-C1fi4drN.js";import{W as j}from"./Wrapper-BDzPti5V.js";import{c as x}from"./formatDate-DxyJv62d.js";import{C as h}from"./ColorDiv-DCSjoc16.js";import{u as f}from"./useSEO-DArNPcMT.js";import{u as y,a as b}from"./router-CeOKvF5U.js";import"./utils-CLBY9Uzt.js";import"./query-CNvpHjp-.js";import"./redux-B_RFUBXH.js";const P=({totalPages:a,currentPage:t,data:s,isLoading:l=!1,handleDetail:i,setPage:n})=>{const r=s.length>0;if(l)return e.jsx(o,{});const c=p(s);return e.jsxs("div",{children:[e.jsx("ul",{id:"list",className:"list-avisos",children:c.map((a,t)=>e.jsx(g,{handleClick:()=>i(a),...a},t))}),r&&e.jsxs("div",{className:"pagination",children:[e.jsx("button",{onClick:()=>{t>1&&n(t-1)},style:{opacity:1===t?"0.5":"1"},disabled:1===t,children:e.jsx("img",{src:d,alt:"Previous",style:{transform:"rotate(180deg)"}})}),e.jsxs("span",{children:[t,"/",a]}),e.jsx("button",{onClick:()=>{t<a&&n(t+1)},style:{opacity:t===a?"0.5":"1"},disabled:t===a,children:e.jsx("img",{src:d,alt:"Previous"})})]})]})},$=({options:t,label:s,icone:i,value:n,name:r,onChange:o,className:d,style:c}
1)=>{const u=`select-form-group ${d}`,m=a.useId();return e.jsxs("div",{className:u,style:c,children:[""!==s&&e.jsx("label",{id:`select-${m}-label`,htmlFor:`select-${m}`,className:"select-label",children:s}),e.jsx(l.Select,{title:r,name:r,id:`select-${m}`,value:n,onChange:e=>o(e.target.value),...i&&{style:{backgroundImage:`url(${i})`,backgroundRepeat:"no-repeat",backgroundPosition:" left 12px center"}},children:t.map(a=>e.jsx("option",{value:a.value,children:a.label}))})]})},C=()=>{const{i18n:l}=t(),o=y(),d=b(),[g,p]=a.useState(1),[C,N]=a.useState(0),S=c({query:"(max-width: 768px)"}),{data:I,isLoading:T}=u({page:g,itensPage:10,categoryId:C}),{data:_}=m({vocabulary:"Commercial Services"}),[k,w]=a.useState([]),{SEOComponent:F}=f({pageKey:"warnings"}),D=a.useCallback(()=>{var e;if(!(null==I?void 0:I.item))return;const a="pt"===l.language?"pt-PT":"en-US",t=null==(e=null==I?void 0:I.item)?void 0:e.map(e=>{var t,s,l;const i=e=>{if(!e||""===e.trim())return"";const t=new Date(e);return isNaN(t.getTime())?"":x(t,a)},n=(null==(t=null==e?void 0:e.contentFields)?void 0:t[a])||[],r=i(v(n,"Date35268359")),o=i(v(n,"Field40441023")),d=r&&o?`${"pt-PT"===a?"de":"from"} ${r} ${"pt-PT"===a?"a":"to"} ${o}`:void 0,c=r&&!o?`${"pt-PT"===a?"desde":"since"} ${r}`:void 0,u=!r&&o?`${"pt-PT"===a?"até":"until"} ${o}`:void 0,m=v(n,"Text48691729")||(null==e?void 0:e.title[a])||"",g=v(n,"Campo69402820")||(null==(s=null==e?void 0:e.description)?void 0:s[a])||"";return{id:e.id,title:m,date:d??c??u??"",description:g,contentFields:(null==(l=null==e?void 0:e.contentFields)?void 0:l[a])??[],friendlyUrl:(null==e?void 0:e.friendlyUrlPath)??"",priority:e.priority,dateModified:e.dateModified}});w(t)},[I,l.language]),L=a.useMemo(()=>_?[{label:s("PageWarningSelectLabelCategory"),value:"0"},..._.map(e=>({label:e.labelPT,value:e.categoryId.toString()}))]:[],[_,l.language]);return a.useEffect(()=>{D()},[D,l.language]),a.useEffect(()=>{var e,a;((null==(e=null==o?void 0:o.state)?void 0:e.page)||(null==(a=null==o?void 0:o.state)?void 0:a.categoryId))&&(p(o.state.page??1),N(o.state.categoryId??0))},[o.state]),e.jsxs(e.Fragment,{children:[e.jsx(F,{}),e.jsx(i,{children:e.jsxs(n,{children:[e.jsx(h,{}),e.jsxs(r,{className:"banner_column",children:[e.jsx("div",{className:"warning banner-default",children:e.jsx("div",{className:"warning__content",children:e.jsx("h1",{className:"warning__content__title",children:s("PageWarningTitle")})})}),e.jsx(j,{style:{paddingBottom:"32px"},column:S?12:10,children:e.jsxs("div",{className:"content_table",children:[e.jsx("h2",{children:s("PageWarningSubtitle")}),e.jsxs("div",{className:"category-filter",children:[e.jsx("h3",{children:s("PageWarningSelectLabel")}),e.jsx($,{...!S&&{style:{width:"388px"}},value:C?String(C):void 0,name:"selecionar categoria",icone:"/assets/images/equalizer.svg",options:L,onChange:e=>{N(Number(e)),p(1)}})]}),e.jsx(P,{currentPage:g,totalPages:(null==I?void 0:I.maxPages)??0,isLoading:T,setPage:p,data:k,handleDetail:e=>{d(`/${l.language}/detalhe-aviso/${e.friendlyUrl}`,{state:{page:g,categoryId:C}})}})]})})]})]})})]})};export{C 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.