text: (window.webpackJsonp=window.webpackJsonp||[]).push([[35],{"4Aq5":function(e,t,o){var a=o("EyLs");"string"==typeof a&&(a=[[e.i,a,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};o("aET+")(a,i);a.locals&&(e.exports=a.locals)},B9JC:function(e,t,o){"use strict";var a=o("GgG6");o.n(a).a},EyLs:function(e,t,o){(t=o("JPst")(!1)).push([e.i,"\n.pagination-container[data-v-68c28e9d] {\n  background: #fff;\n  padding: 32px 16px;\n}\n.pagination-container.hidden[data-v-68c28e9d] {\n  display: none;\n}\n",""]),e.exports=t},GgG6:function(e,t,o){var a=o("o2Ad");"string"==typeof a&&(a=[[e.i,a,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};o("aET+")(a,i);a.locals&&(e.exports=a.locals)},O26g:function(e,t,o){"use strict";o.r(t);var a=o("o0o1"),i=o.n(a),n=o("yXPU"),r=o.n(n),l={data:function(){return{hexTokens:{F:{pattern:/[0-9a-fA-F]/,transform:function(e){return e.toLocaleUpperCase()}},"#":{pattern:/\d/},X:{pattern:/[0-9a-zA-Z]/},S:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleUpperCase()}},a:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleLowerCase()}},"!":{escape:!0}},materialesAccesorios:[],clientes:[],aceros:[],loadingMaterialAccesorio:!0,form:{id:0,catalogo:1,numero_parte:"",material_id:"",cliente_id:"",locacion_almacen:"",almacen:""},rules:{numero_parte:[{required:!0,message:"Ingresa un número de parte",trigger:"blur"}],material_id:[{required:!0,message:"Selecciona un material/accesorio",trigger:"blur"}],cliente_id:[{required:!0,message:"Selecciona un cliente",trigger:"blur"}]},dialogoAgregar:!1,dialogRef:"myForm"}},methods:{open:function(){this.getMaterialesAccesorios(),this.getClientes(),this.dialogoAgregar=!0},close:function(){this.dialogoAgregar=!1},insert:function(e){var t=this;this.$refs[e].validate((function(e){if(!e)return!1;var o=t.$loading({target:".el-dialog"}),a=t;axios.put("/materialesClientes/insert",a.form).then((function(e){console.log("Response:"),console.log(e),a.$parent.getList(),a.clearFields(),a.close(),o.close(),a.notificarSuccess("Asignado correctamente")})).catch((function(e){a.notificarError(),console.log(e)}))}))},clearFields:function(){this.form.id=0,this.form.catalogo=1,this.form.numero_parte="",this.form.material_id="",this.form.cliente_id="",this.form.locacion_almacen="",this.form.almacen=""},handleClose:function(e){var t=this;this.$confirm("Está seguro que deseas salir?").then((function(e){t.clearFields(),t.close()})).catch((function(e){}))},notificarSuccess:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Agregado correctamente.";this.$message({message:e,type:"success"})},notificarError:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Hubo un error.";this.$message.error({message:e})},getMaterialesAccesorios:function(){var e=this;e.loadingMaterialAccesorio=!0,console.log("GET MATERIALESACC"),console.log(this.form.catalogo),axios.put("/materialesClientes/getMaterialesAccesoriosByCatalogo",{catalogo:this.form.catalogo}).then((function(t){console.table("RESPONSE Materiales Accesorios:"),console.log(t.data),console.table(t.data),e.materialesAccesorios=t.data,e.loadingMaterialAccesorio=!1})).catch((function(t){e.notificarError(),console.log(t),e.loadingMaterialAccesorio=!1}))},getClientes:function(){var e=this;axios.get("/clientes").then((function(t){console.table("RESPONSE Clientes:"),console.log(t.data),console.table(t.data),e.clientes=t.data})).catch((function(t){e.notificarError(),console.log(t)}))}}},s=(o("B9JC"),o("KHd+")),c={data:function(){return{loading:!0,listQuery:{page:1,limit:20,importance:void 0,title:void 0,type:void 0,sort:"+id"},list:[]}},components:{formDialog:Object(s.a)(l,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-position":"top","label-width":"150px"}},[o("el-dialog",{ref:e.dialogRef,attrs:{width:"25%","before-close":e.handleClose,visible:e.dialogoAgregar},on:{"update:visible":function(t){e.dialogoAgregar=t}}},[0==e.form.id?o("span",{attrs:{slot:"title"},slot:"title"},[o("i",{staticClass:"el-icon-plus"}),e._v(" Asignar Material")]):e._e(),e._v(" "),0!=e.form.id?o("span",{attrs:{slot:"title"},slot:"title"},[o("i",{staticClass:"el-icon-edit"}),e._v(" Editar Asignación ")]):e._e(),e._v(" "),o("input",{directives:[{name:"model",rawName:"v-model",value:e.form.id,expression:"form.id"}],attrs:{hidden:""},domProps:{value:e.form.id},on:{input:function(t){t.target.composing||e.$set(e.form,"id",t.target.value)}}}),e._v(" "),o("el-form-item",{attrs:{label:"Categoría",prop:"categoria"}},[o("el-select",{staticStyle:{width:"100%"},on:{change:function(t){return e.getMaterialesAccesorios()}},model:{value:e.form.catalogo,callback:function(t){e.$set(e.form,"catalogo",t)},expression:"form.catalogo"}},[o("el-option",{attrs:{label:"Material",value:1}}),e._v(" "),o("el-option",{attrs:{label:"Accesorio​",value:2}})],1)],1),e._v(" "),o("el-form-item",{attrs:{label:"Número de Parte",prop:"numero_parte"}},[o("el-input",{model:{value:e.form.numero_parte,callback:function(t){e.$set(e.form,"numero_parte",t)},expression:"form.numero_parte"}})],1),e._v(" "),o("el-form-item",{attrs:{label:"Material/Accesorio",prop:"material_id"}},[o("el-select",{staticStyle:{width:"100%"},attrs:{loading:e.loadingMaterialAccesorio},model:{value:e.form.material_id,callback:function(t){e.$set(e.form,"material_id",t)},expression:"form.material_id"}},e._l(e.materialesAccesorios,(function(e){return o("el-option",{key:e.id,attrs:{label:1==e.catalogo?e.nombreCompleto:e.descripcion,value:e.id}})})),1)],1),e._v(" "),o("el-form-item",{attrs:{label:"Cliente",prop:"cliente_id"}},[o("el-select",{staticStyle:{width:"100%"},attrs:{filterable:""},model:{value:e.form.cliente_id,callback:function(t){e.$set(e.form,"cliente_id",t)},expression:"form.cliente_id"}},e._l(e.clientes,(function(e){return o("el-option",{key:e.id,attrs:{label:e.nombre_cliente,value:e.id}})})),1)],1),e._v(" "),o("el-form-item",{attrs:{label:"Almacén",prop:"almacen"}},[o("el-input",{model:{value:e.form.almacen,callback:function(t){e.$set(e.form,"almacen",t)},expression:"form.almacen"}})],1),e._v(" "),o("el-form-item",{attrs:{label:"Locación",prop:"locacion_almacen"}},[o("el-input",{model:{value:e.form.locacion_almacen,callback:function(t){e.$set(e.form,"locacion_almacen",t)},expression:"form.locacion_almacen"}})],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{staticClass:"float-left",on:{click:function(t){e.clearFields(),e.dialogoAgregar=!1}}},[e._v("Cancelar")]),e._v(" "),0==e.form.id?o("el-button",{attrs:{type:"success",icon:"el-icon-check"},on:{click:function(t){return e.insert("form")}}},[e._v("Agregar")]):e._e(),e._v(" "),0!=e.form.id?o("el-button",{attrs:{type:"success",icon:"el-icon-check"},on:{click:function(t){return e.insert("form")}}},[e._v("Guardar")]):e._e()],1)],1)],1)}),[],!1,null,"eb15416c",null).exports,Pagination:o("k9pt").a},methods:{getList:function(){var e=this;return r()(i.a.mark((function t(){var o;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=e,"/materialesClientes",axios.get("/materialesClientes").then((function(e){console.table("RESPONSE:"),console.log(e.data),console.table(e.data),o.list=e.data,o.loading=!1})).catch((function(e){o.notificarError(),console.log(e)}));case 3:case"end":return t.stop()}}),t)})))()},loadFieldsUpdate:function(e){console.log("DATA:"),console.log(e),this.$refs.myForm.form.id=e.id,this.$refs.myForm.form.catalogo=e.catalogo,this.$refs.myForm.form.numero_parte=e.numero_parte,this.$refs.myForm.form.material_id=e.material_id,this.$refs.myForm.form.cliente_id=e.cliente_id,this.$refs.myForm.form.locacion_almacen=e.locacion_almacen,this.$refs.myForm.form.almacen=e.almacen,this.$refs.myForm.open()},deleteRow:function(e){var t=this;t.loading=!0,console.log("DELETE FUNCTION"),axios.post("/materialesClientes/delete",{id:e}).then((function(e){console.log("Response:"),console.log(e),t.getList(),t.notificarSuccess("Eliminado correctamente."),t.loading=!1})).catch((function(e){t.notificarError(),console.log(e),t.loading=!1}))},notificarSuccess:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Agregado correctamente.";this.$message({message:e,type:"success"})},notificarError:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Hubo un error.";this.$message.error({message:e})}},mounted:function(){this.getList()}},u=Object(s.a)(c,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"app-container"},[o("el-row",{attrs:{type:"flex"}}),e._v(" "),o("div",{staticClass:"filter-container"},[o("el-button",{staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-plus"},on:{click:function(t){e.$refs.myForm.clearFields(),e.$refs.myForm.open()}}},[e._v("Agregar")])],1),e._v(" "),o("el-row",[o("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:e.list,border:"","tooltip-effect":"light",fit:"","highlight-current-row":""}},[o("el-table-column",{attrs:{type:"index",align:"center",width:"80"}}),e._v(" "),o("el-table-column",{attrs:{prop:"cliente.nombre_cliente",label:"Cliente"}}),e._v(" "),o("el-table-column",{attrs:{prop:"numero_parte",label:"Núm. de Parte(Cliente)","show-overflow-tooltip":""}}),e._v(" "),o("el-table-column",{attrs:{prop:"nombre",label:"Material/Accesorio","show-overflow-tooltip":""}}),e._v(" "),o("el-table-column",{attrs:{prop:"almacen",label:"Almacén"}}),e._v(" "),o("el-table-column",{attrs:{prop:"locacion_almacen",label:"Locación","show-overflow-tooltip":""}}),e._v(" "),o("el-table-column",{attrs:{fixed:"right",label:"",align:"center",width:"180"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(o){return e.loadFieldsUpdate(t.row)}}},[e._v("Editar")]),e._v(" "),o("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(o){return e.deleteRow(t.row.id)}}},[e._v("Eliminar")])]}}])})],1)],1),e._v(" "),o("el-row",{attrs:{type:"flex",justify:"end"}},[o("pagination",{directives:[{name:"show",rawName:"v-show",value:e.list.length>0,expression:"list.length>0"}],attrs:{total:e.list.length,page:e.list.page,limit:e.listQuery.limit},on:{"update:page":function(t){return e.$set(e.list,"page",t)},"update:limit":function(t){return e.$set(e.listQuery,"limit",t)},pagination:e.getList}})],1),e._v(" "),o("formDialog",{ref:"myForm"})],1)}),[],!1,null,null,null);t.default=u.exports},bHOZ:function(e,t,o){"use strict";var a=o("4Aq5");o.n(a).a},k9pt:function(e,t,o){"use strict";Math.easeInOutQuad=function(e,t,o,a){return(e/=a/2)<1?o/2*e*e+t:-o/2*(--e*(e-2)-1)+t};var a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)};function i(e,t,o){var i=document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop,n=e-i,r=0;t=void 0===t?500:t;!function e(){r+=20;var l,s=Math.easeInOutQuad(r,i,n,t);l=s,document.documentElement.scrollTop=l,document.body.parentNode.scrollTop=l,document.body.scrollTop=l,r<t?a(e):o&&"function"==typeof o&&o()}()}var n={name:"Pagination",props:{total:{required:!0,type:Number},page:{type:Number,default:1},limit:{type:Number,default:20},pageSizes:{type:Array,default:function(){return[10,15,20,30,50]}},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"},background:{type:Boolean,default:!0},autoScroll:{type:Boolean,default:!0},hidden:{type:Boolean,default:!1}},computed:{currentPage:{get:function(){return this.page},set:function(e){this.$emit("update:page",e)}},pageSize:{get:function(){return this.limit},set:function(e){this.$emit("update:limit",e)}}},methods:{handleSizeChange:function(e){this.$emit("pagination",{page:this.currentPage,limit:e}),this.autoScroll&&i(0,800)},handleCurrentChange:function(e){this.$emit("pagination",{page:e,limit:this.pageSize}),this.autoScroll&&i(0,800)}}},r=(o("bHOZ"),o("KHd+")),l=Object(r.a)(n,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"pagination-container",class:{hidden:e.hidden}},[o("el-pagination",e._b({attrs:{background:e.background,"current-page":e.currentPage,"page-size":e.pageSize,layout:e.layout,"page-sizes":e.pageSizes,total:e.total},on:{"update:currentPage":function(t){e.currentPage=t},"update:current-page":function(t){e.currentPage=t},"update:pageSize":function(t){e.pageSize=t},"update:page-size":function(t){e.pageSize=t},"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}},"el-pagination",e.$attrs,!1))],1)}),[],!1,null,"68c28e9d",null);t.a=l.exports},o2Ad:function(e,t,o){(t=o("JPst")(!1)).push([e.i,"\n.color[data-v-eb15416c] {\n    width: 100%;\n}\n",""]),e.exports=t}}]);