Your IP : 3.21.247.221


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

(this["webpackJsonpncdc-admin"]=this["webpackJsonpncdc-admin"]||[]).push([[7],{731:function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=n(732),i=n.n(r),s=n(6),a=n.n(s),c=function(t){return i()(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",i="second",s="minute",a="hour",c="day",o="week",u="month",d="quarter",l="year",f="date",b="Invalid Date",j=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|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,v={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("_")},p=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},m={s:p,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+p(r,2,"0")+":"+p(i,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()),i=e.clone().add(r,u),s=n-i<0,a=e.clone().add(r+(s?-1:1),u);return+(-(r+(n-i)/(s?i-a:a-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:u,y:l,w:o,d:c,D:f,h:a,m:s,s:i,ms:r,Q:d}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},O="en",g={};g[O]=v;var x=function(t){return t instanceof w},y=function(t,e,n){var r;if(!t)return O;if("string"==typeof t)g[t]&&(r=t),e&&(g[t]=e,r=t);else{var i=t.name;g[i]=t,r=i}return!n&&r&&(O=r),r||!n&&O},$=function(t,e){if(x(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new w(n)},D=m;D.l=y,D.i=x,D.w=function(t,e){return $(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var w=function(){function v(t){this.$L=y(t.locale,null,!0),this.parse(t)}var p=v.prototype;return p.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(D.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 i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},p.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()},p.$utils=function(){return D},p.isValid=function(){return!(this.$d.toString()===b)},p.isSame=function(t,e){var n=$(t);return this.startOf(e)<=n&&n<=this.endOf(e)},p.isAfter=function(t,e){return $(t)<this.startOf(e)},p.isBefore=function(t,e){return this.endOf(e)<$(t)},p.$g=function(t,e,n){return D.u(t)?this[e]:this.set(n,t)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(t,e){var n=this,r=!!D.u(e)||e,d=D.p(t),b=function(t,e){var i=D.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(c)},j=function(t,e){return D.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},h=this.$W,v=this.$M,p=this.$D,m="set"+(this.$u?"UTC":"");switch(d){case l:return r?b(1,0):b(31,11);case u:return r?b(1,v):b(0,v+1);case o:var O=this.$locale().weekStart||0,g=(h<O?h+7:h)-O;return b(r?p-g:p+(6-g),v);case c:case f:return j(m+"Hours",0);case a:return j(m+"Minutes",1);case s:return j(m+"Seconds",2);case i:return j(m+"Milliseconds",3);default:return this.clone()}},p.endOf=function(t){return this.startOf(t,!1)},p.$set=function(t,e){var n,o=D.p(t),d="set"+(this.$u?"UTC":""),b=(n={},n[c]=d+"Date",n[f]=d+"Date",n[u]=d+"Month",n[l]=d+"FullYear",n[a]=d+"Hours",n[s]=d+"Minutes",n[i]=d+"Seconds",n[r]=d+"Milliseconds",n)[o],j=o===c?this.$D+(e-this.$W):e;if(o===u||o===l){var h=this.clone().set(f,1);h.$d[b](j),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else b&&this.$d[b](j);return this.init(),this},p.set=function(t,e){return this.clone().$set(t,e)},p.get=function(t){return this[D.p(t)]()},p.add=function(r,d){var f,b=this;r=Number(r);var j=D.p(d),h=function(t){var e=$(b);return D.w(e.date(e.date()+Math.round(t*r)),b)};if(j===u)return this.set(u,this.$M+r);if(j===l)return this.set(l,this.$y+r);if(j===c)return h(1);if(j===o)return h(7);var v=(f={},f[s]=e,f[a]=n,f[i]=t,f)[j]||1,p=this.$d.getTime()+r*v;return D.w(p,this)},p.subtract=function(t,e){return this.add(-1*t,e)},p.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||b;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=D.z(this),s=this.$H,a=this.$m,c=this.$M,o=n.weekdays,u=n.months,d=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},l=function(t){return D.s(s%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:D.s(c+1,2,"0"),MMM:d(n.monthsShort,c,u,3),MMMM:d(u,c),D:this.$D,DD:D.s(this.$D,2,"0"),d:String(this.$W),dd:d(n.weekdaysMin,this.$W,o,2),ddd:d(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:D.s(s,2,"0"),h:l(1),hh:l(2),a:f(s,a,!0),A:f(s,a,!1),m:String(a),mm:D.s(a,2,"0"),s:String(this.$s),ss:D.s(this.$s,2,"0"),SSS:D.s(this.$ms,3,"0"),Z:i};return r.replace(h,(function(t,e){return e||j[t]||i.replace(":","")}))},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(r,f,b){var j,h=D.p(f),v=$(r),p=(v.utcOffset()-this.utcOffset())*e,m=this-v,O=D.m(this,v);return O=(j={},j[l]=O/12,j[u]=O,j[d]=O/3,j[o]=(m-p)/6048e5,j[c]=(m-p)/864e5,j[a]=m/n,j[s]=m/e,j[i]=m/t,j)[h]||m,b?O:D.a(O)},p.daysInMonth=function(){return this.endOf(u).$D},p.$locale=function(){return g[this.$L]},p.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=y(t,e,!0);return r&&(n.$L=r),n},p.clone=function(){return D.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},v}(),M=w.prototype;return $.prototype=M,[["$ms",r],["$s",i],["$m",s],["$H",a],["$W",c],["$M",u],["$y",l],["$D",f]].forEach((function(t){M[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),$.extend=function(t,e){return t.$i||(t(e,w,$),t.$i=!0),$},$.locale=y,$.isDayjs=x,$.unix=function(t){return $(1e3*t)},$.en=g[O],$.Ls=g,$.p={},$}()},737:function(t,e,n){"use strict";n.r(e),n.d(e,"JobsRoutes",(function(){return Q}));var r=n(15),i=n(29),s=n(61),a=n(96),c=n(731),o=n(18),u=n(47),d=n(721),l=function(t){var e=t.jobId,n=t.config;return Object(d.a)(Object(o.a)(Object(o.a)({},n),{},{queryKey:["job",e],queryFn:function(){return function(t){var e=t.jobId;return u.a.get("/jobs/".concat(e))}({jobId:e})}}))},f=n(13),b=n.n(f),j=n(23),h=n(98),v=n(48),p=n(99),m=n(97),O=n(171),g=n(95),x=n(6),y=n.n(x),$=n(170),D=function(t){var e=t.data,n=t.jobId;return u.a.patch("/jobs/".concat(n),e)};D.propTypes={data:y.a.shape({title:y.a.string.isRequired,desc:y.a.string.isRequired}).isRequired,jobId:y.a.string.isRequired};var w=n(2),M=m.a({title:m.b().min(1,"Required"),desc:m.b().min(1,"Required")}),S=function(t){var e,n,r=t.jobId,s=l({jobId:r}),a=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config,e=Object(g.a)().addNotification;return Object($.a)(Object(o.a)(Object(o.a)({onMutate:function(){var t=Object(j.a)(b.a.mark((function t(e){var n;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O.a.cancelQueries(["job",null===e||void 0===e?void 0:e.jobId]);case 2:return n=O.a.getQueryData[null===e||void 0===e?void 0:e.jobId],O.a.setQueryData(["job",null===e||void 0===e?void 0:e.jobId],Object(o.a)(Object(o.a)(Object(o.a)({},n),e.data),{},{id:e.jobId})),t.abrupt("return",{previousJob: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.previousJob)&&O.a.setQueryData(["job",n.previousJob.id],n.previousJob)},onSuccess:function(t){O.a.refetchQueries(["job",t.id]),e({type:"success",title:"Job Updated"})}},t),{},{mutationFn:D}))}();return Object(w.jsx)(v.a,{allowedRoles:[v.c.ADMIN],children:Object(w.jsx)(h.c,{sie:"sm",isDone:a.isSuccess,triggerButton:Object(w.jsx)(i.a,{startIcon:Object(w.jsx)(p.a,{className:"h-4 w-4"}),size:"sm",children:"Update Job"}),title:"Update Job",submitButton:Object(w.jsx)(i.a,{form:"update-job",type:"submit",size:"sm",isLoading:a.isLoading,children:"Submit"}),children:Object(w.jsx)(h.b,{id:"update-job",onSubmit:function(){var t=Object(j.a)(b.a.mark((function t(e){return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,a.mutateAsync({data:e,jobId:r});case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),options:{defaultValues:{title:null===(e=s.data)||void 0===e?void 0:e.title,desc:null===(n=s.data)||void 0===n?void 0:n.desc}},schema:M,children:function(t){var e=t.register,n=t.formState,r=t.watch,i=t.setValue;return Object(w.jsxs)(w.Fragment,{children:[Object(w.jsx)(h.d,{label:"Title",error:n.errors.title,registration:e("title")}),Object(w.jsx)(h.f,{label:"Description",error:n.errors.desc,editorContent:r("desc"),setValue:i,value:"desc"})]})}})})})},I=function(){var t=Object(r.j)().jobId,e=l({jobId:t});return e.isLoading?Object(w.jsx)("div",{className:"w-full h-48 flex justify-center items-center",children:Object(w.jsx)(i.e,{size:"lg"})}):e.data?Object(w.jsxs)(w.Fragment,{children:[Object(w.jsx)(s.a,{title:e.data.title}),Object(w.jsxs)(a.a,{title:e.data.title,button:Object(w.jsx)(S,{jobId:t}),children:[Object(w.jsx)("span",{className:"text-xs font-bold",children:Object(c.a)(e.data.createdAt)}),Object(w.jsx)("div",{className:"mt-6 flex flex-col space-y-16",children:Object(w.jsx)("div",{children:Object(w.jsx)("div",{className:"bg-white shadow overflow-hidden sm:rounded-lg",children:Object(w.jsx)("div",{className:"px-4 py-5 sm:px-6",children:Object(w.jsx)("div",{className:"mt-1 max-w-2xl text-sm text-gray-500",children:Object(w.jsx)(i.d,{value:e.data.desc})})})})})})]})]}):null},J=n(21),N=n(22),_=function(t){var e=t.data;return u.a.post("/jobs",e)};_.propTypes={data:y.a.shape({title:y.a.string.isRequired,desc:y.a.string.isRequired}).isRequired};var A=m.a({title:m.b().min(1,"Required"),desc:m.b().min(1,"Required")}),C=function(){var t=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config,e=Object(g.a)().addNotification;return Object($.a)(Object(o.a)(Object(o.a)({onMutate:function(){var t=Object(j.a)(b.a.mark((function t(e){var n;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O.a.cancelQueries("jobs");case 2:return n=O.a.getQueryData("jobs"),O.a.setQueryData("jobs",[].concat(Object(N.a)(n||[]),[e.data])),t.abrupt("return",{previousJobs: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.previousJobs)&&O.a.setQueryData("jobs",n.previousJobs)},onSuccess:function(){O.a.invalidateQueries("jobs"),e({type:"success",title:"Job Created"})}},t),{},{mutationFn:_}))}();return Object(w.jsx)(v.a,{allowedRoles:[v.c.ADMIN],children:Object(w.jsx)(h.c,{size:"sm",isDone:t.isSuccess,triggerButton:Object(w.jsx)(i.a,{size:"sm",startIcon:Object(w.jsx)(J.i,{className:"h-4 w-4"}),children:"Create Job"}),title:"Create Job",submitButton:Object(w.jsx)(i.a,{form:"create-job",type:"submit",size:"sm",isLoading:t.isLoading,children:"Submit"}),children:Object(w.jsx)(h.b,{id:"create-job",onSubmit:function(){var e=Object(j.a)(b.a.mark((function e(n){return b.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.mutateAsync({data:n});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),schema:A,children:function(t){var e=t.register,n=t.formState,r=t.watch,i=t.setValue;return Object(w.jsxs)(w.Fragment,{children:[Object(w.jsx)(h.d,{label:"Title",error:n.errors.title,registration:e("title")}),Object(w.jsx)(h.f,{label:"Description",error:n.errors.desc,editorContent:r("desc"),setValue:i,value:"desc"})]})}})})})},T=function(){return u.a.get("/jobs")},q=function(t){var e=t.jobId;return u.a.delete("/jobs/".concat(e))};q.propTypes={jobId:y.a.string.isRequired};var R=function(t){var e=t.id,n=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config,e=Object(g.a)().addNotification;return Object($.a)(Object(o.a)(Object(o.a)({onMutate:function(){var t=Object(j.a)(b.a.mark((function t(e){var n;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,O.a.cancelQueries("jobs");case 2:return n=O.a.getQueryData("jobs"),O.a.setQueryData("jobs",null===n||void 0===n?void 0:n.filter((function(t){return t.id!==e.jobId}))),t.abrupt("return",{previousJobs: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.previousJobs)&&O.a.setQueryData("jobs",n.previousJobs)},onSuccess:function(){O.a.invalidateQueries("jobs"),e({type:"success",title:"Career Deleted"})}},t),{},{mutationFn:q}))}();return Object(w.jsx)(v.a,{allowedRoles:[v.c.ADMIN],children:Object(w.jsx)(i.b,{icon:"danger",title:"Delete Job",body:"Are you sure you want to delete this Job?",triggerButton:Object(w.jsx)(i.a,{variant:"danger",children:Object(w.jsx)(J.j,{className:"h-4 w-4"})}),confirmButton:Object(w.jsx)(i.a,{isLoading:n.isLoading,type:"button",className:"bg-red-600",onClick:Object(j.a)(b.a.mark((function t(){return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.mutateAsync({postId:e});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),children:"Delete Job"})})})},Y=function(){var t=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).config;return Object(d.a)(Object(o.a)(Object(o.a)({},t),{},{queryKey:["jobs"],queryFn:function(){return T()}}))}();return t.isLoading?Object(w.jsx)("div",{className:"w-full h-48 flex justify-center items-center",children:Object(w.jsx)(i.e,{size:"lg"})}):t.data?Object(w.jsx)(i.f,{data:t.data,columns:[{title:"Title",field:"title"},{title:"Created At",field:"createdAt",Cell:function(t){var e=t.entry.createdAt;return Object(w.jsx)("span",{children:Object(c.a)(e)})}},{title:"",field:"id",Cell:function(t){var e=t.entry._id;return Object(w.jsx)(i.c,{to:"./".concat(e),children:"View"})}},{title:"",field:"id",Cell:function(t){var e=t.entry._id;return Object(w.jsx)(R,{id:e})}}]}):null},L=function(){return Object(w.jsx)(a.a,{title:"Careers",button:Object(w.jsx)(C,{}),children:Object(w.jsx)("div",{className:"mt-4",children:Object(w.jsx)(Y,{})})})},Q=function(){return Object(w.jsxs)(r.e,{children:[Object(w.jsx)(r.c,{path:"",element:Object(w.jsx)(L,{})}),Object(w.jsx)(r.c,{path:":jobId",element:Object(w.jsx)(I,{})}),Object(w.jsx)(r.c,{path:"*",element:Object(w.jsx)(r.a,{to:"."})})]})}}}]);
//# sourceMappingURL=7.11f1bb99.chunk.js.map