(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6035182d"],{"263a":function(e,t,r){"use strict";var a=r("1da1"),n=(r("96cf"),r("26b3"));t["a"]={deleteSchool:function(e){return Object(a["a"])(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(n["a"])().delete("/api/School/"+e);case 2:return r=t.sent,t.abrupt("return",r.data);case 4:case"end":return t.stop()}}),t)})))()},createSchool:function(e){return Object(a["a"])(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(n["a"])().post("/api/School",e);case 2:return r=t.sent,t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)})))()},getSchoolList:function(){return Object(a["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(n["a"])().get("/api/School/GetActives");case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})))()}}},4239:function(e,t,r){"use strict";r("a36e")},"57ec":function(e,t,r){"use strict";r.r(t);var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"container-sm container-md",attrs:{id:"teacher"}},[r("div",{staticClass:"card"},[r("a-tabs",{attrs:{defaultActiveKey:"1"}},[r("a-tab-pane",{key:"1"},[r("span",{attrs:{slot:"tab"},slot:"tab"},[r("a-icon",{attrs:{type:"bars"}}),e._v("List ")],1),r("teacher-list",{attrs:{schoolList:e.schoolList}})],1),r("a-tab-pane",{key:"2"},[r("span",{attrs:{slot:"tab"},slot:"tab"},[r("a-icon",{attrs:{type:"plus"}}),e._v("Create ")],1),r("create-teacher",{attrs:{schoolList:e.schoolList}})],1)],1)],1)])},n=[],s=r("1da1"),o=(r("96cf"),function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[r("div",{staticClass:"row justify-content-center mb-3"},[r("div",{staticClass:"col-sm-12 col-md-4"},[r("a-select",{staticClass:"select-box",attrs:{showSearch:"",placeholder:"Select a School",optionFilterProp:"children",filterOption:e.filterOption},on:{select:e.handleChangeSchool}},e._l(e.schoolList,(function(t){return r("a-select-option",{key:t.id,attrs:{value:t.id}},[e._v(" "+e._s(t.Name)+" ")])})),1)],1)]),r("a-table",{attrs:{columns:e.columns,dataSource:e.campusList,pagination:!1,loading:e.tableLoading,rowKey:"id"},scopedSlots:e._u([{key:"status",fn:function(t){return r("span",{},[r("a-tag",{attrs:{color:1===t?"green":"volcano"}},[e._v(" "+e._s(1===t?"Active":"Deleted")+" ")])],1)}}])})],1)}),c=[],i=r("26b3"),u={getTeachers:function(e){return Object(s["a"])(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(i["a"])().get("/api/Teacher/GetBySchool/"+e);case 2:return r=t.sent,t.abrupt("return",r.data);case 4:case"end":return t.stop()}}),t)})))()},createTeacher:function(e){return Object(s["a"])(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(i["a"])().post("/api/Teacher",e);case 2:return r=t.sent,t.abrupt("return",r.data);case 4:case"end":return t.stop()}}),t)})))()},generateCode:function(){return Object(s["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(i["a"])().get("/api/Teacher/GenerateKey");case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})))()}},l=[{title:"#",dataIndex:"id",key:"id"},{title:"Login Code",dataIndex:"LoginCode"},{title:"Description",dataIndex:"Description"},{title:"Status",dataIndex:"Status",scopedSlots:{customRender:"status"}}],d={props:["schoolList"],data:function(){return{campusList:[],columns:l,tableLoading:!1}},methods:{filterOption:function(e,t){return t.componentOptions.children[0].text.toLowerCase().indexOf(e.toLowerCase())>=0},handleChangeSchool:function(e){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function r(){var a;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return t.tableLoading=!0,r.next=3,u.getTeachers(e);case 3:a=r.sent,t.campusList=a,t.tableLoading=!1;case 6:case"end":return r.stop()}}),r)})))()}}},p=d,m=(r("6165"),r("2877")),h=Object(m["a"])(p,o,c,!1,null,"30542e63",null),f=h.exports,v=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("a-form",{staticClass:"mt-3",attrs:{form:e.form},on:{submit:function(t){return t.preventDefault(),e.validateTeacher(t)}}},[r("a-form-item",{attrs:{label:"School","label-col":{sm:4},"wrapper-col":{xs:24,sm:20,md:10}}},[r("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["SchoolID",{rules:[{required:!0,message:"Please select a school!"}]}],expression:"[\n 'SchoolID',\n { rules: [{ required: true, message: 'Please select a school!' }] },\n ]"}],attrs:{showSearch:"",placeholder:"Select a School",optionFilterProp:"children",filterOption:e.filterOption}},e._l(e.schoolList,(function(t){return r("a-select-option",{key:t.id,attrs:{value:t.id}},[e._v(" "+e._s(t.Name)+" ")])})),1)],1),r("a-form-item",{attrs:{label:"Login Code","label-col":{sm:5,md:4},"wrapper-col":{xs:24,sm:19,md:10}}},[r("a-input-group",[r("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["LoginCode",{rules:[{required:!0,message:"Please input a login code!"}]}],expression:"['LoginCode', { rules: [{ required: true, message: 'Please input a login code!'}] }]"}],staticStyle:{width:"60%"},attrs:{placeholder:"Login Code"}}),r("a-button",{staticStyle:{width:"40%"},attrs:{type:"primary"},on:{click:e.generateCode}},[e._v("Generate Code")])],1)],1),r("a-form-item",{attrs:{label:"Description","label-col":{sm:5,md:4},"wrapper-col":{xs:24,sm:19,md:10}}},[r("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["Description",{rules:[{required:!0,message:"Please input a teacher description!"}]}],expression:"['Description', { rules: [{ required: true, message: 'Please input a teacher description!'}] }]"}],attrs:{placeholder:"Description"}})],1),r("a-form-item",{attrs:{label:"Status","label-col":{sm:4},"wrapper-col":{xs:24,sm:20,md:10}}},[r("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["Status",{initialValue:1},{rules:[{required:!0,message:"Please select a status!"}]}],expression:"[\n 'Status',\n { initialValue: 1 },\n { rules: [{ required: true, message: 'Please select a status!' }] },\n ]"}],attrs:{placeholder:"Select a Status"}},[r("a-select-option",{attrs:{value:1}},[e._v(" Active ")]),r("a-select-option",{attrs:{value:0}},[e._v(" Deleted ")])],1)],1),r("a-form-item",{attrs:{"wrapper-col":{xs:24,sm:21,md:{span:3,offset:6}}}},[r("a-button",{attrs:{htmlType:"submit",type:"primary",shape:"round",block:!0}},[e._v("Add")])],1)],1)},g=[],b={props:["schoolList"],beforeCreate:function(){this.form=this.$form.createForm(this,{name:"teacher"})},methods:{validateTeacher:function(){var e=this;this.form.validateFields((function(t,r){t||e.createTeacher(r)}))},createTeacher:function(e){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function r(){var a;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,u.createTeacher(e);case 2:a=r.sent,a&&(t.$message.success("Teacher Created!"),t.form.resetFields());case 4:case"end":return r.stop()}}),r)})))()},filterOption:function(e,t){return t.componentOptions.children[0].text.toLowerCase().indexOf(e.toLowerCase())>=0},generateCode:function(){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,u.generateCode();case 2:r=t.sent,e.form.setFieldsValue({LoginCode:r});case 4:case"end":return t.stop()}}),t)})))()}}},w=b,x=Object(m["a"])(w,v,g,!1,null,"395fd53c",null),L=x.exports,S=r("263a"),O={components:{TeacherList:f,CreateTeacher:L},data:function(){return{schoolList:[]}},created:function(){this.setSchoolList(),this.$store.commit("setActiveNavText","7")},methods:{setSchoolList:function(){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,S["a"].getSchoolList();case 2:r=t.sent,e.schoolList=r;case 4:case"end":return t.stop()}}),t)})))()}}},C=O,k=(r("4239"),Object(m["a"])(C,a,n,!1,null,"88109850",null));t["default"]=k.exports},6165:function(e,t,r){"use strict";r("80cd")},"80cd":function(e,t,r){},a36e:function(e,t,r){}}]); //# sourceMappingURL=chunk-6035182d.d0f26dcc.js.map