PageSourceSearch

https://transparencia.aguasgrancanaria.com/_next/static/chunks/pages/dashboard/entity-7941306f26f6a4fa.js

js aguasgrancanaria.com collected 2026-09-24 22:31:53 UTC 17,884 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6729],{23189:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/entity",function(){return a(63838)}])},63534:function(e,t,a){"use strict";var n=a(52676),s=a(75271),l=a(1629),r=a(78619),i=a(31985),o=a.n(i),c=a(82187),d=a.n(c),m=a(52073),u=a(75018),x=a(90394);t.Z=e=>{var t,a;let{navClass:i="",inactiveClass:c="",activeClass:h="text-ogovOrange font-bold text-xs",routes:p,isPublicView:f,portalInfo:g,skipSegments:v=[]}=e,j=(0,l.useRouter)(),{t:b,i18n:y}=(0,r.$G)(),w=null==g?void 0:null===(a=g.customization)||void 0===a?void 0:null===(t=a.config)||void 0===t?void 0:t.primary_color,N=w?(0,x.k8)(w):void 0,[C,Z]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(j){let e=j.asPath.split("/");e.shift();let t=[];e.forEach((e,a)=>{isNaN(parseInt(e))?t.push(e):t[a-1]="".concat(t[a-1],"/").concat(e)});let a=t.filter(e=>"dashboard"!==e),n=a.map((e,a)=>({breadcrumb:"dashboard"===e.split("/")[0]?t[a]:e.split("/")[0],href:"/"+t.slice(0,a+2).join("/"),hidden:v.includes(e.split("/")[0])})),s=n.reduceRight((e,t,a)=>-1!==e||t.hidden?e:a,-1);Z(n.map((e,t)=>({...e,active:t===s})))}},[j]),(0,n.jsxs)("nav",{"aria-label":"breadcrumbs",className:d()("flex flex-col sm:flex-row align-middle font-ptSans text-gray-600 text-xs",i),children:[!f&&(0,n.jsx)(o(),{href:"/dashboard",children:b("common.home")}),p&&p.length>0?(0,n.jsx)(n.Fragment,{children:null==p?void 0:p.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center",children:[(!f||t>0)&&(0,n.jsx)("span",{className:"inline-flex items-center px-1","aria-hidden":"true",children:(0,n.jsx)(m.Z,{className:"w-3.5 h-3.5 text-gray-400"})}),(0,n.jsx)(o(),{href:e.href,className:d()(t===p.length-1?h:d()(c,"hover:text-gray-900 hover:underline transition-colors")),style:{color:t===p.length-1?N:void 0},children:(0,u.QN)(e.title)})]},t))}):null==C?void 0:C.filter(e=>!e.hidden).map(e=>{var t,a;let s=null===(t=C[0])||void 0===t?void 0:t.breadcrumb.split("?")[0],l=null==e?void 0:e.breadcrumb.split("?")[0],r="".concat(s,".").concat(l,".pageTitle"),i=C.indexOf(e);if(i>=1){let e=null===(a=C[i-1])||void 0===a?void 0:a.breadcrumb.split("?")[0],t="".concat(s,".").concat(e,".").concat(l,".pageTitle");y.exists(t)&&(r=t)}return(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"inline-flex items-center px-1","aria-hidden":"true",children:(0,n.jsx)(m.Z,{className:"w-3.5 h-3.5 text-gray-400"})}),(0,n.jsx)(o(),{href:null==e?void 0:e.href,className:d()(e.active?h:d()(c,"hover:text-gray-900 hover:underline transition-colors"),"capitalize"),style:{color:e.active?N:void 0},children:b(r)})]},i)})]})}},12671:function(e,t,a){"use strict";a.d(t,{f:function(){return EntityRecordColumns}});var n=a(52676),s=a(90394),l=a(75018),r=a(14990),i=a(21715),o=a(82187),c=a.n(o),d=a(42774),m=a(78619),useCellRenderEntity=e=>{let{cellContent:t,t:a,uniqueKey:s}=e,{i18n:o}=(0,m.$G)();if(Array.isArray(t)){let e=t.map(e=>{let t=e.name;return"object"==typeof t?(0,l.QN)(t):t}).filter(Boolean).join(", ");return(0,n.jsx)("p",{className:"text-justify overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:e})}let u=(0,l.QN)(t)||t;if(u&&"object"==typeof u){if(Object.keys(u)[0]&&Object.keys(u)[0].includes("file"))return(0,n.jsx)("div",{className:c()("flex gap-2 flex-wrap","imageUploadComponent"===s&&"flex-col"),children:Object.values(u).map((function(e){if(null==e?void 0:e.type){var t;if(null==e?void 0:e.type.includes("image"))return(0,n.jsx)("img",{src:null==e?void 0:e.image,alt:e.path,className:"max-w-[100px] max-h-[100px]"});if(!(null==e?void 0:e.image)&&!(null==e?void 0:e.name))return"";if(!(null==e?void 0:null===(t=e.type)||void 0===t?void 0:t.includes("image"))&&!(null==e?void 0:e.name))return(0,n.jsx)("a",{href:null==e?void 0:e.image,download:null==e?void 0:e.path,target:"_blank",rel:"noreferrer",children:(0,n.jsx)(r.Z,{className:"w-5 h-5 mr-2 font-bold"})})}}).bind())});if("isCurrency"in u)return(0,n.jsx)("p",{className:"text-justify overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:u.value});if(u.type){var x;return(null==u?void 0:u.type.includes("image"))?(0,n.jsx)("img",{src:null==u?void 0:u.image,alt:u.path,className:"max-w-[100px] max-h-[100px]"}):(null==u?void 0:u.image)||(null==u?void 0:u.name)?(null==u?void 0:null===(x=u.type)||void 0===x?void 0:x.includes("image"))||(null==u?void 0:u.name)?u.name?(0,n.jsx)("p",{children:(0,l.QN)(u.name)||u.name}):(0,n.jsx)("p",{children:JSON.stringify(u)}):(0,n.jsx)("a",{href:null==u?void 0:u.image,download:null==u?void 0:u.path,target:"_blank",rel:"noreferrer",children:(0,n.jsx)(r.Z,{className:"w-5 h-5 mr-2 font-bold"})}):""}if((null==u?void 0:u.type)===null)return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(d.Z,{title:a("common.corruptUploadedFile"),children:(0,n.jsx)(i.Z,{className:"w-5 h-5 mr-2 text-red-600"})})});{if((null==u||!u.label)&&(null==u||!u.name))return null;let e=u.label?(0,l.QN)(u.label):(0,l.QN)(u.name)||u.name;
1return(0,n.jsx)("p",{className:"text-justify overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:e})}}return"boolean"==typeof u?(0,n.jsx)("p",{className:"text-justify overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:a(u?"common.yes":"common.no")}):(0,n.jsx)("p",{className:"text-justify overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:u})};let{TrashIcon:u,PencilSquareIcon:x,ArrowRightOnRectangleIcon:h}=a(69126),EntityRecordColumns=function(e,t,a,l,r,i){let o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,handleName=(e,t)=>(0,s.C5)(e,t),c=e.reduce((e,t)=>[...e,...Object.keys(t.data)],[]),d=[...new Set(c.filter(e=>"submit"!==e&&void 0!==e&&!(e.includes("relationsSelect")&&e.includes("-"))))],m=d.map(e=>({id:e,sortField:e,name:(0,n.jsx)("p",{className:"text-center capitalize",children:handleName(o,e)}),selector:a=>(0,n.jsx)(useCellRenderEntity,{cellContent:a.data[e],uniqueKey:e,t:t}),sortable:!0}));return m.unshift({name:t("common.actions"),sortable:!1,cell:e=>(0,n.jsxs)(n.Fragment,{children:[i(["record.show"])&&(0,n.jsx)(h,{className:"w-5 h-5 mr-2 cursor-pointer",onClick:()=>window.open("/".concat(a.locale).concat(e.route),"_blank")}),i(["record.update"])&&(0,n.jsx)(x,{className:"w-5 h-5 mr-2 cursor-pointer",onClick:()=>{a.push({pathname:"/dashboard/entity/record/".concat(e.id),query:{entity:l}})}}),i(["record.destroy"])&&(0,n.jsx)(u,{className:"w-5 h-5 mr-2 cursor-pointer",onClick:()=>{a.push({pathname:"/dashboard/entity/delete/".concat(e.id),query:{entity:l}})}})]})}),m}},15907:function(e,t,a){"use strict";var n=a(52676),s=a(82187),l=a.n(s),r=a(31985),i=a.n(r);t.Z=e=>{let{className:t,...a}=e;return(0,n.jsx)(i(),{className:l()(t,"\n        inline-flex \n        items-center\n        px-3\n        py-3\n        border \n        border-transparent \n        rounded-md \n        font-semibold \n        text-xs\n        text-white\n        uppercase\n        tracking-widest\n        focus:outline-none\n        focus:ring\n        disabled:opacity-25\n        transition\n        ease-in-out\n        duration-150"),...a})}},33199:function(e,t,a){"use strict";a.d(t,{Z:function(){return Modal}});var n=a(52676),s=a(75271),l=a(87902),r=a(73043),i=a(42597);function Modal(e){let{title:t,show:a,handleShow:o,children:c,footer:d}=e;return(0,n.jsx)(l.u,{appear:!0,show:a,as:s.Fragment,children:(0,n.jsxs)(r.V,{as:"div",className:"relative z-10",onClose:o,children:[(0,n.jsx)(l.u.Child,{as:s.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),(0,n.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,n.jsx)(l.u.Child,{as:s.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,n.jsxs)(r.V.Panel,{className:"w-full max-w-md transform rounded-lg bg-white text-left align-middle shadow-xl transition-all",children:[(0,n.jsx)(r.V.Title,{as:"h3",className:"text-lg border-b-2 border-gray-100 font-medium leading-6 text-gray-900 mb-5",children:(0,n.jsxs)("div",{className:"flex justify-between items-center p-6",children:[t,(0,n.jsx)("div",{className:"cursor-pointer",onClick:()=>o(!1),children:(0,n.jsx)(i.Z,{className:"w-5 h-5"})})]})}),(0,n.jsx)("div",{className:"px-6 pb-6",children:c}),d&&(0,n.jsx)("div",{className:"flex justify-between px-6 pt-4 pb-4 ",children:d})]})})})})]})})}},29670:function(e,t,a){"use strict";a.d(t,{MR:function(){return o},pn:function(){return c}});var n=a(52676),s=a(21386),l=a(19647),r=a(33250),i=a(56284);let o="success",c="error",d={[o]:{icon:(0,n.jsx)(s.Z,{className:"w-7 h-7 text-emerald-600 mr-2"}),textColor:"text-green-800",bgColor:"bg-green-50",closeIconColor:"text-green-400"},[c]:{icon:(0,n.jsx)(l.Z,{className:"w-7 h-7 text-red-600 mr-2"}),textColor:"text-red-700",bgColor:"bg-red-50",closeIconColor:"text-red-400"},info:{icon:(0,n.jsx)(r.Z,{className:"w-7 h-7 text-blue-600 mr-2"}),textColor:"text-blue-700",bgColor:"bg-blue-300",closeIconColor:"text-blue-600"}};t.ZP=e=>{let{notification:t,removeNotification:a}=e;return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"rounded-md p-4 ".concat(d[t.status].bgColor," mb-2"),children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:d[t.status].icon}),(0,n.jsx)("div",{className:"ml-3",children:(0,n.jsx)("p",{className:"text-sm font-medium  ".concat(d[t.status].textColor),children:t.message})}),(0,n.jsx)("div",{className:"ml-auto pl-3",children:(0,n.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,n.jsx)("button",{type:"button",className:"inline-flex rounded-md ".concat(d[t.status].bgColor," p-1.5 ").concat(d[t.status].closeIconColor),onClick:()=>a(t),children:(0,n.jsx)(i.Z,{className:"h-5 w-5","aria-hidden":"true"})})})})]})})})}},66085:function(e,t,a){"use strict";a.d(t,{Z:function(){return useDatatable}});var n=a(52676),s=a(96208),l=a(91750),r=a(78619);a(75271);var i=a(51507);let NotData=e=>{let{data:t}=e;return(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center w-full",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-gray-100",children:(0,n.jsx)(i.Z,{className:"w-8 h-8 text-gray-400"})}),(0,n.jsx)("span",{className:"leading-normal text-base font-semibold text-gray-500 md:text-lg",children:t})]})},datatableLocales=()=>({rowsPerPageText:r.ag.t("common.rowsPerPageText"),rangeSeparatorText:r.ag.t("common.rangeSeparatorText"),selectAllRowsItem:!0,selectAllRowsItemText:r.ag.t("common.selectAllRowsItemText")});function useDatatable(e){let{data:t,columns:a,isFetching:i,page:o,handlePageChange:c,handlePerPageChange:d,total:m,perPage:u,noServerPagination:x,...h}=e,{t:p}=(0,r.$G)();return{renderDatatable:()=>(0,n.jsx)(s.ZP,{columns:a,data:t,noDataComponent:(0,n.jsxs)(n.Fragment,{children:[" ",(0,n.jsx)(NotData,{data:p("common.noData")})]}),pagination:!0,paginationServer:!x,paginationTotalRows:m,paginationDefaultPage:o,progressPending:i,progressComponent:(0,n.jsx)("div",{className:"py-6",children:(0,n.jsx)(l.g,{})}),onChangePage:e=>c(e),onChangeRowsPerPage:e=>d(e),paginationPerPage:u,paginationComponentOptions:datatableLocales(),...h})}}},63989:function(e,t,a){"use strict";a.d(t,{Z:function(){return usePagination}});var n=a(75271);function usePagination(){let{initialPerPage:e=10}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
1,[t,a]=(0,n.useState)(1),[s,l]=(0,n.useState)(0),[r,i]=(0,n.useState)(0),[o,c]=(0,n.useState)(e);return{page:t,setPage:a,total:s,setTotal:l,lastPage:r,setLastPage:i,perPage:o,setPerPage:c}}},22836:function(e,t,a){"use strict";a.d(t,{Z:function(){return useNotifications}});var n=a(52676),s=a(29670),l=a(75271),r=a(31785),i=a(1629);function useNotifications(){let{clearNotifications:e}=(0,l.useContext)(r.u),t=(0,i.useRouter)();return(0,l.useEffect)(()=>(t.events.on("routeChangeStart",e),()=>{t.events.off("routeChangeStart",e)}),[]),{showNotifications:(e,t)=>e.map((e,a)=>(0,n.jsx)(s.ZP,{notification:e,removeNotification:t},a))}}},63838:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return E}});var n=a(52676),s=a(42474),l=a(66085),r=a(63989),i=a(61982),o=a(51180),c=a(60027),d=a(78619),m=a(1629),u=a(75271),x=a(15907),h=a(57394),p=a.n(h),f=a(34090),g=a(63534),v=a(31785),j=a(22836),b=a(35629),y=a(29820),w=a(12671),N=a(43667),C=a(90394),Z=a(64957),_=a(33199),T=a(91750);let EntityRecords=()=>{let e=(0,m.useRouter)(),t=e.query.entity?JSON.parse(e.query.entity):null,{t:a}=(0,d.$G)(),{handlePermission:h}=(0,s.a)({middleware:["auth","verified"]}),[f,E]=(0,u.useState)([]),{page:P,setPage:k,total:S,setTotal:D,perPage:F,setPerPage:R}=(0,r.Z)(),{notifications:O,removeNotification:I}=(0,u.useContext)(v.u),{showNotifications:q}=(0,j.Z)(),[G,Q]=(0,u.useState)(null),[A,z]=(0,u.useState)(),[$,L]=(0,u.useState)(!1),[M,V]=(0,u.useState)(!0),fetchEntityRecords=async(e,a)=>{let n=await b.Y.list(t,null,e,a);E(null==n?void 0:n.data.data),D(null==n?void 0:n.data.meta.total)},{renderDatatable:B}=(0,l.Z)({data:f,columns:(0,w.f)(f,a,e,t,A,h),page:P,handlePageChange:e=>{k(e),fetchEntityRecords(e,F)},handlePerPageChange:e=>{R(e),fetchEntityRecords(P,e)},total:S,perPage:F});(0,u.useEffect)(()=>{h(["record.list"])||e.push("/dashboard"),fetchEntityRecords()},[t]),(0,u.useEffect)(()=>{V(!0);let fetchData=async()=>{let e=await Z.B.list(null,null,t);z(e.data.data[0]);let a=await y.c.show(t);Q(a.data.data),V(!1)};fetchData()},[t]);let handleExport=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"csv";if(!A)return;let{data:t}=await N.F.exportData({form_schema_id:A.id},e);(0,C.an)(t,"".concat((0,C.bG)(A.name[d.ag.language]),"_data_export.").concat(e),e)},handleExportTemplate=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"csv";if(!A)return;let{data:t}=await N.F.exportTemplateData({form_schema_id:A.id});(0,C.an)(t,"".concat((0,C.bG)(A.name[d.ag.language]),"_data_template.").concat(e),e)},handleImport=async e=>{if(!A)return;let t=new FormData;t.append("form_schema_id",A.id),t.append("file",e.target.files[0]),await N.F.importData(t)};return M?(0,n.jsx)(T.g,{}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p(),{children:(0,n.jsx)("title",{children:null==G?void 0:G.name})}),(0,n.jsx)("div",{className:"mx-auto max-w-screen-2xl",children:(0,n.jsxs)("div",{className:"overflow-hidden bg-white rounded-lg shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center border-b border-gray-200",children:[(0,n.jsxs)("div",{className:"p-6 grow",children:[(0,n.jsx)("div",{className:"text-xl font-bold text-black bg-white sm:text-2xl",children:null==G?void 0:G.name}),(0,n.jsx)("div",{children:(0,n.jsx)(g.Z,{})})]}),(0,n.jsxs)("div",{className:"p-6",children:[(0,n.jsxs)("button",{className:"inline-flex items-center px-3 py-3 text-xs font-bold uppercase disabled:opacity-50 disabled:cursor-not-allowed",disabled:!A,onClick:()=>handleExport(),children:[(0,n.jsx)(i.Z,{className:"w-5 h-5 mr-2 font-bold"}),a("export")]}),(0,n.jsxs)("button",{className:"inline-flex items-center px-3 py-3 text-xs font-bold uppercase disabled:opacity-50 disabled:cursor-not-allowed",disabled:!A,onClick:()=>L(!0),children:[(0,n.jsx)(o.Z,{className:"w-5 h-5 mr-2 font-bold"}),a("import")]}),h(["record.store"])&&(0,n.jsxs)(x.Z,{className:"bg-ogovOrange",href:"/dashboard/entity/"+e.query.entity,children:[(0,n.jsx)(c.Z,{className:"w-5 h-5 mr-2"}),a("forms:addRecord")]})]})]}),q(O,I),B()]})}),(0,n.jsx)(_.Z,{show:$,handleShow:L,title:"".concat(a("form-schemas/form-schemas:importDataFrom")," ").concat(null==A?void 0:A.name),children:(0,n.jsxs)("div",{className:"flex gap-4 p-5",children:[(0,n.jsxs)("button",{onClick:()=>{L(!1),handleExportTemplate()},className:"flex flex-col items-center w-1/2 p-8 rounded-lg shadow-md cursor-pointer focus:outline-none focus:ring-1 focus:border-transparent ring-2 ring-gray-200 hover:bg-gray-50 hover:text-primary",children:[(0,n.jsx)(i.Z,{className:"w-10 h-10 mb-4"}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:a("form-schemas/form-schemas:downloadTemplate")}),(0,n.jsx)("p",{className:"text-gray-700",children:a("form-schemas/form-schemas:downloadTemplateDescription")})]}),(0,n.jsx)("input",{type:"file",onChange:e=>{L(!1),handleImport(e)},className:"hidden",id:"file-input"}),(0,n.jsxs)("label",{htmlFor:"file-input",className:"flex flex-col items-center w-1/2 p-8 rounded-lg shadow-md cursor-pointer ring-2 ring-gray-200 hover:bg-gray-50 hover:text-primary",children:[(0,n.jsx)(o.Z,{className:"w-10 h-10 mb-4"}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:a("form-schemas/form-schemas:importData")}),(0,n.jsx)("p",{className:"text-gray-700",children:a("form-schemas/form-schemas:importDataDescription")})]})]})})]})};EntityRecords.getLayout=function(e){return(0,n.jsx)(f.Z,{isTenant:!0,children:e})};var E=!0;t.default=EntityRecords},43667:function(e,t,a){"use strict";a.d(t,{F:function(){return s}});var n=a(129);let s={exportData:(e,t)=>n.default.post("/api/v1/export-".concat(t||"csv"),e),exportTemplateData:(e,t)=>n.default.post("/api/v1/export-template-".concat(t||"csv"),e),importData:(e,t)=>n.default.post("/api/v1/import-".concat(t||"csv"),e,{headers:{"Content-Type":"multipart/form-data"}}),exportTranslations:e=>n.default.get("/api/v1/translations/export/".concat(e)),importTranslations:(e,t)=>n.default.post("/api/v1/translations/import/".concat(e),t,{headers:{"Content-Type":"multipart/form-data"}})}}},function(e){e.O(0,[3043,1968,4090,9774,2888,179],function(){return e(e.s=23189)}),_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.