text: (window.webpackJsonp=window.webpackJsonp||[]).push([[13],{330:function(e,t,a){"use strict";a.r(t),function(e){var r=a(1),n=a.n(r),l=a(8),c=a(59),o=(a(24),a(65)),s=a.n(o),i=a(66),m=a.n(i),d=(a(57),a(63)),u=a(331);function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e}).apply(this,arguments)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var a=[],r=!0,n=!1,l=void 0;try{for(var c,o=e[Symbol.iterator]();!(r=(c=o.next()).done)&&(a.push(c.value),!t||a.length!==t);r=!0);}catch(e){n=!0,l=e}finally{try{r||null==o.return||o.return()}finally{if(n)throw l}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(a);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return E(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}var b=o.Search.SearchBar;t.default=function(t){var a=this,o=f(Object(r.useState)(!1),2),i=o[0],E=o[1],y=f(Object(r.useState)([]),2),v=y[0],h=y[1],g=f(Object(r.useState)(!1),2),S=g[0],N=g[1],w=f(Object(r.useState)(""),2),O=w[0],j=w[1],T=f(Object(r.useState)(""),2),x=T[0],A=T[1],C=f(Object(r.useState)({}),2),k=C[0],F=C[1],I=f(Object(r.useState)(t.user),2),M=I[0],_=(I[1],"".concat(window.origin).concat(t.history.location.pathname));Object(r.useEffect)((function(){K()}),[]);var K=function(){E(!0),e.ajax({url:"".concat(l.a,"/institution/students/list/").concat(t.user.institution.id),method:"GET",headers:{appkey:"ELE-2020-XCZ3"},error:function(e,t,a){var r="Sorry an error has occurred. We are working on it. (".concat(e.status,")");try{r=JSON.parse(e.responseText).message}catch(e){}E(!1),N(!0),j("alert alert-danger"),A(r)}.bind(a),success:function(e){h(e),E(!1)}.bind(a)})},P=function(e,t){F(e)};return n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"application"},n.a.createElement(d.Helmet,null,n.a.createElement("link",{rel:"canonical",href:_}),n.a.createElement("meta",{name:"keywords",content:"Tutorsoma Tu, Kenya, KCSE, KCPE, elearning, past revision papers, online courses, Education in Kenya, Maths, Science, Technology, English, Kiswahili"}),n.a.createElement("meta",{name:"author",content:"Standard Group"}),n.a.createElement("meta",{name:"description",content:"Tutorsoma Tu is an e-learning platform targeting students in the Kenya education system. Learn Maths, English, Kiswahili, Social Studies, Science and many more"}),n.a.createElement("meta",{property:"twitter:title",content:"Tutor-Soma Tu : Classes : The Standard"}),n.a.createElement("meta",{property:"twitter:description",content:"Tutor-Soma Tu - Classes "}),n.a.createElement("meta",{property:"twitter:url",content:_}),n.a.createElement("meta",{property:"og:title",content:"Tutor-Soma Tu : Classes : The Standard"}),n.a.createElement("meta",{property:"og:description",content:"Tutor-Soma Tu - Classes "}),n.a.createElement("meta",{property:"og:url",content:_}))),n.a.createElement("div",{id:"sliders"},n.a.createElement("div",{className:"full-width"},n.a.createElement("div",{className:"carousel slide",id:"light-slider"},n.a.createElement("div",{id:"carousel-area"},n.a.createElement("div",{className:"carousel slide","data-ride":"carousel",id:"carousel-slider"},n.a.createElement("div",{className:"carousel-inner smaller",role:"listbox"},n.a.createElement("div",{className:"carousel-item active"},n.a.createElement("img",{alt:"",src:"".concat(l.h,"/static/new/img/rendered.png"),style:{height:"76px",objectFit:"cover"}})))))))),n.a.createElement("div",{id:"about",className:"section-padding profile"},n.a.createElement("div",{className:"container"},n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"row"},n.a.createElement("div",{className:"col-md-12"},n.a.createElement("h2",{className:"section-title wow fadeInDown animated text-center mt-5","data-wow-delay":"0.3s"},"".concat(t.user.institution.name).toUpperCase()," STUDENTS"))),n.a.createElement("div",{className:"row"},n.a.createElement("div",{className:"col-md-12"},i?n.a.createElement(c.a,null):S?n.a.createElement("div",{className:"text-center mt-2"},n.a.createElement("div",{className:O,role:"alert"},n.a.createElement("div",{className:"alert-message"},x))):n.a.createElement(s.a,{keyField:"id",data:v.filter((function(e){return e.institution_id===M.institution_id})),columns:[{dataField:"adm_no",text:"Adm. No.",sort:!0},{dataField:"login_code",text:"Login Code",sort:!0},{dataField:"name",text:"Name",sort:!0},{dataField:"avg",text:"Average",sort:!0},{dataField:"created_at",text:"Actions",sort:!0,formatter:function(e,t){return n.a.createElement("div",{className:"actions ml-3"},n.a.createElement("button",{className:"btn btn-sm btn-rounded btn-success","data-toggle":"modal","data-target":"#studentModal"},"Edit Student"))}}],search:!0},(function(e){return n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"row  mb-3"},n.a.createElement("div",{className:"col-md-4"},n.a.createElement(b,p({className:"float-left mb-3 form-control-sm"},e.searchProps))),n.a.createElement("div",{className:"col-md-8 "},n.a.createElement("button",{className:"mb-3 float-right btn btn-sm btn-rounded btn-success","data-toggle":"modal","data-target":"#studentModal",onClick:F.bind({})},"Add Student"))),n.a.createElement(m.a,p({},e.baseProps,{headerWrapperClasses:"pt-0 shadowtable bg-danger",headerClasses:"border-0",rowClasses:"border-0",rowStyle:{borderRadius:"18px"},wrapperClasses:"table-responsive",selectRow:{mode:"radio",clickToSelect:!0,onSelect:P.bind(a)}})))}))))))),n.a.createElement(u.a,{student:k,user:t.user,getStudents:K}))}}.call(this,a(58))},331:function(e,t,a){"use strict";(function(e){var r=a(1),n=a.n(r),l=a(24),c=a(8);a(59);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var a=[],r=!0,n=!1,l=void 0;try{for(var c,o=e[Symbol.iterator]();!(r=(c=o.next()).done)&&(a.push(c.value),!t||a.length!==t);r=!0);}catch(e){n=!0,l=e}finally{try{r||null==o.return||o.return()}finally{if(n)throw l}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(a);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}t.a=function(t){var a=this,s=o(Object(r.useState)(!1),2),i=s[0],m=s[1],d=o(Object(r.useState)(!1),2),u=d[0],p=(d[1],o(Object(r.useState)(!1),2)),f=p[0],E=p[1],b=o(Object(r.useState)(!1),2),y=b[0],v=b[1],h=o(Object(r.useState)(""),2),g=h[0],S=h[1],N=o(Object(r.useState)(""),2),w=N[0],O=N[1],j=o(Object(r.useState)({}),2),T=j[0],x=j[1];Object(r.useEffect)((function(e){x(t.student)}),[t.student]);var A=function(r){r.preventDefault(),v(!1),E(!0);var n=new FormData(e("form#student")[0]);n.append("institutionid",t.user.institution_id),T.hasOwnProperty("id")&&n.append("id",T.id),e.ajax({url:"".concat(c.a,"/institution/student/").concat(T.hasOwnProperty("id")?"edit":"register"),method:"post",headers:{appkey:"ELE-2020-XCZ3"},processData:!1,contentType:!1,data:n,error:function(t,a,r){var n="Sorry an error has occurred. We are working on it. (".concat(t.status,")");try{n=JSON.parse(t.responseText).message}catch(e){}E(!1),v(!0),S("alert alert-danger"),O(n),e("html, body").animate({scrollTop:0},200)}.bind(a),success:function(e){E(!1),v(!0),S("alert alert-success"),O("Student updated successfully."),m(!0),t.getStudents()}.bind(a)})};return n.a.createElement("div",{className:"modal fade",id:"studentModal",tabIndex:"-1",role:"dialog",style:{zIndex:9999999},"aria-labelledby":"studentModalLabel","aria-hidden":"true"},n.a.createElement("div",{className:"modal-dialog",role:"document"},n.a.createElement("div",{className:"modal-content"},u?n.a.createElement("div",{className:"text-center",style:{marginTop:"50px"}},n.a.createElement(l.a,{color:"#cf2027"})):n.a.createElement("form",{onSubmit:A},y?n.a.createElement("div",{className:"row"},n.a.createElement("div",{className:"col-md-12"},n.a.createElement("div",{className:"text-center mt-2"},n.a.createElement("div",{className:g,role:"alert"},n.a.createElement("div",{className:"alert-message"},w))))):"",i?"":n.a.createElement("div",{className:"card"},n.a.createElement("div",{className:"card-header"},n.a.createElement("h5",null,T.hasOwnProperty("name")?T.name:"Register Student")),n.a.createElement("div",{className:"card-body"},n.a.createElement("form",{onSubmit:A,id:"student"},n.a.createElement("div",{className:"row"},n.a.createElement("div",{className:"form-group col-md-12"},n.a.createElement("label",null,"Admission Number"),n.a.createElement("input",{type:"text",name:"adm_no",className:"form-control",defaultValue:T.adm_no,required:!0})),n.a.createElement("div",{className:"form-group col-md-12"},n.a.createElement("label",null,"Name"),n.a.createElement("input",{type:"text",name:"name",className:"form-control",defaultValue:T.name,required:!0})),n.a.createElement("div",{className:"form-group col-md-12"},n.a.createElement("label",null,"Email"),n.a.createElement("input",{type:"email",name:"email",className:"form-control",defaultValue:T.email}))),n.a.createElement("div",{className:"row"},n.a.createElement("div",{className:"col-md-12"},f?n.a.createElement(l.a,null):n.a.createElement("button",{type:"submit",className:"btn btn-sm btn-success btn-rounded float-right"},"Save "))))))))))}}).call(this,a(58))}}]);