text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[14],{ac42:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"q-pa-sm q-gutter-sm"},[r("q-btn",{attrs:{dense:"",color:"secondary",label:"Nuevo Usuario","no-caps":""},on:{click:function(t){e.show_dialog=!0}}}),r("q-table",{attrs:{title:"Treats",data:e.data,columns:e.columns,"row-key":"name",pagination:e.pagination,"binary-state-sort":""},on:{"update:pagination":function(t){e.pagination=t}},scopedSlots:e._u([{key:"top",fn:function(){return[r("div",{staticClass:"row q-col-gutter-sm"},[r("q-dialog",{model:{value:e.show_dialog,callback:function(t){e.show_dialog=t},expression:"show_dialog"}},[r("div",[r("q-form",{ref:"formUser",attrs:{autocomplete:"off"}},[r("q-card",[r("q-card-section",[r("div",{staticClass:"text-h6"},[e._v(e._s(e.formTitle))])]),r("q-card-section",[r("div",{staticClass:"row"},[r("div",{staticClass:"col-6"},[r("q-item",[r("q-input",{attrs:{filled:"",label:"Rol","lazy-rules":"",rules:e.rules.required},model:{value:e.editedItem.idRol,callback:function(t){e.$set(e.editedItem,"idRol",t)},expression:"editedItem.idRol"}})],1)],1),r("div",{staticClass:"col-6"},[r("q-item",[r("q-input",{attrs:{filled:"",label:"Nombres","lazy-rules":"",rules:e.rules.required},model:{value:e.editedItem.nombres,callback:function(t){e.$set(e.editedItem,"nombres",t)},expression:"editedItem.nombres"}})],1)],1),r("div",{staticClass:"col-6"},[r("q-item",[r("q-input",{attrs:{filled:"",label:"Apellidos","lazy-rules":"",rules:e.rules.required},model:{value:e.editedItem.apellidos,callback:function(t){e.$set(e.editedItem,"apellidos",t)},expression:"editedItem.apellidos"}})],1)],1)])]),r("q-card-actions",{attrs:{align:"right"}},[r("q-btn",{attrs:{flat:"",color:"negative",label:"Cancelar"},on:{click:function(t){return e.close()}}}),r("q-btn",{attrs:{flat:"",label:"OK",color:"positive"},on:{click:e.save}})],1)],1)],1)],1)])],1)]},proxy:!0},{key:"body",fn:function(t){return[r("q-tr",{attrs:{props:t}},[r("q-td",{key:"IdUsuario",attrs:{props:t}},[e._v("\n          "+e._s(t.row.idUsuario)+"\n          "),r("q-popup-edit",{model:{value:t.row.idUsuario,callback:function(r){e.$set(t.row,"idUsuario",r)},expression:"props.row.idUsuario"}},[r("q-input",{attrs:{dense:"",autofocus:""},model:{value:t.row.idUsuario,callback:function(r){e.$set(t.row,"idUsuario",r)},expression:"props.row.idUsuario"}})],1)],1),r("q-td",{key:"IdRol",attrs:{props:t}},[e._v("\n          "+e._s(t.row.idRol)+"\n          "),r("q-popup-edit",{attrs:{title:"Actualizar Id Rol",buttons:""},model:{value:t.row.idRol,callback:function(r){e.$set(t.row,"idRol",r)},expression:"props.row.idRol"}},[r("q-input",{attrs:{type:"number",dense:"",autofocus:""},model:{value:t.row.idRol,callback:function(r){e.$set(t.row,"idRol",r)},expression:"props.row.idRol"}})],1)],1),r("q-td",{key:"Nombre",attrs:{props:t}},[r("div",{staticClass:"text-pre-wrap"},[e._v(e._s(t.row.nombres))]),r("q-popup-edit",{model:{value:t.row.nombres,callback:function(r){e.$set(t.row,"nombres",r)},expression:"props.row.nombres"}},[r("q-input",{attrs:{dense:"",autofocus:""},model:{value:t.row.nombres,callback:function(r){e.$set(t.row,"nombres",r)},expression:"props.row.nombres"}})],1)],1),r("q-td",{key:"Apellidos",attrs:{props:t}},[r("div",{staticClass:"text-pre-wrap"},[e._v(e._s(t.row.apellidos))]),r("q-popup-edit",{model:{value:t.row.apellidos,callback:function(r){e.$set(t.row,"apellidos",r)},expression:"props.row.apellidos"}},[r("q-input",{attrs:{dense:"",autofocus:""},model:{value:t.row.apellidos,callback:function(r){e.$set(t.row,"apellidos",r)},expression:"props.row.apellidos"}})],1)],1),r("q-td",{key:"actions",attrs:{props:t}},[r("q-btn",{attrs:{icon:"edit",size:"sm",flat:"",dense:""},on:{click:function(r){return e.editItem(t.row)}}}),r("q-btn",{staticClass:"q-ml-sm",attrs:{icon:"delete",size:"sm",flat:"",dense:""},on:{click:function(r){return e.deleteItem(t.row)}}})],1)],1)]}}])})],1)},a=[],s=r("c973"),o=r.n(s),i=(r("a434"),r("cca6"),r("96cf"),r("c24f")),u={data:function(){return{show_dialog:!1,editedIndex:-1,editedItem:{idUsuario:null,idRol:null,nombres:null,apellidos:null},columns:[{name:"IdUsuario",label:"ID",field:"idUsuario"},{name:"IdRol",label:"Rol",field:"idRol"},{name:"Nombre",label:"Nombres",field:"nombres"},{name:"Apellidos",label:"Apellidos",field:"apellidos"},{name:"actions",label:"Actions",field:"actions"}],pagination:{rowsPerPage:15},data:[],rules:{required:[function(e){return!!e||"Campo Requerido."}],requiredNumber:[function(e){return null!==e&&""!==e||"Please type your age"},function(e){return e>0&&e<100||"Please type a real age"}]}}},mounted:function(){var e=this;return o()(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.getUsers();case 1:case"end":return t.stop()}}),t)})))()},computed:{formTitle:function(){return-1===this.editedIndex?"Nuevo Usuario":"Editar Usuario"}},methods:{getUsers:function(){var e=this;return o()(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i["a"].getUsers();case 3:r=t.sent,e.data=r,t.next=10;break;case 7:t.prev=7,t.t0=t["catch"](0),console.log(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))()},deleteItem:function(e){var t=this;return o()(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:t.$q.dialog({title:"Confirm",dark:!0,message:"Seguro que quieres Eliminar El Registro?",cancel:!0,persistent:!0}).onOk(o()(regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,i["a"].deleteUser(e.idUsuario);case 3:n=t.data.indexOf(e),t.data.splice(n,1),t.$q.notify({type:"positive",position:"center",message:"Usuario Eliminado Correctamente"}),r.next=11;break;case 8:r.prev=8,r.t0=r["catch"](0),t.$q.notify({type:"negative",position:"center",message:"Error Interno, Intente mas Tarde"});case 11:case"end":return r.stop()}}),r,null,[[0,8]])})))).onOk((function(){})).onCancel((function(){console.log(">>>> Cancel")})).onDismiss((function(){}));case 1:case"end":return r.stop()}}),r)})))()},editItem:function(e){this.editedIndex=this.data.indexOf(e),this.editedItem=Object.assign({},e),console.log(this.editedItem),this.show_dialog=!0},close:function(){var e=this;this.show_dialog=!1,this.$nextTick((function(){e.editedItem=Object.assign({},e.defaultItem),e.editedIndex=-1})),this.$refs.formUser.resetValidation()},save:function(){var e=this;return o()(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$refs.formUser.validate();case 2:if(r=t.sent,r){t.next=5;break}return t.abrupt("return");case 5:if(!(e.editedIndex>-1)){t.next=21;break}return t.prev=6,t.next=9,i["a"].updateUser(e.editedItem.idUsuario,{idUsuario:e.editedItem.idUsuario,idRol:e.editedItem.idRol,nombreCompleto:e.editedItem.nombres+" "+e.editedItem.apellidos,nombres:e.editedItem.nombres,apellidos:e.editedItem.apellidos});case 9:return e.$q.notify({type:"positive",position:"center",message:"Usuario Editado Correctamente"}),e.close(),t.next=13,e.getUsers();case 13:t.next=19;break;case 15:t.prev=15,t.t0=t["catch"](6),console.log(t.t0),e.$q.notify({type:"negative",position:"center",message:"Error Interno, Intente mas Tarde"});case 19:t.next=34;break;case 21:return t.prev=21,t.next=24,i["a"].addUser({idRol:e.editedItem.idRol,nombreCompleto:e.editedItem.nombres+" "+e.editedItem.apellidos,nombres:e.editedItem.nombres,apellidos:e.editedItem.apellidos});case 24:return e.$q.notify({type:"positive",position:"center",message:"Usuario Creado Correctamente"}),e.close(),t.next=28,e.getUsers();case 28:t.next=34;break;case 30:t.prev=30,t.t1=t["catch"](21),console.log(t.t1),e.$q.notify({type:"negative",position:"center",message:"Error Interno, Intente mas Tarde"});case 34:case"end":return t.stop()}}),t,null,[[6,15],[21,30]])})))()}}},l=u,c=r("42e1"),d=r("9c40"),p=r("eaac"),m=r("24e8"),f=r("0378"),w=r("f09f"),b=r("a370"),v=r("66e5"),g=r("27f9"),h=r("4b7e"),x=r("bd08"),I=r("db86"),U=r("42a1"),k=r("eebe"),q=r.n(k),R=Object(c["a"])(l,n,a,!1,null,"30bff5e8",null);t["default"]=R.exports;q()(R,"components",{QBtn:d["a"],QTable:p["a"],QDialog:m["a"],QForm:f["a"],QCard:w["a"],QCardSection:b["a"],QItem:v["a"],QInput:g["a"],QCardActions:h["a"],QTr:x["a"],QTd:I["a"],QPopupEdit:U["a"]})},c24f:function(e,t,r){"use strict";var n=r("ded3"),a=r.n(n),s=r("c973"),o=r.n(s),i=(r("96cf"),r("758b")),u=r("bc3a"),l=r.n(u);function c(e){return d.apply(this,arguments)}function d(){return d=o()(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,l.a.get("https://api-validar-dui.herokuapp.com/api/dui/".concat(encodeURIComponent(t)));case 2:return r=e.sent,e.abrupt("return",r.data);case 4:case"end":return e.stop()}}),e)}))),d.apply(this,arguments)}var p={isDui:c};function m(){return f.apply(this,arguments)}function f(){return f=o()(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["a"].get("/Users/GetUsers");case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)}))),f.apply(this,arguments)}function w(e){return b.apply(this,arguments)}function b(){return b=o()(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["a"].get("/Users/UserExistsEmail?email=".concat(encodeURIComponent(t)));case 2:return r=e.sent,e.abrupt("return",r.data);case 4:case"end":return e.stop()}}),e)}))),b.apply(this,arguments)}function v(e){return g.apply(this,arguments)}function g(){return g=o()(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["a"].post("/Users/AddUser",t);case 2:return r=e.sent,e.abrupt("return",r.data);case 4:case"end":return e.stop()}}),e)}))),g.apply(this,arguments)}function h(e,t){return x.apply(this,arguments)}function x(){return x=o()(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["a"].put("/Users/UpdateUser/".concat(encodeURIComponent(t)),r);case 2:return n=e.sent,e.abrupt("return",n.data);case 4:case"end":return e.stop()}}),e)}))),x.apply(this,arguments)}function I(e){return U.apply(this,arguments)}function U(){return U=o()(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["a"].put("/Users/UpdatePassword",t);case 2:return r=e.sent,e.abrupt("return",r.data);case 4:case"end":return e.stop()}}),e)}))),U.apply(this,arguments)}function k(e){return q.apply(this,arguments)}function q(){return q=o()(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,i["a"].delete("/Users/DeleteUser/".concat(encodeURIComponent(t)));case 2:return r=e.sent,e.abrupt("return",r.data);case 4:case"end":return e.stop()}}),e)}))),q.apply(this,arguments)}t["a"]=a()({getUsers:m,addUser:v,updateUser:h,deleteUser:k,userExistsEmail:w,updatePassword:I},p)}}]);