1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4030],{42498:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});var n=a(91696);let s=(0,n.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"}]])},63496:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/manage-indicators/accounts",function(){return a(1766)}])},63534:function(e,t,a){"use strict";var n=a(52676),s=a(75271),l=a(1629),o=a(78619),i=a(31985),r=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:g,portalInfo:f,skipSegments:v=[]}=e,y=(0,l.useRouter)(),{t:b,i18n:j}=(0,o.$G)(),N=null==f?void 0:null===(a=f.customization)||void 0===a?void 0:null===(t=a.config)||void 0===t?void 0:t.primary_color,w=N?(0,x.k8)(N):void 0,[C,_]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(y){let e=y.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);_(n.map((e,t)=>({...e,active:t===s})))}},[y]),(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:[!g&&(0,n.jsx)(r(),{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:[(!g||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)(r(),{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?w: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],o="".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");j.exists(t)&&(o=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)(r(),{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?w:void 0},children:b(o)})]},i)})]})}},50924:function(e,t,a){"use strict";var n=a(52676),s=a(75271);let l=(0,s.forwardRef)(function(e,t){let{type:a="submit",className:s,...l}=e;return(0,n.jsx)("button",{ref:t,type:a,className:"\n ".concat(s,"\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"),...l})});t.Z=l},33199:function(e,t,a){"use strict";a.d(t,{Z:function(){return Modal}});var n=a(52676),s=a(75271),l=a(87902),o=a(73043),i=a(42597);function Modal(e){let{title:t,show:a,handleShow:r,children:c,footer:d}=e;return(0,n.jsx)(l.u,{appear:!0,show:a,as:s.Fragment,children:(0,n.jsxs)(o.V,{as:"div",className:"relative z-10",onClose:r,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)(o.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)(o.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:()=>r(!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})]})})})})]})})}},66085:function(e,t,a){"use strict";a.d(t,{Z:function(){return useDatatable}});var n=a(52676),s=a(96208),l=a(91750),o=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:o.ag.t("common.rowsPerPageText"),rangeSeparatorText:o.ag.t("common.rangeSeparatorText"),selectAllRowsItem:!0,selectAllRowsItemText:o.ag.t("common.selectAllRowsItemText")});function useDatatable(e){let{data:t,columns:a,isFetching:i,page:r,handlePageChange:c,handlePerPageChange:d,total:m,perPage:u,noServerPagination:x,...h}=e,{t:p}=(0,o.$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:r,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})}}},1766:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return F},default:function(){return T}});var n=a(52676),s=a(34090),l=a(42474),o=a(63534),i=a(50924),r=a(4021),c=a(48749),d=a(34302),m=a(4393),u=a(77762),x=a(75271);function StatCell(e){let{value:t,total:a,colorClass:s}=e;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("span",{className:"font-semibold text-sm ".concat(s),children:[a?Math.round(t/a*100):0,"%"]}),(0,n.jsxs)("span",{className:"block text-xs text-gray-400",children:[t,"/",a]})]})}function CoordinatorCell(e){let{name:t,onAssign:a}=e,s=t?t.split(" ").slice(0,2).map(e=>{var t,a;return null!==(a=null===(t=e[0])||void 0===t?void 0:t.toUpperCase())&&void 0!==a?a:""}).join(""):null;return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"inline-flex items-center justify-center w-8 h-8 rounded-full bg-ogovOrange text-white text-xs font-semibold shrink-0",children:s}),(0,n.jsx)("span",{className:"text-sm text-gray-700",children:t})]}):(0,n.jsx)("span",{className:"text-sm text-gray-300",children:"â"}),(0,n.jsx)("button",{type:"button",onClick:a,className:"ml-1 p-1 rounded hover:bg-gray-100 text-gray-400 hover:text-gray-600 transition-colors shrink-0",children:(0,n.jsx)(r.Z,{className:"w-4 h-4"})})]})}
1function NoticesCell(e){let{count:t}=e;return t?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-orange-100 text-orange-700",children:[(0,n.jsx)(c.Z,{className:"w-3.5 h-3.5"}),t]}):(0,n.jsx)("span",{className:"text-sm text-gray-300",children:"â"})}function PortalLinkButton(e){let{subdomain:t,path:a,icon:s,label:l}=e,[o,r]=(0,x.useState)(!1),handleClick=async()=>{r(!0);try{let{data:e}=await u.j.impersonate(t,a),n="".concat(window.location.protocol,"//").concat(e.domain,"/impersonate/").concat(e.token.token);window.open(n,"_blank")}finally{r(!1)}};return(0,n.jsx)("div",{className:"p-1",children:(0,n.jsxs)(i.Z,{className:"bg-indigo-100 !text-indigo-700 group !p-2 ml-2 relative overflow-visible",onClick:handleClick,disabled:o||!t,children:[(0,n.jsx)(s,{className:"w-5 h-5 cursor-pointer shrink-0"}),(0,n.jsx)("span",{className:"absolute left-full top-1/2 -translate-y-1/2 ml-1 whitespace-nowrap opacity-0 sm:group-hover:opacity-100 text-xs px-2 py-1 bg-indigo-100 text-indigo-700 rounded pointer-events-none transition-opacity duration-200 z-10",children:o?"...":l})]})})}let AccountsIndicatorsColumns=function(e){let{onAssignResponsible:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[{name:e("common.account"),selector:e=>e.name,cell:e=>(0,n.jsx)("span",{className:"font-medium text-sm text-gray-900",children:e.name}),sortable:!0,minWidth:"180px"},{name:e("common.ogov_responsible"),cell:e=>(0,n.jsx)(CoordinatorCell,{name:e.responsible_user_name,onAssign:()=>null==t?void 0:t(e)}),minWidth:"190px"},{name:e("common.update_status"),cell:e=>(0,n.jsx)(StatCell,{value:e.total-e.outdated,total:e.total,colorClass:"text-green-600"}),minWidth:"120px"},{name:e("common.notices"),cell:e=>(0,n.jsx)(NoticesCell,{count:e.notices}),minWidth:"90px"},{name:e("common.total"),cell:e=>(0,n.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.total}),minWidth:"70px"},{name:e("common.completed"),cell:e=>(0,n.jsx)(StatCell,{value:e.completed,total:e.total,colorClass:"text-green-600"}),minWidth:"100px"},{name:e("common.pending"),cell:e=>(0,n.jsx)(StatCell,{value:e.pending,total:e.total,colorClass:"text-red-500"}),minWidth:"100px"},{name:e("common.mandatory_completed"),cell:e=>(0,n.jsx)(StatCell,{value:e.mandatory_completed,total:e.mandatory_total,colorClass:"text-green-600"}),minWidth:"140px"},{name:e("common.mandatory_pending"),cell:e=>(0,n.jsx)(StatCell,{value:e.mandatory_pending,total:e.mandatory_total,colorClass:"text-red-500"}),minWidth:"140px"},{name:e("common.actions"),sortable:!1,minWidth:"180px",cell:t=>(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(PortalLinkButton,{subdomain:t.subdomain,path:"/dashboard/indicators/evaluations",icon:d.Z,label:e("common.see_evaluations")}),(0,n.jsx)(PortalLinkButton,{subdomain:t.subdomain,path:"/dashboard/indicators/catalog",icon:m.Z,label:e("common.see_catalog")})]})}]};var h=a(33199),p=a(78446),g=a(129);let f={accountsSummary:()=>g.default.get("/api/v1/module-indicators/accounts-summary"),assignResponsible:(e,t)=>g.default.put("/api/v1/module-indicators/accounts/".concat(e,"/responsible"),{user_id:t})};var v=a(81277),y=a(78619);function AssignResponsibleModal(e){let{show:t,account:a,onClose:s,onSuccess:l}=e,{t:o}=(0,y.$G)(),[r,c]=(0,x.useState)([]),[d,m]=(0,x.useState)(""),[u,g]=(0,x.useState)(null),[b,j]=(0,x.useState)(!1);(0,x.useEffect)(()=>{var e;
1t&&(m(""),g(null!==(e=null==a?void 0:a.responsible_user_id)&&void 0!==e?e:null),p.W.list(1,200).then(e=>{var t,a;return c(null!==(a=null===(t=e.data)||void 0===t?void 0:t.data)&&void 0!==a?a:[])}))},[t,a]);let N=(0,x.useMemo)(()=>d?r.filter(e=>{var t;return null===(t=e.username)||void 0===t?void 0:t.toLowerCase().includes(d.toLowerCase())}):r,[r,d]),handleConfirm=async()=>{j(!0);try{await f.assignResponsible(a.portal_id,u),l()}finally{j(!1)}};return(0,n.jsxs)(h.Z,{show:t,handleShow:s,title:o("manage-indicators.accounts.assign_responsible_title"),footer:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.Z,{type:"button",className:"btn-secondary bg-gray-100 !text-gray-700",onClick:s,children:o("common.cancel")}),(0,n.jsx)(i.Z,{type:"button",className:"bg-ogovOrange",disabled:b,onClick:handleConfirm,children:o("common.assign")})]}),children:[(0,n.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:(0,n.jsx)("span",{className:"font-medium text-gray-800",children:null==a?void 0:a.name})}),(0,n.jsxs)("div",{className:"relative mb-3",children:[(0,n.jsx)(v.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,n.jsx)("input",{type:"text",value:d,onChange:e=>m(e.target.value),placeholder:o("common.search"),className:"w-full pl-9 pr-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-ogovOrange"})]}),(0,n.jsxs)("ul",{className:"max-h-60 overflow-y-auto divide-y divide-gray-100 border border-gray-200 rounded-md",children:[(0,n.jsx)("li",{children:(0,n.jsx)("button",{type:"button",onClick:()=>g(null),className:"w-full text-left px-4 py-2.5 text-sm transition-colors ".concat(null===u?"bg-ogovOrange/10 text-ogovOrange font-medium":"hover:bg-gray-50 text-gray-700"),children:o("common.none")})}),N.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)("button",{type:"button",onClick:()=>g(e.id),className:"w-full text-left px-4 py-2.5 text-sm transition-colors ".concat(u===e.id?"bg-ogovOrange/10 text-ogovOrange font-medium":"hover:bg-gray-50 text-gray-700"),children:e.username})},e.id)),0===N.length&&(0,n.jsx)("li",{className:"px-4 py-3 text-sm text-gray-400 text-center",children:o("common.no_results")})]})]})}var b=a(41501),j=a(66085),N=a(90394),w=a(59810),C=a(23940),_=a(19719),k=a(49870);function AccountsIndicatorsFilters(e){let{filters:t,onChange:a}=e,{t:s}=(0,y.$G)(),yesNoOptions=()=>[{id:"all",value:"all",displayName:s("common.all")},{id:"yes",value:"yes",displayName:s("common.yes")},{id:"no",value:"no",displayName:s("common.no")}];return(0,n.jsxs)("div",{className:"flex flex-col md:flex-row px-6 py-2 md:space-x-4 border-b border-gray-200",children:[(0,n.jsxs)("div",{className:"md:flex-1 mb-2",children:[(0,n.jsx)(_.Z,{children:s("common.account")}),(0,n.jsx)(C.Z,{type:"search",name:"name",className:"w-full form-input block",value:t.name,onChange:e=>a("name",e.target.value)})]}),(0,n.jsxs)("div",{className:"md:flex-1 mb-2",children:[(0,n.jsx)(_.Z,{children:s("common.notices")}),(0,n.jsx)(k.P,{options:yesNoOptions(),value:t.hasNotices,displayName:"displayName",valueName:"value",name:"hasNotices",onChange:e=>a("hasNotices",null!=e?e:"all")})]}),(0,n.jsxs)("div",{className:"md:flex-1 mb-2",children:[(0,n.jsx)(_.Z,{children:s("common.mandatory_pending")}),(0,n.jsx)(k.P,{options:yesNoOptions(),value:t.hasMandatoryPending,displayName:"displayName",valueName:"value",name:"hasMandatoryPending",onChange:e=>a("hasMandatoryPending",null!=e?e:"all")})]})]})}let P={name:"",hasNotices:"all",hasMandatoryPending:"all"};function AccountsIndicatorsList(){let{t:e}=(0,y.$G)(),{isOpen:t,alert:a,showAlert:s}=(0,b.ZP)(),{data:l,isFetching:i,error:r,handleFetch:c}=function(){let[e,t]=(0,x.useState)([]),[a,n]=(0,x.useState)(!0),[s,l]=(0,x.useState)(),handleFetch=()=>{n(!0),f.accountsSummary().then(e=>{var a,n;return t(null!==(n=null===(a=e.data)||void 0===a?void 0:a.data)&&void 0!==n?n:[])}).catch(e=>l(e)).finally(()=>n(!1))};return(0,x.useEffect)(()=>{handleFetch()},[]),{data:e,isFetching:a,error:s,handleFetch}}(),[d,m]=(0,x.useState)(!0),[u,h]=(0,x.useState)(P),[p,g]=(0,x.useState)(null),[v,C]=(0,x.useState)(!1);(0,x.useEffect)(()=>{r&&(0,N.xg)(r,null,s)},[r]);let _=(0,x.useMemo)(()=>Array.isArray(l)?l.filter(e=>{var t;return!!(!u.name||(null===(t=e.name)||void 0===t?void 0:t.toLowerCase().includes(u.name.toLowerCase())))&&("yes"!==u.hasNotices||!!e.notices)&&("no"!==u.hasNotices||!(e.notices>0))&&("yes"!==u.hasMandatoryPending||!!e.mandatory_pending)&&("no"!==u.hasMandatoryPending||!(e.mandatory_pending>0))}):[],[l,u]),k=AccountsIndicatorsColumns(e,{onAssignResponsible:e=>{g(e),C(!0)}}),{renderDatatable:Z}=(0,j.Z)({data:_,isFetching:i,columns:k,noServerPagination:!0,handlePageChange:()=>{},handlePerPageChange:()=>{}});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex border-b border-gray-200 sm:items-center",children:[(0,n.jsxs)("div",{className:"p-6 grow",children:[(0,n.jsx)("div",{className:"text-xl font-bold text-black sm:text-2xl",children:e("manage-indicators.accounts.pageTitle")}),(0,n.jsx)("div",{children:(0,n.jsx)(o.Z,{})})]}),(0,n.jsx)("div",{className:"p-2",children:(0,n.jsx)("div",{onClick:()=>m(!d),className:"p-1.5 border border-black rounded flex justify-center cursor-pointer",children:(0,n.jsx)(w.Z,{className:"w-8 h-8"})})})]}),d&&(0,n.jsx)(AccountsIndicatorsFilters,{filters:u,onChange:(e,t)=>
1{h(a=>({...a,[e]:t}))}}),t&&a(),Z(),(0,n.jsx)(AssignResponsibleModal,{show:v,account:p,onClose:()=>C(!1),onSuccess:()=>{C(!1),g(null),c()}})]})}var Z=a(57394),S=a.n(Z),A=a(1629);let AccountsIndicators=()=>{let{t:e}=(0,y.$G)(),t=(0,A.useRouter)(),{user:a,handlePermission:s}=(0,l.a)({middleware:["auth","verified"]});return(0,x.useEffect)(()=>{a&&!s(["indicator.list"])&&t.push("/dashboard")},[a]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S(),{children:(0,n.jsx)("title",{children:e("manage-indicators.accounts.pageTitle")})}),(0,n.jsx)("div",{className:"mx-auto max-w-screen-2xl",children:(0,n.jsx)("div",{className:"overflow-hidden bg-white rounded-lg shadow-sm",children:(0,n.jsx)(AccountsIndicatorsList,{})})})]})};AccountsIndicators.getLayout=function(e){return(0,n.jsx)(s.Z,{children:e})};var F=!0,T=AccountsIndicators},77762:function(e,t,a){"use strict";a.d(t,{j:function(){return s}});var n=a(129);let impersonate=async(e,t)=>{let a=t?{redirect_path:t}:{};return await n.default.post("/api/v1/impersonate/generate/".concat(e),{},{params:a})},s={impersonate}},42597:function(e,t,a){"use strict";var n=a(75271);let s=n.forwardRef(function({title:e,titleId:t,...a},s){return n.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:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.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=s}},function(e){e.O(0,[3043,4090,9774,2888,179],function(){return e(e.s=63496)}),_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.