1(this["webpackJsonpvuexy-react-admin-dashboard"]=this["webpackJsonpvuexy-react-admin-dashboard"]||[]).push([[78],{1156:function(e,t,n){"use strict";n.r(t);var a=n(64),c=n(8),i=n(0),s=n(1113),o=n(1188),d=n(1119),r=n(1124),l=n(52),u=n(68),p=n.n(u),m=n(72),h=n(88),j=(n(57),n(63)),b=(n(20),n(77),n(74),n(55)),f=n.n(b),v=n(66),O=n(59),x=n.n(O),I=n(60),g=n.n(I),k=n(144),_=n(3),y=g()(x.a);t.default=function(){var e,t=Object(i.useState)(!1),n=Object(c.a)(t,2),u=n[0],b=n[1],O=Object(h.i)(),x=O.dateId,I=O.date,g=Object(i.useState)([]),w=Object(c.a)(g,2),N=w[0],P=w[1],C=Object(i.useState)(),z=Object(c.a)(C,2),H=z[0],S=z[1],B=Object(i.useState)([]),E=Object(c.a)(B,2),D=E[0],J=E[1],R=Object(h.g)(),T=null===(e=Object(j.c)())||void 0===e?void 0:e.id;console.log("CHosen lista pristutnih recreation",H),console.log("CHosen lista pristutnih chosen date",D),console.log("Students",N),Object(i.useEffect)((function(){u||(b(!0),function(){var e=null,t=null,n="".concat("https://unisport-backend-prod.herokuapp.com","/recreation/get-recreations?organisationId=").concat(T);f.a.get(n).then((function(n){n.data.recreations.map((function(t){t._id===O.recreationId&&(e=t,S(t))})),e.dates.map((function(e){e._id===x&&(t=e,J(e))}));var a=O.date;f.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/students-of-date"),{recreationId:e._id,dateId:t._id,day:parseInt(a.slice(8,10),10),month:parseInt(a.slice(5,7),10)}).then((function(n){var c=n.data.students;f.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/get-single-term"),{recreationId:e._id,dateId:t._id,day:parseInt(a.slice(8,10),10),month:parseInt(a.slice(5,7),10)}).then((function(e){e.data.attendance}));var i=parseInt(O.date.slice(8,10),10),s=parseInt(O.date.slice(5,7),10);e.attendance.map((function(e){e.dateId==O.dateId&&e.day==i&&e.month==s&&e.userIds.map((function(e){c=c.map((function(t){return t._id===e.student&&(t.attended=e.attended),t}))}))})),P(c)}))}))}())}),[]);var A=[{name:"Ime i prezime",selector:"name",cell:function(e){return Object(_.jsx)("span",{children:e.name+" "+e.surname})}},{name:"Odabir",selector:"is_checked",cell:function(e){return!0===e.attended?Object(_.jsx)(s.a,{className:"text-capitalize justify-content-center text-center align-content-center",color:"light-success",pill:!0,children:Object(_.jsx)("span",{children:"Prisutan"})}):!1===e.attended?Object(_.jsx)(s.a,{className:"text-capitalize justify-content-center text-center align-content-center",color:"warning",pill:!0,children:Object(_.jsx)("span",{children:"Izostanak"})}):Object(_.jsx)(o.a,{className:"custom-control-info",id:"".concat(e.id,"myvalue").concat(e._id,"test"),type:"checkbox",checked:e.is_checked,onChange:function(t){var n=Object(a.a)(N);n=n.map((function(t){return t&&e&&t._id===e._id&&(t.is_checked=!t.is_checked),t})),P(Object(a.a)(n))}})}}];return Object(_.jsx)(i.Fragment,{children:Object(_.jsx)("div",{style:{minWidth:"90%",overflow:scroll},className:"app-user-list",children:Object(_.jsxs)(d.a,{style:{overflowY:"scroll"},children:[Object(_.jsx)("div",{style:{margin:"25px"},className:"row",children:Object(_.jsx)(r.a,{md:4,children:Object(_.jsx)(l.a.Ripple,{color:"primary",onClick:function(){var e=[["Ime","Prezime","Email","Telefon","Prisutan/na"]];N.map((function(t){var n=[t.name,t.surname,t.email,t.phone,t.attended?"DA":""];e.push(n)}));var t=Object(k.a)(e);Object(k.c)(t,(null===H||void 0===H?void 0:H.name)+".csv","text/csv;charset=utf-8;")},children:"Export svih prijavljenih"})})}),Object(_.jsx)(p.a,{paginationRowsPerPageOptions:[10,20,30,40,50],paginationPerPage:50,noHeader:!0,subHeader:!0,responsive:!0,pagination:!0,columns:A,className:"react-dataTable",data:N,subHeaderComponent:Object(_.jsx)(m.a,{hideNewButton:!0,name:(null===H||void 0===H?void 0:H.name)+" (".concat(I,") - Prisutni")})}),Object(_.jsx)(v.a,{forwardLabel:"Odaberi",forwardClick:function(){var e=[];N.map((function(t){t.is_checked&&void 0===t.attended?e.push({student:t._id,attended:!0}):void 0===t.attended&&e.push({student:t._id,attended:!1})}));var t=O.date;f.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/post-recreation-attendance"),{recreationId:O.recreationId,attendance:{userIds:e,dateId:D._id,day:parseInt(t.slice(8,10),10),month:parseInt(t.slice(5,7),10)}}).then((function(e){y.fire({icon:"success",title:"Uspje\u0161no",text:"Dodana prisutnost",customClass:{confirmButton:"btn btn-success"}}).then((function(){R.goBack()}))})).catch((function(){window.alert("Nesto je poslo po krivu. Molim probajte ponovno.")}))}})]})})})}}}]); 2//# sourceMappingURL=78.f158a9dd.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.