@@ -9,7 +9,7 @@ import { ActivatedRoute, Router, RouterModule } from "@angular/router";
99import { AuthService } from "@auth/services" ;
1010import { AvatarComponent } from "@ui/components/avatar/avatar.component" ;
1111import { TooltipComponent } from "@ui/components/tooltip/tooltip.component" ;
12- import { concatMap , filter , map , of , Subscription , tap } from "rxjs" ;
12+ import { concatMap , EMPTY , filter , map , Observable , of , Subscription , tap } from "rxjs" ;
1313import { User } from "@auth/models/user.model" ;
1414import { Collaborator } from "@office/models/collaborator.model" ;
1515import { ProjectService } from "@office/services/project.service" ;
@@ -35,6 +35,7 @@ import { TruncatePipe } from "projects/core/src/lib/pipes/truncate.pipe";
3535import { ControlErrorPipe , ValidationService } from "@corelib" ;
3636import { ErrorMessage } from "@error/models/error-message" ;
3737import { InviteService } from "@office/services/invite.service" ;
38+ import { ApiPagination } from "@office/models/api-pagination.model" ;
3839
3940@Component ( {
4041 selector : "app-detail" ,
@@ -134,6 +135,8 @@ export class DeatilComponent implements OnInit, OnDestroy {
134135 showApproveSkillModal = false ;
135136 showSendInviteModal = false ;
136137 showNoProjectsModal = false ;
138+ showActiveInviteModal = false ;
139+ showNoInProgramModal = false ;
137140 showSuccessInviteModal = false ;
138141 readAllModal = false ;
139142
@@ -400,9 +403,17 @@ export class DeatilComponent implements OnInit, OnDestroy {
400403 next : ( ) => {
401404 this . showSendInviteModal = false ;
402405 this . showSuccessInviteModal = true ;
406+
403407 this . inviteForm . reset ( ) ;
404408 this . selectedProjectId = null ;
405409 } ,
410+ error : err => {
411+ if ( err . error . user [ 0 ] . includes ( "проект относится к программе" ) ) {
412+ this . showNoInProgramModal = true ;
413+ } else if ( err . error . user [ 0 ] . includes ( "активное приглашение" ) ) {
414+ this . showActiveInviteModal = true ;
415+ }
416+ } ,
406417 } ) ;
407418 }
408419
@@ -537,17 +548,20 @@ export class DeatilComponent implements OnInit, OnDestroy {
537548
538549 this . isInProfileInfo ( ) ;
539550
540- this . subscriptions . push ( profileDataSub$ ) ;
551+ const profileLeaderProjectsSub$ = this . authService . getLeaderProjects ( ) . subscribe ( {
552+ next : ( projects : ApiPagination < Project > ) => {
553+ this . profileProjects . set ( projects . results ) ;
554+ } ,
555+ } ) ;
556+
557+ this . subscriptions . push ( profileDataSub$ , profileLeaderProjectsSub$ ) ;
541558 }
542559 }
543560
544561 private isInProfileInfo ( ) : void {
545562 const profileInfoSub$ = this . authService . profile . subscribe ( {
546563 next : profile => {
547564 this . profile = profile ;
548- this . profileProjects . set (
549- this . profile ?. projects . filter ( project => project . leader === this . profile ?. id )
550- ) ;
551565
552566 if ( this . info ( ) && this . listType === "project" ) {
553567 this . isInProject = this . info ( )
0 commit comments