1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7607],{42498:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(91696);let l=(0,a.Z)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},9673:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/portal/[portal]/dashboard/files",function(){return s(36381)}])},63534:function(e,t,s){"use strict";var a=s(52676),l=s(75271),n=s(1629),i=s(78619),r=s(31985),o=s.n(r),c=s(82187),d=s.n(c),m=s(52073),u=s(75018),x=s(90394);t.Z=e=>{var t,s;let{navClass:r="",inactiveClass:c="",activeClass:h="text-ogovOrange font-bold text-xs",routes:f,isPublicView:p,portalInfo:g,skipSegments:v=[]}=e,j=(0,n.useRouter)(),{t:b,i18n:N}=(0,i.$G)(),w=null==g?void 0:null===(s=g.customization)||void 0===s?void 0:null===(t=s.config)||void 0===t?void 0:t.primary_color,y=w?(0,x.k8)(w):void 0,[F,Z]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(j){let e=j.asPath.split("/");e.shift();let t=[];e.forEach((e,s)=>{isNaN(parseInt(e))?t.push(e):t[s-1]="".concat(t[s-1],"/").concat(e)});let s=t.filter(e=>"dashboard"!==e),a=s.map((e,s)=>({breadcrumb:"dashboard"===e.split("/")[0]?t[s]:e.split("/")[0],href:"/"+t.slice(0,s+2).join("/"),hidden:v.includes(e.split("/")[0])})),l=a.reduceRight((e,t,s)=>-1!==e||t.hidden?e:s,-1);Z(a.map((e,t)=>({...e,active:t===l})))}},[j]),(0,a.jsxs)("nav",{"aria-label":"breadcrumbs",className:d()("flex flex-col sm:flex-row align-middle font-ptSans text-gray-600 text-xs",r),children:[!p&&(0,a.jsx)(o(),{href:"/dashboard",children:b("common.home")}),f&&f.length>0?(0,a.jsx)(a.Fragment,{children:null==f?void 0:f.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center",children:[(!p||t>0)&&(0,a.jsx)("span",{className:"inline-flex items-center px-1","aria-hidden":"true",children:(0,a.jsx)(m.Z,{className:"w-3.5 h-3.5 text-gray-400"})}),(0,a.jsx)(o(),{href:e.href,className:d()(t===f.length-1?h:d()(c,"hover:text-gray-900 hover:underline transition-colors")),style:{color:t===f.length-1?y:void 0},children:(0,u.QN)(e.title)})]},t))}):null==F?void 0:F.filter(e=>!e.hidden).map(e=>{var t,s;let l=null===(t=F[0])||void 0===t?void 0:t.breadcrumb.split("?")[0],n=null==e?void 0:e.breadcrumb.split("?")[0],i="".concat(l,".").concat(n,".pageTitle"),r=F.indexOf(e);if(r>=1){let e=null===(s=F[r-1])||void 0===s?void 0:s.breadcrumb.split("?")[0],t="".concat(l,".").concat(e,".").concat(n,".pageTitle");N.exists(t)&&(i=t)}return(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"inline-flex items-center px-1","aria-hidden":"true",children:(0,a.jsx)(m.Z,{className:"w-3.5 h-3.5 text-gray-400"})}),(0,a.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?y:void 0},children:b(i)})]},r)})]})}},50924:function(e,t,s){"use strict";var a=s(52676),l=s(75271);let n=(0,l.forwardRef)(function(e,t){let{type:s="submit",className:l,...n}=e;return(0,a.jsx)("button",{ref:t,type:s,className:"\n ".concat(l,"\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"),...n})});t.Z=n},33199:function(e,t,s){"use strict";s.d(t,{Z:function(){return Modal}});var a=s(52676),l=s(75271),n=s(87902),i=s(73043),r=s(42597);function Modal(e){let{title:t,show:s,handleShow:o,children:c,footer:d}=e;return(0,a.jsx)(n.u,{appear:!0,show:s,as:l.Fragment,children:(0,a.jsxs)(i.V,{as:"div",className:"relative z-10",onClose:o,children:[(0,a.jsx)(n.u.Child,{as:l.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,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),(0,a.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,a.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,a.jsx)(n.u.Child,{as:l.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,a.jsxs)(i.V.Panel,{className:"w-full max-w-md transform rounded-lg bg-white text-left align-middle shadow-xl transition-all",children:[(0,a.jsx)(i.V.Title,{as:"h3",className:"text-lg border-b-2 border-gray-100 font-medium leading-6 text-gray-900 mb-5",children:(0,a.jsxs)("div",{className:"flex justify-between items-center p-6",children:[t,(0,a.jsx)("div",{className:"cursor-pointer",onClick:()=>o(!1),children:(0,a.jsx)(r.Z,{className:"w-5 h-5"})})]})}),(0,a.jsx)("div",{className:"px-6 pb-6",children:c}),d&&(0,a.jsx)("div",{className:"flex justify-between px-6 pt-4 pb-4 ",children:d})]})})})})]})})}},29670:function(e,t,s){"use strict";s.d(t,{MR:function(){return o},pn:function(){return c}});var a=s(52676),l=s(21386),n=s(19647),i=s(33250),r=s(56284);let o="success",c="error",d={[o]:{icon:(0,a.jsx)(l.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,a.jsx)(n.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,a.jsx)(i.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:s}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"rounded-md p-4 ".concat(d[t.status].bgColor," mb-2"),children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:d[t.status].icon}),(0,a.jsx)("div",{className:"ml-3",children:(0,a.jsx)("p",{className:"text-sm font-medium ".concat(d[t.status].textColor),children:t.message})}),(0,a.jsx)("div",{className:"ml-auto pl-3",children:(0,a.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,a.jsx)("button",{type:"button",className:"inline-flex rounded-md ".concat(d[t.status].bgColor," p-1.5 ").concat(d[t.status].closeIconColor),onClick:()=>s(t),children:(0,a.jsx)(r.Z,{className:"h-5 w-5","aria-hidden":"true"})})})})]})})})}},66085:function(e,t,s){"use strict";s.d(t,{Z:function(){return useDatatable}});var a=s(52676),l=s(96208),n=s(91750),i=s(78619);s(75271);var r=s(51507);let NotData=e=>{let{data:t}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center w-full",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-gray-100",children:(0,a.jsx)(r.Z,{className:"w-8 h-8 text-gray-400"})}),(0,a.jsx)("span",{className:"leading-normal text-base font-semibold text-gray-500 md:text-lg",children:t})]})},datatableLocales=()=>({rowsPerPageText:i.ag.t("common.rowsPerPageText"),rangeSeparatorText:i.ag.t("common.rangeSeparatorText"),selectAllRowsItem:!0,selectAllRowsItemText:i.ag.t("common.selectAllRowsItemText")});function useDatatable(e){let{data:t,columns:s,isFetching:r,page:o,handlePageChange:c,handlePerPageChange:d,total:m,perPage:u,noServerPagination:x,...h}=e,{t:f}=(0,i.$G)();return{renderDatatable:()=>(0,a.jsx)(l.ZP,{columns:s,data:t,noDataComponent:(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsx)(NotData,{data:f("common.noData")})]}),pagination:!0,paginationServer:!x,paginationTotalRows:m,paginationDefaultPage:o,progressPending:r,progressComponent:(0,a.jsx)("div",{className:"py-6",children:(0,a.jsx)(n.g,{})}),onChangePage:e=>c(e),onChangeRowsPerPage:e=>d(e),paginationPerPage:u,paginationComponentOptions:datatableLocales(),...h})}}},63989:function(e,t,s){"use strict";s.d(t,{Z:function(){return usePagination}});var a=s(75271);function usePagination(){let{initialPerPage:e=10}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,s]=(0,a.useState)(1),[l,n]=(0,a.useState)(0),[i,r]=(0,a.useState)(0),[o,c]=(0,a.useState)(e);return{page:t,setPage:s,total:l,setTotal:n,lastPage:i,setLastPage:r,perPage:o,setPerPage:c}}},22836:function(e,t,s){"use strict";s.d(t,{Z:function(){return useNotifications}});var a=s(52676),l=s(29670),n=s(75271),i=s(31785),r=s(1629);function useNotifications(){let{clearNotifications:e}=(0,n.useContext)(i.u),t=(0,r.useRouter)();return(0,n.useEffect)(()=>(t.events.on("routeChangeStart",e),()=>{t.events.off("routeChangeStart",e)}),[]),{showNotifications:(e,t)=>e.map((e,s)=>(0,a.jsx)(l.ZP,{notification:e,removeNotification:t},s))}}},36381:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return E},default:function(){return M}});var a=s(52676),l=s(75271),n=s(11557),i=s(78619),r=s(41501),o=s(31785),c=s(22836),d=s(42474),m=s(1629),u=s(63989),x=s(66085),h=s(39442),f=s(90394),p=s(7107),g=s(84914),v=s(31985),j=s.n(v),b=s(50924),N=s(83456);let filesColumns=e=>{let{t,router:s,handlePermission:l,setShowModal:n,setSelectedFile:i}=e,{locale:r}=s,handleDeleteFile=e=>{n(!0),i(e)};return[{name:t("common.preview"),selector:e=>(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(j(),{href:"/download/".concat(e.name),target:"_blank",rel:"noreferrer",children:e.mimeType&&e.mimeType.includes("image/")?(0,a.jsx)("img",{className:"w-8 h-8 rounded-full",src:"/download/".concat(e.name),alt:"preview"}):(0,a.jsx)(p.Z,{className:"w-6 h-6"})})}),sortable:!1},{name:t("common.name"),selector:e=>e.name,sortable:!0},{name:t("common.date"),selector:e=>e.updated_at,sortable:!0}
1,{name:t("common.actions"),sortable:!1,cell:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"p-1",children:(0,a.jsxs)(b.Z,{className:"bg-blue-100 !text-blue-700 group sm:!p-2 !p-1 ml-2 relative",onClick:()=>{var t;return null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText(window.location.origin+"/download/".concat(e.name))},children:[(0,a.jsx)(N.Z,{className:"w-5 h-5 ml-2 cursor-pointer"}),(0,a.jsx)("div",{className:"opacity-0 text-[0px] sm:group-hover:text-xs sm:group-hover:mx-2 sm:group-hover:opacity-100 transition-opacity duration-300",children:t("common.copyLink")})]})}),l(["file.destroy"])&&(0,a.jsx)("div",{className:"p-1",children:(0,a.jsxs)(b.Z,{className:"bg-red-100 !text-red-700 group sm:!p-2 !p-1 ml-2 relative",onClick:()=>handleDeleteFile(e.name),children:[(0,a.jsx)(g.Z,{className:"w-5 h-5 ml-2 cursor-pointer"}),(0,a.jsx)("div",{className:"opacity-0 text-[0px] sm:group-hover:text-xs sm:group-hover:mx-2 sm:group-hover:opacity-100 transition-opacity duration-300",children:t("common.delete")})]})})]})}]};var w=s(57394),y=s.n(w),F=s(63534),Z=s(60027),C=s(59810),S=s(34090),P=s(23940),k=s(19719);let FilesFilters=e=>{let{filters:t,handleInputFilters:s}=e,{t:l}=(0,i.$G)();return(0,a.jsx)("div",{className:"flex flex-col md:flex-row px-6 py-2 md:space-x-4",children:(0,a.jsxs)("div",{className:"md:flex-1 mb-2",children:[(0,a.jsx)(k.Z,{children:l("common.name")}),(0,a.jsx)(P.Z,{type:"search",name:"name",className:"w-full form-input block",value:null==t?void 0:t.name,onChange:e=>s(e)})]})})};var T=s(33199),_=s(91750),Files_DeleteFileModal=e=>{let{selectedFile:t,showModal:s,setShowModal:l,loading:n,handleDelete:r}=e,{t:o}=(0,i.$G)();return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(T.Z,{show:s,handleShow:l,title:o("files.delete.pageTitle"),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-gray-700",children:[o("files.delete.deleteText")," ",(0,a.jsx)("span",{className:"font-bold",children:t}),"?"]}),(0,a.jsx)(b.Z,{className:"place-self-center flex justify-center w-full max-w-sm bg-red-500 hover:bg-red-600 active:bg-red-900 focus:bg-red-900",onClick:()=>r(t),disabled:n,children:n?(0,a.jsx)(_.g,{width:5,height:5}):(0,a.jsx)("p",{className:"justify-center",children:o("common.delete")})})]})})})};s(14248);var D=s(98449),Files_UploadFileModal=e=>{let{showModal:t,setShowModal:s,loading:l,handleFileUpload:n,uploadedFile:r,setUploadedFile:o}=e,{t:c}=(0,i.$G)();return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(T.Z,{show:t,handleShow:s,title:c("common.uploadFile"),children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("div",{children:(0,a.jsx)(D.Z,{defaultFiles:r,onChange:o})}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(b.Z,{className:" bg-ogovOrange",onClick:()=>n(),disabled:l,children:l?(0,a.jsx)(_.g,{height:5,width:5}):c("common.uploadFile")})})]})})})};let Index=()=>{let e=(0,m.useRouter)(),{data:t,isFetching:s,handleFetchFiles:p,error:g}=function(e){let[t,s]=(0,l.useState)([]),[a,i]=(0,l.useState)(),[r,o]=(0,l.useState)(!0),handleFetchFiles=(e,t,a)=>{o(!0),n.p.list(e,t,null!=a?a:void 0).then(e=>{s(e.data)}).catch(e=>i(e)).finally(()=>o(!1))};return(0,l.useEffect)(()=>{handleFetchFiles()},[]),{data:t,isFetching:r,handleFetchFiles,error:a}}(),{t:v}=(0,i.$G)(),{isOpen:j,alert:N,showAlert:w}=(0,r.ZP)(),{notifications:S,removeNotification:P,newNotification:k}=(0,l.useContext)(o.u),{showNotifications:T}=(0,c.Z)(),{handlePermission:_}=(0,d.a)({middleware:["auth"]}),[D,E]=(0,l.useState)(!0),[M,I]=(0,l.useState)(!1),[O,R]=(0,l.useState)(null),[L,G]=(0,l.useState)(!1),[$,U]=(0,l.useState)(!1),[V,q]=(0,l.useState)(null),[z,A]=(0,l.useState)(!1),{page:X,setPage:B,total:H,setTotal:J,perPage:Q,setPerPage:K}=(0,u.Z)(),W=filesColumns({t:v,router:e,handlePermission:_,setShowModal:I,setSelectedFile:R}),{renderDatatable:Y}=(0,x.Z)({data:t,columns:W,isFetching:s,page:X,handlePageChange:e=>{B(e),p(e,Q,ee)},handlePerPageChange:e=>{K(e),p(X,e,ee)},total:H,perPage:Q,noServerPagination:!0}),{filters:ee,handleInputFilters:et,handleSelectFilters:es}=(0,h.Z)({fields:{name:""},fetchData:p});return(0,l.useEffect)(()=>{Object.keys(t).length>0&&J(t.total)},[t]),(0,l.useEffect)(()=>g&&(0,f.xg)(g,null,w),[g]),(0,l.useEffect)(()=>{_(["file.list"])||e.push("/dashboard")},[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y(),{children:(0,a.jsx)("title",{children:v("files.files.pageTitle")})}),(0,a.jsx)(Files_DeleteFileModal,{showModal:M,selectedFile:O,setShowModal:I,loading:L,handleDelete:()=>{G(!0),n.p.destroy(O).then(()=>{k("success",v("common.successOperation")),p(1,10)}).catch(e=>(0,f.xg)(e,null,w)).finally(()=>{G(!1),I(!1)})}}),(0,a.jsx)(Files_UploadFileModal,{showModal:$,uploadedFile:V,setUploadedFile:q,setShowModal:U,loading:z,handleFileUpload:()=>{A(!0);let e=new FormData;e.append("_method","POST"),e.append("file",JSON.stringify(V)),n.p.upload(e).then(()=>{k("success",v("common.successOperation")),p(1,10)}).catch(e=>(0,f.xg)(e,null,w)).finally(()=>{A(!1),U(!1),q(null)})}}),(0,a.jsx)("div",{className:"max-w-screen-2xl mx-auto",children:(0,a.jsxs)("div",{className:"bg-white overflow-hidden shadow-sm rounded-lg",children:[(0,a.jsxs)("div",{className:"flex sm:items-center max-sm:flex-col border-b border-gray-200",children:[(0,a.jsxs)("div",{className:"grow p-6",children:[(0,a.jsx)("div",{className:" bg-white font-bold text-xl sm:text-2xl text-black",children:v("files.files.pageTitle")}),(0,a.jsx)("div",{children:(0,a.jsx)(F.Z,{})})]}),(0,a.jsxs)("div",{className:"flex items-center sm:justify-between",children:[(0,a.jsx)("div",{className:"flex justify-center p-6",children:(0,a.jsxs)(b.Z,{className:" bg-ogovOrange",onClick:()=>U(!$),children:[(0,a.jsx)(Z.Z,{className:"w-5 h-5 mr-2"}),v("common.uploadFile")]})}),(0,a.jsx)("div",{className:"p-2 max-sm:w-full",children:(0,a.jsx)("div",{onClick:()=>E(!D),className:"p-1.5 border border-black rounded max-sm:w-full flex justify-center",children:(0,a.jsx)(C.Z,{className:"w-8 h-8 cursor-pointer"})})})]})]}),D&&(0,a.jsx)(FilesFilters,{filters:ee,handleInputFilters:et}),j&&N(),T(S,P),(0,a.jsx)("div",{className:"p-6 pb-2",children:(0,a.jsx)("p",{className:"text-sm mb-2",children:v("files.files.filesInfo")})}
1),Y()]})})]})};Index.getLayout=function(e){return(0,a.jsx)(S.Z,{isTenant:!0,children:e})};var E=!0,M=Index},42597:function(e,t,s){"use strict";var a=s(75271);let l=a.forwardRef(function({title:e,titleId:t,...s},l){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},s),e?a.createElement("title",{id:t},e):null,a.createElement("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"}))});t.Z=l}},function(e){e.O(0,[3043,4090,9774,2888,179],function(){return e(e.s=9673)}),_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.