"use strict";(self.webpackChunkworklenz=self.webpackChunkworklenz||[]).push([[406],{16406:(A,k,a)=>{a.d(k,{p:()=>te});var m=a(15861),e=a(65879),c=a(96814),h=a(43389),z=a(42840),p=a(41958),g=a(79382),d=a(69649),s=a(73460),T=a(24139),w=a(8083),I=a(55695),C=a(92574),u=a(16976),v=a(80697);function O(o,i){if(1&o){const l=e.EpF();e.TgZ(0,"li",17),e.NdJ("click",function(){const n=e.CHM(l),r=n.$implicit,_=n.index,Z=e.oxw();return e.KtG(Z.onSelectTemplate(r.id||"",_))}),e.TgZ(1,"span"),e._uU(2),e.qZA()()}if(2&o){const l=i.$implicit;e.Q6J("nzSelected",0===i.index),e.xp6(2),e.Oqu(l.name)}}function P(o,i){if(1&o&&(e.TgZ(0,"nz-tag",18),e._uU(1),e.qZA()),2&o){const l=i.$implicit;e.Q6J("nzColor",l.color_code),e.xp6(1),e.Oqu(l.name)}}function D(o,i){if(1&o&&(e.TgZ(0,"nz-tag",18),e._uU(1),e.qZA()),2&o){const l=i.$implicit;e.Q6J("nzColor",l.color_code),e.xp6(1),e.Oqu(l.name)}}function b(o,i){if(1&o&&(e.TgZ(0,"nz-tag",18),e._uU(1),e.qZA()),2&o){const l=i.$implicit;e.Q6J("nzColor",l.color_code),e.xp6(1),e.Oqu(l.name)}}function M(o,i){if(1&o&&(e.TgZ(0,"nz-tag",18),e._uU(1),e.qZA()),2&o){const l=i.$implicit;e.Q6J("nzColor",l.color_code),e.xp6(1),e.Oqu(l.name)}}function j(o,i){if(1&o&&(e.TgZ(0,"li",19),e._uU(1),e.qZA()),2&o){const l=i.$implicit;e.xp6(1),e.hij(" ",l.name," ")}}let J=(()=>{var o;class i{constructor(t,n){this.cdr=t,this.api=n,this.selectTemplate=new e.vpe,this.loadingList=!1,this.loadingDetails=!1,this.selectedTemplateIndex=0,this.templateList=[],this.templateDetails={}}ngOnInit(){this.get()}get(){var t=this;return(0,m.Z)(function*(){try{t.loadingList=!0;const n=yield t.api.getWorklenzTemplates();n.done&&(t.templateList=n.body,t.loadingList=!1,yield t.emitTemplateSelect(),t.cdr.markForCheck())}catch(n){(0,d.tu)(n),t.cdr.markForCheck()}})()}getTemplateDetails(){var t=this;return(0,m.Z)(function*(){try{t.loadingDetails=!0,t.loadingDetails=!1,t.cdr.markForCheck()}catch(n){(0,d.tu)(n),t.cdr.markForCheck()}})()}onSelectTemplate(t,n){t&&(this.selectedTemplateIndex=n,this.getTemplateDetails(),setTimeout(()=>{this.emitTemplateSelect()},500),this.cdr.markForCheck())}emitTemplateSelect(){var t=this;return(0,m.Z)(function*(){const n=t.templateList[t.selectedTemplateIndex].id;if(t.selectTemplate.emit(n),n){t.loadingDetails=!0;const r=yield t.api.getWorklenzTemplateById(n);r.done&&(t.templateDetails=r.body,t.loadingDetails=!1,t.cdr.markForCheck()),t.loadingDetails=!1}t.cdr.markForCheck()})()}}return(o=i).\u0275fac=function(t){return new(t||o)(e.Y36(e.sBO),e.Y36(v.I))},o.\u0275cmp=e.Xpm({type:o,selectors:[["worklenz-template-list"]],outputs:{selectTemplate:"selectTemplate"},standalone:!0,features:[e.jDz],decls:48,vars:12,consts:[[1,"d-flex"],[1,"side-menu"],[3,"nzActive","nzLoading"],["nz-menu","","nzMode","inline",1,"br-0"],["nz-menu-item","","class","ps-2",3,"nzSelected","click",4,"ngFor","ngForOf"],[1,"temp-details","px-4","py-3"],["nz-typography",""],[1,"preview"],["alt","preview",1,"img-fluid",3,"src"],[1,"d-flex","mb-3"],[1,"worklenz_key_sec"],[1,"worklenz_value_sec"],[1,"d-flex","mb-4"],["class","me-2",3,"nzColor",4,"ngFor","ngForOf"],[1,"mt-2"],["nz-list",""],["nz-list-item","",4,"ngFor","ngForOf"],["nz-menu-item","",1,"ps-2",3,"nzSelected","click"],[1,"me-2",3,"nzColor"],["nz-list-item",""]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"nz-skeleton",2)(3,"ul",3),e.YNc(4,O,3,2,"li",4),e.qZA()()(),e.TgZ(5,"div",5)(6,"h4",6),e._uU(7,"Details"),e.qZA(),e.TgZ(8,"nz-skeleton",2)(9,"div",7),e._UZ(10,"img",8),e.qZA(),e.TgZ(11,"div",9)(12,"div",10)(13,"span",6),e._uU(14,"Description"),e.qZA()(),e.TgZ(15,"div",11)(16,"span",6),e._uU(17),e.qZA()()(),e.TgZ(18,"div",12)(19,"div",10)(20,"span",6),e._uU(21,"Phases"),e.qZA()(),e.TgZ(22,"div",11),e.YNc(23,P,2,2,"nz-tag",13),e.qZA()(),e.TgZ(24,"div",12)(25,"div",10)(26,"span",6),e._uU(27,"Statuses"),e.qZA()(),e.TgZ(28,"div",11),e.YNc(29,D,2,2,"nz-tag",13),e.qZA()(),e.TgZ(30,"div",12)(31,"div",10)(32,"span",6),e._uU(33,"Priorities"),e.qZA()(),e.TgZ(34,"div",11),e.YNc(35,b,2,2,"nz-tag",13),e.qZA()(),e.TgZ(36,"div",12)(37,"div",10)(38,"span",6),e._uU(39,"Labels"),e.qZA()(),e.TgZ(40,"div",11),e.YNc(41,M,2,2,"nz-tag",13),e.qZA()(),e.TgZ(42,"div",10)(43,"span",6),e._uU(44,"Tasks"),e.qZA()(),e.TgZ(45,"div",14)(46,"ul",15),e.YNc(47,j,2,1,"li",16),e.qZA()()()()()),2&t&&(e.xp6(2),e.Q6J("nzActive",!0)("nzLoading",n.loadingList),e.xp6(2),e.Q6J("ngForOf",n.templateList),e.xp6(4),e.Q6J("nzActive",!0)("nzLoading",n.loadingDetails),e.xp6(2),e.Q6J("src",n.templateDetails.image_url,e.LSH),e.xp6(7),e.Oqu(n.templateDetails.description),e.xp6(6),e.Q6J("ngForOf",n.templateDetails.phases),e.xp6(6),e.Q6J("ngForOf",n.templateDetails.status),e.xp6(6),e.Q6J("ngForOf",n.templateDetails.priorities),e.xp6(6),e.Q6J("ngForOf",n.templateDetails.labels),e.xp6(6),e.Q6J("ngForOf",n.templateDetails.tasks))},dependencies:[c.ez,c.sg,s.ip,s.wO,s.r9,T.H0,T.ng,w.ZJ,w.ZU,I.X,I.j,C.zf,u.Ph,u.n_,u.AA],styles:[".side-menu[_ngcontent-%COMP%]{min-width:250px;max-width:250px;max-height:calc(100vh - 200px);overflow-y:auto}.temp-details[_ngcontent-%COMP%]{max-height:calc(100vh - 200px);overflow:auto}.worklenz_key_sec[_ngcontent-%COMP%]{min-width:120px;max-width:120px}.worklenz_key_sec[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:500}.worklenz_value_sec[_ngcontent-%COMP%]{max-width:520px}.preview[_ngcontent-%COMP%]{max-width:600px}nz-tag[_ngcontent-%COMP%]{color:#000;margin-bottom:8px}"],changeDetection:0}),i})();var f=a(60095),W=a(62612),x=a(20824),S=a(9172),L=a(33640),F=a(62595),y=a(60804);function N(o,i){1&o&&e._UZ(0,"span",9)}function Q(o,i){if(1&o&&e._UZ(0,"nz-badge",15),2&o){const l=e.oxw().$implicit;e.Q6J("nzColor",l.color_code)}}function U(o,i){if(1&o&&(e.TgZ(0,"span",16),e._uU(1),e.qZA()),2&o){const l=e.oxw().$implicit;e.xp6(1),e.Oqu(l.name)}}function Y(o,i){if(1&o){const l=e.EpF();e.TgZ(0,"nz-list-item",12),e.NdJ("click",function(){const n=e.CHM(l),r=n.$implicit,_=n.index,Z=e.oxw(2);return e.KtG(Z.changeSelectedTemplate(r.id,_))}),e.TgZ(1,"nz-space"),e.YNc(2,Q,1,1,"nz-badge",13),e.YNc(3,U,2,1,"span",14),e.qZA()()}2&o&&e.Q6J("ngClass",i.$implicit.selected?"selected":"")}function $(o,i){if(1&o&&(e.TgZ(0,"nz-list",10),e.YNc(1,Y,4,1,"nz-list-item",11),e.ALo(2,"searchByName"),e.qZA()),2&o){const l=e.oxw(),t=e.MAs(3);e.xp6(1),e.Q6J("ngForOf",e.xi3(2,1,l.templateList,t.value))}}function B(o,i){if(1&o&&e._UZ(0,"nz-empty",17),2&o){e.oxw();const l=e.MAs(10);e.Q6J("nzNotFoundContent",l)}}function E(o,i){1&o&&e._uU(0," No custom templates are found! ")}let q=(()=>{var o;class i{constructor(t,n){this.cdr=t,this.api=n,this.selectTemplate=new e.vpe,this.teamSearchText=null,this.loading=!1,this.templateList=[]}ngOnInit(){this.get()}get(){var t=this;return(0,m.Z)(function*(){try{t.loading=!0;const n=yield t.api.getWorklenzCustomTemplates();n.done&&(t.templateList=n.body,t.loading=!1),t.loading=!1,t.cdr.markForCheck()}catch(n){(0,d.tu)(n),t.cdr.markForCheck()}})()}changeSelectedTemplate(t,n){for(let r=0;r{var o;class i{constructor(t,n,r){this.cdr=t,this.api=n,this.router=r,this.showBothTabs=!0,this.importProject=new e.vpe,this.selectedWorklenzTemplateId=null,this.selectedCustomTemplateId=null,this.selectedTabIndex=0,this.show=!1,this.loading=!1,this.creating=!1,this.drawerVisible=!1}open(){this.reset(),this.show=!0,this.cdr.markForCheck()}close(){this.show=!1,this.cdr.markForCheck()}create(){var t=this;return(0,m.Z)(function*(){if(t.showBothTabs){if(0===t.selectedTabIndex)return void(yield t.createFromWorklenzLib());if(1===t.selectedTabIndex)return void(yield t.createFromCustomLib())}else t.importProject.emit({template_id:t.selectedWorklenzTemplateId})})()}createFromWorklenzLib(){var t=this;return(0,m.Z)(function*(){if(t.selectedWorklenzTemplateId)try{t.creating=!0;const n=yield t.api.createFromTemplate({template_id:t.selectedWorklenzTemplateId});n.done&&(t.creating=!1,t.close(),t.importProject.emit({project_id:n.body.project_id}),t.router.navigate([`/worklenz/projects/${n.body.project_id}`]),t.cdr.markForCheck()),t.creating=!1}catch(n){(0,d.tu)(n),t.creating=!1,t.cdr.markForCheck()}})()}createFromCustomLib(){var t=this;return(0,m.Z)(function*(){if(t.selectedCustomTemplateId)try{t.creating=!0;const n=yield t.api.createFromCustomTemplate({template_id:t.selectedCustomTemplateId});n.done&&(t.creating=!1,t.close(),t.importProject.emit({project_id:n.body.project_id}),t.router.navigate([`/worklenz/projects/${n.body.project_id}`]),t.cdr.markForCheck()),t.cdr.markForCheck()}catch(n){(0,d.tu)(n),t.creating=!1,t.cdr.markForCheck()}})()}changeSelectedWorklenzTemp(t){this.selectedWorklenzTemplateId=t,this.selectedCustomTemplateId=null,this.cdr.markForCheck()}changeSelectedCustomTemp(t){this.selectedCustomTemplateId=t,this.selectedWorklenzTemplateId=null,this.cdr.markForCheck()}reset(){this.selectedWorklenzTemplateId=null,this.selectedCustomTemplateId=null,this.loading=!1,this.creating=!1,this.selectedTabIndex=0,this.cdr.markForCheck()}onDrawerVisibilityChange(t){this.drawerVisible=t}}return(o=i).\u0275fac=function(t){return new(t||o)(e.Y36(e.sBO),e.Y36(v.I),e.Y36(V.F0))},o.\u0275cmp=e.Xpm({type:o,selectors:[["worklenz-project-template-import-drawer"]],inputs:{showBothTabs:"showBothTabs"},outputs:{importProject:"importProject"},standalone:!0,features:[e.jDz],decls:4,vars:5,consts:[["nzPlacement","right",1,"template-drawer-o-none",3,"nzClosable","nzVisible","nzWidth","nzTitle","nzFooter","nzOnClose","nzVisibleChange"],[4,"nzDrawerContent"],["footer",""],[1,"template-drawer-o-none","d-none"],["nzType","card",3,"nzSelectedIndexChange"],[3,"nzTitle"],[3,"selectTemplate",4,"ngIf"],[3,"nzTitle",4,"ngIf"],[3,"selectTemplate"],[2,"float","right"],["nz-button","",2,"margin-right","8px",3,"click"],["nz-button","","nzType","primary",3,"disabled","nzLoading","click"]],template:function(t,n){if(1&t&&(e.TgZ(0,"nz-drawer",0),e.NdJ("nzOnClose",function(){return n.close()})("nzVisibleChange",function(_){return n.onDrawerVisibilityChange(_)}),e.YNc(1,X,6,3,"ng-container",1),e.YNc(2,ee,5,2,"ng-template",null,2,e.W1O),e.qZA()),2&t){const r=e.MAs(3);e.Q6J("nzClosable",!0)("nzVisible",n.show)("nzWidth",1e3)("nzTitle","Select from templates")("nzFooter",r)}},dependencies:[c.ez,c.O5,h.BL,h.Vz,h.SQ,z.sL,z.ix,H.w,p.dQ,p.vG,g.we,g.xH,g.xw,J,q],changeDetection:0}),i})()},80697:(A,k,a)=>{a.d(k,{I:()=>z});var m=a(26857),e=a(10708),c=a(65879),h=a(69862);let z=(()=>{var p;class g extends m.P{constructor(s){super(),this.http=s,this.root=`${this.API_BASE_URL}/project-templates`}createCustomTemplate(s){return this._post(this.http,`${this.root}/custom-template`,s)}createFromTemplate(s){return this._post(this.http,`${this.root}/import-template`,s)}createFromCustomTemplate(s){return this._post(this.http,`${this.root}/import-custom-template`,s)}createTemplates(){return this._get(this.http,`${this.root}/create`)}getWorklenzTemplates(){return this._get(this.http,`${this.root}/worklenz-templates`)}getWorklenzTemplateById(s){return this._get(this.http,`${this.root}/worklenz-templates/${s}`)}getWorklenzCustomTemplates(){return this._get(this.http,`${this.root}/custom-templates`)}delete(s){return(0,e.n)(this.http.delete(`${this.root}/${s}`))}setupAccount(s){return this._post(this.http,`${this.root}/setup`,s)}}return(p=g).\u0275fac=function(s){return new(s||p)(c.LFG(h.eN))},p.\u0275prov=c.Yz7({token:p,factory:p.\u0275fac,providedIn:"root"}),g})()}}]);