1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6134],{2616:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/news",function(){return a(25778)}])},25778:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSG:function(){return C},default:function(){return E}});var n=a(90626),r=a(91569),s=a(63702),l=a(24875),i=a(29218),o=a(67478),c=a(17862),d=a(24724),u=a.n(d),g=a(7072),m=a(27511),h=a(89559),x=e=>{let{data:t}=e,{lang:a}=(0,h.Z)("admin/common"),[s,l]=(0,r.useState)(null==t?void 0:t.image),i=new Date(Number(t.created_at)),o=i.toLocaleString((0,c.eY)(a),{month:"long"}),d="".concat(i.getDate()," ").concat(o.charAt(0).toUpperCase()+o.slice(1),", ").concat(i.getFullYear());return(0,r.useEffect)(()=>l(null==t?void 0:t.image),[null==t?void 0:t.image]),(0,n.jsxs)("a",{className:"rounded-lg bg-gray-100 p-6 flex flex-col justify-between h-full hover:bg-gray-200 cursor-pointer",href:null==t?void 0:t.url,target:"_blank",rel:"noopener noreferrer",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"flex justify-center mb-4 min-h-[200px]",children:(0,n.jsx)(u(),{src:s||"/images/logos/news.png",className:"object-center rounded-lg",alt:"logo",width:400,height:100,onError:()=>l("/images/logos/news.png")})}),(0,n.jsx)("h4",{className:"text-sm font-normal mb-4 text-gray-500",children:d}),(0,n.jsx)("h3",{className:"text-lg font-semibold mb-4",children:(0,m.T)(null==t?void 0:t.title,100)}),(0,n.jsx)("p",{className:"text-sm font-normal mb-4 text-gray-600",children:(0,m.T)(null==t?void 0:t.description,100)})]}),(0,n.jsx)("div",{className:"flex justify-end mt-auto",children:(0,n.jsx)(g.Z,{className:"object-center w-6 h-6 fill-[#007b6d]",alt:"icons"})})]})},p=a(57035),f=a(90947),b=a(80163);function v(){let e=(0,f._)(["\n query News($data: NewsFilter) {\n news(data: $data) {\n title\n description\n content\n image\n url\n source\n status\n created_at\n updated_at\n id\n }\n }\n"]);return v=function(){return e},e}function N(){let e=(0,f._)(["\n query Query($search: String) {\n totalNews(search: $search)\n }\n"]);return N=function(){return e},e}let j=(0,b.Ps)(v()),w=(0,b.Ps)(N());var y=a(53084),P=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=(0,y.useRouter)(),[s,l]=(0,r.useState)(e),[i,o]=(0,r.useState)(t),c=a?"".concat(a,"Page"):"page",d=a?"".concat(a,"PerPage"):"perPage";(0,r.useEffect)(()=>{let a=parseInt(n.query[c])||e,r=parseInt(n.query[d])||t;l(a),o(r)},[n.query,c,d,e,t]);let u=(0,r.useCallback)((e,t)=>{let a={...n.query};void 0!==e&&(a[c]=e.toString()),void 0!==t&&(a[d]=t.toString()),n.push({pathname:n.pathname,query:a},void 0,{shallow:!0})},[n,c,d]);return{currentPage:s,itemsPerPage:i,handlePageChange:(0,r.useCallback)(e=>{l(e),u(e,void 0)},[u]),handlePerPageChange:(0,r.useCallback)(e=>{let{target:t}=e,a=Number(t.value);o(a),l(1),u(1,a)},[u]),resetPagination:(0,r.useCallback)(()=>{l(1),o(t),u(1,t)},[u,t]),updateUrl:u}},_=a(60816),C=!0,E=()=>{var e;let{t,lang:a}=(0,h.Z)("admin/common"),[c,d]=(0,r.useState)(""),[u,g]=(0,r.useState)(""),{currentPage:m,itemsPerPage:f,handlePageChange:b,handlePerPageChange:v,resetPagination:N}=P(1,12,"news");(0,r.useEffect)(()=>{let e=setTimeout(()=>{g(c)},1e3);return()=>{clearTimeout(e)}},[c]),(0,r.useEffect)(()=>{u!==c&&N()},[u,c,N]);let{loading:y,error:C,data:E}=(0,i.aM)(j,{variables:{data:{limit:f,pagination:m-1,search:u}}}),{loading:S,error:k,data:T}=(0,i.aM)(w,{variables:{search:u}}),Z=(null==T?void 0:T.totalNews)||0;return C?(0,n.jsxs)("p",{children:["Error: ",C.message]}):(0,n.jsx)(l.E.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"md:px-20 ",children:(0,n.jsx)("div",{className:"border rounded-2xl flex flex-col shadow-default bg-white",children:(0,n.jsxs)("div",{className:"flex-grow p-8",children:[(0,n.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center md:h-[45px] rounded-t-2xl pl-1 pr-4",children:[(0,n.jsxs)("div",{className:"font-semibold text-2xl mb-4",children:[t("News"),S?(0,n.jsx)(s.Z,{width:100,height:20}):(0,n.jsxs)("span",{className:"ml-2 text-sm font-normal text-gray-400",children:["(",Z,")"]})]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(o.Z,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-[69%] text-gray-400 z-10 bg-transparent"}),(0,n.jsx)("input",{type:"text",placeholder:t("SearchNews"),value:c,onChange:e=>d(e.target.value),className:"bg-white w-full md:w-[495px] px-10 h-11 border border-gray-300 rounded focus:outline-none hover:border-[#258b7f] focus:border-[#007b6d] focus:border-opacity-80 hover:border-opacity-80"})]})]}),y?(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-8 pt-12",children:[...Array(9)].map((e,t)=>(0,n.jsx)(s.Z,{style:{borderRadius:"16px",height:"450px",padding:"28px",display:"flex",justifyContent:"center",alignItems:"center"}},"skeleton-".concat(t)))}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-8 pt-12",children:null==E?void 0:null===(e=E.news)||void 0===e?void 0:e.map((e,t)=>(0,n.jsx)(x,{data:e},"news-".concat(t)))}),Z>0&&(0,n.jsx)("div",{className:"mt-8 pt-8 border-t",children:(0,n.jsx)(p.Z,{totalPages:Math.ceil(Z/f),currentPageNumber:m,handlePageChange:b,itemsPerPage:f,handlePerPageChange:v,perPage:f,loading:y,itemsPerPageOptions:_.LT.NEWS})})]})]})})})}}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=2616)}),_N_E=e.O()}]);
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.