Skip to content

Commit aa4e6f6

Browse files
committed
Merge remote-tracking branch 'origin/master' into update-edit-project
2 parents 2d42b00 + d60ac63 commit aa4e6f6

9 files changed

Lines changed: 111 additions & 35 deletions

File tree

projects/skills/src/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ export class AppComponent implements OnInit {
5555
*/
5656
navItems = [
5757
// { name: "Навыки", icon: "lib", link: "skills" }, // Временно отключено
58-
{ name: "Старт в карьеру", icon: "trackcar", link: "trackCar" },
59-
{ name: "Траектории", icon: "receipt", link: "subscription" },
60-
{ name: "Рейтинг", icon: "growth", link: "rating" },
58+
{ name: "Детский Форсайт", icon: "trackcar", link: "trackCar" },
59+
// { name: "Траектории", icon: "receipt", link: "subscription" },
60+
// { name: "Рейтинг", icon: "growth", link: "rating" },
6161
// { name: "Траектория бизнеса", icon: "trackbuss", link: "trackBuss" }, // Временно отключено
6262
// { name: "Вебинары", icon: "webinars", link: "webinars" }, // Временно отключено
6363
];

projects/skills/src/app/app.routes.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ export const routes: Routes = [
2929
path: "profile",
3030
loadChildren: () => import("./profile/profile.routes").then(c => c.PROFILE_ROUTES),
3131
},
32-
{
33-
path: "skills",
34-
loadChildren: () => import("./skills/skills.routes").then(c => c.SKILLS_ROUTES),
35-
},
36-
{
37-
path: "rating",
38-
loadChildren: () => import("./rating/rating.routes").then(c => c.RATING_ROUTES),
39-
},
40-
{
41-
path: "task",
42-
loadChildren: () => import("./task/task.routes").then(c => c.TASK_ROUTES),
43-
},
44-
{
45-
path: "trackBuss",
46-
loadChildren: () =>
47-
import("./trajectories/track-bussiness/track-bussiness.routes").then(
48-
c => c.TRACK_BUSSINESS_ROUTES
49-
),
50-
},
32+
// {
33+
// path: "skills",
34+
// loadChildren: () => import("./skills/skills.routes").then(c => c.SKILLS_ROUTES),
35+
// },
36+
// {
37+
// path: "rating",
38+
// loadChildren: () => import("./rating/rating.routes").then(c => c.RATING_ROUTES),
39+
// },
40+
// {
41+
// path: "task",
42+
// loadChildren: () => import("./task/task.routes").then(c => c.TASK_ROUTES),
43+
// },
44+
// {
45+
// path: "trackBuss",
46+
// loadChildren: () =>
47+
// import("./trajectories/track-bussiness/track-bussiness.routes").then(
48+
// c => c.TRACK_BUSSINESS_ROUTES
49+
// ),
50+
// },
5151
{
5252
path: "trackCar",
5353
loadChildren: () =>
@@ -58,8 +58,8 @@ export const routes: Routes = [
5858
loadChildren: () =>
5959
import("./subscription/subscription.routes").then(c => c.SUBSCRIPTION_ROUTES),
6060
},
61-
{
62-
path: "webinars",
63-
loadChildren: () => import("./webinars/webinars.routes").then(c => c.WEBINARS_ROUTES),
64-
},
61+
// {
62+
// path: "webinars",
63+
// loadChildren: () => import("./webinars/webinars.routes").then(c => c.WEBINARS_ROUTES),
64+
// },
6565
];

projects/social_platform/src/app/office/feed/feed.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class FeedComponent implements OnInit, AfterViewInit, OnDestroy {
101101
tap(includes => {
102102
this.includes.set(includes);
103103
}),
104-
skip(1), // Пропускаем первое значение (уже загружено резолвером)
104+
skip(1),
105105
concatMap(includes => {
106106
this.totalItemsCount.set(0);
107107
this.feedPage.set(0);
@@ -112,7 +112,6 @@ export class FeedComponent implements OnInit, AfterViewInit, OnDestroy {
112112
.subscribe(feed => {
113113
this.feedItems.set(feed);
114114

115-
// Плавная прокрутка к началу ленты после фильтрации
116115
setTimeout(() => {
117116
this.feedRoot?.nativeElement.children[0].scrollIntoView({ behavior: "smooth" });
118117
});
@@ -175,7 +174,6 @@ export class FeedComponent implements OnInit, AfterViewInit, OnDestroy {
175174

176175
// Определяем тип новости по структуре contentObject
177176
if ("email" in item.content.contentObject) {
178-
// Новость профиля
179177
this.profileNewsService
180178
.toggleLike(
181179
item.content.contentObject.id as unknown as string,
@@ -195,7 +193,6 @@ export class FeedComponent implements OnInit, AfterViewInit, OnDestroy {
195193
});
196194
});
197195
} else if ("leader" in item.content.contentObject) {
198-
// Новость проекта
199196
this.projectNewsService
200197
.toggleLike(
201198
item.content.contentObject.id as unknown as string,

projects/social_platform/src/app/office/onboarding/stage-zero/stage-zero.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit, signal } from "@angula
44
import { AuthService } from "@auth/services";
55
import { FormArray, FormBuilder, FormGroup, ReactiveFormsModule, Validators } from "@angular/forms";
66
import { ErrorMessage } from "@error/models/error-message";
7-
import { ControlErrorPipe, ValidationService } from "projects/core";
7+
import { ControlErrorPipe, ValidationService, YearsFromBirthdayPipe } from "projects/core";
88
import { concatMap, Subscription } from "rxjs";
99
import { Router } from "@angular/router";
1010
import { User } from "@auth/models/user.model";

projects/social_platform/src/app/office/program/detail/main/main.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ import { NewsFormComponent } from "@office/features/news-form/news-form.componen
3939
ButtonComponent,
4040
ProgramNewsCardComponent,
4141
UserLinksPipe,
42+
AsyncPipe,
4243
ParseBreaksPipe,
4344
ParseLinksPipe,
4445
ModalComponent,
4546
MatProgressBarModule,
4647
SoonCardComponent,
4748
NewsFormComponent,
49+
ModalComponent,
50+
MatProgressBarModule,
4851
],
4952
})
5053
export class ProgramDetailMainComponent implements OnInit, OnDestroy {
@@ -139,6 +142,8 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
139142
},
140143
});
141144

145+
this.loadEvent = fromEvent(window, "load");
146+
142147
this.subscriptions$().push(program$);
143148
this.subscriptions$().push(programIdSubscription$);
144149
this.subscriptions$().push(routeModalSub$);
@@ -253,6 +258,8 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
253258
this.projectAdditionalService.clearAssignProjectToProgramError();
254259
}
255260

261+
private loadEvent?: Observable<Event>;
262+
256263
program?: Program;
257264
registerDateExpired!: boolean;
258265
descriptionExpandable!: boolean;

projects/social_platform/src/app/office/program/services/program.service.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ export class ProgramService {
9696

9797
createProgramFilters(
9898
programId: number,
99-
filters: { filters: { string: string[] } }
99+
filters: Record<string, string[]>,
100+
params?: HttpParams
100101
): Observable<ApiPagination<Project>> {
101-
return this.apiService.post(`${this.PROGRAMS_URL}/${programId}/projects/filter/`, {
102-
filters,
103-
});
102+
let url = `${this.PROGRAMS_URL}/${programId}/projects/filter/`;
103+
104+
if (params) {
105+
url += `?${params.toString()}`;
106+
}
107+
108+
return this.apiService.post(url, { filters: filters });
104109
}
105110

106111
submitCompettetiveProject(relationId: number): Observable<Project> {

projects/social_platform/src/app/office/projects/edit/edit.component.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ export class ProjectEditComponent implements OnInit, AfterViewInit, OnDestroy {
206206
// Маркер того является ли проект привязанный к конкурсной программе
207207
isCompetitive = false;
208208

209+
// Маркер что проект привязан
210+
isProjectBoundToProgram = false;
211+
209212
// Текущий шаг редактирования
210213
get editingStep(): EditStep {
211214
return this.projectStepService.getCurrentStep()();
@@ -327,6 +330,21 @@ export class ProjectEditComponent implements OnInit, AfterViewInit, OnDestroy {
327330
});
328331
}
329332

333+
/**
334+
* Удаление проекта с проверкой удаления у пользователя
335+
*/
336+
deleteProject(): void {
337+
if (!confirm("Вы точно хотите удалить проект?")) {
338+
return;
339+
}
340+
341+
this.projectService.remove(Number(this.route.snapshot.paramMap.get("projectId"))).subscribe({
342+
next: () => {
343+
this.router.navigateByUrl(`/office/projects/my`);
344+
},
345+
});
346+
}
347+
330348
/**
331349
* Сохранение проекта как опубликованного с проверкой доп. полей
332350
*/

projects/social_platform/src/app/office/projects/edit/shared/project-main-step/project-main-step.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export class ProjectMainStepComponent implements OnInit, OnDestroy {
6868
@Input() leaderId = 0;
6969
@Input() projSubmitInitiated = false;
7070
@Input() projectId!: number;
71+
@Input() isProjectBoundToProgram = false;
7172

7273
private subscription = new Subscription();
7374

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/** @format */
2+
3+
interface yearListElement {
4+
id: number; // порядковый номер в массиве
5+
value: string; // строка, которую будем показывать в UI
6+
label: string; // то же самое, что и value (можно использовать обе подписи)
7+
}
8+
9+
/**
10+
* Генерирует массив годов.
11+
*
12+
* @param amount – сколько лет нужно вывести.
13+
* Считаем, что список должен начинаться с «текущий‑year‑amount+1» и
14+
* заканчиваться текущим календарным годом.
15+
* @returns массив объектов вида { id, value, label }
16+
*
17+
* Пример: generateYearList(3) (при текущем 2025‑м году) →
18+
* [
19+
* { id: 0, value: '2023 год', label: '2023 год' },
20+
* { id: 1, value: '2024 год', label: '2024 год' },
21+
* { id: 2, value: '2025 год', label: '2025 год' }
22+
* ]
23+
*/
24+
export const generateYearList = (amount: number): yearListElement[] => {
25+
if (amount <= 0) return [];
26+
27+
const now = new Date().getFullYear();
28+
const firstYear = now - amount + 1;
29+
const list: yearListElement[] = [];
30+
31+
for (let i = 0; i < amount; i++) {
32+
const year = firstYear + i;
33+
list.push({
34+
id: i,
35+
value: `${year} год`,
36+
label: `${year} год`,
37+
});
38+
}
39+
40+
const currentId = amount - 1;
41+
list.push({
42+
id: currentId,
43+
value: `${now} год`,
44+
label: "по наст. вр.",
45+
});
46+
47+
return list;
48+
};

0 commit comments

Comments
 (0)