Skip to content

Commit c14a29e

Browse files
committed
fix rate modal with project info & criterias
1 parent d13d87c commit c14a29e

5 files changed

Lines changed: 85 additions & 14 deletions

File tree

projects/social_platform/src/app/office/features/project-rating/project-rating.component.html

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,39 @@
2929
placeholder="Небольшой комментарий, если необходимо"
3030
></app-textarea>
3131
</div>
32-
} }
32+
} }<!-- @format -->
33+
<form [formGroup]="form" class="rating">
34+
<section class="rating__columns">
35+
@for (criterion of criteria; track $index) { @if (criterion.type === "int") {
36+
<div class="rating__field">
37+
<app-range-criterion-input
38+
class="rating__input"
39+
[max]="criterion.maxValue!"
40+
[formControlName]="criterion.id"
41+
></app-range-criterion-input>
42+
<label class="text-body-10">{{ criterion.name }}</label>
43+
</div>
44+
} @if (criterion.type === "bool") {
45+
<div class="rating__field">
46+
<app-boolean-criterion
47+
class="rating__input"
48+
[formControlName]="criterion.id"
49+
></app-boolean-criterion>
50+
<label class="text-body-10">{{ criterion.name }}</label>
51+
</div>
52+
} }
53+
</section>
54+
<section>
55+
@for (criterion of criteria; track $index) { @if (criterion.type === "str") {
56+
<div class="rating__comment">
57+
<app-textarea
58+
size="big"
59+
[formControlName]="criterion.id"
60+
placeholder="Небольшой комментарий, если необходимо"
61+
></app-textarea>
62+
</div>
63+
} }
64+
</section>
65+
</form>
3366
</section>
3467
</form>

projects/social_platform/src/app/office/features/project-rating/project-rating.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
app-textarea {
3636
::ng-deep .field__input {
3737
min-height: 66px !important;
38-
color: var(--dark-grey);
38+
color: var(--grey-for-text) !important;
3939
background-color: transparent;
4040
border-color: var(--grey-button);
4141

projects/social_platform/src/app/office/features/project-rating/project-rating.component.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ export class ProjectRatingComponent implements OnDestroy, ControlValueAccessor,
8888
return this._criteria();
8989
}
9090

91+
@Input()
92+
set disabled(value: boolean) {
93+
this._disabled = value;
94+
if (this.form) {
95+
value ? this.form.disable() : this.form.enable();
96+
}
97+
}
98+
99+
get disabled(): boolean {
100+
return this._disabled;
101+
}
102+
103+
private _disabled = false;
104+
91105
/** Сигнал для хранения критериев оценки */
92106
_criteria = signal<ProjectRatingCriterion[]>([]);
93107

@@ -183,6 +197,10 @@ export class ProjectRatingComponent implements OnDestroy, ControlValueAccessor,
183197
});
184198

185199
this.form = new FormGroup(formGroupControls);
200+
201+
if (this.disabled) {
202+
this.form.disable();
203+
}
186204
}
187205

188206
/**

projects/social_platform/src/app/office/program/shared/rating-card/rating-card.component.html

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
<p class="text-body-12">оценка проекта</p>
6464
<i appIcon icon="medal" appWidth="8" appHeight="12"></i>
6565
</div>
66-
<app-project-rating [criteria]="project.criterias" [formControl]="form"></app-project-rating>
66+
<app-project-rating
67+
[criteria]="project.criterias"
68+
[formControl]="form"
69+
[disabled]="(projectRated() || projectConfirmed()) && !programDateFinished()"
70+
></app-project-rating>
6771
@if (form | controlError: "required"; as error) {
6872
<div class="text-body-10 error">
6973
{{ error }}
@@ -114,7 +118,19 @@
114118
<div class="cancel">
115119
<div class="cancel__top">
116120
<p class="cancel__title text-body-14">подтвердите оценку</p>
117-
<i appIcon icon="check" appSquare="60"></i>
121+
122+
<div class="cancel__project">
123+
<app-avatar [size]="50" [url]="project.imageAddress"></app-avatar>
124+
<p class="text-body-12">{{ project.name }}</p>
125+
</div>
126+
</div>
127+
128+
<div class="cancel__criterias">
129+
<app-project-rating
130+
[criteria]="project.criterias"
131+
[formControl]="form"
132+
[disabled]="(projectRated() || projectConfirmed()) && !programDateFinished()"
133+
></app-project-rating>
118134
</div>
119135

120136
<div class="cancel__buttons">
@@ -123,19 +139,18 @@
123139
class="cancel__button"
124140
customTypographyClass="text-body-12"
125141
(click)="confirmRateProject()"
126-
style="width: 100%"
127142
>
128143
подтверждаю
129144
</app-button>
130145

131146
<app-button
132147
size="big"
133148
class="cancel__button"
149+
appearance="outline"
134150
customTypographyClass="text-body-12"
135151
(click)="showConfirmRateModal.set(false)"
136-
style="width: 100%"
137152
>
138-
исправить оценку
153+
изменить оценку
139154
</app-button>
140155
</div>
141156
</div>

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,24 @@
170170
width: 350px;
171171
max-height: calc(100vh - 40px);
172172

173-
i {
174-
padding: 36px 0;
175-
color: var(--green);
176-
}
177-
178173
&__top {
179174
display: flex;
180175
flex-direction: column;
181176
align-items: center;
182177
margin-bottom: 10px;
183178
}
184179

180+
&__project {
181+
display: flex;
182+
align-items: center;
183+
gap: 8px;
184+
margin: 20px 0px;
185+
}
186+
187+
&__criterias {
188+
margin-bottom: 20px;
189+
}
190+
185191
&__title {
186192
text-align: center;
187193
}
@@ -194,8 +200,7 @@
194200

195201
&__buttons {
196202
display: flex;
197-
flex-direction: column;
198-
gap: 10px;
203+
gap: 20px;
199204
align-items: center;
200205
justify-content: center;
201206
}

0 commit comments

Comments
 (0)