|
32 | 32 | <button mat-icon-button [disabled]="isLoading || questionNum === 1" (click)="moveQuestion(-1)"><mat-icon>navigate_before</mat-icon></button> |
33 | 33 | <button mat-icon-button [disabled]="isLoading || questionNum === maxQuestions" (click)="nextQuestion({ nextClicked: true })"><mat-icon>navigate_next</mat-icon></button> |
34 | 34 | </mat-toolbar> |
| 35 | + <div class="progress-bar-track" *ngIf="!isLoading && maxQuestions > 0"> |
| 36 | + <div class="progress-bar-fill" [style.width.%]="progressPercent"></div> |
| 37 | + </div> |
35 | 38 | <div class="view-container" [ngClass]="{ 'view-full-height': !isDialog }"> |
36 | 39 | <ng-container *ngIf="!isLoading; else LoadingContent"> |
37 | | - <td-markdown [content]="question?.body"></td-markdown> |
38 | | - <div [ngSwitch]="mode"> |
39 | | - <ng-container *ngSwitchCase="'take'"> |
40 | | - <ng-container [ngSwitch]="question?.type"> |
41 | | - <mat-form-field class="full-width" *ngSwitchCase="'input'"> |
42 | | - <mat-label i18n>Enter answer here</mat-label> |
43 | | - <input matInput [formControl]="answer"> |
44 | | - </mat-form-field> |
45 | | - <mat-form-field *ngSwitchCase="'textarea'" class="full-width mat-form-field-type-no-underline"> |
46 | | - <planet-markdown-textbox [formControl]="answer"></planet-markdown-textbox> |
47 | | - </mat-form-field> |
48 | | - <mat-radio-group *ngSwitchCase="'select'" class="question-list" [formControl]="answer"> |
49 | | - <mat-radio-button [value]="option" *ngFor="let option of question?.choices"> |
50 | | - <span class="multiple-choice-text">{{option.text}}</span> |
51 | | - </mat-radio-button> |
52 | | - <ng-container *ngIf="question?.hasOtherOption"> |
53 | | - <div class="other-option-flex"> |
54 | | - <mat-radio-button [value]="currentOtherOption"> |
55 | | - <span class="multiple-choice-text" i18n>Other: </span> |
| 40 | + <div [ngClass]="slideDirection === 'right' |
| 41 | + ? (slideAnimationVariant === 'a' ? 'slide-in-right-a' : 'slide-in-right-b') |
| 42 | + : (slideAnimationVariant === 'a' ? 'slide-in-left-a' : 'slide-in-left-b')"> |
| 43 | + <td-markdown [content]="question?.body"></td-markdown> |
| 44 | + <div [ngSwitch]="mode"> |
| 45 | + <ng-container *ngSwitchCase="'take'"> |
| 46 | + <ng-container [ngSwitch]="question?.type"> |
| 47 | + <mat-form-field class="full-width" *ngSwitchCase="'input'"> |
| 48 | + <mat-label i18n>Enter answer here</mat-label> |
| 49 | + <input matInput [formControl]="answer"> |
| 50 | + </mat-form-field> |
| 51 | + <mat-form-field *ngSwitchCase="'textarea'" class="full-width mat-form-field-type-no-underline"> |
| 52 | + <planet-markdown-textbox [formControl]="answer"></planet-markdown-textbox> |
| 53 | + </mat-form-field> |
| 54 | + <mat-radio-group *ngSwitchCase="'select'" class="question-list" [formControl]="answer"> |
| 55 | + <div class="option-card" *ngFor="let option of question?.choices" [class.selected]="isSelectOptionSelected(option)" (click)="selectOption(option)"> |
| 56 | + <mat-radio-button [value]="option"> |
| 57 | + <span class="multiple-choice-text">{{option.text}}</span> |
56 | 58 | </mat-radio-button> |
57 | | - <input matInput |
58 | | - class="other-option-input" |
59 | | - [disabled]="!isOtherSelected()" |
60 | | - [(ngModel)]="currentOtherOption.text" |
61 | | - (ngModelChange)="updateOtherText()"> |
| 59 | + <mat-icon class="option-check" *ngIf="isSelectOptionSelected(option)">check</mat-icon> |
62 | 60 | </div> |
63 | | - </ng-container> |
64 | | - </mat-radio-group> |
65 | | - <div *ngSwitchCase="'selectMultiple'" class="question-list"> |
66 | | - <span class="mat-caption" i18n> |
67 | | - {examType, select, survey {You can choose one or more answers.} exam {There are one or more correct answers. Please choose all correct answers.}} |
68 | | - </span> |
69 | | - <mat-checkbox *ngFor="let option of question?.choices" [value]="option" (change)="setAnswer($event, option)" [checked]="checkboxState[option.id]"> |
70 | | - <span class="multiple-choice-text">{{option.text}}</span> |
71 | | - </mat-checkbox> |
72 | | - <ng-container *ngIf="question?.hasOtherOption"> |
73 | | - <div class="other-option-flex"> |
74 | | - <mat-checkbox [checked]="checkboxState['other']" (change)="toggleOtherMultiple($event)"> |
75 | | - <span class="multiple-choice-text" i18n>Other: </span> |
| 61 | + <ng-container *ngIf="question?.hasOtherOption"> |
| 62 | + <div class="option-card" [class.selected]="isOtherSelected()" (click)="selectOtherRadio()"> |
| 63 | + <mat-radio-button [value]="currentOtherOption"> |
| 64 | + <span class="multiple-choice-text" i18n>Other: </span> |
| 65 | + </mat-radio-button> |
| 66 | + <div class="other-option-flex"> |
| 67 | + <input matInput |
| 68 | + #singleOtherInput |
| 69 | + class="other-option-input" |
| 70 | + [(ngModel)]="currentOtherOption.text" |
| 71 | + (ngModelChange)="updateOtherText()" |
| 72 | + (focus)="selectOtherRadio()" |
| 73 | + (click)="$event.stopPropagation()"> |
| 74 | + </div> |
| 75 | + <mat-icon class="option-check" *ngIf="isOtherSelected()">check</mat-icon> |
| 76 | + </div> |
| 77 | + </ng-container> |
| 78 | + </mat-radio-group> |
| 79 | + <div *ngSwitchCase="'selectMultiple'" class="question-list"> |
| 80 | + <span i18n> |
| 81 | + {examType, select, survey {You can choose one or more answers.} exam {There are one or more correct answers. Please choose all correct answers.}} |
| 82 | + </span> |
| 83 | + <div class="option-card" *ngFor="let option of question?.choices" [class.selected]="checkboxState[option.id]" (click)="toggleMultipleOption(option)"> |
| 84 | + <mat-checkbox [value]="option" (change)="setAnswer($event, option)" [checked]="checkboxState[option.id]" (click)="$event.stopPropagation()"> |
| 85 | + <span class="multiple-choice-text">{{option.text}}</span> |
76 | 86 | </mat-checkbox> |
77 | | - <input matInput class="other-option-input" [disabled]="!checkboxState['other']" [(ngModel)]="currentOtherOption.text" (ngModelChange)="updateOtherText()"> |
| 87 | + <mat-icon class="option-check" *ngIf="checkboxState[option.id]">check</mat-icon> |
78 | 88 | </div> |
79 | | - </ng-container> |
80 | | - </div> |
81 | | - <div *ngSwitchCase="'ratingScale'" class="rating-scale-keypad"> |
82 | | - <div class="rating-scale-grid"> |
83 | | - <button type="button" mat-raised-button class="rating-scale-button" *ngFor="let num of [1,2,3,4,5,6,7,8,9]" [class.selected]="answer.value === num.toString()" [attr.data-rating]="num" (click)="setRatingScaleAnswer(num)"> |
84 | | - {{num}} |
85 | | - </button> |
| 89 | + <ng-container *ngIf="question?.hasOtherOption"> |
| 90 | + <div class="option-card" [class.selected]="checkboxState['other']" (click)="toggleOtherCheckbox()"> |
| 91 | + <mat-checkbox [checked]="checkboxState['other']" (change)="toggleOtherMultiple($event)" (click)="$event.stopPropagation()"> |
| 92 | + <span class="multiple-choice-text" i18n>Other: </span> |
| 93 | + </mat-checkbox> |
| 94 | + <div class="other-option-flex"> |
| 95 | + <input matInput #multipleOtherInput class="other-option-input" [(ngModel)]="currentOtherOption.text" (ngModelChange)="updateOtherText()" (focus)="ensureOtherCheckboxSelected()" (click)="$event.stopPropagation()"> |
| 96 | + </div> |
| 97 | + <mat-icon class="option-check" *ngIf="checkboxState['other']">check</mat-icon> |
| 98 | + </div> |
| 99 | + </ng-container> |
86 | 100 | </div> |
87 | | - </div> |
| 101 | + <ng-container *ngSwitchCase="'ratingScale'"> |
| 102 | + <div class="rating-scale-keypad rating-scale-keypad--grid" *ngIf="(question?.scaleMax ?? 9) === 9; else ratingScaleRow"> |
| 103 | + <button type="button" mat-raised-button class="rating-scale-button rating-scale-button--phone" *ngFor="let num of ratingScaleNumbers" [class.selected]="answer.value === num.toString()" [attr.data-rating]="num" (click)="setRatingScaleAnswer(num)"> |
| 104 | + {{num}} |
| 105 | + </button> |
| 106 | + </div> |
| 107 | + <ng-template #ratingScaleRow> |
| 108 | + <div class="rating-scale-keypad rating-scale-keypad--row"> |
| 109 | + <button type="button" class="rating-scale-button rating-scale-button--line" *ngFor="let num of ratingScaleNumbers" [class.selected]="answer.value === num.toString()" (click)="setRatingScaleAnswer(num)"> |
| 110 | + {{num}} |
| 111 | + </button> |
| 112 | + </div> |
| 113 | + </ng-template> |
| 114 | + </ng-container> |
| 115 | + </ng-container> |
88 | 116 | </ng-container> |
89 | | - </ng-container> |
90 | | - <ng-container *ngSwitchCase="'grade'"> |
91 | | - <p><b i18n>Submitted answer:</b></p> |
92 | | - <td-markdown [content]="answer?.value?.text || answer?.value"></td-markdown> |
93 | | - <mat-radio-group [(ngModel)]="grade" [disabled]="question?.type === 'select' || question?.type === 'selectMultiple'"> |
94 | | - <mat-radio-button [value]="1" class="planet-radio-button" i18n>Correct</mat-radio-button> |
95 | | - <mat-radio-button [value]="0" class="planet-radio-button" i18n>Incorrect</mat-radio-button> |
96 | | - </mat-radio-group> |
97 | | - <mat-form-field class="full-width mat-form-field-type-no-underline"> |
98 | | - <mat-label i18n>Comment</mat-label> |
99 | | - <planet-markdown-textbox class="full-width" [(ngModel)]="comment"></planet-markdown-textbox> |
100 | | - </mat-form-field> |
101 | | - </ng-container> |
102 | | - <ng-container *ngSwitchCase="'view'"> |
103 | | - <p><b i18n>Response:</b></p> |
104 | | - <td-markdown [content]="answer?.value?.text || answer?.value"></td-markdown> |
105 | | - <ng-container *ngIf="grade>=0"> |
106 | | - <p><b i18n>Grade:</b></p> |
107 | | - <p *ngIf="grade===1" i18n>Correct</p> |
108 | | - <p *ngIf="grade===0" i18n>Incorrect</p> |
| 117 | + <ng-container *ngSwitchCase="'grade'"> |
| 118 | + <p><b i18n>Submitted answer:</b></p> |
| 119 | + <td-markdown [content]="answer?.value?.text || answer?.value"></td-markdown> |
| 120 | + <mat-radio-group [(ngModel)]="grade" [disabled]="question?.type === 'select' || question?.type === 'selectMultiple'"> |
| 121 | + <mat-radio-button [value]="1" class="planet-radio-button" i18n>Correct</mat-radio-button> |
| 122 | + <mat-radio-button [value]="0" class="planet-radio-button" i18n>Incorrect</mat-radio-button> |
| 123 | + </mat-radio-group> |
| 124 | + <mat-form-field class="full-width mat-form-field-type-no-underline"> |
| 125 | + <mat-label i18n>Comment</mat-label> |
| 126 | + <planet-markdown-textbox class="full-width" [(ngModel)]="comment"></planet-markdown-textbox> |
| 127 | + </mat-form-field> |
109 | 128 | </ng-container> |
110 | | - <ng-container *ngIf="comment"> |
111 | | - <p><b i18n>Feedback:</b></p> |
112 | | - <td-markdown [content]="comment"></td-markdown> |
| 129 | + <ng-container *ngSwitchCase="'view'"> |
| 130 | + <p><b i18n>Response:</b></p> |
| 131 | + <td-markdown [content]="answer?.value?.text || answer?.value"></td-markdown> |
| 132 | + <ng-container *ngIf="grade>=0"> |
| 133 | + <p><b i18n>Grade:</b></p> |
| 134 | + <p *ngIf="grade===1" i18n>Correct</p> |
| 135 | + <p *ngIf="grade===0" i18n>Incorrect</p> |
| 136 | + </ng-container> |
| 137 | + <ng-container *ngIf="comment"> |
| 138 | + <p><b i18n>Feedback:</b></p> |
| 139 | + <td-markdown [content]="comment"></td-markdown> |
| 140 | + </ng-container> |
113 | 141 | </ng-container> |
114 | | - </ng-container> |
| 142 | + </div> |
115 | 143 | </div> |
116 | 144 | <div class="v-align-center action-buttons"> |
117 | 145 | <button |
|
124 | 152 | </button> |
125 | 153 | <button |
126 | 154 | *ngIf="mode === 'take'" |
127 | | - mat-raised-button |
128 | | - color="accent" |
| 155 | + mat-stroked-button |
| 156 | + color="primary" |
129 | 157 | (click)="nextQuestion({ isFinish: true })" |
130 | 158 | [disabled]="!isComplete || !answer.valid || grade === undefined || grade === null" |
131 | 159 | i18n> |
|
0 commit comments