import{a as p}from"./chunk-SFW4HL5C.js";import{h as d,x as L}from"./chunk-FCHM4KKB.js";import{q as r,r as T,u as f,v as g}from"./chunk-Y4JXSDKI.js";import{c as m,d as b}from"./chunk-I6HXBYFU.js";import{k as u}from"./chunk-AVXTYPYF.js";import{d as h,g as S}from"./chunk-5EZRMHVZ.js";import{ka as l,la as w,od as v,qa as a,v as o,va as n}from"./chunk-HEIW4SFT.js";var i=function(e){return e[e.AllTasks=1]="AllTasks",e[e.AllUnfinishedTasks=2]="AllUnfinishedTasks",e[e.UserTasks=3]="UserTasks",e[e.UnfinishedUserTasks=4]="UnfinishedUserTasks",e}(i||{});var x=function(e){return e.DocType="epDocType",e.FormClassName="epFormClassName",e.WorkFlowControlId="epWorkFlowControlId",e}(x||{}),U=function(e){return e.Documents="TMNDocuments",e.CreateDocument="THECreateDocument",e.dlWF_60="dlWF_60",e.NewVacation="TSifForm_NoviDopust",e}(U||{}),A=function(e){return e.Classification="ltMNClassification",e}(A||{}),C=[{value:i.UnfinishedUserTasks,label:"MyUnfinishedTasks"},{value:i.UserTasks,label:"AllMyTasks"},{value:i.AllUnfinishedTasks,label:"AllUnfinishedTasks"},{value:i.AllTasks,label:"AllTasks"}];L();w();b();T();var c=function(e){return e.TravelOrder="S",e}(c||{});v();S();g();var q=(()=>{class e extends p{get model$(){return this._model$}get attachments$(){return this._attachments$}get connections$(){return this._connections$}get chatLog$(){return this._chatLog$}get isEditMode(){return m.isSet(this.model?.id)}constructor(t,s,k){super(),this.http=t,this.apiService=s,this.router=k,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(t){this.apiService.get(r.tasks.fetch(t)).subscribe(s=>{this.shouldRedirectToTravelOrder(s)||this.shouldRedirectToLocation(s)||(this.unsetModel(),this.formGroup=new d([]),this.model=s,this.modelS.next(s))})}fetchChatLogList(t){return this.apiService.post(r.tasks.fetchChatLogList,{DocumentQid:t,TaskQid:this.model?.id,TakeAll:!0}).pipe(l(s=>{this.chatLogS.next(s)}))}fetchAttachmentsList(t){this.apiService.get(r.attachments.fetchAttachmentsList(t)).subscribe(s=>{this.attachmentsS.next(s)})}fetchConnectionsList(t){return this.apiService.get(r.documents.fetchConnectionsList(t)).pipe(l(s=>{this.connectionsS.next(s)}))}shouldRedirectToTravelOrder(t){return t&&t.workflowVariables!=null&&t.workflowVariables.documentKey&&t.workflowVariables.documentKey.trim()!==""&&t.docTypeSetOf===c.TravelOrder?(this.router.navigate(["/human-resources/travel-order/positions"],{queryParams:{id:t.workflowVariables.documentKey,taskId:t.id}}),!0):!1}shouldRedirectToLocation(t){return t&&t.workflowVariables&&t.workflowVariables.acType==="L"&&(!t.workflowVariables.location||t.workflowVariables.location.trim()==="")&&t.workflowVariables.address&&t.workflowVariables.address.trim()!==""&&t.actions&&t.actions.length===1?(this.router.navigate(["/code-lists/locations"],{queryParams:{mode:"create",address:t.workflowVariables.address,taskId:t.id}}),!0):!1}static{this.\u0275fac=function(s){return new(s||e)(n(h),n(f),n(u))}}static{this.\u0275prov=a({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();export{i as a,x as b,U as c,A as d,C as e,q as f};
