text: (this.webpackJsonpadmin=this.webpackJsonpadmin||[]).push([[27],{626:function(e,t,n){"use strict";var r=n(642);r.a.initializeApp({apiKey:"AIzaSyDfrxRJfUUiDKF2x7_oPI74P7pdAxtSWHQ",authDomain:"notesapp-59b05.firebaseapp.com",databaseURL:"https://notesapp-59b05-default-rtdb.firebaseio.com",projectId:"notesapp-59b05",storageBucket:"notesapp-59b05.appspot.com",messagingSenderId:"239525944656",appId:"1:239525944656:web:4ca89a894242baa072e055",measurementId:"G-NZLCJQPYBX"}),r.a.analytics(),t.a=r.a},629:function(e,t,n){e.exports=n(377)},630:function(e,t,n){"use strict";function r(e,t,n,r,c,a,s){try{var i=e[a](s),u=i.value}catch(l){return void n(l)}i.done?t(u):Promise.resolve(u).then(r,c)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(c,a){var s=e.apply(t,n);function i(e){r(s,c,a,i,u,"next",e)}function u(e){r(s,c,a,i,u,"throw",e)}i(void 0)}))}}n.d(t,"a",(function(){return c}))},645:function(e,t,n){"use strict";var r=n(43),c=n(158),a=(n(1),n(620)),s=n.n(a),i=n(627),u=n(20);t.a=function(e){var t=e.title,n=e.subtitle,a=e.className,l=Object(c.a)(e,["title","subtitle","className"]),j=s()(a,"text-center","text-md-left","mb-sm-0");return Object(u.jsxs)(i.h,Object(r.a)(Object(r.a)({xs:"12",sm:"4",className:j},l),{},{children:[Object(u.jsx)("span",{className:"text-uppercase page-subtitle",children:n}),Object(u.jsx)("h3",{className:"page-title",children:t})]}))}},788:function(e,t,n){"use strict";n.r(t);var r=n(43),c=n(629),a=n.n(c),s=n(630),i=n(623),u=n(1),l=n.n(u),j=n(627),d=n(645),o=n(626),b=n(20),h=o.a.firestore(),p=function(){return Object(b.jsx)("tbody",{children:Object(b.jsx)("tr",{children:Object(b.jsx)("td",{children:"LOADING ... "})})})},f=function(e){var t=e.title,n=e.number;return Object(b.jsx)(j.h,{sm:"4",className:"mb-4",children:Object(b.jsxs)(j.d,{small:!0,className:"card-post card-post--1",children:[Object(b.jsx)(j.g,{className:"text-center",children:Object(b.jsx)("h5",{className:"card-title font-weight-bold text-fiord-blue",children:t})}),Object(b.jsx)(j.e,{className:"text-center",children:Object(b.jsx)("h3",{className:"card-text d-inline-block mb-3",children:n})})]})})};t.default=function(){var e=[1,2,3,4,5,6,7,8,9,10,11,12],t=l.a.useState(2021),n=Object(i.a)(t,2),c=n[0],u=n[1],x=l.a.useState(!1),O=Object(i.a)(x,2),m=O[0],v=O[1],g=l.a.useState([]),w=Object(i.a)(g,2),D=w[0],y=w[1],N=l.a.useState([]),T=Object(i.a)(N,2),S=T[0],_=T[1],k=l.a.useState("all"),A=Object(i.a)(k,2),I=A[0],P=A[1],J=l.a.useState([]),R=Object(i.a)(J,2),F=R[0],L=R[1],U=l.a.useState([]),C=Object(i.a)(U,2),G=C[0],z=C[1],B=l.a.useState([]),E=Object(i.a)(B,2),K=E[0],M=E[1],Q=l.a.useState([]),H=Object(i.a)(Q,2),W=H[0],X=H[1],Y=l.a.useState([]),Z=Object(i.a)(Y,2),q=Z[0],V=Z[1],$=l.a.useState([]),ee=Object(i.a)($,2),te=ee[0],ne=ee[1],re=l.a.useState(0),ce=Object(i.a)(re,2),ae=ce[0],se=ce[1];l.a.useEffect((function(){function e(){return(e=Object(s.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v(!0),e.next=3,ie();case 3:return e.next=5,le(c);case 5:return e.next=7,je();case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[c]);var ie=function(){var e=Object(s.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=_,e.next=3,h.collection("districts").get();case 3:e.t1=e.sent.docs.map((function(e){return Object(r.a)(Object(r.a)({},e.data()),{},{id:e.id})})).sort((function(e,t){return e.name>t.name?1:t.name>e.name?-1:0})),(0,e.t0)(e.t1);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ue=function(){var e=Object(s.a)(a.a.mark((function e(t){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v(!0),P(t),e.next=4,le(c,t);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),le=function(){var e=Object(s.a)(a.a.mark((function e(t){var n,c,s,i,u,l,j,d,b,p,f,x=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=x.length>1&&void 0!==x[1]?x[1]:"all",e.next=3,h.collection("subscriptions").get();case 3:if(c=e.sent.docs.map((function(e){return Object(r.a)(Object(r.a)({},e.data()),{},{id:e.id})})),s=[],"all"!==n){e.next=11;break}return e.next=8,h.collection("users").get();case 8:s=e.sent.docs.map((function(e){return Object(r.a)(Object(r.a)({},e.data()),{},{id:e.id})})).filter((function(e){return e.updated_at>o.a.firestore.Timestamp.fromDate(new Date(t,1,1))&&e.updated_at<o.a.firestore.Timestamp.fromDate(new Date(t,12,31))})),e.next=14;break;case 11:return e.next=13,h.collection("users").get();case 13:s=e.sent.docs.map((function(e){return Object(r.a)(Object(r.a)({},e.data()),{},{id:e.id})})).filter((function(e){return e.updated_at>o.a.firestore.Timestamp.fromDate(new Date(t,1,1))&&e.updated_at<o.a.firestore.Timestamp.fromDate(new Date(t,12,31))&&e.district===n}));case 14:for(i=s.filter((function(e){return null===e.deleted_at||void 0===e.deleted_at})),u=i.filter((function(e){return null===e.inactive_at||void 0===e.inactive_at})),l=i.filter((function(e){return null!==e.inactive_at&&void 0!==e.inactive_at})),j=u.filter((function(e){for(var t=0;t<c.length;t++)if(c[t].planType===e.subscriptionType&&"0"===c[t].price)return!0;return!1})),d=u.filter((function(e){for(var t=0;t<c.length;t++)if(c[t].planType===e.subscriptionType&&"0"!==c[t].price)return!0;return!1})),b=0,p=0;p<d.length;p++)for(f=0;f<c.length;f++)c[f].planType===d[p].subscriptionType&&(b+=Number(c[f].price));y(c),L(i),z(u),V(l),M(j),X(d),se(b),v(!1);case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),je=function(){var e=Object(s.a)(a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=ne,e.next=3,h.collection("new_users").get();case 3:e.t1=e.sent.docs.map((function(e){return Object(r.a)(Object(r.a)({},e.data()),{},{id:e.id})})),(0,e.t0)(e.t1);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),de=function(e){for(var t=0,n=0;n<W.filter((function(t){return t.updated_at>o.a.firestore.Timestamp.fromDate(new Date(c,e,1))&&t.updated_at<o.a.firestore.Timestamp.fromDate(new Date(c,e,31))})).length;n++)for(var r=0;r<D.length;r++)D[r].planType===W[n].subscriptionType&&(t+=Number(D[r].price));return t},oe=function(e,t){return e.filter((function(e){return e.updated_at>o.a.firestore.Timestamp.fromDate(new Date(c,t,1))&&e.updated_at<o.a.firestore.Timestamp.fromDate(new Date(c,t,31))})).length};return Object(b.jsxs)(j.i,{fluid:!0,className:"c-dashboard main-content-container px-4",children:[Object(b.jsx)(j.u,{noGutters:!0,className:"page-header py-4",children:Object(b.jsx)(d.a,{title:"Dashboard",subtitle:"Dashboard",className:"text-sm-left mb-3"})}),Object(b.jsxs)(j.u,{children:[Object(b.jsx)(f,{title:"Total Pending Approval",number:te.length}),Object(b.jsx)(f,{title:"Number of Users",number:F.length}),Object(b.jsx)(f,{title:"Total Revenue",number:ae}),Object(b.jsx)(f,{title:"Total Free Registerations",number:K.length}),Object(b.jsx)(f,{title:"Total Paid Registration",number:W.length}),Object(b.jsx)(f,{title:"Total Expired Users",number:"0"})]}),Object(b.jsx)(j.u,{children:Object(b.jsx)(j.h,{children:Object(b.jsx)(j.d,{children:Object(b.jsxs)(j.e,{children:[Object(b.jsxs)(j.u,{form:!0,children:[Object(b.jsx)(j.h,{md:"3"}),Object(b.jsx)(j.h,{md:"2",className:"text-right",children:"For Location"}),Object(b.jsx)(j.h,{md:"2",children:Object(b.jsxs)(j.n,{value:I,onChange:function(e){return ue(e.target.value)},children:[Object(b.jsx)("option",{value:"all",children:"All"}),S.map((function(e,t){return Object(b.jsx)("option",{value:e.name,children:e.name},t)}))]})}),Object(b.jsx)(j.h,{md:"2",children:"(All District Names)"}),Object(b.jsx)(j.h,{md:"3"})]}),Object(b.jsxs)("table",{className:"table mb-0",children:[Object(b.jsx)("thead",{children:Object(b.jsxs)("tr",{children:[Object(b.jsx)("th",{children:Object(b.jsx)(j.n,{value:c,onChange:function(e){return u(e.target.value)},children:[2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034].map((function(e,t){return Object(b.jsx)("option",{value:e,children:e},t)}))})}),Object(b.jsx)("th",{children:"Lifetime"}),Object(b.jsx)("th",{children:"Jan"}),Object(b.jsx)("th",{children:"Feb"}),Object(b.jsx)("th",{children:"Mar"}),Object(b.jsx)("th",{children:"Apr"}),Object(b.jsx)("th",{children:"May"}),Object(b.jsx)("th",{children:"Jun"}),Object(b.jsx)("th",{children:"Jul"}),Object(b.jsx)("th",{children:"Aug"}),Object(b.jsx)("th",{children:"Sep"}),Object(b.jsx)("th",{children:"Oct"}),Object(b.jsx)("th",{children:"Nov"}),Object(b.jsx)("th",{children:"Dec"})]})}),m?Object(b.jsx)(p,{}):Object(b.jsxs)("tbody",{children:[Object(b.jsxs)("tr",{children:[Object(b.jsx)("td",{children:"Total Revenue"}),Object(b.jsx)("td",{children:ae}),e.map((function(e,t){return Object(b.jsx)("td",{children:de(e)},t)}))]}),Object(b.jsxs)("tr",{children:[Object(b.jsx)("td",{children:"Registered"}),Object(b.jsx)("td",{children:F.length}),e.map((function(e,t){return Object(b.jsx)("td",{children:oe(F,e)},t)}))]}),Object(b.jsxs)("tr",{children:[Object(b.jsx)("td",{children:"Active"}),Object(b.jsx)("td",{children:G.length}),e.map((function(e,t){return Object(b.jsx)("td",{children:oe(G,e)},t)}))]}),Object(b.jsxs)("tr",{children:[Object(b.jsx)("td",{children:"Free"}),Object(b.jsx)("td",{children:K.length}),e.map((function(e,t){return Object(b.jsx)("td",{children:oe(K,e)},t)}))]}),Object(b.jsxs)("tr",{children:[Object(b.jsx)("td",{children:"Paid"}),Object(b.jsx)("td",{children:W.length}),e.map((function(e,t){return Object(b.jsx)("td",{children:oe(W,e)},t)}))]}),Object(b.jsxs)("tr",{children:[Object(b.jsx)("td",{children:"Inactive"}),Object(b.jsx)("td",{children:q.length}),e.map((function(e,t){return Object(b.jsx)("td",{children:oe(q,e)},t)}))]})]})]})]})})})})]})}}}]);
  //# sourceMappingURL=27.a6112539.chunk.js.map