(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d213767"],{ad7e:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t._self._c;return e("div",[t.loading&&!t.list.length?e("div",{staticClass:"d-flex justify-center"},[e("i",{staticClass:"far fa-spinner-third fa-spin"})]):e("div",[e("div",{staticClass:"d-flex justify-content-between align-items-center"},[e("h6",{staticClass:"m-0"},[t._v(t._s(t.title)),t.iconClass?e("i",{class:t.iconClass}):t._e()]),e("a",{on:{click:function(e){t.isNew=!t.isNew}}},[e("i",{class:t.isNew?"far fa-times fa-fw":"far fa-plus fa-fw"})])]),t.canEdit&&t.isNew?e("CommentForm",{attrs:{parent:t.parent,type:t.type},on:{add:t.add}}):t._e(),t._l(t.list,(function(n){return e("CommentItem",{key:n._id,attrs:{item:n,type:t.type,canEdit:t.canEdit},on:{remove:t.remove,update:t.update}})})),t.canLoadMore?e("div",{staticClass:"mt-2 d-flex justify-content-end"},[e("b-button",{attrs:{disabled:t.loading,size:"sm",variant:"link",block:""},on:{click:t.loadNextComments}},[t._v(" Load More ")])],1):t._e()],2)])},a=[],s=n("75fc"),r=(n("96cf"),n("3b8d")),o=n("987f"),c={name:"Comments",inject:["$validator"],components:{CommentForm:function(){return n.e("chunk-2d0d4417").then(n.bind(null,"5ff6"))},CommentItem:function(){return n.e("chunk-2d0f066f").then(n.bind(null,"9be5"))}},props:["parent","type","canEdit","title","iconClass"],data:function(){return{canLoadMore:!1,limit:10,page:1,list:[],text:null,pending:!1,loading:!1,isNew:!1}},created:function(){var t=Object(r["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:this.loadComments();case 1:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}(),methods:{loadNextComments:function(){this.page++,this.loadComments()},loadComments:function(){var t=Object(r["a"])(regeneratorRuntime.mark((function t(){var e,n,i,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,this.loading=!0,e={parent:this.parent,type:this.type,page:this.page,limit:this.limit},t.next=5,this.$http.get("/comments",{params:e,paramsSerializer:o["a"]});case 5:n=t.sent.data,i=n.data,a=n.count,this.list=[].concat(Object(s["a"])(this.list),Object(s["a"])(i)),this.canLoadMore=this.list.length<a,t.next=14;break;case 12:t.prev=12,t.t0=t["catch"](0);case 14:return t.prev=14,this.loading=!1,t.finish(14);case 17:case"end":return t.stop()}}),t,this,[[0,12,14,17]])})));function e(){return t.apply(this,arguments)}return e}(),update:function(){this.onChange()},remove:function(t){this.list=this.list.filter((function(e){return e._id!==t._id})),this.onChange()},add:function(t){this.list.splice(0,0,t),this.onChange()},onChange:function(){this.$emit("change")}}},l=c,d=n("2877"),u=Object(d["a"])(l,i,a,!1,null,null,null);e["default"]=u.exports}}]);
//# sourceMappingURL=chunk-2d213767.2d766af4.js.map