text: (window.webpackJsonp=window.webpackJsonp||[]).push([[203],{1194:function(t,a,e){"use strict";e.r(a);var r=e(2),o=e.n(r),s=e(0);o.a.component(s.HasError.name,s.HasError);var n={name:"subCategory",created:function(){var t=this;this.category(),setTimeout((function(){t.loading=!1}),500)},data:function(){return{form:new s.Form({name:"",image:"",category:""}),error:"",loading:!0,categories:""}},methods:{category:function(){var t=this;axios.get("/others").then((function(a){"SUCCESS"==a.data.status&&(t.categories=a.data.categories)})).catch((function(t){console.log(t)}))},add:function(){var t=this;this.form.post("/subCategory/add",{transformRequest:[function(t,a){return objectToFormData(t)}]}).then((function(a){console.log(a),"SUCCESS"==a.data.status?(t.$router.push({name:"SubCategory"}),t.$toasted.show(a.data.message,{type:"success",position:"top-center",duration:4e3})):t.error="some thing want to wrong"})).catch((function(a){t.error="some thing want to wrong",t.$toasted.show("some thing want to wrong",{type:"error",position:"top-center",duration:5e3})}))},uploadImage:function(t){var a=t.target.files[0];this.form.image=a}},computed:{}},i=(e(619),e(1)),c=Object(i.a)(n,(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",[e("admin-main"),t._v(" "),e("div",{staticClass:"content-wrapper"},[e("section",{staticClass:"content-header"},[e("h1",[e("router-link",{staticClass:"btn btn-primary",attrs:{to:{name:"SubCategory"}}},[e("i",{staticClass:"fa fa-arrow-right"})])],1),t._v(" "),t._m(0)]),t._v(" "),e("section",{staticClass:"content"},[e("div",{staticClass:"row justify-content-center"},[e("div",{staticClass:"col-lg-6 col-lg-offset-2"},[e("div",{staticClass:"box box-primary"},[t._m(1),t._v(" "),e("div",{staticClass:"box-body"},[t.loading?e("h1",[e("i",{staticClass:"fa fa-spin fa-spinner"})]):e("form",{attrs:{enctype:"multipart/form-data"},on:{submit:function(a){return a.preventDefault(),t.add(a)},keydown:function(a){return t.form.onKeydown(a)}}},[t.error?e("div",{staticClass:"alert-danger alert"},[t._v("\n                                     "+t._s(t.error)+"\n                                 ")]):t._e(),t._v(" "),e("div",{staticClass:"form-group"},[e("label",[t._v("sub category Name")]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.name,expression:"form.name"}],staticClass:"form-control",class:{"is-invalid":t.form.errors.has("name")},attrs:{type:"text",name:"name",autofocus:"",autocomplete:"off",placeholder:"Laptop"},domProps:{value:t.form.name},on:{input:function(a){a.target.composing||t.$set(t.form,"name",a.target.value)}}}),t._v(" "),e("has-error",{attrs:{form:t.form,field:"name"}})],1),t._v(" "),e("div",{staticClass:"form-group"},[e("label",[t._v("Category")]),t._v(" "),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.category,expression:"form.category"}],staticClass:"form-control",class:{"is-invalid":t.form.errors.has("category")},attrs:{name:"category"},on:{change:function(a){var e=Array.prototype.filter.call(a.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.form,"category",a.target.multiple?e:e[0])}}},[e("option",{attrs:{value:""}},[t._v("Select Category")]),t._v(" "),t._l(t.categories,(function(a){return e("option",{domProps:{value:a.id}},[t._v(t._s(a.name))])}))],2),t._v(" "),e("has-error",{attrs:{form:t.form,field:"category"}})],1),t._v(" "),e("div",{staticClass:"form-group"},[e("label",[t._v("sub category Image")]),t._v(" "),e("input",{staticClass:"form-control",class:{"is-invalid":t.form.errors.has("image")},attrs:{type:"file",name:"image"},on:{change:t.uploadImage}}),t._v(" "),e("has-error",{attrs:{form:t.form,field:"image"}})],1),t._v(" "),e("div",{staticClass:"form-group text-center"},[e("button",{staticClass:"btn btn-primary",attrs:{disabled:t.form.busy,type:"submit"}},[t.form.busy?e("i",{staticClass:"fa fa-spin fa-spinner"}):t._e(),t._v("Submit\n                                ")])])])])])])])])])],1)}),[function(){var t=this.$createElement,a=this._self._c||t;return a("ol",{staticClass:"breadcrumb"},[a("li",[a("a",{attrs:{href:"#"}},[a("i",{staticClass:"fa fa-dashboard"}),this._v("Dashboard")])]),this._v(" "),a("li",{staticClass:"active"},[this._v("Sub Category")])])},function(){var t=this.$createElement,a=this._self._c||t;return a("div",{staticClass:"box-header with-border text-center"},[a("h3",{staticClass:"box-title"},[this._v("Add sub category")])])}],!1,null,"52bf070c",null);a.default=c.exports},138:function(t,a,e){var r=e(620);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};e(5)(r,o);r.locals&&(t.exports=r.locals)},619:function(t,a,e){"use strict";var r=e(138);e.n(r).a},620:function(t,a,e){(t.exports=e(4)(!1)).push([t.i,"\n.mb-2[data-v-52bf070c] {\n    margin-bottom: 5px !important;\n}\n",""])}}]);