Current Path : /home/ncdcgo/admin.ncdc.go.ug/static/js/ |
Current File : /home/ncdcgo/admin.ncdc.go.ug/static/js/333.e72cb7fc.chunk.js |
"use strict";(self.webpackChunkpanel=self.webpackChunkpanel||[]).push([[333],{223:function(e,t,i){i(2791);var n=i(3504),r=i(2506),s=i(184);t.Z=function(e){var t=e.routes;return(0,s.jsx)("nav",{className:"flex bg-white border border-gray-200 p-2 rounded-full px-4 mt-4","aria-label":"Breadcrumb",children:(0,s.jsxs)("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[(0,s.jsx)("li",{className:"inline-flex items-center text-gray-800",children:(0,s.jsxs)(n.rU,{to:"/app",className:"inline-flex items-center text-sm text-gray-800 hover:text-gray-900 dark:text-gray-800 dark:hover:text-gray-200",children:[(0,s.jsx)("svg",{className:"w-4 h-4 mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"})}),"Home"]})}),null===t||void 0===t?void 0:t.map((function(e,t){return(0,s.jsxs)("li",{className:"inline-flex items-center",children:[(0,s.jsx)(r.Z,{size:10,className:"mr-4"}),(0,s.jsx)(n.rU,{to:e.path,className:"inline-flex items-center text-sm font-extrabold text-gray-700 hover:text-gray-900 dark:text-gray-800 dark:hover:text-gray-200",children:e.name})]},t)}))]})})}},9333:function(e,t,i){i.r(t),i.d(t,{SettingsRoutes:function(){return U}});var n=i(6871),r=i(2412),s=i(223),a=(i(2791),i(3504)),l=i(184),c=function(){return(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{children:[[{id:1,title:"Logo",route:"logo"},{id:2,title:"Quick Link",route:"quick-links"},{id:3,title:"Socials",route:"social-links"}].map((function(e){return(0,l.jsxs)("div",{className:"bg-white px-5 py-3 mt-2 text-md flex justify-between rounded-md",children:[(0,l.jsx)("div",{className:"text-black",children:e.title}),(0,l.jsx)(a.rU,{to:"./".concat(e.route),children:(0,l.jsx)("div",{className:"text-gray-500 cursor-pointer hover:text-green-400",children:"edit"})})]},e.id)})),[{id:1,title:"Physical Adrress",content:"Plot M838, Kyambogo."},{id:2,title:"Opening Hours",content:"",days:"Mon - Fri, 8am - 5pm"},{id:3,title:"Phone Number",content:"+256393112088"},{id:4,title:"Email Address",content:"+info@ncdc.go.ug"}].map((function(e,t){return(0,l.jsx)("div",{className:"accordion bg-white text-md mt-2 rounded-md",id:"accordionExample",children:(0,l.jsxs)("div",{className:"accordion-item bg-white border border-gray-200",children:[(0,l.jsx)("h2",{className:"accordion-header mb-0",id:"headingOne",children:(0,l.jsxs)("button",{className:" relative flex justify-between items-center w-full py-4 px-5 text-base text-black text-left bg-white border-0 rounded-none transition focus:outline-none ",type:"button","data-bs-toggle":"collapse","data-bs-target":"#collapseOne".concat(e.id),"aria-expanded":"true","aria-controls":"collapseOne",children:[(0,l.jsx)("h1",{className:"text-black ",children:e.title}),(0,l.jsx)("svg",{"data-accordion-icon":!0,className:"w-6 h-6 rotate-270 shrink-0 hover:text-green-400",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,l.jsx)("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})})]})}),(0,l.jsx)("div",{id:"collapseOne".concat(e.id),className:"accordion-collapse collapse show","aria-labelledby":"headingOne","data-bs-parent":"#accordionExample",children:(0,l.jsx)("div",{className:"accordion-body py-4 px-5 bg-gray-200",children:(0,l.jsxs)("div",{className:"flex justify-between mx-8",children:[(0,l.jsxs)("div",{className:"text-black",children:[e.content,e.days]}),(0,l.jsx)("div",{className:"text-gray-500 cursor-pointer hover:text-green-400",children:"edit"})]})})})]})},t)}))]})})},o=function(){return(0,l.jsxs)(r.D,{title:"Settings",children:[(0,l.jsx)(s.Z,{routes:[{name:"Settings",path:"."}]}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(c,{})})]})},d=i(5528),u=i(9630),x=i(1413),m=i(6771),h=i(1933),p=function(){return m.o.get("/quick-links")},f=i(4165),k=i(5861),g=i(4430),j=i(3777),v=i(7889),y=i(2007),b=i.n(y),w=function(e){var t=e.quicklinkId;return m.o.delete("/quick-links/".concat(t))};w.propTypes={quicklinkId:b().string.isRequired};var N=function(e){var t=e.id,i=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config,t=(0,v.G)().addNotification;return(0,h.useMutation)((0,x.Z)((0,x.Z)({onMutate:function(){var e=(0,k.Z)((0,f.Z)().mark((function e(t){var i;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j.E.cancelQueries("quicklinks");case 2:return i=j.E.getQueryData("quicklinks"),j.E.setQueryData("quicklinks",null===i||void 0===i?void 0:i.filter((function(e){return e.id!==t.quicklinkId}))),e.abrupt("return",{previousQuickLinks:i});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),onError:function(e,t,i){null!==i&&void 0!==i&&i.previousQuickLinks&&j.E.setQueryData("quicklinks",i.previousQuickLinks)},onSuccess:function(){j.E.invalidateQueries("quicklinks"),t({type:"success",title:"Quick Link Deleted"})}},e),{},{mutationFn:w}))}();return i.isLoading?(0,l.jsx)("div",{id:"loading-screen",className:"w-full h-full fixed block top-0 left-0 bg-black opacity-75 z-50",children:(0,l.jsx)("span",{className:"opacity-75 top-1/2 my-0 mx-auto block relative w-0 h-0",children:(0,l.jsx)(u.$j,{size:"sm"})})}):(0,l.jsx)(g._n,{allowedRoles:[g.K$.ADMIN],children:(0,l.jsx)(u.U6,{icon:"danger",title:"Delete Quick Link",body:"Are you sure you want to delete this Quick Link?",triggerButton:(0,l.jsx)("button",{children:"Remove"}),confirmButton:(0,l.jsx)(u.zx,{isLoading:i.isLoading,type:"button",className:"bg-red-600",onClick:(0,k.Z)((0,f.Z)().mark((function e(){return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.mutateAsync({faqId:t});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),children:"Delete Quick Link"})})})},q=i(806),L=i(8419),Z=i(9879),Q=function(e){var t=e.quicklinkId,i=e.config;return(0,h.useQuery)((0,x.Z)((0,x.Z)({},i),{},{queryKey:["quicklink",t],queryFn:function(){return function(e){var t=e.quicklinkId;return m.o.get("/quick-links/".concat(t))}({quicklinkId:t})}}))},I=function(e){var t=e.data,i=e.quicklinkId;return m.o.patch("/quick-links/".concat(i),t)};I.propTypes={data:b().shape({title:b().string.isRequired,url:b().string.isRequired}).isRequired,quicklinkId:b().string.isRequired};var E=Z.Ry({title:Z.Z_().min(1,"Required"),url:Z.Z_().min(1,"Required")}),D=function(e){var t,i,n=e.quicklinkId,r=Q({quicklinkId:n}),s=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config,t=(0,v.G)().addNotification;return(0,h.useMutation)((0,x.Z)((0,x.Z)({onMutate:function(){var e=(0,k.Z)((0,f.Z)().mark((function e(t){var i;return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j.E.cancelQueries(["quicklink",null===t||void 0===t?void 0:t.quicklinkId]);case 2:return i=j.E.getQueryData[null===t||void 0===t?void 0:t.quicklinkId],j.E.setQueryData(["quicklink",null===t||void 0===t?void 0:t.quicklinkId],(0,x.Z)((0,x.Z)((0,x.Z)({},i),t.data),{},{id:t.quicklinkId})),e.abrupt("return",{previousQuickLink:i});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),onError:function(e,t,i){null!==i&&void 0!==i&&i.previousQuickLink&&j.E.setQueryData(["quicklink",i.previousQuickLink.id],i.previousQuickLink)},onSuccess:function(e){j.E.refetchQueries(["quicklink",e.id]),t({type:"success",title:"Quick Link Updated"})}},e),{},{mutationFn:I}))}();return s.isLoading?(0,l.jsx)("div",{id:"loading-screen",className:"w-full h-full fixed block top-0 left-0 bg-black opacity-75 z-50",children:(0,l.jsx)("span",{className:"opacity-75 top-1/2 my-0 mx-auto block relative w-0 h-0",children:(0,l.jsx)(u.$j,{size:"sm"})})}):(console.log(r),(0,l.jsx)(g._n,{allowedRoles:[g.K$.ADMIN],children:(0,l.jsx)(q._8,{sie:"sm",isDone:s.isSuccess,triggerButton:(0,l.jsx)(u.zx,{variant:"create",startIcon:(0,l.jsx)(L.Z,{className:"h-4 w-4"}),size:"sm",children:"Update Quick Link"}),title:"Update Quick Link",submitButton:(0,l.jsx)(u.zx,{form:"update-quickLink",type:"submit",size:"sm",isLoading:s.isLoading,children:"Submit"}),children:(0,l.jsx)(q.l0,{id:"update-quickLink",onSubmit:function(){var e=(0,k.Z)((0,f.Z)().mark((function e(t){return(0,f.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.mutateAsync({data:t,quicklinkId:n});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),options:{defaultValues:{title:null===(t=r.data)||void 0===t?void 0:t.title,url:null===(i=r.data)||void 0===i?void 0:i.url}},schema:E,children:function(e){var t=e.register,i=e.formState;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(q.UP,{label:"Name",error:i.errors.title,registration:t("title")}),(0,l.jsx)(q.UP,{label:"Url",error:i.errors.url,registration:t("url")})]})}})})}))},O=function(){(0,n.UO)().quickLinkId;var e=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config;return(0,h.useQuery)((0,x.Z)((0,x.Z)({},e),{},{queryKey:["quickLinks"],queryFn:function(){return p()}}))}();return e.isLoading?(0,l.jsx)("div",{className:"w-full h-48 flex justify-center items-center",children:(0,l.jsx)(u.$j,{size:"lg"})}):e.data?(0,l.jsx)(u.iA,{data:e.data,columns:[{title:"Name",field:"title"},{title:"",field:"id",Cell:function(e){var t=e.entry.id;return(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:"flex flex-row justify-center items-center gap-5",children:[(0,l.jsx)(u.rU,{to:"./".concat(t),className:"mr-2 text-black dark:text-gray-200 hover:text-green-400",children:"Edit"}),(0,l.jsx)(N,{id:t})]})})}}]}):null},z=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.F,{title:"Quick Links"}),(0,l.jsxs)(r.D,{title:"Quick Links",button:"Edit",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 font-bold",children:"Time"}),(0,l.jsx)(s.Z,{routes:[{name:"Settings",path:"/app/settings"},{name:"Quick Links",path:""}]}),(0,l.jsx)(O,{})]})]})},F=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.F,{title:"Social Links"}),(0,l.jsxs)(r.D,{title:"Social Links",button:"Edit",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 font-bold",children:"Time"}),(0,l.jsx)(s.Z,{routes:[{name:"Settings",path:"/app/settings"},{name:"Social Links",path:""}]}),(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:"flex flex-col mt-2",children:(0,l.jsx)("div",{className:"overflow-x-auto sm:-mx-6 lg:-mx-8",children:(0,l.jsx)("div",{className:"py-2 inline-block min-w-full sm:px-6 lg:px-8",children:(0,l.jsx)("div",{className:"overflow-hidden",children:(0,l.jsxs)("table",{className:"min-w-full",children:[(0,l.jsx)("thead",{className:"bg-white border-b",children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{scope:"col",className:"text-sm font-medium text-gray-900 px-6 py-4 text-left",children:"Name"}),(0,l.jsx)("th",{scope:"col",className:"text-sm font-medium text-gray-900 px-6 py-4 text-left",children:"Url Link"})]})}),[{id:1,title:"Facebook",url:"facebook.com/NCDC"},{id:2,title:"Twitter",url:"twitter.com/NCDC"},{id:3,title:"Linked in",url:"linkedin.com/NCDC"},{id:4,title:"Youtube",url:"youtube.com/NCDC"}].map((function(e,t){return(0,l.jsx)("tbody",{children:(0,l.jsxs)("tr",{className:"bg-gray-100 border-b",children:[(0,l.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:e.title}),(0,l.jsx)("td",{className:"text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap",children:e.url})]})},t)}))]})})})})})})]})]})},S=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.F,{title:"Logo"}),(0,l.jsxs)(r.D,{title:"Logo",button:"Publish",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 font-bold",children:"Time"}),(0,l.jsx)(s.Z,{routes:[{name:"Settings",path:"/app/settings"},{name:"Logo",path:""}]}),(0,l.jsx)("div",{className:"bg-white h-fit rounded-md mt-4",children:(0,l.jsxs)("div",{className:"md:grid md:grid-cols-3 md:gap-4 p-4",children:[(0,l.jsx)("div",{children:(0,l.jsx)("img",{src:"",alt:"Logo",className:"bg-green-100 h-64"})}),(0,l.jsxs)("div",{className:"col-span-2 flex flex-col justify-between mt-2 md:mt-0",children:[(0,l.jsxs)("div",{className:"flex md:flex-col items-start justify-between gap-2",children:[(0,l.jsx)(a.rU,{to:"./edit",children:(0,l.jsx)("button",{className:"bg-green-400 px-4 py-2 rounded-md",children:"Edit"})}),(0,l.jsx)("button",{className:"bg-green-400 px-4 py-2 rounded-md",children:"Update"})]}),(0,l.jsxs)("div",{className:"mt-10 md:mt-0",children:[(0,l.jsx)("h1",{className:"font-bold text-black text-lg",children:"Note:"}),(0,l.jsxs)("p",{className:"mt-2",children:["Please adhere to the dimensions catered for in the source code."," "]}),(0,l.jsx)("p",{className:"mt-2",children:"Dimensions are 80px by 120px "})]})]})]})})]})]})},C=function(){var e=(0,n.UO)().quicklinkId,t=Q({quicklinkId:e});if(t.isLoading)return(0,l.jsx)("div",{className:"w-full h-48 flex justify-center items-center",children:(0,l.jsx)(u.$j,{size:"lg"})});if(!t.data)return null;var i=[{name:"Quick Links",path:"/app/quick-links"},{name:t.data.title,path:"."}];return console.log(t),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.F,{title:t.data.title}),(0,l.jsxs)(r.D,{title:t.data.title,button:(0,l.jsx)(D,{quicklinkId:e}),children:[(0,l.jsx)(s.Z,{routes:i}),(0,l.jsx)("div",{className:"mt-6 flex flex-col space-y-16",children:(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:"bg-white dark:bg-gray-700 shadow overflow-hidden sm:rounded-lg",children:(0,l.jsx)("div",{className:"px-4 py-5 sm:px-6",children:(0,l.jsx)("div",{className:"mt-1 max-w-2xl text-sm text-gray-400 flex flex-wrap",children:(0,l.jsx)(u.Xz,{value:t.data.url})})})})})})]})]})},U=function(){return(0,l.jsxs)(n.Z5,{children:[(0,l.jsx)(n.AW,{path:"",element:(0,l.jsx)(o,{})}),(0,l.jsx)(n.AW,{path:":quicklinkId",element:(0,l.jsx)(C,{})}),(0,l.jsx)(n.AW,{path:"/quick-links",element:(0,l.jsx)(z,{})}),(0,l.jsx)(n.AW,{path:"/social-links",element:(0,l.jsx)(F,{})}),(0,l.jsx)(n.AW,{path:"/logo",element:(0,l.jsx)(S,{})}),(0,l.jsx)(n.AW,{path:"*",element:(0,l.jsx)(n.Fg,{to:"."})})]})}},2506:function(e,t,i){var n=i(2791),r=i(2007),s=i.n(r);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},a.apply(this,arguments)}function l(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}var c=(0,n.forwardRef)((function(e,t){var i=e.color,r=void 0===i?"currentColor":i,s=e.size,c=void 0===s?24:s,o=l(e,["color","size"]);return n.createElement("svg",a({ref:t,xmlns:"http://www.w3.org/2000/svg",width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),n.createElement("polyline",{points:"9 18 15 12 9 6"}))}));c.propTypes={color:s().string,size:s().oneOfType([s().string,s().number])},c.displayName="ChevronRight",t.Z=c},8419:function(e,t,i){var n=i(2791);var r=n.forwardRef((function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{d:"M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"}))}));t.Z=r}}]); //# sourceMappingURL=333.e72cb7fc.chunk.js.map