(window.webpackJsonp=window.webpackJsonp||[]).push([[117],{359:function(t,a,s){"use strict";s.r(a);var r=s(1),e=s.n(r),o=s(488);e.a.component(o.HasError.name,o.HasError);var n={name:"Edit",created:function(){var t=this;this.getFactory(),setTimeout((function(){t.loading=!1}),500)},data:function(){return{form:new o.Form({name:"",address:""}),loading:!0,error:""}},methods:{getFactory:function(){var t=this;axios.get("/api/edit/factory/"+this.$route.params.id).then((function(a){"SUCCESS"==a.data.status?(t.form.name=a.data.factory.name,t.form.address=a.data.factory.address):t.$toastr.e(a.data.message)}))},update:function(){var t=this;this.form.post("/api/update/factory/"+this.$route.params.id,{transformRequest:[function(t,a){return objectToFormData(t)}],onUploadProgress:function(t){console.log(t)}}).then((function(a){console.log(a),"SUCCESS"==a.data.status?(t.$router.push({name:"factory_list"}),t.$toasted.show(a.data.message,{type:"success",position:"top-center",duration:4e3})):t.$toastr.e(a.data.message)})).catch((function(a){console.log(a),t.$toastr.e(a.response.data.message)}))}}},i=s(3),d=Object(i.a)(n,(function(){var t=this,a=t._self._c;return a("div",[a("admin-main"),t._v(" "),a("div",{staticClass:"content-wrapper"},[a("section",{staticClass:"content-header"},[a("h1",[a("router-link",{staticClass:"btn btn-primary",attrs:{to:{name:"factory_list"}}},[a("i",{staticClass:"fa fa-arrow-right"})])],1),t._v(" "),t._m(0)]),t._v(" "),a("section",{staticClass:"content"},[a("div",{staticClass:"row justify-content-center"},[a("div",{staticClass:"col-lg-6 col-lg-offset-2"},[a("div",{staticClass:"box box-primary"},[t._m(1),t._v(" "),a("div",{staticClass:"box-body"},[t.loading?a("h1",[a("i",{staticClass:"fa fa-spinner fa-spin"})]):a("form",{attrs:{enctype:"multipart/form-data"},on:{submit:function(a){return a.preventDefault(),t.update.apply(null,arguments)},keydown:function(a){return t.form.onKeydown(a)}}},[t.error?a("div",{staticClass:"alert-danger alert"},[t._v("\n                  "+t._s(t.error)+"\n                ")]):t._e(),t._v(" "),a("div",{staticClass:"form-group"},[a("label",[t._v("Name")]),t._v(" "),a("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"},domProps:{value:t.form.name},on:{input:function(a){a.target.composing||t.$set(t.form,"name",a.target.value)}}}),t._v(" "),a("has-error",{attrs:{form:t.form,field:"name"}})],1),t._v(" "),a("br"),t._v(" "),a("div",{staticClass:"form-group"},[a("label",[t._v("Address")]),t._v(" "),a("input",{directives:[{name:"model",rawName:"v-model",value:t.form.address,expression:"form.address"}],staticClass:"form-control",class:{"is-invalid":t.form.errors.has("address")},attrs:{type:"text",name:"address",placeholder:"factory address "},domProps:{value:t.form.address},on:{input:function(a){a.target.composing||t.$set(t.form,"address",a.target.value)}}}),t._v(" "),a("has-error",{attrs:{form:t.form,field:"address"}})],1),t._v(" "),a("button",{staticClass:"btn btn-primary",attrs:{disabled:t.form.busy,type:"submit"}},[t.form.busy?a("i",{staticClass:"fa fa-spin fa-spinner"}):t._e(),t._v("Submit\n                ")])])])])])])])])],1)}),[function(){var t=this._self._c;return t("ol",{staticClass:"breadcrumb"},[t("li",[t("a",{attrs:{href:"#"}},[t("i",{staticClass:"fa fa-dashboard"}),this._v("Dashboard")])]),this._v(" "),t("li",{staticClass:"active"},[this._v("Edit factory")])])},function(){var t=this._self._c;return t("div",{staticClass:"box-header with-border"},[t("h3",{staticClass:"box-title"},[this._v("Edit factory")])])}],!1,null,null,null);a.default=d.exports}}]);