@@ -19,6 +19,10 @@ import { ProjectAssign } from "@office/projects/models/project-assign.model";
1919import { ProjectAdditionalService } from "@office/projects/edit/services/project-additional.service" ;
2020import { ProjectDataService } from "@office/projects/detail/services/project-data.service" ;
2121import { ProgramDataService } from "@office/program/services/program-data.service" ;
22+ import { ChatService } from "@office/services/chat.service" ;
23+ import { calculateProfileProgress } from "@utils/calculateProgress" ;
24+ import { ProfileDataService } from "@office/profile/detail/services/profile-date.service" ;
25+ import { ProfileService } from "projects/skills/src/app/profile/services/profile.service" ;
2226
2327@Component ( {
2428 selector : "app-detail" ,
@@ -46,19 +50,26 @@ export class DeatilComponent implements OnInit, OnDestroy {
4650 private readonly projectAdditionalService = inject ( ProjectAdditionalService ) ;
4751 private readonly router = inject ( Router ) ;
4852 private readonly location = inject ( Location ) ;
53+ private readonly profileDataService = inject ( ProfileDataService ) ;
54+ public readonly skillsProfileService = inject ( ProfileService ) ;
55+ public readonly chatService = inject ( ChatService ) ;
4956
5057 // Основные данные(типы данных, данные)
5158 info ?: any ;
59+ loggedUserId ?: number ;
5260 profile ?: User ;
5361 listType : "project" | "program" | "profile" = "project" ;
5462
5563 // Переменная для подсказок
5664 isTooltipVisible = false ;
5765
66+ tooltipText = "Заполни до конца — и открой весь функционал платформы!" ;
67+
5868 // Переменные для отображения данных в зависимости от url
5969 isProjectsPage = false ;
6070 isMembersPage = false ;
6171 isProjectsRatingPage = false ;
72+
6273 isTeamPage = false ;
6374 isVacanciesPage = false ;
6475
@@ -67,13 +78,18 @@ export class DeatilComponent implements OnInit, OnDestroy {
6778 registerDateExpired ?: boolean ;
6879 isInProject ?: boolean ;
6980
81+ isSended = false ;
82+ isSubscriptionActive = signal ( false ) ;
83+ isProfileFill = false ;
84+
7085 // Переменные для работы с модалкой подачи проекта
7186 selectedProjectId = 0 ;
7287 dubplicatedProjectId = 0 ;
7388 memberProjects : Project [ ] = [ ] ;
7489
7590 // Сигналы для работы с модальными окнами с текстом
7691 assignProjectToProgramModalMessage = signal < ProjectAssign | null > ( null ) ;
92+ errorMessageModal = signal ( "" ) ;
7793
7894 // Переменные для работы с модалками
7995 isAssignProjectToProgramModalOpen = signal ( false ) ;
@@ -83,6 +99,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
8399 isEditDisableModal = false ; // Флаг недоступности редактирования для модалки
84100 openSupport = false ; // Флаг модального окна поддержки
85101 leaderLeaveModal = false ; // Флаг модального окна предупреждения лидера
102+ isDelayModalOpen = false ;
86103
87104 subscriptions : Subscription [ ] = [ ] ;
88105
@@ -256,6 +273,24 @@ export class DeatilComponent implements OnInit, OnDestroy {
256273 ) ;
257274 }
258275
276+ /**
277+ * Отправка CV пользователя на email
278+ * Проверяет ограничения по времени и отправляет CV на почту пользователя
279+ */
280+ sendCVEmail ( ) {
281+ this . authService . sendCV ( ) . subscribe ( {
282+ next : ( ) => {
283+ this . isSended = true ;
284+ } ,
285+ error : err => {
286+ if ( err . status === 400 ) {
287+ this . isDelayModalOpen = true ;
288+ this . errorMessageModal . set ( err . error . seconds_after_retry ) ;
289+ }
290+ } ,
291+ } ) ;
292+ }
293+
259294 /**
260295 * Обновляет состояния страниц на основе URL
261296 */
@@ -266,6 +301,8 @@ export class DeatilComponent implements OnInit, OnDestroy {
266301 currentUrl . includes ( "/projects" ) && ! currentUrl . includes ( "/projects-rating" ) ;
267302 this . isMembersPage = currentUrl . includes ( "/members" ) ;
268303 this . isProjectsRatingPage = currentUrl . includes ( "/projects-rating" ) ;
304+ this . isTeamPage = currentUrl . includes ( "/team" ) ;
305+ this . isVacanciesPage = currentUrl . includes ( "/vacancies" ) ;
269306 }
270307
271308 private initializeInfo ( ) {
@@ -304,6 +341,36 @@ export class DeatilComponent implements OnInit, OnDestroy {
304341
305342 this . subscriptions . push ( program$ ) ;
306343 this . subscriptions . push ( memeberProjects$ ) ;
344+ } else {
345+ const profileDataSub$ = this . profileDataService
346+ . getProfile ( )
347+ . pipe (
348+ map ( user => ( { ...user , progress : calculateProfileProgress ( user ! ) } ) ) ,
349+ filter ( user => ! ! user )
350+ )
351+ . subscribe ( {
352+ next : user => {
353+ this . info = user as User ;
354+ this . isProfileFill =
355+ user . progress ! < 100 ? ( this . isProfileFill = true ) : ( this . isProfileFill = false ) ;
356+ } ,
357+ } ) ;
358+
359+ const profileIdDataSub$ = this . profileDataService
360+ . getProfileId ( )
361+ . pipe ( filter ( userId => ! ! userId ) )
362+ . subscribe ( {
363+ next : profileId => {
364+ this . loggedUserId = profileId ;
365+ } ,
366+ } ) ;
367+
368+ this . skillsProfileService . getSubscriptionData ( ) . subscribe ( r => {
369+ this . isSubscriptionActive . set ( r . isSubscribed ) ;
370+ } ) ;
371+
372+ profileDataSub$ && this . subscriptions . push ( profileDataSub$ ) ;
373+ profileIdDataSub$ && this . subscriptions . push ( profileIdDataSub$ ) ;
307374 }
308375 }
309376
@@ -316,7 +383,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
316383 } else if ( this . listType === "program" ) {
317384 this . backPath = "/office/program/all" ;
318385 } else {
319- this . backPath = "/office/members/all " ;
386+ this . backPath = "/office/members" ;
320387 }
321388 }
322389}
0 commit comments