1(this["webpackJsonpvuexy-react-admin-dashboard"]=this["webpackJsonpvuexy-react-admin-dashboard"]||[]).push([[34],{1184:function(e,t,n){"use strict";n.r(t),n.d(t,"ADMIN",(function(){return U}));var c=n(8),a=n(0),i=(n(20),n(82),n(1113)),s=n(1119),o=n(1120),r=n(1121),l=n(1122),d=n(1123),j=n(1124),u=n(1130),b=n(68),m=n.n(b),p=n(88),O=n(55),h=n.n(O),x=n(57),f=(n(85),n(72)),g=(n(185),n(1)),v=n(1190),k=n(1128),N=n(1129),C=n(1131),y=n(52),w=n(59),S=n.n(w),B=n(60),P=n.n(B),I=n(62),F=n(3),D=(P()(S.a),function(e){var t=e.toggle,n=e.isOpen,i=(e.constituents,e.setConstituents,Object(a.useState)({label:"Odaberi rolu",value:"Odaberi rolu"})),s=Object(c.a)(i,2),o=s[0],r=s[1],l=Object(a.useState)(""),d=Object(c.a)(l,2),j=d[0],b=d[1],m=Object(a.useState)(""),p=Object(c.a)(m,2),O=p[0],f=p[1],w=Object(a.useState)([]),S=Object(c.a)(w,2),B=S[0],P=S[1],D=Object(a.useState)([]),A=Object(c.a)(D,2),_=A[0],R=A[1],z=Object(a.useState)([]),T=Object(c.a)(z,2),M=T[0],U=T[1],E=Object(a.useState)([]),K=Object(c.a)(E,2),L=K[0],J=K[1],Y=Object(a.useState)([{label:"Super admin",value:"super admin"},{label:"Tehni\u010dki delegat",value:"tehnicki delegat"},{label:"student",value:"student"},{label:"team admin",value:"team admin"}]),H=Object(c.a)(Y,2),G=H[0],V=(H[1],Object(a.useState)(!1)),W=Object(c.a)(V,2),q=W[0];W[1];return Object(a.useEffect)((function(){h.a.get("".concat("https://unisport-backend-prod.herokuapp.com","/admin/organisations")).then((function(e){var t=e.data.organisations;console.log(t),t=t.map((function(e){return{value:e.name,label:e.name}})),R(t)})),h.a.get("".concat("https://unisport-backend-prod.herokuapp.com","/admin/sports")).then((function(e){var t=e.data.sports;console.log(t),t=t.map((function(e){return{value:e,label:e}})),P(t)}))}),[]),Object(F.jsxs)(v.a,{isOpen:n,toggle:t,children:[Object(F.jsxs)(k.a,{toggle:t,children:["Dodavanje korisnika na rolu - ",e.role]}),Object(F.jsxs)(N.a,{children:[Object(F.jsx)(u.a,{placeholder:"Ime",theme:x.d,className:"react-select",classNamePrefix:"select",invalid:""===j&&q,value:j,onChange:function(e){b(e.target.value)}}),Object(F.jsx)("br",{}),Object(F.jsx)(u.a,{placeholder:"Prezime",theme:x.d,className:"react-select",classNamePrefix:"select",invalid:""===j&&q,value:O,onChange:function(e){f(e.target.value)}}),Object(F.jsx)("br",{}),Object(F.jsx)(I.a,{theme:x.d,className:"react-select",classNamePrefix:"select",value:o,styles:{control:function(e){return Object(g.a)(Object(g.a)({},e),{},{borderColor:q&&""===o?"red":e.borderColor,"&:hover":{borderColor:q&&""===o?"red":e["&:hover"].borderColor}})}},onChange:function(e){r(e)},name:"clear",options:G,isClearable:!1}),Object(F.jsx)("br",{}),Object(F.jsx)("h5",{children:"Prava"}),Object(F.jsx)(I.a,{theme:x.d,className:"react-select",classNamePrefix:"select",value:L,isMulti:!0,styles:{control:function(e){return Object(g.a)(Object(g.a)({},e),{},{borderColor:q&&""===L?"red":e.borderColor,"&:hover":{borderColor:q&&""===L?"red":e["&:hover"].borderColor}})}},onChange:function(e){J(e)},name:"clear",options:_,isClearable:!1}),Object(F.jsx)("br",{}),Object(F.jsx)("h5",{style:{marginTop:"30px"},children:"Sportovi"}),Object(F.jsx)(I.a,{theme:x.d,className:"react-select",classNamePrefix:"select",isMulti:!0,value:M,styles:{control:function(e){return Object(g.a)(Object(g.a)({},e),{},{borderColor:q&&""===M?"red":e.borderColor,"&:hover":{borderColor:q&&""===o?"red":e["&:hover"].borderColor}})}},onChange:function(e){U(e)},name:"clear",options:B,isClearable:!1}),Object(F.jsx)("br",{})]}),Object(F.jsx)(C.a,{children:Object(F.jsxs)("div",{className:"row justify-content-center text-center",style:{width:"100%"},children:[Object(F.jsx)("div",{className:"col",children:Object(F.jsx)(y.a.Ripple,{onClick:function(){e.toggle()},type:"submit",color:"danger",className:"btn-next",children:Object(F.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odustani"})})}),Object(F.jsx)("div",{className:"col",children:Object(F.jsx)(y.a.Ripple,{onClick:function(){window.alert("work in progress")},type:"submit",color:"primary",className:"btn-next",children:Object(F.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Kreiraj"})})})]})})]})}),A=(n(124),n(177),n(175)),_=n(430),R=n(406),z=(n(65),n(63)),T=P()(S.a),M=function(e){var t=e.toggle,n=e.isOpen,i=e.selectedUser,s=Object(a.useState)(!1),o=Object(c.a)(s,2),r=o[0],l=o[1],u=Object(a.useState)(null),b=Object(c.a)(u,2),m=b[0],p=b[1],O=Object(a.useState)([]),x=Object(c.a)(O,2),f=x[0],g=x[1],C=Object(a.useState)(!1),y=Object(c.a)(C,2),w=y[0],S=y[1];if(Object(a.useEffect)((function(){h.a.get("".concat("https://unisport-backend-prod.herokuapp.com","/admin/get-user?userId=").concat(i)).then((function(e){console.log(e),p(e.data.user);var t="".concat("https://unisport-backend-prod.herokuapp.com","/admin/constituents"),n=Object(z.b)();t+="?org=".concat(n,"&withoutTeams=true"),h.a.get(t).then((function(t){g(t.data.constituents),S(!0),t.data.constituents.map((function(t){t._id===e.data.user.constituent&&l(t)}))}
1))}))}),[i]),!m||!w)return Object(F.jsxs)(v.a,{isOpen:n,children:[Object(F.jsx)(k.a,{children:"U\u010ditavanje..."}),Object(F.jsx)(N.a,{children:Object(F.jsx)(_.a,{})})]});var B=[];m.role.map((function(e){"team admin"!==e&&"team leader"!==e&&B.push({name:e,constituent:r?r.name:null,constituentId:r?r._id:null})})),m.teamAdminConstituents&&m.teamAdminConstituents.length>0&&m.teamAdminConstituents.map((function(e){f.map((function(t){t._id===e&&B.push({name:"team admin",constituent:t.name,constituentId:t._id})}))})),m.roleForSports&&m.roleForSports.length>0?m.roleForSports.map((function(e){e.rights&&"team leader"===e.role&&e.rights.length>0&&e.rights.map((function(e){e.sports&&e.sports.map&&e.sports.map((function(t){var n="";f.map((function(t){t._id===e.constituent&&(n=t.name)})),B.push({name:"team leader",constituent:n,constituentId:e.constituent,sport:t})}))}))})):m.teamLeaderConstituents&&m.teamLeaderConstituents.length>0&&m.teamLeaderConstituents.map((function(e){f.map((function(t){t._id===e&&B.push({name:"team leader",constituent:t.name,constituentId:t._id})}))}));return Object(F.jsxs)(v.a,{isOpen:n,toggle:t,children:[Object(F.jsxs)(k.a,{toggle:function(){p(null),t()},children:["Role korisnika - ",m.name," ",m.surname]}),Object(F.jsx)(N.a,{children:B.map((function(n){return(!Object(z.u)()||Object(z.i)()||Object(z.t)()||"team leader"===n.name||"team admin"===n.name)&&(!Object(z.u)()||Object(z.i)()||Object(z.t)()||n.constituentId==Object(z.e)())?Object(F.jsxs)(d.a,{style:{marginBottom:"29px"},children:[Object(F.jsxs)(j.a,{md:6,children:["team leader"!=n.name?n.name:"voditelj teama",("team admin"===n.name||"team leader"===n.name)&&Object(F.jsxs)("span",{children:[" (",n.constituent,")"]}
1),n.sport&&Object(F.jsxs)("span",{children:[" - ",n.sport]})]}),Object(F.jsx)(j.a,{md:2,children:"user"!==n.name&&"super admin"!==n.name&&(c=n.constituentId,!(!Object(z.t)()&&!Object(z.i)())||!(Object(z.v)()&&!Object(z.u)())&&!(!Object(z.u)()||c!=Object(z.e)()))&&Object(F.jsx)(R.a,{style:{cursor:"pointer",marginLeft:"50px"},onClick:function(c){T.fire({title:"Jeste li sigurni",text:"Klikom na gumb Potvrdi user \u0107e biti maknut sa role",icon:"warning",showCancelButton:!0,confirmButtonText:"Potvrdi",cancelButtonText:"Odustani",customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-danger ml-1"},buttonsStyling:!1}).then((function(c){if(c.value){var a={userId:m._id,constituentId:n.constituentId,role:n.name};n.sport&&(a.sports=[n.sport]),a.rights=[],h.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/remove-role"),a).then((function(n){T.fire({icon:"success",title:"Uspje\u0161no",text:"User maknut sa role.",customClass:{confirmButton:"btn btn-success"}}),p(null),t(),e.fetchFreshData()})).catch((function(e){return console.log(e)}))}}))},size:17})})]}):null;var c}))})]})},U="admin";t.default=function(){var e=Object(a.useState)([]),t=Object(c.a)(e,2),n=t[0],b=t[1],O=Object(a.useState)([]),g=Object(c.a)(O,2),v=(g[0],g[1]),k=Object(a.useState)(!1),N=Object(c.a)(k,2),C=N[0],y=N[1],w=Object(a.useState)(!1),S=Object(c.a)(w,2),B=S[0],P=S[1],_=Object(a.useState)(!1),R=Object(c.a)(_,2),T=R[0],U=R[1],E=Object(a.useState)(null),K=Object(c.a)(E,2),L=K[0],J=K[1],Y=Object(a.useState)(!1),H=Object(c.a)(Y,2),G=H[0],V=H[1],W=Object(a.useState)(""),q=Object(c.a)(W,2),Q=q[0],X=q[1],Z=Object(a.useState)(""),$=Object(c.a)(Z,2),ee=$[0],te=$[1],ne=Object(a.useState)(null),ce=Object(c.a)(ne,2),ae=ce[0],ie=ce[1],se=Object(p.g)(),oe=function(){var e="".concat("https://unisport-backend-prod.herokuapp.com","/admin/get-users");h.a.get(e).then((function(e){var t=e.data.users;Object(x.a)().userData.role.includes("super admin")||"developer"===Object(x.a)().userData.name||(t=t.filter((function(e){return!e.role.includes("super admin")&&"developer"!==e.name}))),b(t),v(t)}))};Object(a.useEffect)((function(){0==n.length&&oe()}));var re=[{name:"Naziv",selector:"name",sortable:!0,cell:function(e){return Object(F.jsxs)("span",{children:[e.name," ",e.surname]})}},{name:"Email",selector:"email",sortable:!0},{name:"Status profila",selector:"isApproved",sortable:!0,cell:function(e){return"waiting"===e.isApproved?Object(F.jsx)(i.a,{color:"light-primary",children:"\u010ceka odobrenje"}):"false"===e.isApproved?Object(F.jsx)(i.a,{color:"light-warning",children:"Odbijeno"}):"true"===e.isApproved?Object(F.jsx)(i.a,{color:"light-success",children:"Odobreno"}):void 0}},{name:"Odobrenje profila",selector:"",sortable:!0,cell:function(e){var t="Odobri/odbij profil";return"waiting"===e.isApproved&&Object(z.t)()||(t="Detalji"),Object(F.jsx)("span",{onClick:function(){V(!1),J(e),setTimeout((function(){P(!0)}),0)},style:{color:"blue",cursor:"pointer"},children:t})}},{name:"",selector:"",sortable:!0,cell:function(e){return Object(F.jsx)("span",{onClick:function(){J(e),setTimeout((function(){U(!0)}),0)},style:{color:"blue",cursor:"pointer"},children:"Role"})}}];return Object(z.s)()&&re.push({name:"",selector:"",sortable:!0,cell:function(e){return Object(F.jsx)("span",{onClick:function(){se.push("/korisnicki-profil/"+e._id)},style:{color:"blue",cursor:"pointer"},children:"Izmijeni detalje usera"})}}),Object(F.jsxs)(a.Fragment,{children:[null!=L&&Object(F.jsx)(A.a,{isNatjecanjaOdobrenje:G,fetchFreshData:oe,selectedUser:L._id,isOpen:B,toggle:function(){J(null),P(!B)}}),null!=L&&Object(F.jsx)(M,{fetchFreshData:oe,selectedUser:L._id,isOpen:T,toggle:function(){J(null),U(!T)}}),Object(F.jsx)(D,{toggle:function(){y(!C)},isOpen:C}),Object(F.jsxs)("div",{style:{minWidth:"90%",overflow:"scroll"},className:"app-user-list",children:[Object(F.jsxs)(s.a,{children:[Object(F.jsx)(o.a,{children:Object(F.jsx)(r.a,{tag:"h4",children:"Filter"})}),Object(F.jsx)(l.a,{children:Object(F.jsxs)(d.a,{children:[Object(F.jsx)(j.a,{md:"4",children:Object(F.jsx)(u.a,{placeholder:"Tra\u017ei korisnika po imenu i prezimenu",theme:x.d,className:"react-select",classNamePrefix:"select",value:Q,onChange:function(e){X(e.target.value)}})}),Object(F.jsx)(j.a,{md:"4",children:Object(F.jsx)(I.a,{isClearable:!0,theme:x.d,className:"react-select",classNamePrefix:"select",placeholder:"Filtriraj po statusu profila",options:[{value:"true",label:"Odobreno"},{value:"false",label:"Odbijeno"},{value:"waiting",label:"\u010ceka odobrenje"}],value:ae,onChange:function(e){ie(e)}})}),Object(F.jsx)(j.a,{md:"2",children:Object(F.jsx)(u.a,{placeholder:"Tra\u017ei korisnika po Unisport ID-u",theme:x.d,type:"number",className:"react-select",classNamePrefix:"select",value:ee,onChange:function(e){te(e.target.value)}})})]})})]}),Object(F.jsx)(s.a,{style:{overflowY:"scroll"},children:Object(F.jsx)(m.a,{paginationRowsPerPageOptions:[10,20,30,40,50],paginationPerPage:50,defaultSortField:"createdAt",defaultSortAsc:!1,noHeader:!0,subHeader:!0,pagination:!0,responsive:!0,columns:re,className:"react-dataTable",data:n.filter((function(e){if(null!=ae&&ae.value&&ae.value!=e.isApproved)return!1;var t=""===Q||!!(e.name.toLowerCase().includes(Q.toLowerCase())||(e.name.toLowerCase()+" "+e.surname.toLowerCase()).includes(Q.toLowerCase())||e.surname.toLowerCase().includes(Q.toLowerCase()));return(""===ee||e.unisportId.toString().includes(ee.trim()))&&t})),subHeaderComponent:Object(F.jsx)(f.a,{hideNewButton:!0,name:"Korisnici",new:"Novi korisnik",onClick:function(){y(!0)}})})})]})]})}},124:function(e,t,n){"use strict";var c=n(8),a=n(0),i=n(1190),s=n(1128),o=n(1129),r=n(1113),l=n(1130),d=n(1131),j=n(52),u=n(55),b=n.n(u),m=n(394),p=n(59),O=n.n(p),h=n(60),x=n.n(h),f=n(3),g=x()(O.a);t.a=function(e){var t=e.toggle,n=e.isOpen,u=e.selectedApplication,p=Object(a.useState)(!1),O
1=Object(c.a)(p,2),h=O[0],x=O[1],v=u&&(null==u.status||"approved"!=u.status&&"rejected"!=u.status),k=u&&"approved"==u.status,N=u&&"rejected"==u.status,C=u&&u.comment?u.comment:"",y=Object(a.useState)(C),w=Object(c.a)(y,2),S=w[0],B=w[1];if(!u)return null;var P=function(){g.fire({title:"Jeste li sigurni",text:"Klikom na gumb Yes prijava \u0107e biti odbijena",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes",customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-danger ml-1"},buttonsStyling:!1}).then((function(t){t.value&&b.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/reject-application?"),{applicationId:e.selectedApplication._id,comment:S}).then((function(t){g.fire({icon:"success",title:"Uspje\u0161no",text:"Prijava odbijena.",customClass:{confirmButton:"btn btn-success"}}),x(!1),e.fetchFreshData(),e.hide()})).catch((function(){window.alert("Nesto je poslo po krivu. Molim probajte ponovno.")}))}))},I=function(){g.fire({title:"Jeste li sigurni",text:"Klikom na gumb Yes prijava \u0107e biti odobrena",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes",customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-danger ml-1"},buttonsStyling:!1}).then((function(t){t.value&&b.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/approve-application"),{applicationId:e.selectedApplication._id,comment:S}).then((function(t){g.fire({icon:"success",title:"Uspje\u0161no",text:"Prijava odobrena.",customClass:{confirmButton:"btn btn-success"}}),x(!1),e.fetchFreshData(),e.hide()})).catch((function(){window.alert("Nesto je poslo po krivu. Molim probajte ponovno.")}))}))};return Object(f.jsxs)(i.a,{isOpen:n,toggle:t,children:[Object(f.jsx)(s.a,{toggle:function(){x(!1),t()},children:"Odobri team"}),Object(f.jsxs)(o.a,{children:[Object(f.jsxs)("div",{className:"row justify-content-center text-center align-content-center",children:[k&&Object(f.jsx)(r.a,{style:{padding:"10px",margin:"20px"},className:"text-capitalize justify-content-center text-center align-content-center",color:"light-success",pill:!0,children:Object(f.jsx)("span",{children:"Odobreno"})}),N&&Object(f.jsx)(r.a,{style:{padding:"10px",margin:"20px"},className:"text-capitalize justify-content-center text-center align-content-center",color:"light-warning",pill:!0,children:Object(f.jsx)("span",{children:"Odbijeno"})})]}),Object(f.jsxs)("div",{style:{marginBottom:"90px"},className:"row justify-content-center text-center",children:[Object(f.jsxs)("div",{className:"col justify-content-center text-center",children:[Object(f.jsx)("h3",{children:"Op\u0107i podaci"}),Object(f.jsx)("br",{}),Object(f.jsxs)("h6",{children:["Naziv: ",u.constituent.name]}),Object(f.jsxs)("h6",{children:["Organizacija: ",u.constituent.organisation.name]})]}),Object(f.jsxs)("div",{className:"col justify-content-center text-center",children:[Object(f.jsx)("h3",{children:"Kontakt osobe"}),Object(f.jsx)("br",{}),u&&u.contacts.map((function(e){return console.log(e),Object(f.jsxs)("div",{children:[Object(f.jsxs)("h4",{children:[e.name," ",e.surname]}),Object(f.jsxs)("h6",{children:["Broj: ",e.mobile]}),Object(f.jsxs)("h6",{children:["Funkcija: ",e.function]}),Object(f.jsxs)("h6",{children:["Email: ",e.email]}),Object(f.jsx)("br",{})]})}))]})]}),Object(f.jsx)("div",{style:{marginBottom:"90px"},className:"row justify-content-center text-center",children:Object(f.jsx)(l.a,{type:"textarea",style:{width:"85%",height:"90px"},placeholder:"Komentar",value:S,onChange:function(e){B(e.target.value)}})})]}),Object(f.jsx)(d.a,{children:Object(f.jsxs)("div",{className:"row justify-content-center text-center",style:{width:"100%"},children:[!v&&!h&&Object(f.jsx)(a.Fragment,{children:Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{type:"submit",color:"primary",className:"btn-next",onClick:function(){x(!0)},children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Izmijeni"})})})}),!v&&h&&Object(f.jsxs)(a.Fragment,{children:[Object(f.jsx)("div",{className:"col",children:Object(f.jsxs)(j.a.Ripple,{onClick:function(){x(!1)},color:"secondary",className:"btn-prev",outline:!0,children:[Object(f.jsx)(m.a,{size:14,className:"align-middle mr-sm-25 mr-0"}),Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Povratak"})]})}),Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{type:"submit",color:N?"primary":"danger",className:"btn-next",onClick:function(){N?I():P()},children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:N?"Odobri prijavu":"Odbij prijavu"})})})]}),v&&Object(f.jsxs)(a.Fragment,{children:[Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{type:"submit",color:"danger",className:"btn-next",onClick:P,children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odbij"})})}),Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{onClick:I,type:"submit",color:"primary",className:"btn-next",children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odobri"})})})]})]})})]})}},175:function(e,t,n){"use strict";var c=n(8),a=n(0),i=n(1190),s=n(1128),o=n(1129),r=n(1113),l=n(1130),d=n(1131),j=n(52),u=n(55),b=n.n(u),m=n(394),p=n(59),O=n.n(p),h=n(60),x=n.n(h),f=(n(65),n(63)),g=n(3),v=x()(O.a);t.a=function(e){var t=e.toggle,n=e.isOpen,u=e.isNatjecanjaOdobrenje,p=e.selectedUser,O=Object(a.useState)(null),h=Object(c.a)(O,2),x=h[0],k=h[1],N=Object(a.useState)(!1),C=Object(c.a)(N,2),y=C[0],w=C[1],S=Object(a.useState)(null),B=Object(c.a)(S,2),P=B[0],I=B[1],F=x&&(null==x.isApproved||"waiting"===x.isApproved),D=x&&"true"===x.isApproved,A=x&&"false"===x.isApproved;u&&(D=x&&x.approvedForCompetitions&&"true"===x.approvedForCompetitions.flag,A=x&&x.approvedForCompetitions&&"false"===x.approvedForCompetitions.flag,F=!D&&!A);var _=x&&x.comment?x.comment:"",R=Object(a.useState)(_),z=Object(c.a)(R,2),T=z[0],M=z[1],U=Object(a.useState)(null),E=Object(c.a)(U,2),K=E[0],L=E[1];Object(a.useEffect)((function(){var e="".concat("https://unisport-backend-prod.herokuapp.com","/admin/constituents"),t=Object(f.b)();e+="?org=".concat(t,"&withoutTeams=true"),b.a.get("".concat("https://unisport-backend-prod.herokuapp.com","/admin/get-user?userId=").concat(p)).then((function(t){k(t.data.user),null==P?b.a.get(e).then((function(e){I(e.data.constituents),e.data.constituents.map((function(e){e._id===t.data.user.constituent&&L(e)}))})):P.map((function(e){e._id===t.data.user.constituent&&L(e)}))}))}),[p]);var J=function(){v.fire({title:"Jeste li sigurni",text:u?"Klikom na gumb Potvrdi korisnik \u0107e biti odbijen za natjecanja":"Klikom na gumb Potvrdi profil \u0107e biti odbijen",icon:"warning",showCancelButton:!0,confirmButtonText:"Potvrdi",cancelButtonText:"Odustani",customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-danger ml-1"},buttonsStyling:!1}).then((function(n){if(n.value){var c="reject-user";u&&(c="/approve-for-competitions"),b.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/").concat(c,"?"),{user:x._id,userId:x._id,flag:!1,comment:T}).then((function(n){v.fire({icon:"success",title:"Uspje\u0161no",text:u?"Odbijen korisnik za natjecanja":"Odbijen profil",customClass:{confirmButton:"btn btn-success"}}),M(""),k(null),t(),e.fetchFreshData()})).catch((function(e){console.log(e),window.alert("Nesto je poslo po krivu. Molim probajte ponovno.")}))}}))},Y=function(){v.fire({title:"Jeste li sigurni",text:u?"Klikom na gumb Da korisnik \u0107e biti odobren za
1natjecanja":"Klikom na gumb Da korisnikov profil \u0107e biti odobren",icon:"warning",showCancelButton:!0,confirmButtonText:"Da",customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-danger ml-1"},buttonsStyling:!1}).then((function(n){if(n.value){var c="approve-user";u&&(c="approve-for-competitions"),b.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/").concat(c),{user:x._id,userId:x._id,flag:!0,comment:T}).then((function(n){v.fire({icon:"success",title:"Uspje\u0161no",text:"Odobreno",customClass:{confirmButton:"btn btn-success"}}),M(""),t(),k(null),e.fetchFreshData()})).catch((function(e){console.log(e),window.alert("Nesto je poslo po krivu. Molim probajte ponovno.")}))}}))};if(!x)return null;var H=[];e.selectedTeam&&e.selectedTeam.disciplines&&e.selectedTeam.disciplines&&e.selectedTeam.disciplines.length>0&&e.selectedTeam.disciplines.map((function(e){e.player===x._id&&H.push(e.discipline)}));var G=x.profilePhoto?x.profilePhoto.split("/"):[""];return Object(g.jsxs)(i.a,{isOpen:n,toggle:t,children:[Object(g.jsxs)(s.a,{toggle:function(){w(!1),k(null),t()},children:["Odobri korisnika - ",x.name," ",x.surname]}),Object(g.jsxs)(o.a,{children:[Object(g.jsxs)("div",{className:"row justify-content-center text-center align-content-center",children:[x&&"true"===x.isApproved&&!e.viewOnly&&Object(g.jsx)(r.a,{style:{padding:"10px",margin:"20px"},className:"text-capitalize justify-content-center text-center align-content-center",color:"light-success",pill:!0,children:Object(g.jsx)("span",{children:"Profil odobren"})}),x&&"false"===x.isApproved&&Object(g.jsx)(r.a,{style:{padding:"10px",margin:"20px"},className:"text-capitalize justify-content-center text-center align-content-center",color:"light-warning",pill:!0,children:Object(g.jsx)("span",{children:"Profil odbijen"})})]}),Object(g.jsx)("div",{style:{marginBottom:"90px"},className:"row justify-content-center text-center",children:Object(g.jsxs)("div",{className:"col justify-content-center text-center",children:[Object(g.jsx)("h3",{children:"Op\u0107i podaci"}),Object(g.jsx)("br",{}),Object(g.jsxs)("h6",{children:["Ime korisnika: ",x.name," ",x.surname]}),x.unisportId&&Object(g.jsxs)("div",{children:["Unisport ID: ",x.unisportId]}),K&&Object(g.jsxs)("div",{children:["Fakultet: ",K.shortName?K.shortName:K.name]}),x.status&&Object(g.jsxs)("div",{children:["Studentski status: ",x.status]}),x.carnetResponse&&x.carnetResponse.map&&x.carnetResponse.length>0&&Object(g.jsxs)("div",{children:[Object(g.jsx)("br",{}),Object(g.jsx)("div",{children:Object(g.jsx)("h5",{children:"SRCE podaci:"})}),x.carnetResponse.map((function(e){if("dc"===e.fieldName||"hrEduOrgMember"===e.fieldName||"hrEduPersonHomeOrg"===e.fieldName||"o"===e.fieldName||"cn"===e.fieldName||"hrEduPersonExpireDate"===e.fieldName){var t=e.value;try{t.length>100&&(t=t.substring(0,100))}catch(n){}if("hrEduPersonExpireDate"===e.fieldName)try{t=t.slice(0,4)+"-"+t.slice(4,6)+"-"+t.slice(6,8)}catch(n){}return Object(g.jsxs)("span",{children:[e.fieldName,": ",t," ",Object(g.jsx)("br",{})]})}return null})),Object(g.jsx)("br",{}),Object(g.jsx)("hr",{}),Object(g.jsx)("br",{})]}),Object(f.t)()&&Object(g.jsxs)("div",{children:["Nacionalnost: ",x.nationality]}),Object(f.t)()&&Object(g.jsxs)("div",{children:["OIB: ",x.oib]}),Object(g.jsxs)("div",{children:["Velicina majice: ",x.shirtSize]}),Object(f.t)()&&Object(g.jsxs)("div",{children:["Datum ro\u0111enja: ",x.birthDate.slice(0,10)]}),(Object(f.h)()||Object(f.u)()||Object(f.v)()||Object(f.m)())&&Object(g.jsxs)("div",{children:["Godina ro\u0111enja: ",function(){var e=function(){if(x&&x.birthDate)return new Date(x.birthDate)}();return e?e.getFullYear():null}()]}),Object(f.t)()&&Object(g.jsxs)("div",{children:["Mjesto ro\u0111enja: ",x.birthLocation]}),Object(f.t)()&&Object(g.jsxs)("div",{children:["Mobitel: ",x.phone]}),Object(f.t)()&&Object(g.jsxs)("div",{children:["Email: ",x.email]}),Object(g.jsx)("br",{}),Object(g.jsxs)("div",{children:[Object(g.jsx)("h5",{children:"Dokumenti"}),x.files&&x.files.map((function(e){var t=e.split("/");return Object(g.jsxs)(a.Fragment,{children:[Object(g.jsx)("a",{target:"_blank",href:e,children:t[t.length-1]}),Object(g.jsx)("br",{})]})}))]}),x.profilePhoto&&Object(g.jsxs)("div",{children:[Object(g.jsx)("br",{}),Object(g.jsx)("h5",{children:"Akreditacijska fotografija (do 3 MB)"}
1),Object(g.jsx)("a",{target:"_blank",href:x.profilePhoto,children:G[G.length-1]}),Object(g.jsx)("br",{}),Object(g.jsx)("br",{}),Object(g.jsx)("img",{alt:"Profile photo",style:{width:"190px",height:"auto"},src:x.profilePhoto})]}),!e.viewOnly&&x.comments&&x.comments.length>0&&!u&&Object(g.jsxs)("div",{children:[Object(g.jsx)("br",{}),Object(g.jsx)("br",{}),Object(g.jsx)("h6",{children:"Dosada\u0161nji komentari:"}),x.comments.map((function(e){return Object(g.jsxs)("span",{children:[e,Object(g.jsx)("br",{})]})}))]}),H.length>0&&Object(g.jsxs)("div",{children:[Object(g.jsx)("br",{}),Object(g.jsx)("br",{}),"Discipline: ",H.join()]})]})}),!e.viewOnly&&Object(f.t)()&&Object(g.jsx)("div",{style:{marginBottom:"90px"},className:"row justify-content-center text-center",children:Object(g.jsx)(l.a,{type:"textarea",style:{width:"85%",height:"90px"},placeholder:"Komentar",value:T,onChange:function(e){M(e.target.value)}})})]}),!e.viewOnly&&Object(f.t)()&&Object(g.jsx)(d.a,{children:Object(g.jsxs)("div",{className:"row justify-content-center text-center",style:{width:"100%"},children:[!F&&!y&&Object(g.jsx)(a.Fragment,{children:Object(g.jsx)("div",{className:"col",children:Object(g.jsx)(j.a.Ripple,{type:"submit",color:"primary",className:"btn-next",onClick:function(){w(!0)},children:Object(g.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Izmijeni"})})})}),!F&&y&&Object(g.jsxs)(a.Fragment,{children:[Object(g.jsx)("div",{className:"col",children:Object(g.jsxs)(j.a.Ripple,{onClick:function(){w(!1)},color:"secondary",className:"btn-prev",outline:!0,children:[Object(g.jsx)(m.a,{size:14,className:"align-middle mr-sm-25 mr-0"}),Object(g.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Povratak"})]})}),Object(g.jsx)("div",{className:"col",children:Object(g.jsx)(j.a.Ripple,{type:"submit",color:A?"primary":"danger",className:"btn-next",onClick:function(){A?Y():J()},children:Object(g.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:A?"Odobri prijavu":"Odbij prijavu"})})})]}),F&&Object(g.jsxs)(a.Fragment,{children:[Object(g.jsx)("div",{className:"col",children:Object(g.jsx)(j.a.Ripple,{type:"submit",color:"danger",className:"btn-next",onClick:J,children:Object(g.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odbij"})})}),Object(g.jsx)("div",{className:"col",children:Object(g.jsx)(j.a.Ripple,{onClick:Y,type:"submit",color:"primary",className:"btn-next",children:Object(g.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odobri"})})})]})]})})]})}},177:function(e,t,n){"use strict";var c=n(8),a=n(0),i=n(1190),s=n(1128),o=n(1129),r=n(1113),l=n(1130),d=n(1131),j=n(52),u=n(59),b=n.n(u),m=n(60),p=n.n(m),O=n(55),h=n.n(O),x=n(394),f=n(3),g=p()(b.a);t.a=function(e){var t=e.toggle,n=e.isOpen,u=e.player,b=e.competition,m=function(){if(!u||!b)return{};var e=null;return u.competitionApproval.map((function(t){t.competitionId===b._id&&(e=t)})),null==e?{}:e};if(!u)return null;var p=Object(a.useState)(!1),O=Object(c.a)(p,2),v=O[0],k=O[1],N=u&&(null==m().isApproved||!0!==m().isApproved&&!1!==m().isApproved),C=!0===m().isApproved,y=!1===m().isApproved,w=m().comment,S=Object(a.useState)(w),B=Object(c.a)(S,2),P=B[0],I=B[1],F=function(){g.fire({title:"Jeste li sigurni",text:"Klikom na gumb 'DA' prijava igra\u010da \u0107e biti odbijena",
1icon:"warning",showCancelButton:!0,cancelButtonText:"Odustani",confirmButtonText:"DA",customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-danger ml-1"},buttonsStyling:!1}).then((function(t){t.value&&h.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/approve-player"),{userId:u._id,competitionId:e.competition._id,teamId:e.team._id,flag:!1,comment:P}).then((function(t){g.fire({icon:"success",title:"Uspje\u0161no",text:"Prijava odbijena.",customClass:{confirmButton:"btn btn-success"}}),I(""),e.fetchFreshData(),e.toggle()})).catch((function(){window.alert("Nesto je poslo po krivu. Molim probajte ponovno.")}))}))},D=function(){g.fire({title:"Jeste li sigurni",text:"Klikom na gumb Yes prijava \u0107e biti odobrena",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes",customClass:{confirmButton:"btn btn-primary",cancelButton:"btn btn-outline-danger ml-1"},buttonsStyling:!1}).then((function(t){t.value&&h.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/approve-player"),{userId:u._id,competitionId:e.competition._id,teamId:e.team._id,flag:!0,comment:P}).then((function(t){g.fire({icon:"success",title:"Uspje\u0161no",text:"Prijava igra\u010da odobrena.",customClass:{confirmButton:"btn btn-success"}}),I(""),e.fetchFreshData(),e.toggle()})).catch((function(){window.alert("Nesto je poslo po krivu. Molim probajte ponovno.")}))}))};return Object(f.jsxs)(i.a,{isOpen:n,toggle:t,children:[Object(f.jsx)(s.a,{toggle:function(){k(!1),t()},children:"Odobri igra\u010da"}),Object(f.jsxs)(o.a,{children:[Object(f.jsxs)("div",{className:"row justify-content-center text-center align-content-center",children:[C&&Object(f.jsx)(r.a,{style:{padding:"10px",margin:"20px"},className:"text-capitalize justify-content-center text-center align-content-center",color:"light-success",pill:!0,children:Object(f.jsx)("span",{children:"Odobreno"})}),y&&Object(f.jsx)(r.a,{style:{padding:"10px",margin:"20px"},className:"text-capitalize justify-content-center text-center align-content-center",color:"light-warning",pill:!0,children:Object(f.jsx)("span",{children:"Odbijeno"})})]}),Object(f.jsxs)("div",{style:{marginBottom:"90px"},className:"row justify-content-center text-center",children:["\u017delite li odobriti prijavu za igra\u010da ",u.name," ",u.surname]}),Object(f.jsx)("div",{style:{marginBottom:"90px"},className:"row justify-content-center text-center",children:Object(f.jsx)(l.a,{type:"textarea",style:{width:"85%",height:"90px"},placeholder:"Komentar",value:P,onChange:function(e){I(e.target.value)}})})]}),Object(f.jsx)(d.a,{children:Object(f.jsxs)("div",{className:"row justify-content-center text-center",style:{width:"100%"},children:[!N&&!v&&Object(f.jsx)(a.Fragment,{children:Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{type:"submit",color:"primary",className:"btn-next",onClick:function(){k(!0)},children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Izmijeni"})})})}),!N&&v&&Object(f.jsxs)(a.Fragment,{children:[Object(f.jsx)("div",{className:"col",children:Object(f.jsxs)(j.a.Ripple,{onClick:function(){k(!1)},color:"secondary",className:"btn-prev",outline:!0,children:[Object(f.jsx)(x.a,{size:14,className:"align-middle mr-sm-25 mr-0"}),Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Povratak"})]})}),Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{type:"submit",color:y?"primary":"danger",className:"btn-next",onClick:function(){y?D():F()},children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:y?"Odobri prijavu":"Odbij prijavu"})})})]}),N&&Object(f.jsxs)(a.Fragment,{children:[Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{type:"submit",color:"danger",className:"btn-next",onClick:F,children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odbij"})})}),Object(f.jsx)("div",{className:"col",children:Object(f.jsx)(j.a.Ripple,{onClick:D,type:"submit",color:"primary",className:"btn-next",children:Object(f.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odobri"})})})]})]})})]})}},185:function(e,t,n){"use strict";var c=n(1),a=n(8),i=n(0),s=n(1190),o=n(1128),r=n(1129),l=n(1131),d=n(52),j=n(59),u=n.n(j),b=n(60),m=n.n(b),p=n(55),O=n.n(p),h=n(62),x=n(57),f=n(65),g=n(63),v=n(3),k=m()(u.a);t.a=function(e){var t=e.toggle,n=e.isOpen,j=(e.constituents,e.setConstituents,Object(i.useState)({label:"Odaberi korisnika",value:"Odaberi korisnika"})),u=Object(a.a)(j,2),b=u[0],m=u[1],p=Object(i.useState)([]),N=Object(a.a)(p,2),C=N[0],y=N[1],w=Object(i.useState)([]),S=Object(a.a)(w,2),B=S[0],P=S[1],I=Object(i.useState)([]),F=Object(a.a)(I,2),D=F[0],A=F[1],_=Object(i.useState)([]),R=Object(a.a)(_,2),z=R[0],T=R[1],M=Object(i.useState)(null),U=Object(a.a)(M,2),E=U[0],K=U[1],L=Object(i.useState)([]),J=Object(a.a)(L,2),Y=J[0],H=J[1],G=Object(i.useState)([]),V=Object(a.a)(G,2),W=V[0],q=V[1],Q=Object(i.useState)(!1),X=Object(a.a)(Q,2),Z=X[0],$=X[1],ee=Object(i.useState)(!1),te=Object(a.a)(ee,2),ne=te[0];te[1];if(Object(i.useEffect)((function(){if(!Z){$(!0),O.a.get("".concat("https://unisport-backend-prod.herokuapp.com","/admin/get-users")).then((function(e){var t=e.data.users.filter((function(e){return"true"===e.isApproved})).map((function(e,t){return{pick:e,value:e._id,label:e.name+" "+e.surname+" (Unisport Id: "+e.unisportId+")"}}));q(t)})),O.a.get("".concat("https://unisport-backend-prod.herokuapp.com","/admin/organisations")).then((function(e){var t=e.data.organisations;t=t.map((function(e){return{value:e.name,label:e.name}})),P(t)})),O.a.get("".concat("https://unisport-backend-prod.herokuapp.com","/admin/sports")).then((function(e){var t=e.data.sports;t=t.map((function(e){return{value:e,label:e}})),y(t)}));var e="".concat("https://unisport-backend-prod.herokuapp.com","/admin/constituents"),t=Object(g.b)();e+="?org=".concat(t),O.a.get(e).then((function(e){var t=e.data.constituents;t=t.map((function(e){return{value:e,label:e.name}})),H(t)}))}}),[]),!e.role)return null;var ce=null!=Object(g.b)(),ae="team admin"===e.role,ie="technician"!==e.role&&"super admin"!==e.role&&(Object(f.a)().userData.role&&Object(f.a)().userData.role.includes("super admin")||!ce&&"admin"!==e.role&&"team admin"!==e.role&&"team leader"!==e.role&&"technician"!==e.role&&"delegate"!==e.role),se="super admin"!==e.role&&"admin"!==e.role&&"technician"!==e.role&&"team admin"!==e.role&&"recreations admin"!==e.role&&!e.role.includes("CMS")&&!e.role.includes("cms");return Object(v.jsxs)(s.a,{isOpen:n,toggle:t,children:[Object(v.jsxs)(o.a,{toggle:t,children:["Dodavanje korisnika na rolu - ",e.role]}),Object(v.jsxs)(r.a,{children:[Object(v.jsx)(h.a,{theme:x.d,className:"react-select",classNamePrefix:"select",value:b,styles:{control:function(e){return Object(c.a)(Object(c.a)({},e),{},{borderColor:ne&&""===b?"red":e.borderColor,"&:hover":{borderColor:ne&&""===b?"red":e["&:hover"].borderColor}})}},onChange:function(e){m(e)},name:"clear",options:W,isClearable:!1}),ie&&Object(v.jsxs)(i.Fragment,{children:[Object(v.jsx)("br",{}),Object(v.jsx)("br",{}),Object(v.jsx)("h4",{children:"Organizacija"}),Object(v.jsx)(h.a,{theme:x.d,className:"react-select",classNamePrefix:"select",value:z,styles:{control:function(e){return Object(c.a)(Object(c.a)({},e),{},{borderColor:ne&&""===z?"red":e.borderColor,"&:hover":{borderColor:ne&&""===z?"red":e["&:hover"].borderColor}})}},onChange:function(e){T(e)},name:"clear",options:B,isClearable:!1})]}),ae&&Object(v.jsxs)(i.Fragment,{children:[Object(v.jsx)("br",{}),Object(v.jsx)("br",{}),Object(v.jsx)("h4",{children:"Sastavnica"}),Object(v.jsx)(h.a,{theme:x.d,className:"react-select",classNamePrefix:"select",value:E,styles:{control:function(e){return Object(c.a)(Object(c.a)({},e),{},{borderColor:ne&&""===E?"red":e.borderColor,"&:hover":{borderColor:ne&&""===E?"red":e["&:hover"].borderColor}})}},onChange:function(e){K(e)},name:"clear",options:Y,isClearable:!1})]}),se&&Object(v.jsxs)(i.Fragment,{children:[Object(v.jsx)("br",{}),Object(v.jsx)("h4",{style:{marginTop:"30px"},children:"Sportovi"}
1),Object(v.jsx)(h.a,{theme:x.d,className:"react-select",classNamePrefix:"select",isMulti:!0,value:D,styles:{control:function(e){return Object(c.a)(Object(c.a)({},e),{},{borderColor:ne&&""===D?"red":e.borderColor,"&:hover":{borderColor:ne&&""===b?"red":e["&:hover"].borderColor}})}},onChange:function(e){A(e)},name:"clear",options:C,isClearable:!1})]}),Object(v.jsx)("br",{})]}),Object(v.jsx)(l.a,{children:Object(v.jsxs)("div",{className:"row justify-content-center text-center",style:{width:"100%"},children:[Object(v.jsx)("div",{className:"col",children:Object(v.jsx)(d.a.Ripple,{onClick:function(){e.toggle()},type:"submit",color:"danger",className:"btn-next",children:Object(v.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odustani"})})}),Object(v.jsx)("div",{className:"col",children:Object(v.jsx)(d.a.Ripple,{onClick:function(){if(b.pick)if(ie&&0===z.length)window.alert("Molimo odaberite organizaciju");else if(ae&&0===E.length)window.alert("Molimo odaberite sastavnicu");else if(se&&0===D.length)window.alert("Molimo odaberite sport");else if(console.log(E),b&&b.pick&&b.pick.role&&b.pick.role.includes("team admin")&&e.role&&"team leader"===e.role&&b.pick.teamAdminConstituents.includes(Object(g.e)()))window.alert("Ovaj korisnik je ve\u0107 team admin, \u0161to obuhva\u0107a sve \u0161to mo\u017ee i team leader");else{b&&b.pick&&b.pick.role&&b.pick.role.includes("team leader")&&e.role&&e.role;var n=[];z&&z.value&&n.push(z.value),0===n.length&&null!=Object(g.b)()&&n.push(Object(g.b)());var c=[];D.map((function(e){c.push(e.value)}));var a=e.role;a.includes("CMS")||(a=a.toLowerCase()),O.a.post("".concat("https://unisport-backend-prod.herokuapp.com","/admin/set-role"),{userId:b.pick._id,role:a,rights:n,sports:c,roleForSports:c,constituent:E?E.value._id:Object(g.e)()}).then((function(e){t(),k.fire({icon:"success",title:"Uspje\u0161no",text:"Uspje\u0161no dodana rola na korisnika.",customClass:{confirmButton:"btn btn-success"}})})).catch((function(e){t(),k.fire({icon:"warning",title:"Pogre\u0161ka",text:"Ne\u0161to je po\u0161lo po krivu. Molimo probajte ponovno",customClass:{confirmButton:"btn btn-success"}})}))}else window.alert("Molimo odaberite barem jednog korisnika")},type:"submit",color:"primary",className:"btn-next",children:Object(v.jsx)("span",{className:"align-middle d-sm-inline-block d-none",children:"Odaberi"})})})]})})]})}}}]); 2//# sourceMappingURL=34.78fae62a.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.