(window.webpackJsonp=window.webpackJsonp||[]).push([[111],{1259:function(t,e,n){"use strict";n.r(e);n(30);var o,r,c,l,m=n(0),d=(n(7),n(284),n(15),n(129),n(8),{components:{CommentList:n(785).a},data:function(){return{postId:String(),replyText:String(),replyData:Object(),editData:Object(),page:0,inputObserver:null,isEndOfContentVisible:!1}},computed:{theme:function(){return this.$store.state.theme},currentLocale:function(){return this.$i18n.locale},title:function(){return this.$store.state.title},jwt:function(){return this.$store.state.jwt},jwtDecoded:function(){return this.$store.state.jwtDecoded},profile:function(){return this.$store.state.tlc.profile},profilePosts:function(){return this.$store.state.tlc.profilePosts},isLoadingGetProfile:function(){return this.$store.state.tlc.isLoadingGetProfile},isLoadingGetProfilePost:function(){return this.$store.state.tlc.isLoadingGetProfilePost},isLastProfilePost:function(){return this.$store.state.tlc.isLastProfilePost},isLoadingSendComment:function(){return this.$store.state.tlc.isLoadingSendComment}},head:function(){return{title:this.title}},mounted:function(){var t=this;return Object(m.a)(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.$route.params,t.postId=n.commentid,e.next=4,t.loadPostDetail();case 4:return e.next=6,t.loadComments();case 6:window.scrollTo({top:0,behavior:"smooth"}),t.createObserver();case 8:case"end":return e.stop()}}),e)})))()},methods:{loadComments:(l=Object(m.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.$store.dispatch("tlc/actGetComment",{postId:this.postId,page:0,size:10});case 2:case"end":return t.stop()}}),t,this)}))),function(){return l.apply(this,arguments)}),loadPostDetail:(c=Object(m.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.$store.dispatch("tlc/actGetPostDetail",{postId:this.postId});case 2:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)}),onInput:function(){var t=document.getElementById("inputor");t.scrollHeight>41&&t.scrollHeight<108&&(t.style.height="auto",t.style.height=t.scrollHeight+"px")},clearInputor:function(){this.replyData=Object(),this.editData=Object(),this.replyText=String()},startReply:function(data){this.clearInputor(),this.replyData=data,this.replyText="/@".concat(data.commenter.id,"@/ "),document.getElementById("inputor").focus()},startEdit:function(data){this.clearInputor(),this.editData=data,this.replyText=data.originalCommentBody,document.getElementById("inputor").focus()},sendReply:(r=Object(m.a)(regeneratorRuntime.mark((function t(){var text,body,e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!((text=this.replyText.trim()).length<1)){t.next=3;break}return t.abrupt("return");case 3:if(this.jwt){t.next=6;break}return this.$router.push("/"+this.currentLocale+"/login"),t.abrupt("return");case 6:if(this.isLoadingSendComment){t.next=12;break}return body={text:text,comment:this.replyData},t.next=10,this.$store.dispatch("tlc/actSendComment",{postId:this.postId,data:body});case 10:(e=t.sent)&&200==e.status&&(document.getElementById("topComment").scrollIntoView(),this.clearInputor());case 12:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)}),editComment:(o=Object(m.a)(regeneratorRuntime.mark((function t(){var text,body,e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!((text=this.replyText.trim()).length<1)){t.next=3;break}return t.abrupt("return");case 3:if(this.isLoadingSendComment){t.next=9;break}return body={text:text,comment:this.editData},t.next=7,this.$store.dispatch("tlc/actEditComment",{data:body});case 7:(e=t.sent)&&200==e.status&&(document.getElementById(this.editData.parentId?this.editData.parentId:this.editData.id).scrollIntoView(),this.clearInputor());case 9:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)}),createObserver:function(){var t=this,e=this.$refs.endOfContent;this.inputObserver=new IntersectionObserver((function(n){n.forEach((function(n){if(n.isIntersecting)t.isEndOfContentVisible=!0,$("#inputComment").removeClass("active"),$("#inputComment").removeClass("fixed"),t.onEndOfContentVisible();else{t.isEndOfContentVisible=!1;var o=e.getBoundingClientRect();o.top>window.innerHeight?($("#inputComment").addClass("fixed"),setTimeout((function(){$("#inputComment").addClass("active")}),50)):o.bottom}}))}),{root:null,threshold:.1}),this.inputObserver.observe(e)},onEndOfContentVisible:function(){console.log("End of content is visible!"),$("#inputComment").rem}},beforeDestroy:function(){this.observer&&this.inputObserver.disconnect()},layout:function(t){return t.store.state.theme}}),f=d,h=n(128),v=n(995),component=Object(h.a)(f,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"container m-t-10 mt-0-mobile m-b-20"},[e("div",{attrs:{id:"topComment"}},[e("comment-list",{ref:"comment",attrs:{postId:t.postId,replyData:t.replyData},on:{setReplyData:t.startReply,setEditData:t.startEdit}}),t._v(" "),e("div",{ref:"endOfContent",staticClass:"end-of-content"})],1),t._v(" "),e("div",{staticClass:"mt-5 sticky-input",attrs:{id:"inputComment"}},[t.replyData.commenter?e("div",{staticClass:"mb-2 message is-info is-size-14px"},[e("div",{staticClass:"message-body p-10"},[e("span",[t._v("\n                    "+t._s(t.$t("replying"))+" "),e("b",[t._v("@"+t._s(t.replyData.commenter.name))])]),t._v(" "),e("span",{staticClass:"is-pulled-right is-pointer",on:{click:function(e){return t.clearInputor()}}},[e("font-awesome-icon",{attrs:{icon:["fas","times"]}})],1)])]):t._e(),t._v(" "),t.editData.id?e("div",{staticClass:"mb-2 message is-info is-size-14px"},[e("div",{staticClass:"message-body p-10"},[e("span",[t._v("\n                    "+t._s(t.$t("edit"))+' "'),e("span",{domProps:{innerHTML:t._s(t.editData.commentBodyHtml)}}),t._v('"\n                ')]),t._v(" "),e("span",{staticClass:"is-pulled-right is-pointer",on:{click:function(e){return t.clearInputor()}}},[e("font-awesome-icon",{attrs:{icon:["fas","times"]}})],1)])]):t._e(),t._v(" "),e("div",{staticClass:"columns is-mobile mb-0 pb-0"},[e("div",{staticClass:"column is-9 pr-0"},[e("div",{staticClass:"field"},[e("div",{staticClass:"control"},[e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.replyText,expression:"replyText"}],staticClass:"textarea inputor",staticStyle:{height:"40px"},attrs:{id:"inputor",placeholder:"Tambahkan Komentar..."},domProps:{value:t.replyText},on:{input:[function(e){e.target.composing||(t.replyText=e.target.value)},t.onInput]}})])])]),t._v(" "),e("div",{staticClass:"column is-3"},[t.editData.id?e("button",{staticClass:"button is-primary",class:{"is-loading":t.isLoadingSendComment},on:{click:function(e){return t.editComment()}}},[t._v("\n                    Edit\n                ")]):e("button",{staticClass:"button is-primary",class:{"is-loading":t.isLoadingSendComment},on:{click:function(e){return t.sendReply()}}},[t._v("\n                    "+t._s(t.replyData.id?t.$t("reply"):t.$t("send"))+"\n                ")])])])])])}),[],!1,null,null,null);"function"==typeof v.default&&Object(v.default)(component);e.default=component.exports},495:function(t,e,n){"use strict";var o=n(4),r=n(200);o({target:"String",proto:!0,forced:n(201)("sub")},{sub:function(){return r(this,"sub","","")}})},537:function(t,e,n){t.exports=n.p+"img/user.633d921.png"},538:function(t,e){t.exports=function(t){t.options.__i18n=t.options.__i18n||[],t.options.__i18n.push('{"en":{"submit":"Submit","seeMore":"See more","edited":"Edited","deletedComment":"This comment has been deleted"},"id":{"submit":"Submit","seeMore":"Lihat lebih banyak","edited":"Diedit","deletedComment":"Komentar ini telah dihapus"}}'),delete t.options._Ctor}},630:function(t,e,n){"use strict";var o=n(538),r=n.n(o);e.default=r.a},718:function(t,e){t.exports=function(t){t.options.__i18n=t.options.__i18n||[],t.options.__i18n.push('{"en":{"replying":"replying to","send":"Send","reply":"Reply","edit":"Edit"},"id":{"replying":"membalas","send":"Kirim","reply":"Balas","edit":"Ubah"}}'),delete t.options._Ctor}},785:function(t,e,n){"use strict";n(50),n(30),n(495);var o,r,c,l=n(0),m=(n(8),n(19)),d=n.n(m),f={props:["postId","replyData"],data:function(){return{}},computed:{currentLocale:function(){return this.$i18n.locale},jwt:function(){return this.$store.state.jwt},jwtDecoded:function(){return this.$store.state.jwtDecoded},postDetail:function(){return this.$store.state.tlc.postDetail},comment:function(){return this.$store.state.tlc.comment},isLoadingGetComment:function(){return this.$store.state.tlc.isLoadingGetComment}},mounted:function(){},methods:{showMoreReplies:(c=Object(l.a)(regeneratorRuntime.mark((function t(e,n){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return $("#reply-".concat(e)).addClass("is-loading"),t.next=3,this.$store.dispatch("tlc/actGetReplyComment",{postId:this.postId,commentId:e,isShowReplies:!0,page:10==n.size?n.number:n.number+1,size:30,loadMore:10!=n.size});case 3:$("#reply-".concat(e)).removeClass("is-loading");case 4:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)}),showReplies:(r=Object(l.a)(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return $("#open-reply-".concat(e)).removeClass("disnone"),t.next=3,this.$store.dispatch("tlc/actGetReplyComment",{postId:this.postId,commentId:e,isShowReplies:!0,size:10,page:0});case 3:$("#open-reply-".concat(e)).addClass("disnone");case 4:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)}),hideReplies:(o=Object(l.a)(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.$store.dispatch("tlc/actGetReplyComment",{postId:this.postId,commentId:e,isShowReplies:!1});case 2:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)}),setReplyData:function(data){this.$emit("setReplyData",data)},setEditData:function(data){this.$emit("setEditData",data)},loadMoreComments:function(){this.isLoadingGetComment||this.comment.last||this.$store.dispatch("tlc/actGetComment",{postId:this.postId,page:10==this.comment.pageSize?this.comment.pageNumber:this.comment.pageNumber+1,size:30,loadMore:10!=this.comment.pageSize})},formatDate:function(t){var e=d()(),n=d()(t),o=d.a.duration(e.diff(n)),r=Math.floor(o.asWeeks()),c=Math.floor(o.asDays()),l=Math.floor(o.asHours()),m=Math.floor(o.asMinutes());return m<1?"".concat("en"==this.currentLocale?"just now":"baru saja"):m<60?"".concat(m,"m"):l<24?"".concat(l).concat("en"==this.currentLocale?"h":"j"):c<7?"".concat(c).concat("en"==this.currentLocale?"d":"h"):"".concat(r).concat("en"==this.currentLocale?"w":"M")}}},h=f,v=n(128),C=n(630),component=Object(v.a)(h,(function(){var t=this,e=t._self._c;return e("div",[e("div",{staticClass:"columns is-mobile"},[e("div",{staticClass:"column is-2-widescreen is-3-mobile p-r-0"},[e("figure",{staticClass:"image profilePic"},[t.postDetail.customerImageUri?e("img",{staticClass:"is-rounded",attrs:{src:t.postDetail.customerImageUri,alt:"profile"}}):e("img",{staticClass:"is-rounded",attrs:{src:n(537),alt:"profile"}})])]),t._v(" "),e("div",{staticClass:"column is-10-widescreen is-9-mobile"},[e("div",{staticClass:"mb-2"},[e("div",[e("span",[e("nuxt-link",{attrs:{to:"/".concat(t.currentLocale,"/tlc/profile/").concat(t.postDetail.customerId)}},[e("b",[t._v(t._s(t.postDetail.customerName))])])],1),t._v(" "),e("span",[t._v("\n                        "+t._s(t.postDetail.caption)+"\n                    ")])]),t._v(" "),e("div",{staticClass:"mt-2"},[e("small",[t._v("\n                        "+t._s(t.formatDate(t.postDetail.creationDate))+"\n                    ")])])])])]),t._v(" "),t._l(t.comment.data,(function(o,r){return e("div",{key:o.id+r,staticClass:"columns is-mobile",attrs:{id:o.id}},[e("div",{staticClass:"column is-2-widescreen is-3-mobile p-r-0"},[e("figure",{staticClass:"image profilePic"},[o.commenter&&o.commenter.displayImage?e("img",{staticClass:"is-rounded",attrs:{src:o.commenter.displayImage.src,alt:"profile"}}):e("img",{staticClass:"is-rounded",attrs:{src:n(537),alt:"profile"}})])]),t._v(" "),e("div",{staticClass:"column is-10-widescreen is-9-mobile"},[e("div",{staticClass:"mb-2"},[e("div",[e("span",[e("nuxt-link",{attrs:{to:"/".concat(t.currentLocale,"/tlc/profile/").concat(o.commenter.id)}},[e("b",[t._v(t._s(o.commenter.name))])])],1),t._v(" "),"VOID"==o.status?e("small",[e("i",[t._v(t._s(t.$t("deletedComment")))])]):e("span",{domProps:{innerHTML:t._s(o.commentBodyHtml)}})]),t._v(" "),"VOID"!=o.status?e("div",{staticClass:"mt-1"},[e("small",{staticClass:"mr-2"},[t._v("\n                        "+t._s(t.formatDate(o.creationTime))+"\n                    ")]),t._v(" "),e("a",{staticClass:"mr-2"},[e("small",{on:{click:function(e){return t.setReplyData(o)}}},[e("b",[t._v("Reply")])])]),t._v(" "),t.jwt&&t.jwtDecoded.sub==o.commenter.id&&o.isShowEdit?e("a",{staticClass:"mr-2"},[e("small",{on:{click:function(e){return t.setEditData(o)}}},[e("b",[t._v("Edit")])])]):t._e(),t._v(" "),o.modificationTime?e("small",{staticClass:"mr-2"},[t._v("\n                        ("+t._s(t.$t("edited"))+")\n                    ")]):t._e()]):t._e()]),t._v(" "),o.totalReplies>0?e("div",[o.isShowReplies?e("small",{staticClass:"has-text-weight-bold is-pointer",on:{click:function(e){return t.hideReplies(o.id)}}},[t._v("\n                    "+t._s("--- Hide replies")+"\n                ")]):e("small",{staticClass:"has-text-weight-bold is-pointer",on:{click:function(e){return t.showReplies(o.id)}}},[t._v("\n                    "+t._s("--- View replies ")+"("+t._s(o.totalReplies)+")\n                ")]),t._v(" "),e("button",{staticClass:"button is-rounded is-light is-small is-loading disnone",attrs:{id:"open-reply-".concat(o.id)}},[t._v("\n                    A\n                ")])]):t._e(),t._v(" "),e("br"),t._v(" "),o.totalReplies>0?e("div",{staticClass:"mt-3"},[t._l(o.replies.content,(function(o,r){return e("div",{key:o.id+r,staticClass:"columns is-mobile",attrs:{id:o.id}},[e("div",{staticClass:"column is-2-widescreen is-3-mobile p-r-0"},[e("figure",{staticClass:"image profilePic"},[o.commenter.displayImage?e("img",{staticClass:"is-rounded",attrs:{src:o.commenter.displayImage.src}}):e("img",{staticClass:"is-rounded",attrs:{src:n(537),alt:"profile"}})])]),t._v(" "),e("div",{staticClass:"column is-10-widescreen is-9-mobile"},[e("div",[e("div",[e("span",[e("nuxt-link",{attrs:{to:"/".concat(t.currentLocale,"/tlc/profile/").concat(o.commenter.id)}},[e("b",[t._v(t._s(o.commenter.name))])])],1),t._v(" "),"VOID"==o.status?e("small",[e("i",[t._v(t._s(t.$t("deletedComment")))])]):e("span",{domProps:{innerHTML:t._s(o.commentBodyHtml)}})]),t._v(" "),"VOID"!=o.status?e("div",{staticClass:"mt-2"},[e("small",{staticClass:"mr-2"},[t._v("\n                                    "+t._s(t.formatDate(o.creationTime))+"\n                                ")]),t._v(" "),e("a",{staticClass:"mr-2"},[e("small",{on:{click:function(e){return t.setReplyData(o)}}},[e("b",[t._v("Reply")])])]),t._v(" "),t.jwt&&t.jwtDecoded.sub==o.commenter.id&&o.isShowEdit?e("a",{staticClass:"mr-2"},[e("small",{on:{click:function(e){return t.setEditData(o)}}},[e("b",[t._v("Edit")])])]):t._e(),t._v(" "),o.modificationTime?e("small",{staticClass:"mr-2"},[t._v("\n                                    ("+t._s(t.$t("edited"))+")\n                                ")]):t._e()]):t._e()])])])})),t._v(" "),o.isShowReplies&&!o.replies.last?e("div",{staticClass:"columns is-mobile"},[e("div",{staticClass:"column is-2"}),t._v(" "),e("div",{staticClass:"column is-10"},[e("div",[e("button",{staticClass:"button is-rounded is-light is-small",attrs:{id:"reply-".concat(o.id)},on:{click:function(e){return t.showMoreReplies(o.id,o.replies)}}},[t._v("\n                                "+t._s("see more replies")+" ("+t._s(o.replies.totalElements-o.replies.content.length)+")\n                            ")])])])]):t._e()],2):t._e()])])})),t._v(" "),t.comment.last?t._e():e("div",{staticClass:"has-text-centered"},[e("button",{staticClass:"button is-rounded is-light",class:{"is-loading":t.isLoadingGetComment},on:{click:t.loadMoreComments}},[t._v("\n            "+t._s(t.$t("seeMore"))+"\n        ")])])],2)}),[],!1,null,null,null);"function"==typeof C.default&&Object(C.default)(component);e.a=component.exports},995:function(t,e,n){"use strict";var o=n(718),r=n.n(o);e.default=r.a}}]);