text: (window.webpackJsonp=window.webpackJsonp||[]).push([[18],{359:function(t,e,r){"use strict";r.r(e);var s=r(2),a=r.n(s);function i(t,e,r,s,a,i,o){try{var n=t[i](o),l=n.value}catch(t){return void r(t)}n.done?e(l):Promise.resolve(l).then(s,a)}var o={data:function(){return{record:{name:"",slug:""},fullscreenLoading:!1,error:0}},computed:{},methods:{limpiarCriterios:function(){this.record.name="",this.record.slug=""},setRegistrarPermiso:function(){var t,e=this;return(t=a.a.mark((function t(){var r,s;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.validarRegistrarPermiso()){t.next=2;break}return t.abrupt("return");case 2:return e.fullscreenLoading=!0,t.next=6,e.callApi("post","/seguridad/permiso/store",e.record);case 6:if(200==(r=t.sent).status)e.notification("success","Registro creado con éxito",0),e.$router.push("/permiso");else{if(422==r.status)for(s in r.data.errors)e.notification("error",r.data.errors[s][0]);401==r.status&&(e.$router.push({name:"login"}),location.reload(),localStorage.clear()),419==r.status&&(e.notification("error","Fue necesario recargar la página",0),location.reload())}e.fullscreenLoading=!1;case 9:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(s,a){var o=t.apply(e,r);function n(t){i(o,s,a,n,l,"next",t)}function l(t){i(o,s,a,n,l,"throw",t)}n(void 0)}))})()},validarRegistrarPermiso:function(){return this.error=0,this.record.name||(this.notification("error","El Nombre es un campo obligatorio",0),this.error=1),this.record.slug||(this.notification("error","La Url Amigable es un campo obligatorio",10),this.error=1),this.error}}},n=r(14),l=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"pcoded-content"},[r("div",{staticClass:"page-header"},[r("div",{staticClass:"page-block"},[r("div",{staticClass:"row align-items-center"},[r("div",{staticClass:"col-md-12"},[t._m(0),t._v(" "),r("ul",{staticClass:"breadcrumb"},[r("li",{staticClass:"breadcrumb-item"},[r("router-link",{attrs:{to:{name:"permiso.index"}}},[r("i",{staticClass:"feather icon-power"})])],1),t._v(" "),r("li",{staticClass:"breadcrumb-item"},[r("router-link",{attrs:{to:{name:"permiso.crear"}}},[t._v("\n                                Crear Permiso\n                            ")])],1)])])])])]),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-sm-12"},[r("div",{staticClass:"card"},[r("div",{staticClass:"card-header"},[r("div",{staticClass:"col-sm-12"},[r("div",{staticClass:"btn-actions"},[r("div",{staticClass:"btn-group card-option"},[r("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"Regresar",placement:"top"}},[r("button",{staticClass:"btn btn-icon btn-outline-primary",on:{click:function(e){return e.preventDefault(),t.goBack(e)}}},[r("i",{staticClass:"fas fa-arrow-left"})])])],1)])])]),t._v(" "),r("div",{staticClass:"card-body"},[r("form",{on:{submit:function(t){t.preventDefault()}}},[r("div",{staticClass:"row"},[r("div",{staticClass:"col-sm-6"},[r("div",{staticClass:"form-group"},[r("label",{attrs:{for:"Nombre"}},[t._v("Nombre (*)")]),t._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:t.record.name,expression:"record.name"}],staticClass:"form-control",attrs:{type:"text",id:"Nombre",placeholder:"Nombre"},domProps:{value:t.record.name},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.setRegistrarPermiso(e)},input:function(e){e.target.composing||t.$set(t.record,"name",e.target.value)}}})])]),t._v(" "),r("div",{staticClass:"col-sm-6"},[r("div",{staticClass:"form-group"},[r("label",{attrs:{for:"Url"}},[t._v("Url Amigable (*)")]),t._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:t.record.slug,expression:"record.slug"}],staticClass:"form-control",attrs:{type:"text",for:"Url",placeholder:"Url Amigable"},domProps:{value:t.record.slug},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.setRegistrarPermiso(e)},input:function(e){e.target.composing||t.$set(t.record,"slug",e.target.value)}}})])])]),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-sm-12"},[r("button",{directives:[{name:"loading",rawName:"v-loading.fullscreen.lock",value:t.fullscreenLoading,expression:"fullscreenLoading",modifiers:{fullscreen:!0,lock:!0}}],staticClass:"btn btn-outline-primary has-ripple",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.setRegistrarPermiso(e)}}},[t._v("Guardar")]),t._v(" "),r("button",{staticClass:"btn btn-outline-info has-ripple ",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.limpiarCriterios(e)}}},[t._v("Limpiar")])])])])])])])])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"page-header-title"},[e("h5",{staticClass:"m-b-10"},[this._v("Gestión Permisos")])])}],!1,null,null,null);e.default=l.exports}}]);