text: (window.webpackJsonp=window.webpackJsonp||[]).push([[41],{1321:function(t,s,r){"use strict";r.r(s);var i=r(2),n=r.n(i),e=r(0);function a(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,s){if(!t)return;if("string"==typeof t)return o(t,s);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,s)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,s){(null==s||s>t.length)&&(s=t.length);for(var r=0,i=new Array(s);r<s;r++)i[r]=t[r];return i}n.a.component(e.HasError.name,e.HasError);var m={name:"Add",created:function(){this.getPermissonList()},data:function(){return{form:new e.Form({permissons_id:[]}),admin_name:"",role:"",permissons:[],loading:!0,error:""}},methods:{getPermissonList:function(){var t=this;axios.get("/api/get/admin/permission/list/"+this.$route.params.id).then((function(s){var r;(console.log(s),"OK"==s.data.status)&&(t.admin_name=s.data.admin_name[0].name,(r=t.permissons).push.apply(r,a(s.data.permissions)),s.data.admin_has_permissions_id.length&&s.data.admin_has_permissions_id.forEach((function(s){t.form.permissons_id.push(s)})),t.loading=!1)}))},update:function(){var t=this;this.form.post("/api/assign/admin/permissions/"+this.$route.params.id,{ternsformRequest:[function(t,s){return objectToFormData(t)}]}).then((function(s){console.log(s),"OK"==s.data.status&&(t.$toasted.show(s.data.message,{type:"success",duration:4e3,position:"top-center"}),t.$router.push({name:"admin"}))}))}}},c=(r(810),r(1)),d=Object(c.a)(m,(function(){var t=this,s=t.$createElement,r=t._self._c||s;return r("div",[r("admin-main"),t._v(" "),r("div",{staticClass:"content-wrapper"},[r("section",{staticClass:"content-header"},[r("h1",[r("router-link",{staticClass:"btn btn-primary",attrs:{to:{name:"admin"}}},[r("i",{staticClass:"fa fa-arrow-right"})])],1),t._v(" "),t._m(0)]),t._v(" "),r("section",{staticClass:"content"},[r("div",{staticClass:"row justify-content-center"},[r("div",{staticClass:"col-lg-6 col-lg-offset-2"},[r("div",{staticClass:"box box-primary"},[t._m(1),t._v(" "),r("div",{staticClass:"box-body"},[t.loading?r("h1",[r("i",{staticClass:"fa fa-spinner fa-spin"})]):r("form",{attrs:{enctype:"multipart/form-data"},on:{submit:function(s){return s.preventDefault(),t.update(s)},keydown:function(s){return t.form.onKeydown(s)}}},[t.error?r("div",{staticClass:"alert-danger alert"},[t._v("\n                  "+t._s(t.error)+"\n                ")]):t._e(),t._v(" "),r("div",{staticClass:"form-group"},[r("label",[t._v("Admin Name")]),t._v(" "),r("input",{staticClass:"form-control",attrs:{type:"text",readonly:""},domProps:{value:t.admin_name}})]),t._v(" "),t._m(2),t._v(" "),r("div",{staticClass:"row"},t._l(t.permissons,(function(s){return r("div",{key:s.id,staticClass:"col-lg-3"},[r("label",{attrs:{for:"permission_"+s.id}},[r("input",{directives:[{name:"model",rawName:"v-model",value:t.form.permissons_id,expression:"form.permissons_id"}],attrs:{id:"permission_"+s.id,type:"checkbox"},domProps:{value:s.id,checked:Array.isArray(t.form.permissons_id)?t._i(t.form.permissons_id,s.id)>-1:t.form.permissons_id},on:{change:function(r){var i=t.form.permissons_id,n=r.target,e=!!n.checked;if(Array.isArray(i)){var a=s.id,o=t._i(i,a);n.checked?o<0&&t.$set(t.form,"permissons_id",i.concat([a])):o>-1&&t.$set(t.form,"permissons_id",i.slice(0,o).concat(i.slice(o+1)))}else t.$set(t.form,"permissons_id",e)}}}),t._v("\n                         "+t._s(s.name)+"\n                      ")])])})),0),t._v(" "),r("br"),t._v(" "),r("button",{staticClass:"btn btn-primary",attrs:{disabled:t.form.busy,type:"submit"}},[t.form.busy?r("i",{staticClass:"fa fa-spin fa-spinner"}):t._e(),t._v("Submit\n                ")])])])])])])])])],1)}),[function(){var t=this.$createElement,s=this._self._c||t;return s("ol",{staticClass:"breadcrumb"},[s("li",[s("a",{attrs:{href:"#"}},[s("i",{staticClass:"fa fa-dashboard"}),this._v("Dashboard")])]),this._v(" "),s("li",{staticClass:"active"},[this._v("Permissons")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"box-header with-border"},[s("h3",{staticClass:"box-title"},[this._v("Assign Permissions")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h3",[s("strong",[this._v("PERMISSIONS LIST ")])])}],!1,null,"142475e6",null);s.default=d.exports},233:function(t,s,r){var i=r(811);"string"==typeof i&&(i=[[t.i,i,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};r(5)(i,n);i.locals&&(t.exports=i.locals)},810:function(t,s,r){"use strict";var i=r(233);r.n(i).a},811:function(t,s,r){(t.exports=r(4)(!1)).push([t.i,"\n.mb-2[data-v-142475e6] {\r\n  margin-bottom: 5px !important;\n}\r\n",""])}}]);