text: (this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[]).push([[7],{648:function(e,t,n){var a=n(651),c=n(650).API;n(668).config(),t.getEmployees=function(){return a.get("".concat(c,"/employee"),{headers:{Authorization:"Bearer ".concat(JSON.parse(localStorage.getItem("jwt")).token)}}).then((function(e){return e.data})).catch((function(e){console.log("Error: ",e)}))},t.login=function(e,t){console.log("server ip: ",Object({NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_SERVER_API:"http://localhost:5000/api"}).SERVER_IP);var n={username:e,password:t};a.post("".concat(c,"/admin/login"),n).then((function(e){return JSON.parse(e.data)})).catch((function(e){return{error:e}}))},t.authenticate=function(e,t){"undefined"!==typeof window&&(localStorage.setItem("jwt",JSON.stringify(e)),a.get("".concat(c,"/employee"),{headers:{Authorization:"Bearer ".concat(e.token)}}).then((function(e,t){if(t)console.log("error: ",t);else{var n=[];console.log("data: ",e),e.data.employees.map((function(e){n.push({id:e._id,name:"".concat(e.nom," ").concat(e.prenom),registered:"2018/01/01",role:e.poste,status:"Pending",img:"data:image/png;base64,".concat(e.image)})})),localStorage.setItem("users",JSON.stringify(n))}})),t())},t.signout=function(e){if("undefined"!=typeof window)return localStorage.removeItem("jwt"),localStorage.removeItem("users"),e(),a.get("".concat(c,"/admin/signout")).then((function(e){console.log("Signout: ",e)})).catch((function(e){console.log("Error: ",e)}))},t.isAuthenticate=function(){return"undefined"!=typeof window&&(!!localStorage.getItem("jwt")&&JSON.parse(localStorage.getItem("jwt")))},t.isAdmin=function(){return!!localStorage.getItem("jwt")&&0==JSON.parse(localStorage.getItem("jwt")).type},t.addEmployee=function(e,t,n,o,r,s){var i=new FormData;i.append("image",s,e+" "+t),i.append("nom",e),i.append("prenom",t),i.append("email",n),i.append("telephone",o),i.append("poste",r),a.post("".concat(c,"/employee/add"),i,{headers:{"Content-Type":"multipart/form-data"}}).then((function(e){console.log("response: ",e)})).catch((function(e){return console.log("err: ",e)}))},t.getCard=function(e){return a.get("".concat(c,"/employee/card/").concat(e),{headers:{Authorization:"Bearer ".concat(JSON.parse(localStorage.getItem("jwt")).token)}}).then((function(e){var t=function(e){for(var t=window.atob(e),n=t.length,a=new Uint8Array(n),c=0;c<n;c++)a[c]=t.charCodeAt(c);return a.buffer}(e.data.file),n=new Blob([t],{type:"application/pdf"}),a=URL.createObjectURL(n);window.open().location.href=a})).catch((function(e){console.log("Error: ",e)}))},t.getEmployee=function(e){return a.get("".concat(c,"/employee/").concat(e),{headers:{Authorization:"Bearer ".concat(JSON.parse(localStorage.getItem("jwt")).token)}}).then((function(e){return e})).catch((function(e){return console.log(e)}))}},650:function(e,t,n){"use strict";n.r(t),n.d(t,"API",(function(){return a}));var a="http://localhost:5000/api"},658:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var a=n(648),c=Object(a.isAdmin)();console.log("user: ",c)},723:function(e,t,n){"use strict";n.r(t);var a=n(1),c=n.n(a),o=n(21),r=n(648),s=n(66),i=n(646),l=n(658),d=[{path:"/",exact:!0,name:"Home"},{path:"/dashboard",name:"Dashboard",component:c.a.lazy((function(){return n.e(10).then(n.bind(null,717))}))},{path:"/users",exact:!0,name:"Users",component:c.a.lazy((function(){return n.e(2).then(n.bind(null,724))}))},{path:"/users/:id",exact:!0,name:"User Details",component:l.a?c.a.lazy((function(){return n.e(12).then(n.bind(null,718))})):c.a.lazy((function(){return n.e(2).then(n.bind(null,724))}))},{path:"/profile",exact:!0,name:"Profile",component:c.a.lazy((function(){return n.e(16).then(n.bind(null,719))}))},{path:"/mark_attendance_qr",exact:!0,name:"Mark attendance QR",component:c.a.lazy((function(){return Promise.all([n.e(6),n.e(13)]).then(n.bind(null,720))}))},{path:"/manual_mark_attendance",exact:!0,name:"Manual attendance",component:c.a.lazy((function(){return n.e(9).then(n.bind(null,721))}))},{path:"/addnewuser",exact:!0,name:"Add New Employee",component:c.a.lazy((function(){return n.e(11).then(n.bind(null,722))}))}],m=n(22),u=Object(m.jsx)("div",{className:"pt-3 text-center",children:Object(m.jsx)("div",{className:"sk-spinner sk-spinner-pulse"})}),j=function(){Object(o.h)();return Object(m.jsx)("main",{className:"c-main",children:Object(m.jsx)(i.k,{fluid:!0,children:Object(m.jsx)(a.Suspense,{fallback:u,children:Object(m.jsxs)(o.d,{children:[d.map((function(e,t){return e.component?Object(m.jsx)(o.b,{path:e.path,exact:e.exact,name:e.name,render:function(t){return Object(m.jsx)(e.component,Object(s.a)({},t))}},t):null})),Object(m.jsx)(o.a,{from:"/",to:"/dashboard"})]})})})})},b=c.a.memo(j),p=function(){return Object(m.jsx)(i.r,{fixed:!1,children:Object(m.jsxs)("div",{children:[Object(m.jsx)("a",{href:"https://github.com",target:"_blank",rel:"noopener noreferrer",children:"SAS"}),Object(m.jsx)("span",{className:"ml-1",children:"\xa9 2021 Crafted by DAFI && Benlaria"})]})})},h=c.a.memo(p),O=n(174),f=n(645),g=n.p+"static/media/SAS_LOGO_land_color.288c37b6.png",x=function(){var e=Object(O.b)(),t=Object(O.c)((function(e){return e.sidebarShow}));return Object(m.jsxs)(i.u,{withSubheader:!0,children:[Object(m.jsx)(i.Q,{inHeader:!0,className:"ml-md-3 d-lg-none",onClick:function(){var n=!![!1,"responsive"].includes(t)||"responsive";e({type:"set",sidebarShow:n})}}),Object(m.jsx)(i.Q,{inHeader:!0,className:"ml-3 d-md-down-none",onClick:function(){var n=![!0,"responsive"].includes(t)&&"responsive";e({type:"set",sidebarShow:n})}}),Object(m.jsx)(i.v,{className:"mx-auto d-lg-none",to:"/",children:Object(m.jsx)(f.a,{name:"logo",src:g,height:"60",alt:"Logo"})}),Object(m.jsx)(i.w,{className:"d-md-down-none mr-auto"}),Object(m.jsx)(i.w,{className:"px-3",children:Object(m.jsx)(v,{})}),Object(m.jsx)(i.P,{className:"px-3 justify-content-between",children:Object(m.jsx)(i.d,{className:"border-0 c-subheader-nav m-0 px-0 px-md-3",routes:d})})]})},v=function(){var e=Object(o.g)();return Object(m.jsxs)(i.n,{inNav:!0,className:"c-header-nav-items mx-2",direction:"down",children:[Object(m.jsx)(i.q,{className:"c-header-nav-link",caret:!1,children:Object(m.jsx)("div",{className:"c-avatar",children:Object(m.jsx)(i.x,{src:"avatars/6.jpg",className:"c-avatar-img",alt:"admin@bootstrapmaster.com"})})}),Object(m.jsxs)(i.p,{className:"pt-0",placement:"bottom-end",children:[Object(m.jsx)(i.o,{header:!0,tag:"div",color:"light",className:"text-center",children:Object(m.jsx)("strong",{children:"Settings"})}),Object(m.jsxs)(i.o,{onClick:function(){e.push({pathname:"/profile"})},children:[Object(m.jsx)(f.a,{name:"cil-user",className:"mfe-2"}),"Profile"]}),Object(m.jsx)(i.o,{divider:!0}),Object(m.jsxs)(i.o,{children:[Object(m.jsx)(f.a,{name:"cil-settings",className:"mfe-2"}),"Settings"]}),Object(m.jsx)(i.o,{divider:!0}),Object(m.jsxs)(i.o,{onClick:function(){Object(r.signout)((function(){return window.location.reload(!1)}))},children:[Object(m.jsx)(f.a,{name:"cil-settings",className:"mfe-2"}),"Logout"]})]})]})},S=n.p+"static/media/SAS_LOGO_land.f6f89f7c.png",N=n.p+"static/media/SAS_LOGO_white.645cc1ba.png",w=Object(r.isAdmin)()?[{_tag:"CSidebarNavItem",name:"Dashboard",to:"/dashboard",icon:Object(m.jsx)(f.a,{name:"cil-speedometer",customClasses:"c-sidebar-nav-icon"})},{_tag:"CSidebarNavTitle",_children:["User managments"]},{_tag:"CSidebarNavItem",name:"Users",to:"/users",icon:Object(m.jsx)(f.a,{name:"cil-user",customClasses:"c-sidebar-nav-icon"})},{_tag:"CSidebarNavItem",name:"Add User",to:"/addnewuser",icon:Object(m.jsx)(f.a,{name:"cil-user-follow",customClasses:"c-sidebar-nav-icon"})},{_tag:"CSidebarNavItem",name:"Mark attendance QR",to:"/mark_attendance_qr",icon:Object(m.jsx)(f.a,{name:"cil-user",customClasses:"c-sidebar-nav-icon"})},{_tag:"CSidebarNavItem",name:"Mark attendance manual",to:"/manual_mark_attendance",icon:Object(m.jsx)(f.a,{name:"cil-user",customClasses:"c-sidebar-nav-icon"})}]:[{_tag:"CSidebarNavItem",name:"Dashboard",to:"/dashboard",icon:Object(m.jsx)(f.a,{name:"cil-speedometer",customClasses:"c-sidebar-nav-icon"})},{_tag:"CSidebarNavItem",name:"User",to:"/users",icon:Object(m.jsx)(f.a,{name:"cil-speedometer",customClasses:"c-sidebar-nav-icon"})},{_tag:"CSidebarNavItem",name:"Mark attendance QR",to:"/mark_attendance_qr",icon:Object(m.jsx)(f.a,{name:"cil-qr-code",customClasses:"c-sidebar-nav-icon"})},{_tag:"CSidebarNavItem",name:"Mark attendance manual",to:"/manual_mark_attendance",icon:Object(m.jsx)(f.a,{name:"cil-pen-alt",customClasses:"c-sidebar-nav-icon"})}],_=function(){var e=Object(O.b)(),t=Object(O.c)((function(e){return e.sidebarShow}));return Object(m.jsxs)(i.H,{show:t,onShowChange:function(t){return e({type:"set",sidebarShow:t})},children:[Object(m.jsxs)(i.I,{className:"d-md-down-none",to:"/",children:[Object(m.jsx)(f.a,{className:"c-sidebar-brand-full",name:"",src:S,height:60}),Object(m.jsx)(f.a,{className:"c-sidebar-brand-minimized",name:"sygnet",src:N,height:35})]}),(Object(r.isAdmin)(),Object(m.jsx)(i.K,{children:Object(m.jsx)(i.l,{items:w,components:{CSidebarNavDivider:i.L,CSidebarNavDropdown:i.M,CSidebarNavItem:i.N,CSidebarNavTitle:i.O}})})),Object(m.jsx)(i.J,{className:"c-d-md-down-none"})]})},C=c.a.memo(_);t.default=function(){return Object(m.jsxs)("div",{children:[Object(r.isAuthenticate)()?Object(m.jsxs)("div",{className:"c-app c-default-layout",children:[Object(m.jsx)(C,{}),Object(m.jsxs)("div",{className:"c-wrapper",children:[Object(m.jsx)(x,{}),Object(m.jsx)("div",{className:"c-body",children:Object(m.jsx)(b,{})}),Object(m.jsx)(h,{})]})]}):Object(m.jsx)(o.a,{to:"/login"})," "]})}}}]);
  //# sourceMappingURL=7.b76a1fa0.chunk.js.map