@@ -38,6 +38,8 @@ import { RouterLink } from "@angular/router";
3838import { TagComponent } from "@ui/components/tag/tag.component" ;
3939import { ModalComponent } from "@ui/components/modal/modal.component" ;
4040import { ProgramDataService } from "@office/program/services/program-data.service" ;
41+ import { AuthService } from "@auth/services" ;
42+ import { User } from "@auth/models/user.model" ;
4143
4244/**
4345 * Компонент карточки оценки проекта
@@ -103,6 +105,7 @@ export class RatingCardComponent implements OnInit, AfterViewInit, OnDestroy {
103105 public industryService : IndustryService ,
104106 private projectRatingService : ProjectRatingService ,
105107 private readonly programDataService : ProgramDataService ,
108+ private readonly authService : AuthService ,
106109 private breakpointObserver : BreakpointObserver ,
107110 private cdRef : ChangeDetectorRef
108111 ) { }
@@ -122,6 +125,8 @@ export class RatingCardComponent implements OnInit, AfterViewInit, OnDestroy {
122125 _currentIndex = signal < number > ( 0 ) ;
123126 _projects = signal < ProjectRate [ ] > ( [ ] ) ;
124127
128+ profile = signal < User | null > ( null ) ;
129+
125130 form = new FormControl ( ) ;
126131
127132 submitLoading = signal ( false ) ;
@@ -166,6 +171,14 @@ export class RatingCardComponent implements OnInit, AfterViewInit, OnDestroy {
166171 . subscribe ( ) ;
167172
168173 this . subscriptions$ ( ) . push ( program$ ) ;
174+
175+ const profileId$ = this . authService . profile . subscribe ( {
176+ next : profile => {
177+ this . profile . set ( profile ) ;
178+ } ,
179+ } ) ;
180+
181+ this . subscriptions$ ( ) . push ( profileId$ ) ;
169182 }
170183
171184 ngAfterViewInit ( ) : void {
@@ -232,12 +245,23 @@ export class RatingCardComponent implements OnInit, AfterViewInit, OnDestroy {
232245 return ! this . programDateFinished ( ) ;
233246 }
234247
248+ get isCurrentUserExpert ( ) : boolean {
249+ const currentProfile = this . profile ( ) ;
250+ const project = this . project ;
251+
252+ if ( ! currentProfile || ! project ) return false ;
253+
254+ return project . scored && project . scoredExpertId === currentProfile . id ;
255+ }
256+
235257 get showRatingForm ( ) : boolean {
236258 return ! this . projectRated ( ) && this . canEdit ;
237259 }
238260
239261 get showRatedWithEdit ( ) : boolean {
240- return ( this . projectRated ( ) || this . projectConfirmed ( ) ) && this . canEdit ;
262+ return (
263+ ( this . projectRated ( ) || this . projectConfirmed ( ) ) && this . canEdit && this . isCurrentUserExpert
264+ ) ;
241265 }
242266
243267 get showConfirmedState ( ) : boolean {
0 commit comments