Skip to content

Commit 89585ea

Browse files
committed
add program_id disabled & result routing
1 parent 10c2040 commit 89585ea

8 files changed

Lines changed: 25 additions & 10 deletions

File tree

projects/social_platform/src/app/office/courses/detail/course-detail.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ <h1 class="info__title text-body-12">{{ course()!.title }}</h1>
3030
>
3131

3232
<app-button
33-
[disabled]="true"
33+
[disabled]="isDisabled()"
3434
[class.info__actions--disabled]="isDisabled()"
3535
size="big"
3636
customTypographyClass="text-body-12"
3737
appearance="outline"
38+
(click)="redirectToProgram()"
3839
>вернуться в программу</app-button
3940
>
4041
</div>

projects/social_platform/src/app/office/courses/detail/course-detail.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class CourseDetailComponent implements OnInit {
4747
next: ([course, _]: [CourseDetail, CourseStructure]) => {
4848
this.course.set(course);
4949

50-
if (course.accessType !== "program_members") {
50+
if (!course.partnerProgramId) {
5151
this.isDisabled.set(true);
5252
}
5353
},
@@ -69,10 +69,14 @@ export class CourseDetailComponent implements OnInit {
6969
* Перенаправляет на страницу с информацией в завивисимости от listType
7070
*/
7171
redirectDetailInfo(courseId?: number): void {
72-
if (this.course()) {
72+
if (courseId != null) {
7373
this.router.navigateByUrl(`/office/courses/${courseId}`);
7474
} else {
7575
this.router.navigateByUrl("/office/courses/all");
7676
}
7777
}
78+
79+
redirectToProgram(): void {
80+
this.router.navigateByUrl(`/office/program/${this.course()?.partnerProgramId}`);
81+
}
7882
}

projects/social_platform/src/app/office/courses/lesson/lesson.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
</div>
2929
} @else {
3030
<div class="task__main" [class.task__complete]="isComplete()">
31-
@if (currentTask(); as task) {
31+
<router-outlet></router-outlet>
32+
33+
@if (!isComplete() && currentTask(); as task) {
3234
<div class="task__content">
3335
<!-- informationalType === "text" или "video_text" и answerType === null → info-task -->
3436
@if (task.answerType === null && (task.informationalType === 'text' || task.informationalType
@@ -92,8 +94,6 @@
9294
</div>
9395
</div>
9496
}
95-
96-
<router-outlet></router-outlet>
9797
</div>
9898
}
9999
</div>

projects/social_platform/src/app/office/courses/lesson/lesson.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,17 @@ export class LessonComponent implements OnInit {
107107
lessonInfo.tasks.find(t => t.isAvailable && !t.isCompleted)?.id ??
108108
null;
109109

110-
if (nextTaskId === null) {
110+
const allCompleted = lessonInfo.tasks.every(t => t.isCompleted);
111+
const onResultsPage = this.router.url.includes("results");
112+
113+
if (onResultsPage && !allCompleted) {
114+
// Находимся на results, но не все задания выполнены — редирект обратно
115+
this.currentTaskId.set(nextTaskId);
116+
setTimeout(() => {
117+
this.loading.set(false);
118+
this.router.navigate(["./"], { relativeTo: this.route });
119+
}, 500);
120+
} else if (nextTaskId === null && allCompleted) {
111121
// Все задания выполнены, редирект на results
112122
setTimeout(() => {
113123
this.loading.set(false);

projects/social_platform/src/app/office/courses/lesson/lesson.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const LESSON_ROUTES: Routes = [
2222
},
2323
children: [
2424
{
25-
path: "results", // Маршрут для отображения результатов
25+
path: "results",
2626
component: TaskCompleteComponent,
2727
},
2828
],

projects/social_platform/src/app/office/courses/shared/course-module-card/course-module-card.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<app-avatar [size]="50" [url]="courseModule.avatarUrl"></app-avatar>
77

88
<div class="skill-card__info">
9-
<p class="skill-card__title text-body-12">Модуль {{ courseModule.id }}</p>
9+
<p class="skill-card__title text-body-12">Модуль {{ courseModule.order }}</p>
1010

1111
<p class="skill-card__text text-body-12">
1212
{{ courseModule.title }}

projects/social_platform/src/app/office/courses/shared/course/course.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class CourseComponent implements OnInit {
3737
ngOnInit(): void {
3838
this.accessType();
3939
this.actions();
40-
console.log(this.course);
4140
}
4241

4342
protected readonly isLock = signal<boolean>(false);

projects/social_platform/src/app/office/models/courses.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface CourseDetail {
4848
endDate: Date;
4949
dateLabel: string;
5050
isAvailable: boolean;
51+
partnerProgramId: number;
5152
progressStatus: "not_started" | "in_progress" | "completed" | "blocked";
5253
percent: number;
5354
analyticsStub: any;

0 commit comments

Comments
 (0)