diff --git a/projects/social_platform/src/app/office/courses/lesson/lesson.component.html b/projects/social_platform/src/app/office/courses/lesson/lesson.component.html index ff5acc41..53cca954 100644 --- a/projects/social_platform/src/app/office/courses/lesson/lesson.component.html +++ b/projects/social_platform/src/app/office/courses/lesson/lesson.component.html @@ -11,9 +11,11 @@ @for (task of tasks(); track task.id) {

{{ task.order }}

@@ -43,6 +45,7 @@ } @@ -53,6 +56,7 @@ [data]="task" [success]="success()" [error]="hasError()" + [disabled]="isViewingCompleted()" (update)="onAnswerChange($event)" > } @@ -63,6 +67,7 @@ [data]="task" [success]="success()" [error]="hasError()" + [disabled]="isViewingCompleted()" (update)="onAnswerChange([$event.answerId])" > } @@ -73,6 +78,7 @@ [data]="task" [success]="success()" [error]="hasError()" + [disabled]="isViewingCompleted()" (update)="onAnswerChange($event)" > } @@ -82,8 +88,8 @@ { + const task = this.currentTask(); + return task ? this.isDone(task) : false; + }); + + onSelectTask(task: Task) { + if (!this.isDone(task)) return; + + this.currentTaskId.set(task.id); + this.answerBody.set(null); + this.success.set(false); + this.hasError.set(false); + + if (this.isComplete()) { + this.router.navigate(["./"], { relativeTo: this.route }); + } + } + onSubmitAnswer() { const task = this.currentTask(); if (!task) return; diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.html b/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.html index 12565c27..223de1af 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.html +++ b/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.html @@ -48,6 +48,7 @@ class="exclude__item" [class.exclude__item--success]="success && result().includes(op.id)" [class.exclude__item--error]="error" + [class.exclude__item--disabled]="disabled" (click)="onSelect(op.id)" > diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.scss b/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.scss index 8366c8d1..d5c1c64a 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.scss +++ b/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.scss @@ -71,6 +71,11 @@ } } + &--disabled { + pointer-events: none; + opacity: 0.6; + } + label { cursor: pointer; } diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.ts b/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.ts index e86becb1..06f1481a 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.ts +++ b/projects/social_platform/src/app/office/courses/lesson/shared/exclude-task/exclude-task.component.ts @@ -57,6 +57,7 @@ export class ExcludeTaskComponent implements OnInit { @Output() update = new EventEmitter(); // Событие обновления выбранных ответов @Input() success = false; // Флаг успешного выполнения + @Input() disabled = false; @Input() set error(value: boolean) { @@ -104,6 +105,7 @@ export class ExcludeTaskComponent implements OnInit { * @param id - ID варианта ответа */ onSelect(id: number) { + if (this.disabled) return; if (this.result().includes(id)) { // Если вариант уже выбран, убираем его из списка this.result.set(this.result().filter(i => i !== id)); diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.html b/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.html index d6851966..600d3d0b 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.html +++ b/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.html @@ -65,6 +65,7 @@

ответ

{{ data.answerTitle | truncate: 80 }}

+ @if (!disabled) {
@@ -85,5 +86,6 @@ > }
+ }
diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.ts b/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.ts index f7dfd28b..1877ccc0 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.ts +++ b/projects/social_platform/src/app/office/courses/lesson/shared/file-task/file-task.component.ts @@ -48,6 +48,7 @@ export class FileTaskComponent implements OnInit { @Input({ required: true }) data!: Task; @Input() success = false; @Input() hint = ""; + @Input() disabled = false; @Input() set error(value: boolean) { diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.html b/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.html index fd9be553..56001ee5 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.html +++ b/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.html @@ -55,9 +55,10 @@ class="radio__item" [class.radio__item--success]="success && result().answerId === op.id" [class.radio__item--error]="error && result().answerId === op.id" + [class.radio__item--disabled]="disabled" (click)="onSelect(op.id)" > - + diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.scss b/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.scss index a2b1ddda..031e3146 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.scss +++ b/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.scss @@ -106,6 +106,11 @@ background-color: var(--red); } } + + &--disabled { + pointer-events: none; + opacity: 0.6; + } } &__body, diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.ts b/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.ts index 5abcffa1..1e28dc66 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.ts +++ b/projects/social_platform/src/app/office/courses/lesson/shared/radio-select-task/radio-select-task.component.ts @@ -34,6 +34,7 @@ export class RadioSelectTaskComponent implements OnInit { @Input({ required: true }) data!: Task; @Input() success = false; @Input() hint = ""; + @Input() disabled = false; @Input() set error(value: boolean) { @@ -80,6 +81,7 @@ export class RadioSelectTaskComponent implements OnInit { } onSelect(id: number) { + if (this.disabled) return; this.result.set({ answerId: id }); this.update.emit({ answerId: id }); } diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.html b/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.html index 6aaea7ae..d89c6bdb 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.html +++ b/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.html @@ -58,6 +58,7 @@ attr.maxlength="{{ maxLength }}" (input)="onKeyUp($event)" placeholder="ваш ответ" + [disabled]="disabled" >

@@ -66,7 +67,7 @@

- @if (type === 'text-file') { + @if (type === 'text-file' && !disabled) {
diff --git a/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.ts b/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.ts index a34ab993..ded9ffac 100644 --- a/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.ts +++ b/projects/social_platform/src/app/office/courses/lesson/shared/write-task/write-task.component.ts @@ -48,6 +48,7 @@ export class WriteTaskComponent implements OnInit { @Input({ required: true }) data!: Task; @Input() type: "text" | "text-file" = "text"; @Input() success = false; + @Input() disabled = false; @Output() update = new EventEmitter<{ text: string; fileUrls?: string[] }>();