Skip to content

Commit 1e139cb

Browse files
authored
Merge branch 'master' into platform-fixes
2 parents fdd4d7b + 0e6e299 commit 1e139cb

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ <h1 class="info__title">{{ program.name }}</h1>
3333
</div>
3434
</div>
3535
<div class="info__actions">
36+
@if (program.isUserMember || program.isUserManager) {
37+
<app-button (click)="addProject()" customTypographyClass="text-body-12 bar__add-project">
38+
<span class="bar__add-project-text">Добавить проект</span>
39+
<i appIcon icon="plus" appSquare="10"></i>
40+
</app-button>
41+
}
42+
3643
<a
3744
class="info__presentation"
3845
[href]="program.presentationAddress"

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@
9292
}
9393
}
9494

95+
.bar__add-project {
96+
display: flex;
97+
align-items: center;
98+
cursor: pointer;
99+
100+
i {
101+
display: block;
102+
margin-left: 6px;
103+
}
104+
}
105+
106+
.bar__add-project-text {
107+
display: inline;
108+
}
109+
95110
.about {
96111
&__head {
97112
display: flex;

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { ApiPagination } from "@models/api-pagination.model";
2525
import { TagComponent } from "@ui/components/tag/tag.component";
2626
import { NewsFormComponent } from "@office/shared/news-form/news-form.component";
2727
import { ModalComponent } from "@ui/components/modal/modal.component";
28+
import { ProjectService } from "@office/services/project.service";
2829

2930
/**
3031
* Главный компонент детальной страницы программы
@@ -93,6 +94,8 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
9394
constructor(
9495
private readonly programService: ProgramService,
9596
private readonly programNewsService: ProgramNewsService,
97+
private readonly projectService: ProjectService,
98+
private readonly router: Router,
9699
private readonly route: ActivatedRoute,
97100
private readonly router: Router,
98101
private readonly cdRef: ChangeDetectorRef
@@ -273,10 +276,24 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
273276
this.readFullDescription = !isExpanded;
274277
}
275278

279+
276280
closeModal(): void {
277281
this.showProgramModal.set(false);
278282
}
279283

284+
addProject(): void {
285+
this.projectService.create().subscribe(project => {
286+
this.projectService.projectsCount.next({
287+
...this.projectService.projectsCount.getValue(),
288+
my: this.projectService.projectsCount.getValue().my + 1,
289+
});
290+
291+
this.router
292+
.navigateByUrl(`/office/projects/${project.id}/edit?editingStep=main`)
293+
.then(() => console.debug("Route change from ProjectsComponent"));
294+
});
295+
}
296+
280297
program?: Program;
281298
registerDateExpired!: boolean;
282299
descriptionExpandable!: boolean;

0 commit comments

Comments
 (0)