1import{L as _}from"./Loader-l3cSYZQu.js";import{C as b,a as f}from"./Comment-pDAaaJ0X.js";import{r as d,o,c as n,a as r,t as i,b as l,h,f as u,F as C,e as y,i as v}from"./vue-router-Cc0Ijf1R.js";import{_ as k}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./Modal-CdTST-ss.js";const w={components:{Loader:_,Comment:f,CommentBox:b},data(){return{lesson:null,comments:[],loading:!0,loadingMore:!1,currentPage:1,lastPage:1,newCommentBody:"",posting:!1}},computed:{hasMorePages(){return this.currentPage<this.lastPage},lessonHeading(){return this.lesson?this.formatDateTimeShort(this.lesson.start)+" ⢠"+this.lesson.instructor.name:""}},mounted(){axios.get("/private-lesson/"+this.$route.params.private_lesson_id).then(e=>{this.lesson=e.data.data,this.loadComments(),this.focusNewComment()})},methods:{loadComments(e=!1){return e&&(this.loadingMore=!0,this.currentPage++),axios.get("/private-lesson-comments/"+this.$route.params.private_lesson_id,{params:{page:this.currentPage}}).then(t=>{this.comments=e?[...this.comments,...t.data.data]:t.data.data,this.currentPage=t.data.meta.current_page,this.lastPage=t.data.meta.last_page,this.loadingMore=!1}).finally(()=>{this.loading=!1})},submitComment(){!this.newCommentBody.trim()||this.posting||(this.posting=!0,Snackbar.show(this.$t("posting")),axios.post("/private-lesson-comments/"+this.$route.params.private_lesson_id,{body:this.newCommentBody}).then(()=>{this.newCommentBody="",this.currentPage=1,this.loadComments().then(()=>{this.posting=!1,Snackbar.show(this.$t("success"))})}))},handleReply(e){this.posting=!0,Snackbar.show(this.$t("posting")),axios.post("/private-lesson-comments/"+this.$route.params.private_lesson_id,{parent_comment_id:e.parent_comment_id,reply_to_user_id:e.reply_to_user_id,body:e.body}).then(()=>{this.currentPage=1,this.loadComments().then(()=>{this.posting=!1,Snackbar.show(this.$t("success"))})})},focusNewComment(){setTimeout(()=>{var e;return(e=this.$refs.newCommentBox)==null?void 0:e.focus()},100)},refreshComments(){this.loading=!0,this.currentPage=1,this.loadComments()}}},P={key:0,class:"p-4 border-bottom d-flex justify-content-between align-items-start"},B={class:"h3"},M={class:"text-muted"},S=["disabled"],N={key:1,class:"px-4 py-3 border-bottom bg-light"},V={class:"small mb-0"},L=["href"],x={key:2,class:"p-4 border-bottom"},R={key:3},$={class:"p-4 mb-5"},H={key:0,class:"small"},T={key:1},D=["disabled"],F={key:0},U={key:1};function j(e,t,E,q,s,a){const c=d("comment-box"),p=d("loader"),g=d("comment");return o(),n("div",null,[s.lesson?(o(),n("div",P,[r("div",null,[r("h1",B,i(e.$tc("comment",2))+": "+i(e.$tc("privateLesson",1)),1),r("div",M,i(a.lessonHeading),1)]),r("button",{class:"btn btn-outline-primary btn-sm",onClick:t[0]||(t[0]=(...m)=>a.refreshComments&&a.refreshComments(...m)),disabled:s.loading},i(e.$t("refresh")),9,S)])):l("",!0),s.lesson?(o(),n("div",N,[r("p",V,[h(i(e.$t("privateLessonDiscussionNote"))+" ",1),r("a",{href:e.HelpCenterUrl,target:"_blank"},i(e.$t("helpCenter")),9,L),t[3]||(t[3]=h(". ",-1))])])):l("",!0),s.lesson?(o(),n("div",x,[u(c,{ref:"newCommentBox",modelValue:s.newCommentBody,"onUpdate:modelValue":t[1]||(t[1]=m=>s.newCommentBody=m),placeholder:e.$t("writeComment"),"submit-label":e.$t("sendComment"),disabled:s.posting,onSubmit:a.submitComment},null,8,["modelValue","placeholder","submit-label","disabled","onSubmit"])])):l("",!0),u(p,{show:s.loading},null,8,["show"]),s.loading?l("",!0):(o(),n("div",R,[r("div",$,[s.comments.length===0?(o(),n("p",H,i(e.$t("noComments")),1)):l("",!0),(o(!0),n(C,null,y(s.comments,m=>(o(),v(g,{key:m.id,comment:m,"is-reply":!1,"show-like":!1,onReply:a.handleReply},null,8,["comment","onReply"]))),128)),a.hasMorePages?(o(),n("div",T,[r("button",{class:"btn btn-outline-primary",onClick:t[2]||(t[2]=m=>a.loadComments(!0)),disabled:s.loadingMore},[s.loadingMore?(o(),n("span",F,i(e.$t("loading"))+"...",1)):(o(),n("span",U,i(e.$t("loadMore")),1))],8,D)])):l("",!0)])]))])}const K=k(w,[["render",j]]);export{K as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.