text: (window.webpackJsonp=window.webpackJsonp||[]).push([[26],{"+59b":function(e,t,n){"use strict";n.r(t);var o=n("o0o1"),r=n.n(o),i=n("yXPU"),s=n.n(i),a=n("k9pt"),l=(n("wd/R"),n("7tbW"),n("2F5j"),n("HF+U")),u=n("+Awk"),c=new u.a("departamentos"),d=new u.a("puestos"),p={name:"DepartamentosList",components:{Pagination:a.a},directives:{waves:l.a},created:function(){this.getListDepartamentos()},data:function(){return{loading:!0,loadingPuestos:!1,list:[],total:0,query:{page:1,limit:15,keyword:"",role:""},listPuestos:[],totalPuestos:0,queryPuestos:{page:1,limit:15,keyword:"",role:"",departamento_id:0},formVisible:!1,formTitle:"",activeName:"first",current:{id:0,nombre:"",simbolo:"",descripcion:"",puestos:[]},formVisiblePuestos:!1,formTitlePuestos:"",currentPuesto:{id:0,nombre:"",simbolo:"",descripcion:"",departamento_id:0},rules:{nombre:[{required:!0,message:"Ingresa un Nombre",trigger:"blur"}],simbolo:[{required:!0,message:"Ingresa un simbolo",trigger:"blur"}]},rulesPuestos:{nombre:[{required:!0,message:"Ingresa un Nombre",trigger:"blur"}],simbolo:[{required:!0,message:"Ingresa un simbolo",trigger:"blur"}]}}},computed:{disableEditar:function(){return 0==this.current.id},disableEditarPuestos:function(){return 0==this.currentPuesto.id},disableAgregarPuestos:function(){return 0==this.current.id}},methods:{handleAddPuesto:function(){this.formVisiblePuestos=!0,this.formTitlePuestos="Agregar Puesto"},setCurrentPuestos:function(e){this.$refs.tableListPuestos.setCurrentRow(e)},handleEditFormPuestos:function(){this.formTitlePuestos="Editar Puesto",this.formVisiblePuestos=!0},handleCurrentChangeTable:function(e){null!=e&&(this.current=e,this.queryPuestos.departamento_id=this.current.id,this.getListPuestos())},handleCurrentChangeTablePuestos:function(e){null!=e&&(this.currentPuesto=e)},setCurrent:function(e){this.$refs.tableList.setCurrentRow(e)},handleCreateForm:function(){this.formVisible=!0,this.formTitle="Agregar Nuevo Departamento",this.clearCurrent()},handleEditForm:function(){this.formTitle="Editar Departamento",this.formVisible=!0},handleFilter:function(){this.query.page=1,this.getListDepartamentos()},getListDepartamentos:function(){var e=this;return s()(r.a.mark((function t(){var n,o,i,s,a,l;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.query,o=n.limit,i=n.page,e.loading=!0,t.next=4,c.list(e.query);case 4:s=t.sent,a=s.data,l=s.meta,console.log("GET LIST DATA"),console.log(a),e.list=a,e.list.forEach((function(e,t){e.index=(i-1)*o+t+1})),e.total=l.total,e.loading=!1;case 13:case"end":return t.stop()}}),t)})))()},getListPuestos:function(){var e=this;return s()(r.a.mark((function t(){var n,o,i,s,a,l;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.listPuestos=[],0!=e.query.departamento_id){t.next=3;break}return t.abrupt("return",!1);case 3:return n=e.queryPuestos,o=n.limit,i=n.page,e.loadingPuestos=!0,t.next=7,d.list(e.queryPuestos);case 7:s=t.sent,a=s.data,l=s.meta,console.log("GET LIST DATA"),console.log(a),e.listPuestos=a,e.listPuestos.forEach((function(e,t){e.index=(i-1)*o+t+1})),e.total=l.total,e.loadingPuestos=!1;case 16:case"end":return t.stop()}}),t)})))()},handleSubmit:function(){var e=this;this.$refs.form.validate((function(t){if(!t)return!1;var n=e.$loading({target:".el-dialog"});c.store({current:e.current}).then((function(t){e.$message({message:"Departamento agregado correctamente.",type:"success",duration:5e3}),e.formVisible=!1,e.clearCurrent(),e.getListDepartamentos(),n.close()})).catch((function(e){console.log(e),n.close()}))}))},handleSubmitPuestos:function(){var e=this;this.$refs.form.validate((function(t){if(!t)return!1;var n=e.$loading({target:".el-dialog"});e.currentPuesto.departamento_id=e.current.id,d.store({current:e.currentPuesto}).then((function(t){e.$message({message:"Puesto agregado correctamente.",type:"success",duration:5e3}),e.formVisiblePuestos=!1,e.clearCurrentPuesto(),e.getListPuestos(),n.close()})).catch((function(e){console.log(e),n.close()}))}))},deleteRow:function(e){var t=this;this.$confirm("Esto eliminara permanentemente la Orden Abierta. Quieres continuar?","Advertencia",{confirmButtonText:"Eliminar",cancelButtonText:"Cancelar",type:"warning"}).then((function(){})).catch((function(){t.$message({type:"info",message:"Eliminacion cancelada"})}))},clearCurrent:function(){this.setCurrent(),this.current={id:0,nombre:"",simbolo:"",descripcion:"",puestos:[]},this.queryPuestos.departamento_id=0,this.listPuestos=[]},clearCurrentPuesto:function(){this.setCurrent(),this.currentPuesto={id:0,nombre:"",simbolo:"",descripcion:""}}}},m=(n("ppdl"),n("KHd+")),f=Object(m.a)(p,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-container"},[n("div",{staticClass:"filter-container"},[n("el-row",[n("el-col",{staticStyle:{width:"56%","margin-right":"10px"}},[n("el-button",{staticClass:"filter-item",staticStyle:{"margin-left":"0px"},attrs:{type:"primary",size:"small",icon:"el-icon-plus"},on:{click:function(t){return e.handleCreateForm()}}},[e._v("\n                    Agregar Departamento\n                ")]),e._v(" "),n("el-button",{directives:[{name:"waves",rawName:"v-waves"}],staticClass:"filter-item",staticStyle:{"margin-left":"0px"},attrs:{type:"primary",size:"small",icon:"el-icon-edit",disabled:e.disableEditar},on:{click:function(t){return e.handleEditForm()}}},[e._v("\n                    Editar Departamento\n                ")])],1),e._v(" "),n("el-col",{staticStyle:{width:"40%"}},[n("el-button",{staticClass:"filter-item",attrs:{type:"primary",size:"small",icon:"el-icon-plus",disabled:e.disableAgregarPuestos},on:{click:function(t){return e.handleAddPuesto()}}},[e._v("\n                    Agregar Puesto\n                ")]),e._v(" "),n("el-button",{directives:[{name:"waves",rawName:"v-waves"}],staticClass:"filter-item",staticStyle:{"margin-left":"0px"},attrs:{type:"primary",size:"small",icon:"el-icon-edit",disabled:e.disableEditarPuestos},on:{click:function(t){return e.handleEditFormPuestos()}}},[e._v("Editar Puesto")])],1)],1)],1),e._v(" "),n("el-row",[n("el-col",{staticStyle:{width:"56%","margin-right":"10px"}},[n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"tableList",staticStyle:{width:"100%","word-wrap":"break-word"},attrs:{data:e.list,"highlight-current-row":"",sortable:"",border:"","tooltip-effect":"light",fit:""},on:{"current-change":e.handleCurrentChangeTable}},[n("af-table-column",{attrs:{type:"index",align:"center",sortable:"",fixed:""}}),e._v(" "),n("el-table-column",{attrs:{prop:"nombre",label:"Nombre","show-overflow-tooltip":""}}),e._v(" "),n("el-table-column",{attrs:{prop:"simbolo",label:"Simbolo",align:"center","show-overflow-tooltip":""}}),e._v(" "),n("el-table-column",{attrs:{prop:"descripcion",label:"Descripcion","show-overflow-tooltip":""}})],1)],1),e._v(" "),n("el-col",{staticStyle:{width:"40%"}},[n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loadingPuestos,expression:"loadingPuestos"}],ref:"tableListPuestos",staticStyle:{width:"100%","word-wrap":"break-word"},attrs:{data:e.listPuestos,"highlight-current-row":"",sortable:"",border:"","tooltip-effect":"light",fit:""},on:{"current-change":e.handleCurrentChangeTablePuestos}},[n("af-table-column",{attrs:{type:"index",align:"center",sortable:"",fixed:""}}),e._v(" "),n("el-table-column",{attrs:{prop:"nombre",label:"Nombre","show-overflow-tooltip":""}}),e._v(" "),n("el-table-column",{attrs:{prop:"simbolo",label:"Simbolo",align:"center","show-overflow-tooltip":""}}),e._v(" "),n("el-table-column",{attrs:{prop:"descripcion",label:"Descripcion","show-overflow-tooltip":""}})],1)],1)],1),e._v(" "),n("el-row",{attrs:{type:"flex",justify:"end"}},[n("el-col",{staticStyle:{width:"53%"}},[n("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total>0"}],attrs:{layout:"prev, pager, next",total:e.total,page:e.query.page,limit:e.query.limit},on:{"update:page":function(t){return e.$set(e.query,"page",t)},"update:limit":function(t){return e.$set(e.query,"limit",t)},pagination:e.getListDepartamentos}})],1)],1),e._v(" "),n("el-dialog",{attrs:{title:e.formTitle,visible:e.formVisible,width:"40%"},on:{"update:visible":function(t){e.formVisible=t}}},[n("div",{staticClass:"form-container"},[n("el-form",{ref:"form",attrs:{model:e.current,rules:e.rules,"label-position":"top","label-width":"150px"}},[n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"Nombre",prop:"nombre"}},[n("el-input",{model:{value:e.current.nombre,callback:function(t){e.$set(e.current,"nombre",t)},expression:"current.nombre"}})],1)],1),e._v(" "),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"Simbolo",prop:"simbolo"}},[n("el-input",{model:{value:e.current.simbolo,callback:function(t){e.$set(e.current,"simbolo",t)},expression:"current.simbolo"}})],1)],1)],1),e._v(" "),n("el-row",{attrs:{gutter:20}},[n("el-col",[n("el-form-item",{attrs:{label:"Descripcion",prop:"descripcion"}},[n("el-input",{attrs:{type:"textarea",autosize:{minRows:2,maxRows:16}},model:{value:e.current.descripcion,callback:function(t){e.$set(e.current,"descripcion",t)},expression:"current.descripcion"}})],1)],1)],1)],1)],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{staticClass:"float-left",on:{click:function(t){e.formVisible=!1}}},[e._v("Cancelar")]),e._v(" "),n("el-button",{attrs:{type:"success",icon:"el-icon-check"},on:{click:function(t){return e.handleSubmit()}}},[e._v("Confirmar")])],1)]),e._v(" "),n("el-dialog",{attrs:{title:e.formTitlePuestos,visible:e.formVisiblePuestos,width:"30%"},on:{"update:visible":function(t){e.formVisiblePuestos=t}}},[n("div",{staticClass:"form-container"},[n("el-form",{ref:"form",attrs:{model:e.currentPuesto,rules:e.rulesPuestos,"label-position":"top","label-width":"150px"}},[n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"Nombre",prop:"nombre"}},[n("el-input",{model:{value:e.currentPuesto.nombre,callback:function(t){e.$set(e.currentPuesto,"nombre",t)},expression:"currentPuesto.nombre"}})],1)],1),e._v(" "),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"Simbolo",prop:"simbolo"}},[n("el-input",{model:{value:e.currentPuesto.simbolo,callback:function(t){e.$set(e.currentPuesto,"simbolo",t)},expression:"currentPuesto.simbolo"}})],1)],1)],1),e._v(" "),n("el-row",{attrs:{gutter:20}},[n("el-col",[n("el-form-item",{attrs:{label:"Descripcion",prop:"descripcion"}},[n("el-input",{attrs:{type:"textarea",autosize:{minRows:2,maxRows:16}},model:{value:e.currentPuesto.descripcion,callback:function(t){e.$set(e.currentPuesto,"descripcion",t)},expression:"currentPuesto.descripcion"}})],1)],1)],1)],1)],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{staticClass:"float-left",on:{click:function(t){e.formVisiblePuestos=!1}}},[e._v("Cancelar")]),e._v(" "),n("el-button",{attrs:{type:"success",icon:"el-icon-check"},on:{click:function(t){return e.handleSubmitPuestos()}}},[e._v("Confirmar")])],1)])],1)}),[],!1,null,null,null);t.default=f.exports},"+Awk":function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var o=n("lwsE"),r=n.n(o),i=n("W8MJ"),s=n.n(i),a=n("rywy"),l=function(){function e(t){r()(this,e),this.uri=t}return s()(e,[{key:"list",value:function(e){return Object(a.a)({url:"/"+this.uri,method:"get",params:e})}},{key:"get",value:function(e){return Object(a.a)({url:"/"+this.uri+"/"+e,method:"get"})}},{key:"store",value:function(e){return Object(a.a)({url:"/"+this.uri,method:"post",data:e})}},{key:"update",value:function(e,t){return Object(a.a)({url:"/"+this.uri+"/"+e,method:"put",data:t})}},{key:"destroy",value:function(e){return Object(a.a)({url:"/"+this.uri+"/"+e,method:"delete"})}}]),e}()},"4Aq5":function(e,t,n){var o=n("EyLs");"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(o,r);o.locals&&(e.exports=o.locals)},"7sWw":function(e,t,n){var o=n("VyIk");"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(o,r);o.locals&&(e.exports=o.locals)},EyLs:function(e,t,n){(t=n("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},"HF+U":function(e,t,n){"use strict";n("7sWw");var o="@@wavesContext";function r(e,t){function n(n){var o=Object.assign({},t.value),r=Object.assign({ele:e,type:"hit",color:"rgba(0, 0, 0, 0.15)"},o),i=r.ele;if(i){i.style.position="relative",i.style.overflow="hidden";var s=i.getBoundingClientRect(),a=i.querySelector(".waves-ripple");switch(a?a.className="waves-ripple":((a=document.createElement("span")).className="waves-ripple",a.style.height=a.style.width=Math.max(s.width,s.height)+"px",i.appendChild(a)),r.type){case"center":a.style.top=s.height/2-a.offsetHeight/2+"px",a.style.left=s.width/2-a.offsetWidth/2+"px";break;default:a.style.top=(n.pageY-s.top-a.offsetHeight/2-document.documentElement.scrollTop||document.body.scrollTop)+"px",a.style.left=(n.pageX-s.left-a.offsetWidth/2-document.documentElement.scrollLeft||document.body.scrollLeft)+"px"}return a.style.backgroundColor=r.color,a.className="waves-ripple z-active",!1}}return e[o]?e[o].removeHandle=n:e[o]={removeHandle:n},n}var i={bind:function(e,t){e.addEventListener("click",r(e,t),!1)},update:function(e,t){e.removeEventListener("click",e[o].removeHandle,!0),e.addEventListener("click",r(e,t),!1)},unbind:function(e){e.removeEventListener("click",e[o].removeHandle,!1),e[o]=null,delete e[o]}},s=function(e){e.directive("waves",i)};window.Vue&&(window.waves=i,Vue.use(s)),i.install=s;t.a=i},JiiM:function(e,t,n){var o=n("eVdz");"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(o,r);o.locals&&(e.exports=o.locals)},VyIk:function(e,t,n){(t=n("JPst")(!1)).push([e.i,".waves-ripple {\n    position: absolute;\n    border-radius: 100%;\n    background-color: rgba(0, 0, 0, 0.15);\n    background-clip: padding-box;\n    pointer-events: none;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n    -webkit-transform: scale(0);\n    transform: scale(0);\n    opacity: 1;\n}\n\n.waves-ripple.z-active {\n    opacity: 0;\n    -webkit-transform: scale(2);\n    transform: scale(2);\n    -webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;\n    transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;\n    transition: opacity 1.2s ease-out, transform 0.6s ease-out;\n    transition: opacity 1.2s ease-out, transform 0.6s ease-out, -webkit-transform 0.6s ease-out;\n}",""]),e.exports=t},bHOZ:function(e,t,n){"use strict";var o=n("4Aq5");n.n(o).a},eVdz:function(e,t,n){(t=n("JPst")(!1)).push([e.i,"\n.el-select .el-input {\n    width: 180px;\n}\n.el-transfer-panel{\n    width: 35%;\n}\n.input-with-select .el-input-group__prepend {\n    background-color: #fff;\n}\n.pre-formateado {\n    white-space: pre;\n}\n.el-table .cell {\n    word-break: break-word;\n}\n\n\n",""]),e.exports=t},k9pt:function(e,t,n){"use strict";Math.easeInOutQuad=function(e,t,n,o){return(e/=o/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t};var o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)};function r(e,t,n){var r=document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop,i=e-r,s=0;t=void 0===t?500:t;!function e(){s+=20;var a,l=Math.easeInOutQuad(s,r,i,t);a=l,document.documentElement.scrollTop=a,document.body.parentNode.scrollTop=a,document.body.scrollTop=a,s<t?o(e):n&&"function"==typeof n&&n()}()}var i={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&&r(0,800)},handleCurrentChange:function(e){this.$emit("pagination",{page:e,limit:this.pageSize}),this.autoScroll&&r(0,800)}}},s=(n("bHOZ"),n("KHd+")),a=Object(s.a)(i,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"pagination-container",class:{hidden:e.hidden}},[n("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=a.exports},ppdl:function(e,t,n){"use strict";var o=n("JiiM");n.n(o).a}}]);