"use strict";(self.webpackChunkworklenz=self.webpackChunkworklenz||[]).push([[771],{63392:(j,P,n)=>{n.d(P,{p:()=>g});var d=n(15861),l=n(96814),h=n(43389),p=n(82669),s=n(96928),i=n(61320),m=n(19035),_=n(24139),a=n(63577),r=n(65879),C=n(64532);function O(f,M){if(1&f&&(r.ynx(0),r._UZ(1,"worklenz-project-updates-list",2),r.BQk()),2&f){const z=r.oxw();r.xp6(1),r.Q6J("projectId",z.projectId)("isLimit",!0)}}const I=function(){return{"padding-bottom":"0px"}};let g=(()=>{var f;class M{constructor(t,E){this.cdr=t,this.utils=E,this.show=!1,this.projectId=null}open(t){var E=this;return(0,d.Z)(function*(){E.show=!0,E.list.loadDataOnDrawer(t),E.cdr.markForCheck()})()}handleClose(){this.reset(),this.show=!1}onVisibleChange(t){t&&this.cdr.markForCheck()}reset(){this.projectId=null}trackById(t,E){return E.id}}return(f=M).\u0275fac=function(t){return new(t||f)(r.Y36(r.sBO),r.Y36(C.F))},f.\u0275cmp=r.Xpm({type:f,selectors:[["worklenz-project-updates-drawer"]],viewQuery:function(t,E){if(1&t&&r.Gf(a.D,5),2&t){let U;r.iGM(U=r.CRH())&&(E.list=U.first)}},standalone:!0,features:[r.jDz],decls:2,vars:7,consts:[[3,"nzWidth","nzClosable","nzTitle","nzVisible","nzPlacement","nzBodyStyle","nzOnClose","nzVisibleChange"],[4,"nzDrawerContent"],[3,"projectId","isLimit"]],template:function(t,E){1&t&&(r.TgZ(0,"nz-drawer",0),r.NdJ("nzOnClose",function(){return E.handleClose()})("nzVisibleChange",function(A){return E.onVisibleChange(A)}),r.YNc(1,O,2,2,"ng-container",1),r.qZA()),2&t&&r.Q6J("nzWidth",600)("nzClosable",!0)("nzTitle","Project Updates")("nzVisible",E.show)("nzPlacement","right")("nzBodyStyle",r.DdM(6,I))},dependencies:[l.ez,h.BL,h.Vz,h.SQ,p.j,s.Rt,i.YM,m._p,_.H0,a.D],styles:[".comments-block[_ngcontent-%COMP%]{position:absolute;bottom:0;left:24px;right:24px;z-index:1;background:#FAFAFA;margin-left:-1.5rem;margin-right:-1.5rem;border-top:1px solid rgba(0,0,0,.06)}nz-comment-content[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{-webkit-user-select:text;user-select:text}nz-skeleton[_ngcontent-%COMP%]{margin-top:-16px}worklenz-project-updates-input[_ngcontent-%COMP%]{position:sticky;bottom:0}"],changeDetection:0}),M})()},63577:(j,P,n)=>{n.d(P,{D:()=>J});var d=n(15861),l=n(96814),h=n(2919),p=n(34302),s=n(96928),i=n(61320),m=n(19035),_=n(24139),a=n(69649),r=n(71993),C=n(42840),O=n(92574),I=n(41958),g=n(60095),f=n(3599),M=n(20824),z=n(36513),t=n(65879),E=n(90586),U=n(93302),A=n(32333),T=n(64532),B=n(78066),y=n(88019),R=n(6593),W=n(70855);function x(c,v){if(1&c&&(t.TgZ(0,"nz-comment-content"),t._UZ(1,"p",13),t.qZA()),2&c){const u=t.oxw().$implicit;t.xp6(1),t.Q6J("innerHTML",u.content,t.oJD)}}function K(c,v){if(1&c){const u=t.EpF();t.TgZ(0,"nz-comment-action")(1,"span",14),t.NdJ("nzOnConfirm",function(){t.CHM(u);const o=t.oxw().$implicit,D=t.oxw(2);return t.KtG(D.deleteComment(o.id))}),t._uU(2," Delete "),t.qZA()()}2&c&&(t.xp6(1),t.Q6J("nzPopconfirmTitle","Are you sure?"))}function b(c,v){if(1&c&&(t.TgZ(0,"nz-comment",10),t.ALo(1,"fromNow"),t._UZ(2,"nz-avatar",11),t.ALo(3,"firstCharUpper"),t.YNc(4,x,2,1,"nz-comment-content",12),t.YNc(5,K,3,1,"nz-comment-action",12),t.qZA()),2&c){const u=v.$implicit,e=t.oxw(2);t.Q6J("nzAuthor",u.created_by)("nzDatetime",t.lcZ(1,8,u.created_at)),t.xp6(2),t.Udp("background-color",e.utils.getColor(u.created_by)),t.Q6J("nzSrc",u.avatar_url)("nzText",t.lcZ(3,10,u.created_by)),t.xp6(2),t.Q6J("ngIf",u.content),t.xp6(1),t.Q6J("ngIf",e.canDelete(u.user_id))}}function S(c,v){if(1&c&&(t.ynx(0,8),t.YNc(1,b,6,12,"nz-comment",9),t.BQk()),2&c){const u=t.oxw();t.xp6(1),t.Q6J("ngForOf",u.updates)("ngForTrackBy",u.trackById)}}function F(c,v){if(1&c){const u=t.EpF();t.TgZ(0,"button",18),t.NdJ("click",function(){t.CHM(u);const o=t.oxw(2);return t.KtG(o.cancel())}),t._uU(1,"Cancel"),t.qZA()}}function $(c,v){if(1&c&&(t.TgZ(0,"button",19),t._uU(1,"Add"),t.qZA()),2&c){const u=t.oxw(2);t.Q6J("disabled",!u.isValid())}}function Z(c,v){1&c&&(t.TgZ(0,"div",15)(1,"nz-space"),t.YNc(2,F,2,0,"button",16),t.YNc(3,$,2,1,"button",17),t.qZA()())}const Y=function(c,v){return{minRows:c,maxRows:v}};let J=(()=>{var c;class v{constructor(e,o,D,L,N,k,Q,w,G){this.fb=e,this.app=o,this.projectMembersApi=D,this.cdr=L,this.auth=N,this.utils=k,this.api=Q,this.service=w,this.sanitizer=G,this.projectId=null,this.isLimit=!1,this.loading=!1,this.commentsInputFocused=!1,this.loadingMembers=!1,this.creatingComment=!1,this.search=null,this.updates=[],this.projectMembers=[],this.mentions=[],this.valueWith=V=>V.name,this.form=this.fb.group({content:[null,[g.kI.required,g.kI.maxLength(2e3)]]}),this.service.onRefresh.pipe((0,r.sL)()).subscribe(()=>{this.get()})}ngOnInit(){this.get(),this.getProjectMembers(),this.getCount(),this.service.emitBadgeDisable()}ngOnDestroy(){this.projectMembers=[],this.search=null,this.mentions=[]}get rows(){return this.cdr.markForCheck(),this.commentsInputFocused?4:1}updateLocalCount(e){return localStorage.setItem("worklenz.project.updates-"+this.projectId,e)}loadDataOnDrawer(e){var o=this;return(0,d.Z)(function*(){o.projectId=e,o.get(),o.getProjectMembers(),o.getCount()})()}get(){var e=this;return(0,d.Z)(function*(){if(e.projectId)try{e.loading=!0;const o=yield e.api.getByProjectId(e.projectId,e.isLimit);o&&(e.updates=o.body,e.loading=!1,e.cdr.markForCheck())}catch(o){(0,a.tu)(o),e.loading=!1,e.cdr.markForCheck()}})()}getCount(){var e=this;return(0,d.Z)(function*(){if(e.projectId)try{const o=yield e.api.getCountByProjectId(e.projectId);o&&(e.updateLocalCount(o.body.toString()),e.cdr.markForCheck())}catch(o){(0,a.tu)(o),e.cdr.markForCheck()}})()}getProjectMembers(){var e=this;return(0,d.Z)(function*(){if(e.projectId)try{e.loadingMembers=!0;const o=yield e.api.getMembers(e.projectId,1,5,null,null,e.search);o.done&&(e.projectMembers=o.body||[]),e.loadingMembers=!1,e.cdr.markForCheck()}catch(o){e.loadingMembers=!1,(0,a.tu)(o),e.cdr.markForCheck()}})()}setFocus(e){this.commentsInputFocused=e}create(){var e=this;return(0,d.Z)(function*(){if(e.projectId&&e.form.value.content&&""!==e.form.value.content.trim())try{e.creatingComment=!0;const o=e.auth.getCurrentSession(),D={project_id:e.projectId,team_id:o?.team_id,content:e.form.value.content,mentions:[...new Set(e.mentions||[])]};(yield e.api.create(D))&&(e.get(),e.getCount(),e.service.emitGetLastUpdate(),e.reset()),e.creatingComment=!1,e.cdr.markForCheck()}catch(o){(0,a.tu)(o),e.creatingComment=!1,e.cdr.markForCheck()}})()}onSearchChange({value:e}){this.search=e}onSelect(e){!e||!e.id||!e.name||this.mentions.some(o=>o.id===e.id)||this.mentions.push({id:e.id,name:e.name})}cancel(){this.setFocus(!1),this.form.reset()}isValid(){return this.form.valid}submit(){this.form.valid?this.create():this.app.displayErrorsOf(this.form)}canDelete(e){return!!e&&e===this.auth.getCurrentSession()?.id}deleteComment(e){var o=this;return(0,d.Z)(function*(){if(e)try{(yield o.api.deleteById(e))&&(o.get(),o.getCount(),o.service.emitGetLastUpdate())}catch(D){(0,a.tu)(D)}})()}trackById(e,o){return o.id}reset(){this.mentions=[],this.form.reset(),this.creatingComment=!1}}return(c=v).\u0275fac=function(e){return new(e||c)(t.Y36(g.qu),t.Y36(E.z),t.Y36(U.r),t.Y36(t.sBO),t.Y36(A.e),t.Y36(T.F),t.Y36(B.L),t.Y36(y.k),t.Y36(R.H7))},c.\u0275cmp=t.Xpm({type:c,selectors:[["worklenz-project-updates-list"]],inputs:{projectId:"projectId",isLimit:"isLimit"},standalone:!0,features:[t.jDz],decls:8,vars:16,consts:[[3,"nzLoading"],["class","comments-list",4,"ngIf"],["nz-form","",3,"formGroup","submit"],[3,"nzSuggestions","nzValueWith","nzLoading","nzNotFoundContent","nzOnSearchChange","nzOnSelect","click"],[3,"nzMaxCharacterCount"],["nz-input","","placeholder","Add a comment...","nzMentionTrigger","",1,"border-0",3,"formControlName","maxlength","rows","nzAutosize"],["input",""],["class","mt-3 justify-content-end d-flex",4,"ngIf"],[1,"comments-list"],[3,"nzAuthor","nzDatetime",4,"ngFor","ngForOf","ngForTrackBy"],[3,"nzAuthor","nzDatetime"],["nz-comment-avatar","",3,"nzSrc","nzText"],[4,"ngIf"],[1,"mention-text",3,"innerHTML"],["nz-popconfirm","",3,"nzPopconfirmTitle","nzOnConfirm"],[1,"mt-3","justify-content-end","d-flex"],["type","button","nz-button","","nzType","default",3,"click",4,"nzSpaceItem"],["type","submit","nz-button","","nzType","primary",3,"disabled",4,"nzSpaceItem"],["type","button","nz-button","","nzType","default",3,"click"],["type","submit","nz-button","","nzType","primary",3,"disabled"]],template:function(e,o){1&e&&(t.TgZ(0,"nz-skeleton",0),t.YNc(1,S,2,2,"ng-container",1),t.TgZ(2,"form",2),t.NdJ("submit",function(){return o.submit()}),t.TgZ(3,"nz-mention",3),t.NdJ("nzOnSearchChange",function(L){return o.onSearchChange(L)})("nzOnSelect",function(L){return o.onSelect(L)})("click",function(){return o.setFocus(!0)}),t.TgZ(4,"nz-textarea-count",4),t._UZ(5,"textarea",5,6),t.qZA()(),t.YNc(7,Z,4,0,"div",7),t.qZA()()),2&e&&(t.Q6J("nzLoading",o.loading),t.xp6(1),t.Q6J("ngIf",o.updates.length),t.xp6(1),t.Q6J("formGroup",o.form),t.xp6(1),t.Q6J("nzSuggestions",o.projectMembers)("nzValueWith",o.valueWith)("nzLoading",o.loadingMembers)("nzNotFoundContent","No members found!"),t.xp6(1),t.Q6J("nzMaxCharacterCount",2e3),t.xp6(1),t.Q6J("formControlName","content")("maxlength",2e3)("rows",o.rows)("nzAutosize",t.WLB(13,Y,o.rows,o.rows)),t.xp6(2),t.Q6J("ngIf",o.commentsInputFocused))},dependencies:[l.ez,l.sg,l.O5,h.I,p.d,s.Rt,s.Dz,i.YM,i.WE,i.DA,i.Y4,i.Ql,m._p,m.JW,_.H0,_.ng,C.sL,C.ix,W.w,I.dQ,f.U5,f.Lr,M.o7,M.w,M.Zp,M.rh,z.Gl,z.YW,z.jO,O.zf,O.NU,O.$1,I.vG,g.UX,g._Y,g.Fj,g.JJ,g.JL,g.nD,g.sg,g.u,g.u5],styles:["textarea[_ngcontent-%COMP%]{box-shadow:none!important}form[_ngcontent-%COMP%]{background-color:#fff;position:sticky;bottom:0;padding-top:12px;padding-bottom:18px}"],changeDetection:0}),v})()},53980:(j,P,n)=>{n.d(P,{s:()=>p});var d=n(26857),l=n(65879),h=n(69862);let p=(()=>{var s;class i extends d.P{constructor(_){super(),this.http=_,this.root=`${this.API_BASE_URL}/project-categories`}create(_){return this._post(this.http,this.root,_)}get(){return this._get(this.http,`${this.root}`)}getByTeamId(_){return this._get(this.http,`${this.root}/${_}`)}getByOrg(){return this._get(this.http,`${this.root}/org-categories`)}updateColor(_,a){return this._put(this.http,`${this.root}/${_}`,{color:a})}deleteById(_){return this._delete(this.http,`${this.root}/${_}`)}}return(s=i).\u0275fac=function(_){return new(_||s)(l.LFG(h.eN))},s.\u0275prov=l.Yz7({token:s,factory:s.\u0275fac,providedIn:"root"}),i})()},78066:(j,P,n)=>{n.d(P,{L:()=>s});var d=n(26857),l=n(69649),h=n(65879),p=n(69862);let s=(()=>{var i;class m extends d.P{constructor(a){super(),this.http=a,this.root=`${this.API_BASE_URL}/project-comments`}create(a){return this._post(this.http,`${this.root}`,a)}getMembers(a,r,C,O,I,g){const f=encodeURIComponent(g||""),M=`${this.root}/project-members/${a}${(0,l.UK)({index:r,size:C,field:O,order:I,search:f})}`;return this._get(this.http,M)}getCountByProjectId(a){return this._get(this.http,`${this.root}/comments-count/${a}`)}getByProjectId(a,r){const C=`${this.root}/project-comments/${a}${(0,l.UK)({latest:r})}`;return this._get(this.http,C)}deleteById(a){return this._delete(this.http,`${this.root}/delete/${a}`)}}return(i=m).\u0275fac=function(a){return new(a||i)(h.LFG(p.eN))},i.\u0275prov=h.Yz7({token:i,factory:i.\u0275fac,providedIn:"root"}),m})()},19350:(j,P,n)=>{n.d(P,{w:()=>p});var d=n(26857),l=n(65879),h=n(69862);let p=(()=>{var s;class i extends d.P{constructor(_){super(),this.http=_,this.root=`${this.API_BASE_URL}/project-healths`}get(){return this._get(this.http,this.root)}}return(s=i).\u0275fac=function(_){return new(_||s)(l.LFG(h.eN))},s.\u0275prov=l.Yz7({token:s,factory:s.\u0275fac,providedIn:"root"}),i})()},93302:(j,P,n)=>{n.d(P,{r:()=>i});var d=n(26857),l=n(10708),h=n(69649),p=n(65879),s=n(69862);let i=(()=>{var m;class _ extends d.P{constructor(r){super(),this.http=r,this.root=`${this.API_BASE_URL}/project-members`}create(r){const C=(0,h.UK)({current_project_id:r.project_id});return this._post(this.http,`${this.root}${C}`,r)}createByEmail(r){return this._post(this.http,`${this.root}/invite`,r)}getByProjectId(r){return this._get(this.http,`${this.root}/${r}`)}deleteById(r,C){const O=(0,h.UK)({current_project_id:C});return(0,l.n)(this.http.delete(`${this.root}/${r}${O}`))}}return(m=_).\u0275fac=function(r){return new(r||m)(p.LFG(s.eN))},m.\u0275prov=p.Yz7({token:m,factory:m.\u0275fac,providedIn:"root"}),_})()},52732:(j,P,n)=>{n.d(P,{k:()=>p});var d=n(26857),l=n(65879),h=n(69862);let p=(()=>{var s;class i extends d.P{constructor(_){super(),this.http=_,this.root=`${this.API_BASE_URL}/project-statuses`}get(){return this._get(this.http,this.root)}}return(s=i).\u0275fac=function(_){return new(_||s)(l.LFG(h.eN))},s.\u0275prov=l.Yz7({token:s,factory:s.\u0275fac,providedIn:"root"}),i})()},88019:(j,P,n)=>{n.d(P,{k:()=>h});var d=n(78645),l=n(65879);let h=(()=>{var p;class s{constructor(){this._emitRefreshSbj$=new d.x,this._disableBadgeSbj$=new d.x,this._getLastUpdateSbj$=new d.x}get onRefresh(){return this._emitRefreshSbj$.asObservable()}get onBadgeDisable(){return this._disableBadgeSbj$.asObservable()}get onGetLatestUpdate(){return this._getLastUpdateSbj$.asObservable()}emitRefresh(){this._emitRefreshSbj$.next()}emitBadgeDisable(){this._disableBadgeSbj$.next()}emitGetLastUpdate(){this._getLastUpdateSbj$.next()}}return(p=s).\u0275fac=function(m){return new(m||p)},p.\u0275prov=l.Yz7({token:p,factory:p.\u0275fac,providedIn:"root"}),s})()}}]);