(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[841],{69499:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/projectslist",function(){return r(70073)}])},36672:function(e,t,r){"use strict";var o=r(35944),i=r(67294),a=r(95804),n=r(36433),l=r(81458);t.Z=e=>{let[t,r]=i.useState(15);return(0,o.tZ)("div",{children:(0,o.tZ)(a._,{loading:e.loading,columns:e.columns,rows:e.rows,getRowId:e=>e.id,getRowHeight:()=>"auto",getRowWidth:()=>"auto",rowsPerPageOptions:[15,25,35],pageSize:t,onPageSizeChange:e=>r(e),density:"compact",components:{Toolbar:n.T,LoadingOverlay:l.Z},sx:{minHeight:"1000px","& .MuiDataGrid-columnHeaders":{backgroundColor:"#FF5C5C",fontWeight:"bold",color:"#fff ",fontSize:18},'& div[data-rowIndex][role="row"]:nth-of-type(2n-1)':{backgroundColor:"#F0FFFF",fontWeight:"bold",fontSize:16,borderColor:"#547980"},"@media print":{".MuiDataGrid-main":{color:"rgba(0, 0, 0, 0.87)"}},"& .MuiLinearProgress-colorPrimary":{backgroundColor:"#F8B195",marginTop:"3px",height:"10px"},"& .MuiLinearProgress-barColorPrimary":{backgroundColor:"#dc8665"},"&::-webkit-scrollbar":{width:10},"&::-webkit-scrollbar-track":{backgroundColor:"lightblue"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#C06C84",borderRadius:2},maxHeight:500}})})}},37251:function(e,t,r){"use strict";var o=r(35944),i=r(22424);r(37676),t.Z=e=>{let{htmlContent:t}=e,r=i.Z.sanitize(t);return(0,o.BX)("div",{className:"ql-snow",children:[" ",(0,o.tZ)("div",{className:"ql-editor",dangerouslySetInnerHTML:{__html:r}})]})}},1342:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{noSSR:function(){return noSSR},default:function(){return dynamic}});let o=r(10260),i=(r(67294),o._(r(24304)));function convertModule(e){return{default:(null==e?void 0:e.default)||e}}function noSSR(e,t){return delete t.webpack,delete t.modules,e(t)}function dynamic(e,t){let r=i.default,o={loading:e=>{let{error:t,isLoading:r,pastDelay:o}=e;return null}};e instanceof Promise?o.loader=()=>e:"function"==typeof e?o.loader=e:"object"==typeof e&&(o={...o,...e}),o={...o,...t};let a=o.loader;return(o.loadableGenerated&&(o={...o,...o.loadableGenerated},delete o.loadableGenerated),"boolean"!=typeof o.ssr||o.ssr)?r({...o,loader:()=>null!=a?a().then(convertModule):Promise.resolve(convertModule(()=>null))}):(delete o.webpack,delete o.modules,noSSR(r,o))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},30043:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"LoadableContext",{enumerable:!0,get:function(){return a}});let o=r(10260),i=o._(r(67294)),a=i.default.createContext(null)},24304:function(e,t,r){"use strict";/**
@copyright (c) 2017-present James Kyle <me@thejameskyle.com>
 MIT License
 Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
 The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
*/Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return d}});let o=r(10260),i=o._(r(67294)),a=r(30043);function resolve(e){return e&&e.default?e.default:e}let n=[],l=[],s=!1;function load(e){let t=e(),r={loading:!0,loaded:null,error:null};return r.promise=t.then(e=>(r.loading=!1,r.loaded=e,e)).catch(e=>{throw r.loading=!1,r.error=e,e}),r}function createLoadableComponent(e,t){let r=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},t),o=null;function init(){if(!o){let t=new LoadableSubscription(e,r);o={getCurrentValue:t.getCurrentValue.bind(t),subscribe:t.subscribe.bind(t),retry:t.retry.bind(t),promise:t.promise.bind(t)}}return o.promise()}if(!s){let e=r.webpack?r.webpack():r.modules;e&&l.push(t=>{for(let r of e)if(t.includes(r))return init()})}function useLoadableModule(){init();let e=i.default.useContext(a.LoadableContext);e&&Array.isArray(r.modules)&&r.modules.forEach(t=>{e(t)})}function LoadableComponent(e,t){useLoadableModule();let a=i.default.useSyncExternalStore(o.subscribe,o.getCurrentValue,o.getCurrentValue);return i.default.useImperativeHandle(t,()=>({retry:o.retry}),[]),i.default.useMemo(()=>a.loading||a.error?i.default.createElement(r.loading,{isLoading:a.loading,pastDelay:a.pastDelay,timedOut:a.timedOut,error:a.error,retry:o.retry}):a.loaded?i.default.createElement(resolve(a.loaded),e):null,[e,a])}return LoadableComponent.preload=()=>init(),LoadableComponent.displayName="LoadableComponent",i.default.forwardRef(LoadableComponent)}let LoadableSubscription=class LoadableSubscription{promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}};function Loadable(e){return createLoadableComponent(load,e)}function flushInitializers(e,t){let r=[];for(;e.length;){let o=e.pop();r.push(o(t))}return Promise.all(r).then(()=>{if(e.length)return flushInitializers(e,t)})}Loadable.preloadAll=()=>new Promise((e,t)=>{flushInitializers(n).then(e,t)}),Loadable.preloadReady=e=>(void 0===e&&(e=[]),new Promise(t=>{let res=()=>(s=!0,t());flushInitializers(l,e).then(res,res)})),window.__NEXT_PRELOADREADY=Loadable.preloadReady;let d=Loadable},70073:function(e,t,r){"use strict";r.r(t);var o=r(35944),i=r(67294),a=r(9008),n=r.n(a),l=r(36612),s=r.n(l),d=r(66242),u=r(44267),c=r(15861),p=r(67720),m=r(45258),f=r(28358),g=r(67814),h=r(59417),y=r(3702),b=r(5077),P=r(26447),j=r(83321),C=r(86886),T=r(36672),_=r(45398),w=r(85194),Z=r(11163),x=r(41664),v=r.n(x),S=r(37251);r(37676);var N=r(5152);r.n(N)()(()=>Promise.all([r.e(937),r.e(876),r.e(167)]).then(r.t.bind(r,71167,23)),{loadableGenerated:{webpack:()=>[71167]},loading:()=>(0,o.tZ)("p",{children:"Loading editor..."}),ssr:!1});let Projectslist=()=>{let e,t;let r=(0,Z.useRouter)(),[a,l]=i.useState(!1),[b,x]=i.useState(""),{data:N,isLoading:L,isSuccess:k,isError:I}=(0,_.M_)();(0,i.useEffect)(()=>{!0===L&&(l(!0),x("Please wait. Loading the projects...")),!0===k&&(l(!1),x()),!0===I&&(l(!1),x())},[L,k,I]);let q=i.useMemo(()=>[{field:"projectName",headerName:"Project name",width:"200",renderCell:e=>{var t,r,i;return(0,o.tZ)(v(),{href:"/projectsingle?id="+e.id,children:(0,o.BX)(P.Z,{direction:"column",children:[(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"5px",fontWeight:"bold"},children:e.row.projectName}),(null===(r=e.row.financialYear)||void 0===r?void 0:null===(t=r.name)||void 0===t?void 0:t.length)>0&&(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{textAlign:"center",margin:"1px",backgroundColor:"#607164",color:"#fff"},children:null===(i=e.row.financialYear)||void 0===i?void 0:i.name})]})})}},{field:"projectDescription",headerName:"Project description",width:"400",renderCell:e=>(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"2px"},children:(0,o.tZ)(S.Z,{htmlContent:e.row.projectDescription})})},{field:"sector",headerName:"Department",width:"250",renderCell:e=>{var t;return(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"5px"},children:null===(t=e.row.mainStructureOffice)||void 0===t?void 0:t.name})}},{field:"Status",headerName:"Status",width:"150",renderCell:e=>(0,o.BX)(o.HY,{children:["Completed"===e.row.status&&(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"2px",backgroundColor:"#66b2b2",color:"#fff",paddingTop:"3px",paddingBottom:"3px",paddingLeft:"5px",paddingRight:"5px"},children:e.row.status}),"Ongoing"===e.row.status&&(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"2px",backgroundColor:"orange",color:"#fff",paddingTop:"3px",paddingBottom:"3px",paddingLeft:"5px",paddingRight:"5px"},children:e.row.status}),"Not Started"===e.row.status&&(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"2px",backgroundColor:"grey",color:"#fff",paddingTop:"3px",paddingBottom:"3px",paddingLeft:"5px",paddingRight:"5px"},children:e.row.status}),"Under Procurement"===e.row.status&&(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"2px",backgroundColor:"#FF5C5C",color:"#fff",paddingTop:"3px",paddingBottom:"3px",paddingLeft:"5px",paddingRight:"5px"},children:e.row.status}),"Stalled"===e.row.status&&(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"2px",backgroundColor:"#FF5C5C",color:"#fff",paddingTop:"3px",paddingBottom:"3px",paddingLeft:"5px",paddingRight:"5px"},children:e.row.status})]})},{field:"budgetAllocation",headerName:"Budget",align:"right",headerAlign:"right",width:"200",renderCell:e=>(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"3px"},children:new Intl.NumberFormat("ke",{style:"currency",currency:"Ksh"}).format(e.row.budgetAllocation)})},{field:"ward",headerName:"Ward",width:"150",renderCell:e=>{var t,r;return(0,o.BX)(P.Z,{direction:"column",children:[(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"5px",fontWeight:"bold"},children:null===(t=e.row.subCounty)||void 0===t?void 0:t.name}),(0,o.tZ)(c.Z,{className:s().textNormalTableContent,style:{margin:"5px"},children:null===(r=e.row.ward)||void 0===r?void 0:r.name})]})}},{field:"actions",headerName:"",width:"100",type:"actions",renderCell:e=>(0,o.tZ)(v(),{href:"/projectsingle?id="+e.id,children:(0,o.BX)(j.Z,{variant:"outlined",size:"medium",style:{padding:"3px"},sx:{color:"teal",fontWeight:"bold"},className:"faa-parent animated-hover",children:["View",(0,o.tZ)(g.G,{icon:h.eFW,size:"md",style:{marginLeft:"5px",marginRight:"5px",color:"red"},className:"faa-passing"})]})})}],[]);return(0,o.BX)("div",{className:s().container,style:{backgroundColor:"#D8DEDA"},children:[(0,o.BX)(n(),{children:[(0,o.tZ)("title",{children:"IPMS Home"}),(0,o.tZ)("meta",{name:"IPMS",content:"Performance Management System"}),(0,o.tZ)("link",{rel:"icon",href:"/favicon.ico"})]}),(0,o.tZ)(m.Z,{position:"static",className:s().mainPageBar,children:(0,o.tZ)(f.Z,{className:s().mainPageTitles,children:(0,o.tZ)(y.Z,{})})}),(0,o.BX)("main",{className:s().main,children:[(0,o.tZ)(w.Z,{openLoader:a,actionTitle:b}),(0,o.tZ)("div",{className:s().main,style:{height:"100%"},children:(0,o.tZ)("div",{className:s().containerFluid,children:(0,o.tZ)(C.ZP,{container:!0,spacing:2,children:(0,o.tZ)(C.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,children:(0,o.tZ)(d.Z,{style:{marginTop:"10px",backgroundColor:"#fff"},children:(0,o.BX)(u.Z,{children:[0===r.query.id&&(0,o.BX)(c.Z,{variant:"h5",component:"div",children:[r.query.fy," Years : ",r.query.statusType," Projects"]}),r.query.id>0&&(0,o.BX)(c.Z,{variant:"h5",component:"div",children:[r.query.fy," : ",r.query.statusType," Projects"]}),(0,o.tZ)(p.Z,{style:{height:"5px",backgroundColor:"#EFBF04"}}),(0,o.tZ)(T.Z,{columns:q,loading:L,rows:(e=[],"All"===r.query.statusType?e=N:void 0!==N&&(e=N.filter(function(e){return e.status===r.query.statusType})),t=[],"0"===r.query.id?t=e:void 0!==e&&(t=e.filter(function(e){return parseInt(e.financialYear.id)===parseInt(r.query.id)})),void 0===t)?[]:t,error:I})]})})})})})})]})]})};Projectslist.layout=b.Z,t.default=Projectslist},45398:function(e,t,r){"use strict";r.d(t,{M_:function(){return d},NL:function(){return f},id:function(){return s},le:function(){return m},sD:function(){return g},zf:function(){return p}});var o=r(9266);let i="/api/t_projects",a=o.g.enhanceEndpoints({addTagTypes:["Projects"]}),n=a.injectEndpoints({endpoints:e=>({getProjects:e.query({query:()=>i,providesTags:e=>e?[...e.map(e=>{let{id:t}=e;return{type:"Projects",id:t}}),{type:"Projects",id:"LIST"}]:[{type:"Projects",id:"LIST"}]}),getProjectsDashboardFiltered:e.query({query:()=>i+"?&properties[]=id&properties[]=budgetAllocation&properties[]=status",providesTags:e=>e?[...e.map(e=>{let{id:t}=e;return{type:"Projects",id:t}}),{type:"Projects",id:"LIST"}]:[{type:"Projects",id:"LIST"}]}),getProjectsDashboardFilteredAllStatus:e.query({query:()=>i+"?&properties[]=id&properties[]=financialYear&properties[]=projectName&properties[]=projectDescription&properties[]=mainStructureOffice&properties[]=budgetAllocation&properties[]=status&properties[]=subCounty&properties[]=ward&properties[]=municipality&properties[]=tProjectsImages",providesTags:e=>e?[...e.map(e=>{let{id:t}=e;return{type:"Projects",id:t}}),{type:"Projects",id:"LIST"}]:[{type:"Projects",id:"LIST"}]}),getProjectsDashboardFilteredByStatus:e.query({query:e=>i+"?Status="+e+"&properties[]=id&properties[]=projectName&properties[]=projectDescription&properties[]=mainStructureOffice&properties[]=budgetAllocation&properties[]=status&properties[]=municipality&properties[]=tProjectsImages",providesTags:e=>e?[...e.map(e=>{let{id:t}=e;return{type:"Projects",id:t}}),{type:"Projects",id:"LIST"}]:[{type:"Projects",id:"LIST"}]}),getProjectsSectorsFilteredBySector:e.query({query:e=>i+"?mainStructureOffice="+e+"&properties[]=id&properties[]=financialYear&properties[]=projectName&properties[]=projectDescription&properties[]=mainStructureOffice&properties[]=budgetAllocation&properties[]=status&properties[]=subCounty&properties[]=ward&properties[]=tProjectsImages",providesTags:e=>e?[...e.map(e=>{let{id:t}=e;return{type:"Projects",id:t}}),{type:"Projects",id:"LIST"}]:[{type:"Projects",id:"LIST"}]}),getProjectsSectorsFilteredBySubCounty:e.query({query:e=>i+"?subCounty="+e+"&properties[]=id&properties[]=financialYear&properties[]=projectName&properties[]=projectDescription&properties[]=mainStructureOffice&properties[]=budgetAllocation&&properties[]=status&properties[]=subCounty&properties[]=ward&properties[]=tProjectsImages",providesTags:e=>e?[...e.map(e=>{let{id:t}=e;return{type:"Projects",id:t}}),{type:"Projects",id:"LIST"}]:[{type:"Projects",id:"LIST"}]}),getProjectsSectorsFilteredByWard:e.query({query:e=>i+"?ward="+e+"&properties[]=id&properties[]=financialYear&properties[]=projectName&properties[]=projectDescription&properties[]=mainStructureOffice&properties[]=budgetAllocation&properties[]=status&properties[]=subCounty&properties[]=ward&properties[]=tProjectsImages",providesTags:e=>e?[...e.map(e=>{let{id:t}=e;return{type:"Projects",id:t}}),{type:"Projects",id:"LIST"}]:[{type:"Projects",id:"LIST"}]}),getSingleProject:e.query({query:e=>i+"/".concat(e),providesTags:(e,t,r)=>[{type:"Projects",id:r}]}),addNewProject:e.mutation({query:e=>({url:i,method:"POST",body:e,headers:{"Content-type":"application/json; charset=UTF-8"}}),invalidatesTags:[{type:"Projects",id:"LIST"}]}),patchProject:e.mutation({query:e=>({url:i+"/".concat(e.id),method:"PATCH",body:e}),invalidatesTags:(e,t,r)=>[{type:"Projects",id:r.id}]}),deleteProject:e.mutation({query:e=>({url:i+"/".concat(e),method:"DELETE"}),invalidatesTags:(e,t,r)=>[{type:"Projects",id:r}]})}),overrideExisting:!1}),{useGetProjectsQuery:l,useGetProjectsDashboardFilteredQuery:s,useGetProjectsDashboardFilteredAllStatusQuery:d,useGetProjectsDashboardFilteredByStatusQuery:u,useGetProjectsSectorsFilteredByStatusQuery:c,useGetProjectsSectorsFilteredBySectorQuery:p,useGetProjectsSectorsFilteredBySubCountyQuery:m,useGetProjectsSectorsFilteredByWardQuery:f,useGetSingleProjectQuery:g}=n},5152:function(e,t,r){e.exports=r(1342)}},function(e){e.O(0,[976,938,362,957,674,565,903,451,177,314,603,774,888,179],function(){return e(e.s=69499)}),_N_E=e.O()}]);