Current Path : /home/ncdcgo/admin.ncdc.go.ug/static/js/ |
Current File : /home/ncdcgo/admin.ncdc.go.ug/static/js/9.e5af94a2.chunk.js |
(this["webpackJsonpncdc-admin"]=this["webpackJsonpncdc-admin"]||[]).push([[9],{731:function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=n(732),s=n.n(r),i=n(6),a=n.n(i),c=function(t){return s()(t).format("MMMM D, YYYY h:mm A")};c.propTypes={date:a.a.string.isRequired}},732:function(t,e,n){t.exports=function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",s="second",i="minute",a="hour",c="day",u="week",o="month",d="quarter",l="year",f="date",h="Invalid Date",j=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},v=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},b={s:v,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+v(r,2,"0")+":"+v(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,o),i=n-s<0,a=e.clone().add(r+(i?-1:1),o);return+(-(r+(n-s)/(i?s-a:a-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:o,y:l,w:u,d:c,D:f,h:a,m:i,s:s,ms:r,Q:d}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},p="en",O={};O[p]=g;var y=function(t){return t instanceof w},$=function(t,e,n){var r;if(!t)return p;if("string"==typeof t)O[t]&&(r=t),e&&(O[t]=e,r=t);else{var s=t.name;O[s]=t,r=s}return!n&&r&&(p=r),r||!n&&p},x=function(t,e){if(y(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new w(n)},M=b;M.l=$,M.i=y,M.w=function(t,e){return x(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var w=function(){function g(t){this.$L=$(t.locale,null,!0),this.parse(t)}var v=g.prototype;return v.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(M.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(j);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},v.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},v.$utils=function(){return M},v.isValid=function(){return!(this.$d.toString()===h)},v.isSame=function(t,e){var n=x(t);return this.startOf(e)<=n&&n<=this.endOf(e)},v.isAfter=function(t,e){return x(t)<this.startOf(e)},v.isBefore=function(t,e){return this.endOf(e)<x(t)},v.$g=function(t,e,n){return M.u(t)?this[e]:this.set(n,t)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(t,e){var n=this,r=!!M.u(e)||e,d=M.p(t),h=function(t,e){var s=M.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(c)},j=function(t,e){return M.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},m=this.$W,g=this.$M,v=this.$D,b="set"+(this.$u?"UTC":"");switch(d){case l:return r?h(1,0):h(31,11);case o:return r?h(1,g):h(0,g+1);case u:var p=this.$locale().weekStart||0,O=(m<p?m+7:m)-p;return h(r?v-O:v+(6-O),g);case c:case f:return j(b+"Hours",0);case a:return j(b+"Minutes",1);case i:return j(b+"Seconds",2);case s:return j(b+"Milliseconds",3);default:return this.clone()}},v.endOf=function(t){return this.startOf(t,!1)},v.$set=function(t,e){var n,u=M.p(t),d="set"+(this.$u?"UTC":""),h=(n={},n[c]=d+"Date",n[f]=d+"Date",n[o]=d+"Month",n[l]=d+"FullYear",n[a]=d+"Hours",n[i]=d+"Minutes",n[s]=d+"Seconds",n[r]=d+"Milliseconds",n)[u],j=u===c?this.$D+(e-this.$W):e;if(u===o||u===l){var m=this.clone().set(f,1);m.$d[h](j),m.init(),this.$d=m.set(f,Math.min(this.$D,m.daysInMonth())).$d}else h&&this.$d[h](j);return this.init(),this},v.set=function(t,e){return this.clone().$set(t,e)},v.get=function(t){return this[M.p(t)]()},v.add=function(r,d){var f,h=this;r=Number(r);var j=M.p(d),m=function(t){var e=x(h);return M.w(e.date(e.date()+Math.round(t*r)),h)};if(j===o)return this.set(o,this.$M+r);if(j===l)return this.set(l,this.$y+r);if(j===c)return m(1);if(j===u)return m(7);var g=(f={},f[i]=e,f[a]=n,f[s]=t,f)[j]||1,v=this.$d.getTime()+r*g;return M.w(v,this)},v.subtract=function(t,e){return this.add(-1*t,e)},v.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||h;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=M.z(this),i=this.$H,a=this.$m,c=this.$M,u=n.weekdays,o=n.months,d=function(t,n,s,i){return t&&(t[n]||t(e,r))||s[n].substr(0,i)},l=function(t){return M.s(i%12||12,t,"0")},f=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},j={YY:String(this.$y).slice(-2),YYYY:this.$y,M:c+1,MM:M.s(c+1,2,"0"),MMM:d(n.monthsShort,c,o,3),MMMM:d(o,c),D:this.$D,DD:M.s(this.$D,2,"0"),d:String(this.$W),dd:d(n.weekdaysMin,this.$W,u,2),ddd:d(n.weekdaysShort,this.$W,u,3),dddd:u[this.$W],H:String(i),HH:M.s(i,2,"0"),h:l(1),hh:l(2),a:f(i,a,!0),A:f(i,a,!1),m:String(a),mm:M.s(a,2,"0"),s:String(this.$s),ss:M.s(this.$s,2,"0"),SSS:M.s(this.$ms,3,"0"),Z:s};return r.replace(m,(function(t,e){return e||j[t]||s.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(r,f,h){var j,m=M.p(f),g=x(r),v=(g.utcOffset()-this.utcOffset())*e,b=this-g,p=M.m(this,g);return p=(j={},j[l]=p/12,j[o]=p,j[d]=p/3,j[u]=(b-v)/6048e5,j[c]=(b-v)/864e5,j[a]=b/n,j[i]=b/e,j[s]=b/t,j)[m]||b,h?p:M.a(p)},v.daysInMonth=function(){return this.endOf(o).$D},v.$locale=function(){return O[this.$L]},v.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=$(t,e,!0);return r&&(n.$L=r),n},v.clone=function(){return M.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},g}(),D=w.prototype;return x.prototype=D,[["$ms",r],["$s",s],["$m",i],["$H",a],["$W",c],["$M",o],["$y",l],["$D",f]].forEach((function(t){D[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),x.extend=function(t,e){return t.$i||(t(e,w,x),t.$i=!0),x},x.locale=$,x.isDayjs=y,x.unix=function(t){return x(1e3*t)},x.en=O[p],x.Ls=O,x.p={},x}()},743:function(t,e,n){"use strict";n.r(e),n.d(e,"MessagesRoutes",(function(){return L}));var r=n(15),s=n(29),i=n(61),a=n(96),c=n(731),u=n(0),o=n.n(u),d=n(6),l=n.n(d);function f(){return(f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function h(t,e){if(null==t)return{};var n,r,s=function(t,e){if(null==t)return{};var n,r,s={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(s[n]=t[n]);return s}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}var j=Object(u.forwardRef)((function(t,e){var n=t.color,r=void 0===n?"currentColor":n,s=t.size,i=void 0===s?24:s,a=h(t,["color","size"]);return o.a.createElement("svg",f({ref:e,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a),o.a.createElement("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),o.a.createElement("polyline",{points:"22,6 12,13 2,6"}))}));j.propTypes={color:l.a.string,size:l.a.oneOfType([l.a.string,l.a.number])},j.displayName="Mail";var m=j,g=n(18),v=n(47),b=n(721),p=function(t){var e=t.messageId,n=t.config;return Object(b.a)(Object(g.a)(Object(g.a)({},n),{},{queryKey:["message",e],queryFn:function(){return function(t){var e=t.messageId;return v.a.get("/messages/".concat(e))}({messageId:e})}}))},O=n(2),y=function(){var t=Object(r.j)().messageId,e=p({messageId:t});return e.isLoading?Object(O.jsx)("div",{className:"w-full h-48 flex justify-center items-center",children:Object(O.jsx)(s.e,{size:"lg"})}):e.data?Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)(i.a,{title:e.data.subject}),Object(O.jsxs)(a.a,{title:e.data.subject,children:[Object(O.jsx)("span",{className:"text-xs font-bold",children:Object(c.a)(e.data.createdAt)}),Object(O.jsxs)("div",{className:"mt-6 flex flex-col space-y-16",children:[Object(O.jsx)("div",{children:Object(O.jsx)("div",{className:"bg-white shadow overflow-hidden sm:rounded-lg",children:Object(O.jsx)("div",{className:"px-4 py-5 sm:px-6",children:Object(O.jsx)("div",{className:"mt-1 max-w-2xl text-sm text-gray-500",children:Object(O.jsx)(s.d,{value:e.data.content})})})})}),Object(O.jsxs)("a",{href:"mailto:".concat(e.data.email),className:"flex flex-row space-x-2 text-gray-600",children:[Object(O.jsx)(m,{})," ",Object(O.jsx)("span",{children:"Reply From Mail"})]}),Object(O.jsx)("div",{})]})]})]}):null},$=function(){return v.a.get("/messages")},x=n(13),M=n.n(x),w=n(23),D=n(48),S=n(21),_=n(171),N=n(95),I=n(170),Y=function(t){var e=t.messageId;return v.a.delete("/messages/".concat(e))};Y.propTypes={messageId:l.a.string.isRequired};var k=function(t){var e=t.id,n=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config,e=Object(N.a)().addNotification;return Object(I.a)(Object(g.a)(Object(g.a)({onMutate:function(){var t=Object(w.a)(M.a.mark((function t(e){var n;return M.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_.a.cancelQueries("messages");case 2:return n=_.a.getQueryData("messages"),_.a.setQueryData("messages",null===n||void 0===n?void 0:n.filter((function(t){return t.id!==e.messageId}))),t.abrupt("return",{previousMessages:n});case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),onError:function(t,e,n){(null===n||void 0===n?void 0:n.previousMessages)&&_.a.setQueryData("messages",n.previousMessages)},onSuccess:function(){_.a.invalidateQueries("messages"),e({type:"success",title:"Message Deleted"})}},t),{},{mutationFn:Y}))}();return Object(O.jsx)(D.a,{allowedRoles:[D.c.ADMIN],children:Object(O.jsx)(s.b,{icon:"danger",title:"Delete Message",body:"Are you sure you want to delete this Message?",triggerButton:Object(O.jsx)(s.a,{variant:"danger",children:Object(O.jsx)(S.j,{className:"h-4 w-4"})}),confirmButton:Object(O.jsx)(s.a,{isLoading:n.isLoading,type:"button",className:"bg-red-600",onClick:Object(w.a)(M.a.mark((function t(){return M.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.mutateAsync({messageId:e});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),children:"Delete Message"})})})},T=function(){var t=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config;return Object(b.a)(Object(g.a)(Object(g.a)({},t),{},{queryKey:["messages"],queryFn:function(){return $()}}))}();return t.isLoading?Object(O.jsx)("div",{className:"w-full h-48 flex justify-center items-center",children:Object(O.jsx)(s.e,{size:"lg"})}):t.data?Object(O.jsx)(s.f,{data:t.data,columns:[{title:"Subject",field:"subject"},{title:"Created At",field:"createdAt",Cell:function(t){var e=t.entry.createdAt;return Object(O.jsx)("span",{children:Object(c.a)(e)})}},{title:"",field:"id",Cell:function(t){var e=t.entry._id;return Object(O.jsx)(s.c,{to:"./".concat(e),children:"View"})}},{title:"",field:"id",Cell:function(t){var e=t.entry._id;return Object(O.jsx)(k,{id:e})}}]}):null},A=function(){return Object(O.jsx)(a.a,{title:"Messages",children:Object(O.jsx)("div",{className:"mt-4",children:Object(O.jsx)(T,{})})})},L=function(){return Object(O.jsxs)(r.e,{children:[Object(O.jsx)(r.c,{path:"",element:Object(O.jsx)(A,{})}),Object(O.jsx)(r.c,{path:":messageId",element:Object(O.jsx)(y,{})}),Object(O.jsx)(r.c,{path:"*",element:Object(O.jsx)(r.a,{to:"."})})]})}}}]); //# sourceMappingURL=9.e5af94a2.chunk.js.map