text: (window.webpackJsonp=window.webpackJsonp||[]).push([[19],{197:function(t,n,e){"use strict";var r=e(13);function i(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function o(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}n.a={data:function(){return{valid:!0,lazy:!1,loading:!1,description:"",descriptionRules:[function(t){return!!t||"Tidak Boleh Kosong"}],childrens:[{description:"",descriptionRules:[function(t){return!!t||"Tidak Boleh Kosong"}]}]}},methods:function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?i(Object(e),!0).forEach((function(n){o(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}({},Object(r.b)({setSnakbar:"snakbar/setSnakbar"}),{tambah:function(){this.childrens.push({id:0,description:"",descriptionRules:[function(t){return!!t||"Tidak Boleh Kosong"}]})},hapus:function(t){this.childrens.splice(t,1)}})}},199:function(t,n,e){var r=e(366);"string"==typeof r&&(r=[[t.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};e(12)(r,i);r.locals&&(t.exports=r.locals)},365:function(t,n,e){"use strict";var r=e(199);e.n(r).a},366:function(t,n,e){(t.exports=e(11)(!1)).push([t.i,"\n.form-childer[data-v-2b2b43b1]{\n    margin-top:20px;\n    border: 1px solid ;\n    padding: 10px;\n}\n",""])},400:function(t,n,e){"use strict";e.r(n);var r=e(18),i=e.n(r),o=e(197),s=e(53);function a(t,n,e,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void e(t)}a.done?n(c):Promise.resolve(c).then(r,i)}var c,l,d={name:"masterdata.edit",data:function(){return{childrens:[]}},methods:{save:(c=i.a.mark((function t(){var n,e,r=this;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading=!0,n=(n=window.location.pathname).split("/"),n="".concat(n[1],"/").concat(n[2]),(e=new FormData).append("description",this.description),e.append("childrens",JSON.stringify(this.childrens)),e.append("_method","PUT"),t.next=10,this.axios.post(n,e,this.config).then((function(t){r.setSnakbar({color_snakbar:"success",pesan:t.data.message,status:!0})})).catch((function(t){console.log(t.response),r.setSnakbar({pesan:t.response.data.message,status:!0})}));case 10:this.loading=!1;case 11:case"end":return t.stop()}}),t,this)})),l=function(){var t=this,n=arguments;return new Promise((function(e,r){var i=c.apply(t,n);function o(t){a(i,e,r,o,s,"next",t)}function s(t){a(i,e,r,o,s,"throw",t)}o(void 0)}))},function(){return l.apply(this,arguments)}),go:function(){var t=this;this.axios.get(window.location.pathname,this.config).then((function(n){console.log(n);var e=n.data.data;t.description=e.description,e.children.forEach((function(n){t.childrens.push({id:n.id,description:n.description,descriptionRules:t.descriptionRules})})),console.log(t.childrens)})).catch((function(t){console.log(t.response)}))}},created:function(){this.go()},mixins:[o.a,s.a]},u=(e(365),e(19)),p=Object(u.a)(d,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("v-app",[e("v-container",[e("BtnJudul",{attrs:{text:"Edit Master Data"}}),t._v(" "),e("v-card",{staticClass:"border-edit",attrs:{tile:""}},[e("v-card-text",[e("v-container",[e("v-form",{ref:"form",attrs:{"lazy-validation":t.lazy},model:{value:t.valid,callback:function(n){t.valid=n},expression:"valid"}},[e("label",{attrs:{for:"",align:"left"}},[t._v("Master Data")]),t._v(" "),e("v-text-field",{attrs:{rules:t.descriptionRules,label:"Description",required:""},model:{value:t.description,callback:function(n){t.description=n},expression:"description"}}),t._v(" "),e("v-btn",{staticClass:"text-white",attrs:{tile:"",small:"",color:"success"},on:{click:function(n){return t.tambah()}}},[e("v-icon",{attrs:{dark:""}},[t._v("mdi-plus")]),t._v(" Tambah Children\n                    ")],1),t._v(" "),e("br"),t._v(" "),e("div",{staticClass:"form-childer"},[e("label",{attrs:{for:""}},[t._v("Children")]),t._v(" "),t._l(t.childrens,(function(n,r){return e("div",{key:r},[e("v-row",{attrs:{align:"center"}},[e("v-col",{attrs:{cols:"10"}},[e("v-text-field",{attrs:{rules:n.descriptionRules,label:"Description",required:""},model:{value:n.description,callback:function(e){t.$set(n,"description",e)},expression:"children.description"}})],1),t._v(" "),e("v-col",{attrs:{cols:"2"}},[t.childrens.length>1?e("v-btn",{attrs:{fab:"",dark:"","x-small":"",color:"red"},on:{click:function(n){return t.hapus(r)}}},[e("v-icon",{attrs:{dark:""}},[t._v("mdi-close")])],1):t._e()],1)],1)],1)}))],2),t._v(" "),e("v-row",[e("v-col",{attrs:{cols:"12",align:"right"}},[e("v-btn",{attrs:{disabled:!t.valid,color:"success",tile:"",loading:t.loading},on:{click:function(n){return t.save()}}},[t._v("\n                            Simpan\n                            ")])],1)],1)],1)],1)],1),t._v(" "),e("v-card-actions",{})],1)],1)],1)}),[],!1,null,"2b2b43b1",null);n.default=p.exports}}]);