(this.webpackJsonpadmin=this.webpackJsonpadmin||[]).push([[23],{626:function(e,t,c){"use strict";var n=c(642);n.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"}),n.a.analytics(),t.a=n.a},937:function(e,t,c){"use strict";c.r(t);var n=c(643),a=c(43),i=c(623),s=c(1),r=c.n(s),d=c(627),o=c(644),j=c(650),l=(c(938),c(976),c(626)),b=(c(977),c(20));t.default=function(e){var t=Object(s.useState)([]),c=Object(i.a)(t,2),h=c[0],u=c[1],O=r.a.useState("Calendar_".concat((new Date).toLocaleDateString(),"_").concat((new Date).toLocaleTimeString(),".csv")),f=Object(i.a)(O,2),p=f[0],x=f[1],m=Object(s.useState)([]),k=Object(i.a)(m,2),S=k[0],v=k[1],g=r.a.useState(!1),D=Object(i.a)(g,2),L=D[0],y=D[1],C=r.a.useState([]),T=Object(i.a)(C,2),E=T[0],_=T[1];Object(s.useEffect)((function(){l.a.firestore().collection("event").onSnapshot((function(t){var c=t.docs.map((function(e){return Object(a.a)(Object(a.a)({},e.data()),{},{id:e.id})})).filter((function(t){return t.calendarId===e.match.params.id}));u(c),_(c)}))}),[e.match.params.id]),Object(s.useEffect)((function(){if(h.length>0){for(var e=[],t=function(t){var c={Title:h[t].subject_title,"Start Date":h[t].start_date,"Start Time":h[t].start_time,"End Date":h[t].end_date,"End Time":h[t].end_time,"All Day Event":h[t].all_day_event,Location:h[t].location,Repeat:h[t].repeat,Alert:h[t].alert,Tags:h[t].tags};Object.keys(h[t].descriptions).sort().map((function(e){c[e]=h[t].descriptions[e]})),e.push(c)},c=0;c<h.length;c++)t(c);v(e)}}),[h]);return Object(b.jsxs)("div",{className:"c-eventList",children:[Object(b.jsxs)("p",{children:[Object(b.jsxs)(j.CSVLink,{className:"btn btn-primary",filename:p,data:S,onClick:function(){x("Calendar_".concat((new Date).toLocaleDateString(),"_").concat((new Date).toLocaleTimeString(),".csv"))},children:[Object(b.jsx)(o.a,{}),"\xa0 Download"]}),Object(b.jsx)("button",{className:"btn btn-primary pull-right",onClick:function(){!function(){if(window.confirm("Are you sure you want to delete this record?"))for(var e=E.filter((function(e){return!0===e.isChecked})),t=l.a.firestore(),c=0;c<e.length;c++)t.collection("event").doc(e[c].id).delete();else console.log("no")}()},children:"Delete Selected"})]}),Object(b.jsxs)("table",{id:"customers",children:[Object(b.jsx)("thead",{children:Object(b.jsxs)("tr",{children:[Object(b.jsx)("th",{className:"checkboxLeftPadding",children:Object(b.jsx)(d.k,{className:"eventListFixPositionOfCheckBox",checked:L,onChange:function(e){return function(e){y(!L);var t=Object(n.a)(E);t.forEach((function(e){e.isChecked=!L})),_(t)}()}})}),Object(b.jsx)("th",{children:"Title"}),Object(b.jsx)("th",{children:"Start Date"}),Object(b.jsx)("th",{children:"Start Time"}),Object(b.jsx)("th",{children:"End Date"}),Object(b.jsx)("th",{}),Object(b.jsx)("th",{children:"End Time"}),Object(b.jsx)("th",{children:"All Day Event"}),Object(b.jsx)("th",{children:"Location"}),Object(b.jsx)("th",{children:"Repeat"}),Object(b.jsx)("th",{children:"Alert"}),Object(b.jsx)("th",{children:"Tags"}),h[0]?Object.keys(h[0].descriptions).sort().map((function(e){return Object(b.jsx)("th",{children:e})})):null]})}),Object(b.jsx)("tbody",{children:h.map((function(e,t){return Object(b.jsxs)("tr",{children:[Object(b.jsx)("td",{className:"checkboxLeftPadding",children:Object(b.jsx)(d.k,{checked:e.isChecked,className:"eventListFixPositionOfCheckBox",onChange:function(t){return function(e,t){var c=E.findIndex((function(e){return e.id===t})),a=Object(n.a)(E);a[c].isChecked=!a[c].isChecked,_(a)}(0,e.id)}})}),Object(b.jsx)("td",{children:e["Subject ( Title )"]}),Object(b.jsx)("td",{children:e["Start Date"]}),Object(b.jsx)("td",{children:e["Start Time"]}),Object(b.jsx)("td",{children:e["End Date"]}),Object(b.jsx)("td",{}),Object(b.jsx)("td",{children:e["End Time"]}),Object(b.jsx)("td",{children:e["All Day Event "]}),Object(b.jsx)("td",{children:e.Location}),Object(b.jsx)("td",{children:e["Repeat "]}),Object(b.jsx)("td",{children:e["Alert "]}),Object(b.jsx)("td",{children:e.Tags}),Object.keys(e.descriptions).sort().map((function(t){return Object(b.jsx)("td",{children:e.descriptions[t]?e.descriptions[t]:"NULL"})}))]},t)}))})]})]})}},963:function(e,t){},965:function(e,t){},977:function(e,t,c){}}]);
//# sourceMappingURL=23.40bab71c.chunk.js.map