text: (window.webpackJsonp=window.webpackJsonp||[]).push([[36],{"7Lm5":function(e,t,s){"use strict";s.r(t);var i=s("jx1L"),c=s("L2JU");function o(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},i=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),i.forEach(function(t){n(e,t,s[t])})}return e}function n(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}var a={methods:o({},Object(c.mapActions)("topicsables",["clearForm"])),computed:o({},Object(c.mapState)({people:function(e){return e.people},topicsables:function(e){return e.topicsables}}))},r=s("CtO9"),p={name:"topicsables",uri:"people/{people.selected.id}/person-topics/topicsables",isForm:!0},l={props:["mode"],mixins:[i.a,a,r.a],data:function(){return{service:p,topicsablesChecked:{},checkedTopic:{}}},computed:{topicsablesFilterText:{get:function(){return this.$store.state.topicsables.data.filter.text},set:function(e){return this.$store.dispatch(this.service.name+"/mutateSetQueryFilterText",e)}},topicsablesPerPage:{get:function(){return this.$store.state.topicsables.data.links.pagination.per_page},set:function(e){return this.$store.dispatch("topicsables/setPerPage",e)}}},methods:{topicsablesGotoPage:function(e){this.gotoPage(e,"topicsables",this.topicsables.data.links.pagination)},toggleCheck:function(e){this.checkedTopic.hasOwnProperty(e.id)||(this.checkedTopic[e.id]={id:e.id,checked:!1}),this.checkedTopic[e.id].checked=!this.checkedTopic[e.id].checked,this.topicsablesChecked=this.getTopicsablesChecked()},isChecked:function(e){return!!this.checkedTopic.hasOwnProperty(e.id)&&this.checkedTopic[e.id].checked},topicize:function(){var e={personId:this.people.selected.id,topics:this.topicsablesChecked};this.$store.dispatch("topicsables/topicize",e),this.$router.go(-1)},getTopicsablesChecked:function(){return _.filter(this.checkedTopic,function(e){return e.checked})}}},d=s("KHd+"),u=Object(d.a)(l,function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("div",{staticClass:"py-2 text-center"},[s("h1",[e._v(e._s(e.people.selected.name))]),e._v(" "),s("h2",[e._v("Associar Interesses a Pessoas")])]),e._v(" "),s("div",{staticClass:"row justify-content-center"},[s("div",{staticClass:"col-6"},[e.topicsables.data.links?s("app-table-panel",{attrs:{title:"Interesses","per-page":e.topicsablesPerPage,"filter-text":e.topicsablesFilterText},on:{"set-per-page":function(t){e.topicsablesPerPage=t},"input-filter-text":function(t){e.topicsablesFilterText=t.target.value}}},[s("template",{slot:"buttons"},[e.topicsablesChecked.length>0?s("button",{staticClass:"btn btn-primary btn-sm pull-right",attrs:{disabled:e.cannot("people:modify")},on:{click:function(t){return e.topicize()}}},[e._v("\n                        associar interesses\n                    ")]):e._e()]),e._v(" "),s("app-table",{attrs:{pagination:e.topicsables.data.links.pagination,columns:["#","","Nome"]},on:{"goto-page":function(t){return e.personTopicsGotoPage(t)}}},e._l(e.topicsables.data.rows,function(t){return s("tr",{class:{"cursor-pointer":!0,"bg-primary-lighter text-white":e.isCurrent(t,e.topicsables.selected)}},[s("td",{staticClass:"align-middle"},[e._v(e._s(t.id))]),e._v(" "),s("td",{staticClass:"align-middle"},[s("input",{attrs:{type:"checkbox"},domProps:{checked:e.isChecked(t)},on:{input:function(s){return e.toggleCheck(t)}}})]),e._v(" "),s("td",{staticClass:"align-middle"},[e._v(e._s(t.name))])])}),0)],2):e._e()],1)])])},[],!1,null,null,null);t.default=u.exports}}]);