Skip to content

Commit c824c79

Browse files
committed
fix detail info for different permissions
1 parent a03ca24 commit c824c79

3 files changed

Lines changed: 36 additions & 38 deletions

File tree

projects/social_platform/src/app/office/features/detail/detail.component.html

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
</div>
6262

6363
<ng-template #programTpl>
64-
@if (!isUserMember && !isUserManager) { @if (info().name.includes("Кейс-чемпионат MIR")) {
64+
@if (userType() !== undefined) { @if (!isUserMember && !isUserManager) { @if
65+
(info().name.includes("Кейс-чемпионат MIR")) {
6566
<a href="https://case-champ.ru/corporate#rec1176757836">
6667
<app-button
6768
[disabled]="!!registerDateExpired"
@@ -97,7 +98,7 @@
9798
зарегистрироваться
9899
</app-button>
99100
</a>
100-
} } @else if (isUserMember && !isUserManager && !isUserExpert) {
101+
} } @if (isUserMember && !isUserManager && !isUserExpert) {
101102
<app-button
102103
size="medium"
103104
[style.opacity]="registerDateExpired ? '0.5' : '1'"
@@ -108,7 +109,7 @@
108109
<span>подать проект</span>
109110
<i appIcon icon="plus" appSquare="10"></i>
110111
</app-button>
111-
} @else if (isUserManager || isUserExpert) { @if (isUserMember) {
112+
} @if ((isUserManager || isUserExpert) && isUserMember) {
112113
<a [routerLink]="'/office/program/' + info().id + '/projects-rating'">
113114
<app-button
114115
[appearance]="isProjectsRatingPage ? 'inline' : 'outline'"
@@ -118,7 +119,7 @@
118119
оценка проектов
119120
</app-button>
120121
</a>
121-
} }
122+
}
122123

123124
<a
124125
class="info__presentation"
@@ -158,7 +159,19 @@
158159

159160
<div class="info__divider"></div>
160161

161-
@if (!isUserManager) {
162+
@if (isUserManager || isUserExpert) {
163+
<a [routerLink]="'/office/program/' + info().id + '/projects'">
164+
<app-button
165+
[appearance]="isProjectsPage ? 'inline' : 'outline'"
166+
size="medium"
167+
[disabled]="isUserExpert && !isUserManager"
168+
[style.opacity]="isUserExpert && !isUserManager ? '0.5' : '1'"
169+
customTypographyClass="text-body-12"
170+
>
171+
проекты-участники
172+
</app-button>
173+
</a>
174+
} @else {
162175
<a class="info__more">
163176
<app-button
164177
appearance="outline"
@@ -170,19 +183,19 @@
170183
узнать подробнее
171184
</app-button>
172185
</a>
173-
} @else {
174-
<a [routerLink]="'/office/program/' + info().id + '/projects'">
186+
} @if (isUserManager || isUserExpert) {
187+
<a [routerLink]="'/office/program/' + info().id + '/members'">
175188
<app-button
176-
[appearance]="isProjectsPage ? 'inline' : 'outline'"
189+
[appearance]="isMembersPage ? 'inline' : 'outline'"
177190
size="medium"
178-
[disabled]="isUserMember ? true : isUserManager ? false : false"
179-
[style.opacity]="isUserMember ? '0.5' : isUserManager ? '1' : '0.5'"
191+
[disabled]="isUserExpert && !isUserManager"
192+
[style.opacity]="isUserExpert && !isUserManager ? '0.5' : '1'"
180193
customTypographyClass="text-body-12"
181194
>
182-
проекты-участники
195+
участники
183196
</app-button>
184197
</a>
185-
} @if (!isUserManager) {
198+
} @else {
186199
<a class="info__contacts">
187200
<app-button
188201
appearance="outline"
@@ -194,19 +207,7 @@
194207
информация с ссылок
195208
</app-button>
196209
</a>
197-
} @else {
198-
<a [routerLink]="'/office/program/' + info().id + '/members'">
199-
<app-button
200-
[appearance]="isMembersPage ? 'inline' : 'outline'"
201-
size="medium"
202-
[disabled]="isUserMember || isUserExpert ? true : isUserManager ? false : true"
203-
[style.opacity]="isUserMember || isUserExpert ? '0.5' : isUserManager ? '1' : '1'"
204-
customTypographyClass="text-body-12"
205-
>
206-
участники
207-
</app-button>
208-
</a>
209-
}
210+
} }
210211

211212
<app-modal [open]="showSubmitProjectModal()" (openChange)="toggleSubmitProjectModal()">
212213
<div class="cancel">

projects/social_platform/src/app/office/features/detail/detail.component.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
9494
dubplicatedProjectId = 0;
9595
memberProjects: Project[] = [];
9696

97-
userType = 0;
97+
userType = signal<number | undefined>(undefined);
9898

9999
// Сигналы для работы с модальными окнами с текстом
100100
assignProjectToProgramModalMessage = signal<ProjectAssign | null>(null);
@@ -151,7 +151,8 @@ export class DeatilComponent implements OnInit, OnDestroy {
151151
}
152152

153153
get isUserExpert() {
154-
return this.userType !== 1;
154+
const type = this.userType();
155+
return type !== undefined && type !== 1;
155156
}
156157

157158
// Методы для управления состоянием ошибок через сервис
@@ -396,16 +397,12 @@ export class DeatilComponent implements OnInit, OnDestroy {
396397
)
397398
.subscribe();
398399

399-
const profileDataSub$ = this.profileDataService
400-
.getProfile()
401-
.pipe(filter(user => !!user))
402-
.subscribe({
403-
next: user => {
404-
if (user) {
405-
this.userType = user.userType;
406-
}
407-
},
408-
});
400+
const profileDataSub$ = this.authService.profile.pipe(filter(user => !!user)).subscribe({
401+
next: user => {
402+
this.userType.set(user!.userType);
403+
this.cdRef.detectChanges();
404+
},
405+
});
409406

410407
const memeberProjects$ = this.projectService.getMy().subscribe({
411408
next: projects => {

projects/social_platform/src/app/office/program/detail/shared/news-card/news-card.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@
166166

167167
&__left {
168168
display: flex;
169-
align-items: center;
170169
gap: 5px;
170+
align-items: center;
171171
}
172172

173173
&__item {

0 commit comments

Comments
 (0)