Your IP : 13.58.180.210


Current Path : /home/ncdcgo/admin.ncdc.go.ug/static/js/
Upload File :
Current File : /home/ncdcgo/admin.ncdc.go.ug/static/js/865.48a0fdff.chunk.js

"use strict";(self.webpackChunkpanel=self.webpackChunkpanel||[]).push([[865],{223:function(e,t,n){n(2791);var r=n(3504),a=n(2506),s=n(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)(r.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)(a.Z,{size:10,className:"mr-4"}),(0,s.jsx)(r.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)}))]})})}},4865:function(e,t,n){n.r(t),n.d(t,{MailingListRoutes:function(){return z}});var r=n(6871),a=n(2412),s=n(223),i=n(9630),o=n(1413),c=n(6771),l=n(1933),u=function(){return c.o.get("/mailing")},d=n(4165),f=n(5861),x=n(4430),m=n(3777),p=n(7889),h=n(2007),v=function(e){var t=e.contactId;return c.o.delete("/mailing/".concat(t))};v.propTypes={contactId:n.n(h)().string.isRequired};var g=n(184),j=function(e){var t=e.id,n=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config,t=(0,p.G)().addNotification;return(0,l.useMutation)((0,o.Z)((0,o.Z)({onMutate:function(){var e=(0,f.Z)((0,d.Z)().mark((function e(t){var n;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.E.cancelQueries("contacts");case 2:return n=m.E.getQueryData("contacts"),m.E.setQueryData("contacts",null===n||void 0===n?void 0:n.filter((function(e){return e.id!==t.contactId}))),e.abrupt("return",{previousContacts:n});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),onError:function(e,t,n){null!==n&&void 0!==n&&n.previousContacts&&m.E.setQueryData("contacts",n.previousContacts)},onSuccess:function(){m.E.invalidateQueries("contacts"),t({type:"success",title:"Contact Removed from mailing list"})}},e),{},{mutationFn:v}))}();return n.isLoading?(0,g.jsx)("div",{id:"loading-screen",className:"w-full h-full fixed block top-0 left-0 bg-black opacity-75 z-50",children:(0,g.jsx)("span",{className:"opacity-75 top-1/2 my-0 mx-auto block relative w-0 h-0",children:(0,g.jsx)(i.$j,{size:"sm"})})}):(0,g.jsx)(x._n,{allowedRoles:[x.K$.ADMIN],children:(0,g.jsx)(i.U6,{icon:"danger",title:"Delete Contact",body:"Are you sure you want to delete this Contact?",triggerButton:(0,g.jsx)("button",{children:"Remove"}),confirmButton:(0,g.jsx)(i.zx,{isLoading:n.isLoading,type:"button",className:"bg-red-600",onClick:(0,f.Z)((0,d.Z)().mark((function e(){return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.mutateAsync({contactId:t});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),children:"Delete Contact"})})})},y=function(){var e=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config;return(0,l.useQuery)((0,o.Z)((0,o.Z)({},e),{},{queryKey:["contacts"],queryFn:function(){return u()}}))}();return e.isLoading?(0,g.jsx)("div",{className:"w-full h-48 flex justify-center items-center",children:(0,g.jsx)(i.$j,{size:"lg"})}):e.data?(0,g.jsx)(i.iA,{data:e.data,columns:[{title:"Contacts",field:"name",Cell:function(e){var t=e.entry,n=t.name,r=t.email,a=t.phone;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"font-bold",children:n}),(0,g.jsx)("div",{className:"text-xs text-gray-500",children:r}),(0,g.jsx)("div",{className:"text-xs text-gray-500",children:a})]})}},{title:"",field:"id",Cell:function(e){var t=e.entry._id;return(0,g.jsx)(j,{id:t})}}]}):null},b=n(806),w=n(2076),k=n(9879),N=k.Ry({title:k.Z_().min(1,"Required"),desc:k.Z_()}),Z=function(){return(0,g.jsx)(x._n,{allowedRoles:[x.K$.ADMIN],children:(0,g.jsx)(b._8,{size:"sm",triggerButton:(0,g.jsx)(i.zx,{variant:"create",size:"sm",startIcon:(0,g.jsx)(w.Z,{className:"h-4 w-4"}),children:"Send Newsletter"}),title:"Newsletter",submitButton:(0,g.jsx)(i.zx,{form:"create-post",type:"submit",size:"sm",children:"Submit"}),children:(0,g.jsx)(b.l0,{id:"create-post",encType:"multipart/form-data",onSubmit:function(){var e=(0,f.Z)((0,d.Z)().mark((function e(t){var n,r,a;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.subject,r=t.body,(a=new FormData).append("subject",n),a.append("body",r);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),schema:N,children:function(e){var t=e.register,n=e.formState,r=e.watch,a=e.setValue;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(b.UP,{label:"subject",error:n.errors.subject,registration:t("subject")}),(0,g.jsx)(b.N7,{label:"Body",error:n.errors.body,editorContent:r("body"),setValue:a,value:"body"})]})}})})})},C=function(){return(0,g.jsxs)(a.D,{title:"Mailing list",button:(0,g.jsx)(Z,{}),children:[(0,g.jsx)(s.Z,{routes:[{name:"Mailing List",path:"."}]}),(0,g.jsx)("div",{className:"mt-4",children:(0,g.jsx)(y,{})})]})},z=function(){return(0,g.jsxs)(r.Z5,{children:[(0,g.jsx)(r.AW,{path:"",element:(0,g.jsx)(C,{})}),(0,g.jsx)(r.AW,{path:"*",element:(0,g.jsx)(r.Fg,{to:"."})})]})}},2506:function(e,t,n){var r=n(2791),a=n(2007),s=n.n(a);function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=(0,r.forwardRef)((function(e,t){var n=e.color,a=void 0===n?"currentColor":n,s=e.size,c=void 0===s?24:s,l=o(e,["color","size"]);return r.createElement("svg",i({ref:t,xmlns:"http://www.w3.org/2000/svg",width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),r.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},2076:function(e,t,n){var r=n(2791);var a=r.forwardRef((function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))}));t.Z=a}}]);
//# sourceMappingURL=865.48a0fdff.chunk.js.map