import{a as k}from"./chunk-CVN2SFTO.js";import{h as p,x}from"./chunk-6IEN3EM2.js";import{s as r,t as g,w as d,x as L}from"./chunk-GTAUKNDY.js";import{c as f,d as T}from"./chunk-PBM4LEG7.js";import{k as m}from"./chunk-QVLAHW2O.js";import{d as u,g as b}from"./chunk-LYCHGZAM.js";import{ka as c,la as v,nd as S,qa as h,v as o,va as n}from"./chunk-PGS4AHIT.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 U=function(e){return e.DocType="epDocType",e.FormClassName="epFormClassName",e.WorkFlowControlId="epWorkFlowControlId",e}(U||{}),A=function(e){return e.Documents="TMNDocuments",e.CreateDocument="THECreateDocument",e.dlWF_60="dlWF_60",e.NewVacation="TSifForm_NoviDopust",e}(A||{}),$=function(e){return e.Classification="ltMNClassification",e}($||{}),V=[{value:i.UnfinishedUserTasks,label:"MyUnfinishedTasks"},{value:i.UserTasks,label:"AllMyTasks"},{value:i.AllUnfinishedTasks,label:"AllUnfinishedTasks"},{value:i.AllTasks,label:"AllTasks"}];x();v();T();g();var a=function(e){return e.TravelOrder="S",e}(a||{});S();b();L();var E=(()=>{class e extends k{get model$(){return this._model$}get attachments$(){return this._attachments$}get connections$(){return this._connections$}get chatLog$(){return this._chatLog$}get isEditMode(){return f.isSet(this.model?.id)}constructor(t,s,l){super(),this.http=t,this.apiService=s,this.router=l,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 p([]),this.model=s,this.modelS.next(s))})}fetchChatLogList(t,s,l){return this.apiService.post(r.tasks.fetchChatLogList,{DocumentQid:t,TaskQid:this.model?.id,TakeAll:!0,sortColumn:s,sortOrder:l}).pipe(c(w=>{this.chatLogS.next(w)}))}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(c(s=>{this.connectionsS.next(s)}))}shouldRedirectToTravelOrder(t){return t&&t.workflowVariables!=null&&t.workflowVariables.documentKey&&t.workflowVariables.documentKey.trim()!==""&&t.docTypeSetOf===a.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(u),n(d),n(m))}}static{this.\u0275prov=h({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();export{i as a,U as b,A as c,$ as d,V as e,E as f};
