text: (window.webpackJsonp=window.webpackJsonp||[]).push([[2],{"+N8M":function(t,e,s){var n=s("Je9S");"string"==typeof n&&(n=[[t.i,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};s("aET+")(n,o);n.locals&&(t.exports=n.locals)},"6lVQ":function(t,e,s){"use strict";s("kluA")},"8s/l":function(t,e,s){(e=t.exports=s("I1BE")(!1)).i(s("C1MV"),""),e.i(s("snQs"),""),e.push([t.i,"",""])},G1MX:function(t,e,s){"use strict";s("+N8M")},JIvn:function(t,e,s){"use strict";s.r(e);var n=s("L2JU");s("DjPg");s("qQBl");var o={props:{id:{type:String,required:!0},multiple:{type:Boolean,default:!1},settings:{type:Object,required:!0}},data:function(){return{settingsDefault:{mount:!1,theme:"bootstrap",language:"es",closeOnSelect:!0,ajax:function(){},minimumInputLength:0,templateResult:function(){},templateSelection:function(){}}}},watch:{"settings.mount":function(t){this.settingsDefault.mount=t,t&&this.mountComponent()}},methods:{mountComponent:function(){var t=Object.assign(this.settingsDefault,this.settings);$("select#".concat(this.id)).select2(t),$("select#".concat(this.id)).on("select2:unselect",this.settings.unselect)}}},a=(s("G1MX"),s("KHd+"));function i(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,n)}return s}function r(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?i(Object(s),!0).forEach((function(e){l(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):i(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}function l(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}var c={components:{Select2Component:Object(a.a)(o,(function(){var t=this.$createElement;return(this._self._c||t)("select",{attrs:{id:this.id,multiple:this.multiple}})}),[],!1,null,null,null).exports},data:function(){return{settingsSelect2:{mount:!1,closeOnSelect:!1,ajax:{url:"/permissions/select2",dataType:"JSON",delay:50,data:function(t){return{search:t.term}},processResults:function(t){return{results:t.permissions}},cache:!0},templateResult:function(t){return void 0!==t.id&&""!==t.id?t.name:"Buscando..."},templateSelection:null,unselect:null}}},computed:r(r({},Object(n.c)({updateMode:"roles/form/getUpdateMode",role:"roles/form/getRole"})),{},{title:function(){return this.updateMode?"ACTUALIZAR ROLE":"REGISTRAR ROLE"},classButton:function(){return this.updateMode?"btn btn-success":"btn btn-primary"},textButton:function(){return this.updateMode?"Actualizar":"Guardar"}}),methods:r(r({},Object(n.b)({submitRoleForm:"roles/form/submitRoleForm"})),{},{mountSelect2:function(){var t=this;this.settingsSelect2.templateSelection=function(e){return void 0!==e.id&&""!==e.id?(t.role.permissions.includes(e.id)||t.role.permissions.push(e.id),e.name):"Seleccione los permisos para el rol"},this.settingsSelect2.unselect=function(e){t.role.permissions.splice(t.role.permissions.indexOf(e.params.data.id),1)},this.settingsSelect2.mount=!0}}),mounted:function(){this.mountSelect2()}};s("6lVQ");function u(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,n)}return s}function d(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?u(Object(s),!0).forEach((function(e){m(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):u(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}function m(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}var p={components:{RoleForm:Object(a.a)(c,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"modal fade show",attrs:{id:"modal-role-form","aria-modal":"true",role:"dialog"}},[s("div",{staticClass:"modal-dialog"},[s("div",{staticClass:"modal-content"},[s("div",{staticClass:"modal-header"},[s("h4",{staticClass:"modal-title"},[t._v(t._s(t.title))]),t._v(" "),t._m(0)]),t._v(" "),s("div",{staticClass:"modal-body"},[s("form",{attrs:{id:"role-form"},on:{submit:function(e){return e.preventDefault(),t.submitRoleForm()}}},[s("div",{staticClass:"form-group"},[s("label",[t._v("Nombre")]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.role.name,expression:"role.name"}],staticClass:"form-control",attrs:{type:"text",placeholder:"modulo_permiso",dusk:"role-name",pattern:"[\\w\\s]{5,}",title:"El nombre debe contener al menos 5 caracteres",required:""},domProps:{value:t.role.name},on:{input:function(e){e.target.composing||t.$set(t.role,"name",e.target.value)}}})]),t._v(" "),s("div",{staticClass:"form-group"},[s("label",[t._v("Descripcion")]),t._v(" "),s("textarea",{directives:[{name:"model",rawName:"v-model",value:t.role.description,expression:"role.description"}],staticClass:"form-control",attrs:{rows:"5",placeholder:"Descripcion...",pattern:"[\\w\\s]{5,}",title:"La descripcion debe contener al menos 5 caracteres",dusk:"role-description"},domProps:{value:t.role.description},on:{input:function(e){e.target.composing||t.$set(t.role,"description",e.target.value)}}})]),t._v(" "),s("div",{staticClass:"form-group"},[s("label",[t._v("Permisos")]),t._v(" "),s("Select2Component",{attrs:{id:"role-permissions",multiple:!0,settings:t.settingsSelect2}})],1)])]),t._v(" "),s("div",{staticClass:"modal-footer justify-content-between"},[s("button",{staticClass:"btn btn-default",attrs:{type:"button","data-dismiss":"modal"}},[t._v("Cerrar")]),t._v(" "),s("button",{class:t.classButton,attrs:{type:"submit",form:"role-form",dusk:"btn-manage-role"}},[t._v("\n                    "+t._s(t.textButton)+"\n                ")])])])])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("button",{staticClass:"close",attrs:{type:"button","data-dismiss":"modal","aria-label":"Close"}},[e("span",{attrs:{"aria-hidden":"true"}},[this._v("×")])])}],!1,null,null,null).exports},computed:d({},Object(n.c)({roles:"roles/getRoles",datatable:"roles/getDatatable",datatableSettings:"roles/getDatatableSettings"})),methods:d(d(d({},Object(n.d)({setRoles:"roles/setRoles",setDatatable:"roles/setDatatable",setDatatableSettings:"roles/setDatatableSettings",setUpdateMode:"roles/form/setUpdateMode",setPermission:"roles/form/setPermission"})),Object(n.b)({ajaxReloadDatatable:"roles/ajaxReloadDatatable"})),{},{getUpdatedListOfRoles:function(){return this.roles},openRoleForm:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.setUpdateMode(t),e&&this.setPermission(e),this.openModal("div#modal-role-form")},loadDatatableSettings:function(){var t=this;return{ajax:{url:"/roles",dataSrc:function(e){var s=e.data;return t.setRoles(s),s}},columns:[{data:"id"},{data:"id",render:function(t){return'\n                            <div class="w-100 text-center">\n                                <div class="btn-group">\n                                    <button class="btn btn-sm btn-primary btn-roles-update" data-id="'.concat(t,'">\n                                        <i class="fas fa-edit"></i>\n                                    </button>\n                                    <button class="btn btn-sm btn-danger btn-roles-delete" data-id="').concat(t,'">\n                                        <i class="fas fa-trash"></i>\n                                    </button>\n                                </div>\n                            </div>\n                        ')}},{data:"name"},{data:"description"},{data:"permissions",name:"permissions.name",render:function(t){var e;return"<a>".concat(null!==(e=null==t?void 0:t.length)&&void 0!==e?e:0," Permisos</a>")}},{data:"created_at",render:function(t){return moment(t).format("DD/MM/YYYY hh:mm:ss A")}}]}},openPermissionUpdateForm:function(t){this.openRoleForm(!0,t)},openSwalWindowDeletePermission:function(t){var e=this;console.log(t),Swal.fire({text:"¿Está realmente seguro de eliminar el permiso ".concat(t.name,"?"),icon:"warning",showCancelButton:!0,confirmButtonColor:"#d33",cancelButtonColor:"#3085d6",confirmButtonText:"Si, eliminarlo!",cancelButtonText:"Cancelar"}).then((function(s){var n=e.setInterceptorAxios("Eliminando el permiso, espere un momento");axios.delete("/roles/".concat(t.id)).then((function(t){e.ajaxReloadDatatable(),Swal.fire({title:"El permiso se elimino correctamente de la base de datos.",icon:"success"})})).catch((function(t){return e.showErrorHttpAxios(t)})),e.ejectInterceptorAxios(n)}))}}),mounted:function(){var t=this.loadDatatableSettings();this.setDatatableSettings(t);var e=this.loadDatatable("table#table-roles-list",this.datatableSettings);this.setDatatable(e),this.listenButtonWithinDatatable(".btn-roles-update",this.getUpdatedListOfRoles,this.openPermissionUpdateForm),this.listenButtonWithinDatatable(".btn-roles-delete",this.getUpdatedListOfRoles,this.openSwalWindowDeletePermission)}},v=Object(a.a)(p,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"content-wrapper"},[t._m(0),t._v(" "),s("div",{staticClass:"content"},[s("div",{staticClass:"container-fluid"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-12"},[s("div",{staticClass:"card card-primary card-outline"},[s("div",{staticClass:"card-header"},[s("div",{staticClass:"d-flex justify-content-between"},[s("h5",{staticClass:"m-0"},[t._v("Listado de Roles")]),t._v(" "),s("div",[s("button",{staticClass:"btn btn-primary",attrs:{dusk:"btn-role-form"},on:{click:function(e){return t.openRoleForm()}}},[s("i",{staticClass:"fa fa-plus"}),t._v(" Role\n                                    ")])])])]),t._v(" "),t._m(1)])])])])]),t._v(" "),s("RoleForm")],1)}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"content-header"},[e("div",{staticClass:"container-fluid"},[e("div",{staticClass:"row mb-2"},[e("div",{staticClass:"col-sm-6"},[e("h1",{staticClass:"m-0"},[this._v("Roles")])]),this._v(" "),e("div",{staticClass:"col-sm-6"},[e("ol",{staticClass:"breadcrumb float-sm-right"},[e("li",{staticClass:"breadcrumb-item"},[e("a",{attrs:{href:"/authentication"}},[this._v("Autenticacion")])]),this._v(" "),e("li",{staticClass:"breadcrumb-item active"},[this._v("Roles")])])])])])])},function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"card-body"},[s("table",{staticClass:"table table-bordered table-hover",attrs:{id:"table-roles-list"}},[s("thead",[s("tr",[s("th",[t._v("Id")]),t._v(" "),s("th",[t._v("Opciones")]),t._v(" "),s("th",[t._v("Nombre")]),t._v(" "),s("th",[t._v("Description")]),t._v(" "),s("th",[t._v("Permisos")]),t._v(" "),s("th",[t._v("Fecha de creación")])])]),t._v(" "),s("tfoot",[s("tr",[s("th",[t._v("Id")]),t._v(" "),s("th",[t._v("Opciones")]),t._v(" "),s("th",[t._v("Nombre")]),t._v(" "),s("th",[t._v("Description")]),t._v(" "),s("th",[t._v("Permisos")]),t._v(" "),s("th",[t._v("Fecha de creación")])])])])])}],!1,null,null,null);e.default=v.exports},Je9S:function(t,e,s){(e=t.exports=s("I1BE")(!1)).i(s("C1MV"),""),e.i(s("snQs"),""),e.push([t.i,"",""])},kluA:function(t,e,s){var n=s("8s/l");"string"==typeof n&&(n=[[t.i,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};s("aET+")(n,o);n.locals&&(t.exports=n.locals)}}]);