import{a as d}from"./chunk-THKS2M3R.js";import{h as f}from"./chunk-NMMBNW5X.js";import{m as n,n as m}from"./chunk-GJIGZB63.js";import{b as u}from"./chunk-5VDVFGVW.js";import{k as h}from"./chunk-NLMVBXFK.js";import{d as l}from"./chunk-KUS3L5XF.js";import{ga as c,ka as a,pa as r,r as o}from"./chunk-J476KISY.js";var C=(()=>{class t extends d{get model$(){return this._model$}get attachments$(){return this._attachments$}get connections$(){return this._connections$}get chatLog$(){return this._chatLog$}get isEditMode(){return u.isSet(this.model?.id)}constructor(e,s,p){super(),this.http=e,this.apiService=s,this.router=p,this.model=null,this.modelS=new o(1),this._model$=this.modelS.asObservable(),this.attachmentsS=new o(1),this._attachments$=this.attachmentsS.asObservable(),this.connectionsS=new o(1),this._connections$=this.connectionsS.asObservable(),this.chatLogS=new o(1),this._chatLog$=this.chatLogS.asObservable(),this.selectedDocuments=[]}unset(){this.formGroup=void 0}unsetModel(){this.model=null,this.modelS.next(null),this.attachmentsS.next(null),this.connectionsS.next(null),this.chatLogS.next(null)}fetch(e){this.apiService.get(n.tasks.fetch(e)).subscribe(s=>{this.shouldRedirectToTravelOrder(s)||(this.unsetModel(),this.formGroup=new f([]),this.model=s,this.modelS.next(s))})}fetchChatLogList(e){return this.apiService.post(n.tasks.fetchChatLogList,{DocumentQid:e,TaskQid:this.model?.id,TakeAll:!0}).pipe(c(s=>{this.chatLogS.next(s)}))}fetchAttachmentsList(e){this.apiService.get(n.attachments.fetchAttachmentsList(e)).subscribe(s=>{this.attachmentsS.next(s)})}fetchConnectionsList(e){return this.apiService.get(n.documents.fetchConnectionsList(e)).pipe(c(s=>{this.connectionsS.next(s)}))}shouldRedirectToTravelOrder(e){return e&&e.workflowVariables!=null&&e.workflowVariables.documentKey&&e.workflowVariables.documentKey.trim()!==""&&e.docTypeSetOf==="S"?(this.router.navigate(["/human-resources/travel-order/positions"],{queryParams:{id:e.workflowVariables.documentKey,taskId:e.id}}),!0):!1}static{this.\u0275fac=function(s){return new(s||t)(r(l),r(m),r(h))}}static{this.\u0275prov=a({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var i=function(t){return t[t.AllTasks=1]="AllTasks",t[t.AllUnfinishedTasks=2]="AllUnfinishedTasks",t[t.UserTasks=3]="UserTasks",t[t.UnfinishedUserTasks=4]="UnfinishedUserTasks",t}(i||{});var S=function(t){return t.DocType="epDocType",t.FormClassName="epFormClassName",t.WorkFlowControlId="epWorkFlowControlId",t}(S||{}),v=function(t){return t.Documents="TMNDocuments",t.CreateDocument="THECreateDocument",t.dlWF_60="dlWF_60",t.NewVacation="TSifForm_NoviDopust",t}(v||{}),k=function(t){return t.Classification="ltMNClassification",t}(k||{}),O=[{value:i.UnfinishedUserTasks,label:"MyUnfinishedTasks"},{value:i.UserTasks,label:"AllMyTasks"},{value:i.AllUnfinishedTasks,label:"AllUnfinishedTasks"},{value:i.AllTasks,label:"AllTasks"}];export{C as a,i as b,S as c,v as d,k as e,O as f};
