diff --git a/angular.json b/angular.json index 309b708..9188414 100644 --- a/angular.json +++ b/angular.json @@ -77,6 +77,9 @@ "sourceMap": true, "namedChunks": true }, + + + "vniigaz-v2": { "buildOptimizer": false, "optimization": false, @@ -89,6 +92,10 @@ "replace": "src/environments/environment.ts", "with": "src/environments/vniigaz-v2.env.dev.ts" }, + { + "replace": "src/app/_modules/layout/grid/grid.component.ts", + "with": "src/vniigaz-v2/component/layout/grid/grid.component.ts" + }, { "replace": "src/app/_modules/layout/header/header.component.ts", "with": "src/vniigaz-v2/component/layout/header/header.component.ts" @@ -100,6 +107,10 @@ { "replace": "src/app/_modules/layout/jumbotron/jumbotron.component.ts", "with": "src/vniigaz-v2/component/layout/jumbotron/jumbotron.component.ts" + }, + { + "replace": "src/app/_modules/pages/menu/slider-menu/slider-menu.component.ts", + "with": "src/vniigaz-v2/component/pages/menu/slider-menu/slider-menu.component.ts" } ], "inlineStyleLanguage": "scss", @@ -127,6 +138,7 @@ ], "index": "src/vniigaz-v2/index.html" }, + "vniigaz-v2-prod": { "buildOptimizer": false, "optimization": false, @@ -139,6 +151,10 @@ "replace": "src/environments/environment.ts", "with": "src/environments/vniigaz-v2.env.prod.ts" }, + { + "replace": "src/app/_modules/layout/grid/grid.component.ts", + "with": "src/vniigaz-v2/component/layout/grid/grid.component.ts" + }, { "replace": "src/app/_modules/layout/header/header.component.ts", "with": "src/vniigaz-v2/component/layout/header/header.component.ts" @@ -150,6 +166,10 @@ { "replace": "src/app/_modules/layout/jumbotron/jumbotron.component.ts", "with": "src/vniigaz-v2/component/layout/jumbotron/jumbotron.component.ts" + }, + { + "replace": "src/app/_modules/pages/menu/slider-menu/slider-menu.component.ts", + "with": "src/vniigaz-v2/component/pages/menu/slider-menu/slider-menu.component.ts" } ], "inlineStyleLanguage": "scss", @@ -176,6 +196,67 @@ "node_modules/swiper/swiper-bundle.css" ], "index": "src/vniigaz-v2/index.html" + }, + + + + "nir": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/nir.env.dev.ts" + }, + { + "replace": "src/app/_modules/layout/grid/grid.component.ts", + "with": "src/nir/component/layout/grid/grid.component.ts" + }, + { + "replace": "src/app/_modules/layout/header/header.component.ts", + "with": "src/nir/component/layout/header/header.component.ts" + }, + { + "replace": "src/app/_modules/layout/footer/footer.component.ts", + "with": "src/nir/component/layout/footer/footer.component.ts" + }, + { + "replace": "src/app/_modules/layout/jumbotron/jumbotron.component.ts", + "with": "src/nir/component/layout/jumbotron/jumbotron.component.ts" + }, + { + "replace": "src/app/_modules/pages/menu/slider-menu/slider-menu.component.ts", + "with": "src/nir/component/pages/menu/slider-menu/slider-menu.component.ts" + } + ], + "inlineStyleLanguage": "scss", + "assets": [ + { + "glob": "**/*", + "input": "node_modules/tinymce", + "output": "/tinymce/" + }, + "src/favicon.ico", + { + "glob": "**/*", + "input": "src/nir/", + "output": "/assets/" + } + ], + "stylePreprocessorOptions": { + "includePaths": [ + "src/nir/css" + ] + }, + "styles": [ + "src/styles.scss", + "node_modules/swiper/swiper-bundle.css" + ], + "index": "src/nir/index.html" } }, "defaultConfiguration": "production" @@ -191,6 +272,9 @@ }, "vniigaz-v2": { "browserTarget": "front:build:vniigaz-v2" + }, + "nir": { + "browserTarget": "front:build:nir" } }, "defaultConfiguration": "development" diff --git a/src/app/_modules/administration/page/administration-page.component.html b/src/app/_modules/administration/page/administration-page.component.html index fd7deb7..71c54a3 100644 --- a/src/app/_modules/administration/page/administration-page.component.html +++ b/src/app/_modules/administration/page/administration-page.component.html @@ -4,7 +4,9 @@
- +
+ +
diff --git a/src/app/_modules/administration/page/administration-page.component.ts b/src/app/_modules/administration/page/administration-page.component.ts index 4004156..c529ea5 100644 --- a/src/app/_modules/administration/page/administration-page.component.ts +++ b/src/app/_modules/administration/page/administration-page.component.ts @@ -35,7 +35,10 @@ export class AdministrationPageComponent { makeTabs() { //this.tabs = [{name: 'company', title: 'Структура ФАУ «ФЦС»'}, {name: 'committee', title: 'Структура ТК 465'}]; //if (this.authService.isSuperAdmin) this.tabs.push({name: 'site-pages', title: 'Структура сайта'}); - this.tabs = [{name: 'site-pages', title: 'Структура сайта'}, {name: 'users', title: 'Пользователи'}, {name: 'licence', title: 'Данные о лицензии'}]; + this.tabs = [ + {name: 'site-pages', title: 'Структура сайта', access: ["admin", "editor"]}, + {name: 'users', title: 'Пользователи', access: ["admin"]}, + {name: 'licence', title: 'Данные о лицензии', access: ["admin"]}]; this.switchTab(this.route.snapshot.paramMap.get('tab')); } @@ -43,4 +46,12 @@ export class AdministrationPageComponent { this.tabs.map(tab => {tab.active = tab.name === name}); } + showTab(tab){ + return this.privileges&&tab.access.filter(role=>this.privileges[role]).length + } + + get privileges(){ + return this.authService.user?.privileges + } + } diff --git a/src/app/_modules/administration/site-pages/administrate-site-pages.component.ts b/src/app/_modules/administration/site-pages/administrate-site-pages.component.ts index 22442a7..26798d4 100644 --- a/src/app/_modules/administration/site-pages/administrate-site-pages.component.ts +++ b/src/app/_modules/administration/site-pages/administrate-site-pages.component.ts @@ -2,6 +2,7 @@ import {Component} from '@angular/core'; import {PagesService} from "@app/_services/pages.service"; import { FormsService } from '@app/_services'; import {LicenceService} from "@app/_services/licence.service"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'administrate-site-pages', @@ -9,7 +10,7 @@ import {LicenceService} from "@app/_services/licence.service"; styleUrls: ['administrate-site-pages.component.scss'] }) export class AdministrateSitePagesComponent { - constructor(private pagesService: PagesService, private formsService: FormsService, public licenceService: LicenceService) { + constructor(private pagesService: PagesService, private formsService: FormsService, public licenceService: LicenceService, private dialog: DialogService) { } get isLicenceActive() { @@ -33,7 +34,7 @@ export class AdministrateSitePagesComponent { addLocale() { if (this.isMultilang) this.formsService.createModel('localePage', null, 'pages-tree-root'); - else alert('Отсутствует необходимая опция'); + else this.dialog.alert('Данная опция не входит в Вашу лицензию. Для включения опции обратитесь в службу поддержки НИР (+7 499 490 04 65, help@nirgroup.ru)'); } toggle() { diff --git a/src/app/_modules/advisories/tree/advisory/advisories-tree-advisory.component.ts b/src/app/_modules/advisories/tree/advisory/advisories-tree-advisory.component.ts index d846ab5..3507d49 100644 --- a/src/app/_modules/advisories/tree/advisory/advisories-tree-advisory.component.ts +++ b/src/app/_modules/advisories/tree/advisory/advisories-tree-advisory.component.ts @@ -2,6 +2,7 @@ import {Component, Input} from '@angular/core'; import {AdvisoriesService} from "@app/_services/advisories.service"; import {FormsService, ListsService} from "@app/_services"; import {Subscription} from "rxjs"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'advisories-tree-advisory', @@ -17,7 +18,7 @@ export class AdvisoriesTreeAdvisoryComponent { public touched = false; - constructor(private advisoriesService: AdvisoriesService, private listsService: ListsService, private formsService: FormsService) { + constructor(private advisoriesService: AdvisoriesService, private listsService: ListsService, private formsService: FormsService, private dialog: DialogService) { } @@ -83,9 +84,13 @@ export class AdvisoriesTreeAdvisoryComponent { } delete() { - if (confirm(`Удалить ${this.advisory.caption}`)) this.advisoriesService.delete(this.advisory.id).subscribe(res => { - this.listsService.refresh(this.parent.id); - }); + this.dialog.confirm(`Удалить ${this.advisory.caption}`).subscribe( + resp=>{ + if (resp) this.advisoriesService.delete(this.advisory.id).subscribe(res => { + this.listsService.refresh(this.parent.id); + }); + } + ) } addAdvisory() { diff --git a/src/app/_modules/advisories/tree/company/advisories-tree-company.component.ts b/src/app/_modules/advisories/tree/company/advisories-tree-company.component.ts index 4834302..ebf1e0a 100644 --- a/src/app/_modules/advisories/tree/company/advisories-tree-company.component.ts +++ b/src/app/_modules/advisories/tree/company/advisories-tree-company.component.ts @@ -3,6 +3,7 @@ import {Router} from "@angular/router"; import {AdvisoryCompaniesService} from "@app/_services/advisory-companies.service"; import {FormsService, ListsService} from "@app/_services"; import {Subscription} from "rxjs"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'advisories-tree-company', @@ -18,7 +19,7 @@ export class AdvisoriesTreeCompanyComponent { public touched = false; - constructor(private advisoryCompaniesService: AdvisoryCompaniesService, private listsService: ListsService, private formsService: FormsService, private router: Router) { + constructor(private advisoryCompaniesService: AdvisoryCompaniesService, private listsService: ListsService, private formsService: FormsService, private router: Router, private dialog: DialogService) { } @@ -89,11 +90,14 @@ export class AdvisoriesTreeCompanyComponent { delete() { - if (confirm('Исключить организацию из списка участников комитета?')) { - this.advisoryCompaniesService.delete(this.advisoryCompany.id).subscribe(res => { - this.listsService.refresh(this.parent?.id); - }); - } + this.dialog.confirm('Исключить организацию из списка участников комитета?').subscribe( + resp=>{ + if (resp) { + this.advisoryCompaniesService.delete(this.advisoryCompany.id).subscribe(res => { + this.listsService.refresh(this.parent?.id); + }); + } + } + ) } - } diff --git a/src/app/_modules/advisories/tree/member/advisories-tree-member.component.ts b/src/app/_modules/advisories/tree/member/advisories-tree-member.component.ts index dea9840..d76489b 100644 --- a/src/app/_modules/advisories/tree/member/advisories-tree-member.component.ts +++ b/src/app/_modules/advisories/tree/member/advisories-tree-member.component.ts @@ -1,6 +1,7 @@ import {Component, Input} from '@angular/core'; import {AdvisoryMembersService} from "@app/_services/advisory-members.service"; import {ListsService} from "@app/_services"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'advisories-tree-member', @@ -11,7 +12,7 @@ export class AdvisoriesTreeMemberComponent { @Input() advisoryMember: any; @Input() parent: any; - constructor(private advisoryMembersService: AdvisoryMembersService, private listsService: ListsService) { + constructor(private advisoryMembersService: AdvisoryMembersService, private listsService: ListsService, private dialog: DialogService) { } @@ -41,12 +42,14 @@ export class AdvisoriesTreeMemberComponent { delete() { - if (confirm('Исключить сотрудника из участников комитета?')) { - this.advisoryMembersService.delete(this.advisoryMember.id).subscribe(res => { - this.listsService.refresh(this.parent?.id); - }); - } + this.dialog.confirm('Исключить сотрудника из участников комитета?').subscribe( + resp=>{ + if (resp) { + this.advisoryMembersService.delete(this.advisoryMember.id).subscribe(res => { + this.listsService.refresh(this.parent?.id); + }); + } + } + ) } - - } diff --git a/src/app/_modules/auth/auth-modal/auth-modal.component.html b/src/app/_modules/auth/auth-modal/auth-modal.component.html index 1507c29..869fe57 100644 --- a/src/app/_modules/auth/auth-modal/auth-modal.component.html +++ b/src/app/_modules/auth/auth-modal/auth-modal.component.html @@ -1,12 +1,11 @@ - -
+ +

Вход в систему

Регистрация

Восстановление пароля

Сброс пароля

-
- +
@@ -17,5 +16,5 @@
- + diff --git a/src/app/_modules/auth/forms/login/auth-form-login.component.html b/src/app/_modules/auth/forms/login/auth-form-login.component.html index b547a78..47ef81f 100644 --- a/src/app/_modules/auth/forms/login/auth-form-login.component.html +++ b/src/app/_modules/auth/forms/login/auth-form-login.component.html @@ -15,10 +15,10 @@
- + +
diff --git a/src/app/_modules/auth/forms/signup/auth-form-signup.component.html b/src/app/_modules/auth/forms/signup/auth-form-signup.component.html index 987bb58..ace9023 100644 --- a/src/app/_modules/auth/forms/signup/auth-form-signup.component.html +++ b/src/app/_modules/auth/forms/signup/auth-form-signup.component.html @@ -42,7 +42,7 @@
{{error}}
- +
diff --git a/src/app/_modules/auth/forms/signup/auth-form-signup.component.ts b/src/app/_modules/auth/forms/signup/auth-form-signup.component.ts index e75f668..7693c32 100644 --- a/src/app/_modules/auth/forms/signup/auth-form-signup.component.ts +++ b/src/app/_modules/auth/forms/signup/auth-form-signup.component.ts @@ -79,4 +79,11 @@ export class AuthFormSignupComponent implements OnInit { let trans = {'The given data was invalid.': 'Проверьте правильность заполнения формы'}; this.error = trans[error.message] || error.message; } + + login(){ + this.router.navigate( + [ {outlets: {auth: 'login'}}], + {skipLocationChange: true} + ).then(); + } } diff --git a/src/app/_modules/form-fields/types/document/value/field-document-value.component.html b/src/app/_modules/form-fields/types/document/value/field-document-value.component.html index 5c9737d..cd12371 100644 --- a/src/app/_modules/form-fields/types/document/value/field-document-value.component.html +++ b/src/app/_modules/form-fields/types/document/value/field-document-value.component.html @@ -16,8 +16,12 @@
- - +
+ +
+
+ +
diff --git a/src/app/_modules/layout/grid/grid.component.html b/src/app/_modules/layout/grid/grid.component.html index 58b57be..0db5209 100644 --- a/src/app/_modules/layout/grid/grid.component.html +++ b/src/app/_modules/layout/grid/grid.component.html @@ -16,3 +16,4 @@ + diff --git a/src/app/_modules/layout/header/user-bar/header-user-bar.component.html b/src/app/_modules/layout/header/user-bar/header-user-bar.component.html index 1bc49cc..17e3bc8 100644 --- a/src/app/_modules/layout/header/user-bar/header-user-bar.component.html +++ b/src/app/_modules/layout/header/user-bar/header-user-bar.component.html @@ -9,8 +9,8 @@
Личный кабинет
-
-
Структура сайта
+
+
Панель управления
Выход из системы
diff --git a/src/app/_modules/layout/header/user-bar/header-user-bar.component.ts b/src/app/_modules/layout/header/user-bar/header-user-bar.component.ts index cd4188a..87469ed 100644 --- a/src/app/_modules/layout/header/user-bar/header-user-bar.component.ts +++ b/src/app/_modules/layout/header/user-bar/header-user-bar.component.ts @@ -2,6 +2,7 @@ import {Component, Input} from '@angular/core'; import {AuthenticationService} from "@app/_services"; import {Router} from "@angular/router"; import { PagesService } from '@app/_services/pages.service'; +import { DialogService } from '@app/_services/dialog.service'; @Component({ @@ -13,7 +14,7 @@ export class HeaderUserBarComponent { public menuItems = []; public ddHidden = true; - constructor(public authService: AuthenticationService, private router: Router, private pagesService: PagesService) { + constructor(public authService: AuthenticationService, private router: Router, private pagesService: PagesService, private dialog: DialogService) { } get user() { @@ -39,12 +40,16 @@ export class HeaderUserBarComponent { logout() { - if (confirm('Вы деествительно хотите выйти из системы?')) { - this.pagesService.editMode = false; - this.authService.logout(); - this.ddHidden = true; - this.router.navigate(['']).then(); - } + this.dialog.confirm('Вы действительно хотите выйти из системы?').subscribe( + resp=>{ + if (resp) { + this.pagesService.editMode = false; + this.authService.logout(); + this.ddHidden = true; + this.router.navigate(['']).then(); + } + } + ) } link(link: string) { diff --git a/src/app/_modules/pages/menu/item/pages-menu-item.component.html b/src/app/_modules/pages/menu/item/pages-menu-item.component.html index 345fb6a..4c6f321 100644 --- a/src/app/_modules/pages/menu/item/pages-menu-item.component.html +++ b/src/app/_modules/pages/menu/item/pages-menu-item.component.html @@ -1,5 +1,5 @@ diff --git a/src/app/_modules/pages/menu/pages-menu.component.ts b/src/app/_modules/pages/menu/pages-menu.component.ts index d8df33b..9addbb9 100644 --- a/src/app/_modules/pages/menu/pages-menu.component.ts +++ b/src/app/_modules/pages/menu/pages-menu.component.ts @@ -21,7 +21,6 @@ export class PagesMenuComponent implements OnInit { ngOnInit() { if(!this.items){ - this.subscription = combineLatest([ this.pagesService.currentPageSubject, this.pagesService.rootPagesSubject diff --git a/src/app/_modules/pages/menu/slider-menu/slider-menu.component.html b/src/app/_modules/pages/menu/slider-menu/slider-menu.component.html index ba5f5c3..1b80fbb 100644 --- a/src/app/_modules/pages/menu/slider-menu/slider-menu.component.html +++ b/src/app/_modules/pages/menu/slider-menu/slider-menu.component.html @@ -1,4 +1,4 @@ - +
diff --git a/src/app/_modules/pages/page/page.component.ts b/src/app/_modules/pages/page/page.component.ts index 8c302be..a42f1a1 100644 --- a/src/app/_modules/pages/page/page.component.ts +++ b/src/app/_modules/pages/page/page.component.ts @@ -15,7 +15,7 @@ export class PageComponent { private url: string; private inited = false; routeSubscription?: Subscription; - subscription: Subscription; + listSubscription: Subscription; constructor( private router: Router, @@ -42,13 +42,14 @@ export class PageComponent { ngOnInit() { - this.listsService.controls().subscribe(res => { + this.listSubscription = this.listsService.controls().subscribe(res => { this.inited ? this.fetch() : this.inited = true; }); } ngOnDestroy() { this.routeSubscription?.unsubscribe(); + this.listSubscription?.unsubscribe() } onNavigationEnd(event: NavigationEnd) { @@ -64,6 +65,7 @@ export class PageComponent { this.loading = true; let include = [ 'parents.children', + 'parents.picture', 'children', 'sections.type', 'sections.groups.fields.value', @@ -78,7 +80,7 @@ export class PageComponent { this.page = res?.data; if (this.page) { this.pagesService.currentPage = this.page; - this.titleService.setTitle(this.page.title||this.page.h1||this.page.name) + // this.titleService.setTitle(this.page.title||this.page.h1||this.page.name) } this.loading = false; }, error => { diff --git a/src/app/_modules/pages/sections/menu/page-menu.component.ts b/src/app/_modules/pages/sections/menu/page-menu.component.ts index 8179b7f..862c6ec 100644 --- a/src/app/_modules/pages/sections/menu/page-menu.component.ts +++ b/src/app/_modules/pages/sections/menu/page-menu.component.ts @@ -1,5 +1,6 @@ import {Component, Input} from '@angular/core'; import {FormsService, ListsService, ObjectsService} from "@app/_services"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'page-menu', @@ -7,6 +8,17 @@ import {FormsService, ListsService, ObjectsService} from "@app/_services"; styleUrls: ['page-menu.component.scss'] }) export class PageMenuComponent { + + delete() { + this.dialog.confirm('Удалить этот блок?').subscribe( + resp=>{ + if (resp) this.objectsService.destroy(this.section.id).subscribe(res => { + this.listsService.refresh(); + }); + } + ) + } + @Input() page: any; @Input() section: any; @Input() editMode: boolean; @@ -14,7 +26,11 @@ export class PageMenuComponent { @Input() modelId: string; @Input() modelType: string; - constructor(private formsService: FormsService, private objectsService: ObjectsService, private listsService: ListsService) { + constructor( + private formsService: FormsService, + private objectsService: ObjectsService, + private listsService: ListsService, + private dialog: DialogService) { } ngOnInit() { @@ -49,10 +65,5 @@ export class PageMenuComponent { }); } - delete() { - //r u sure? - if (confirm('Удалить этот блок?')) this.objectsService.destroy(this.section.id).subscribe(res => { - this.listsService.refresh(); - }); - } + } diff --git a/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.ts b/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.ts index 3cfd02f..87f95b9 100644 --- a/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.ts +++ b/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.ts @@ -1,5 +1,6 @@ import {Component, Input} from '@angular/core'; import {FormsService, ListsService, ObjectsService} from "@app/_services"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'cards-section-item', @@ -11,7 +12,7 @@ export class CardsSectionItemComponent { @Input() type: any; @Input() editMode = false; - constructor(private objectsService: ObjectsService, private formsService: FormsService, private listsService: ListsService) { + constructor(private objectsService: ObjectsService, private formsService: FormsService, private listsService: ListsService, private dialog: DialogService) { } @@ -23,10 +24,13 @@ export class CardsSectionItemComponent { } delete() { - if (confirm('r u sure?')) this.objectsService.destroy(this.card.id).subscribe(res => { - this.listsService.refresh(); - }); + this.dialog.confirm('Удалить эту карточку?').subscribe( + resp=>{ + if (resp) this.objectsService.destroy(this.card.id).subscribe(res => { + this.listsService.refresh(); + }); + } + ) } - } diff --git a/src/app/_modules/pages/tree/item/pages-tree-item.component.ts b/src/app/_modules/pages/tree/item/pages-tree-item.component.ts index 52c50ae..baa13dc 100644 --- a/src/app/_modules/pages/tree/item/pages-tree-item.component.ts +++ b/src/app/_modules/pages/tree/item/pages-tree-item.component.ts @@ -2,6 +2,7 @@ import {Component, Input} from '@angular/core'; import {PagesService} from "@app/_services/pages.service"; import {FormsService, ListsService} from "@app/_services"; import {Subscription} from "rxjs"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'pages-tree-item', @@ -18,7 +19,8 @@ export class PagesTreeItemComponent { constructor( public pagesService: PagesService, private formsService: FormsService, - private listsService: ListsService) { + private listsService: ListsService, + private dialog: DialogService) { } ngOnInit() { @@ -85,26 +87,36 @@ export class PagesTreeItemComponent { } delete() { - if (confirm('r u sure?')) this.pagesService.delete(this.page.id).subscribe(res => { - this.listsService.refresh(this.parentListId); - this.refresh(); - }); - + this.dialog.confirm(`Удалить страницу ${this.page.name}?`).subscribe( + resp=>{ + if (resp) this.pagesService.delete(this.page.id).subscribe(res => { + this.listsService.refresh(this.parentListId); + this.refresh(); + }); + } + ) } restore() { - if (confirm(`Восстановить страницу ${this.page.name}?`)) this.pagesService.restore(this.page.id, {}).subscribe(res => { - this.listsService.refresh(this.parentListId); - this.refresh(); - }); - + this.dialog.confirm(`Восстановить страницу ${this.page.name}?`).subscribe( + resp=>{ + if (resp) this.pagesService.restore(this.page.id, {}).subscribe(res => { + this.listsService.refresh(this.parentListId); + this.refresh(); + }); + } + ) } clone() { - if (confirm(`Копировать страницу ${this.page.name}?`)) this.pagesService.clone(this.page.id, {recursive: true}).subscribe(res => { - this.listsService.refresh(this.parentListId); - this.refresh(); - }); + this.dialog.confirm(`Копировать страницу ${this.page.name}?`).subscribe( + resp=>{ + if (resp) this.pagesService.clone(this.page.id, {recursive: true}).subscribe(res => { + this.listsService.refresh(this.parentListId); + this.refresh(); + }); + } + ) } private refresh(){ diff --git a/src/app/_modules/publications/list/item/menu/menu.component.ts b/src/app/_modules/publications/list/item/menu/menu.component.ts index 1c38403..99e20a5 100644 --- a/src/app/_modules/publications/list/item/menu/menu.component.ts +++ b/src/app/_modules/publications/list/item/menu/menu.component.ts @@ -42,7 +42,7 @@ export class PublicationsListItemMenuComponent { } delete(id: string) { - if (confirm('Вы деествительно хотите удалить эту запись?')) { + if (confirm('Вы действительно хотите удалить эту запись?')) { this.publicationsService.delete(id).subscribe(res => { this.listsService.refresh(this.listId, true); }); diff --git a/src/app/_modules/publications/list/item/publications-list-item.component.html b/src/app/_modules/publications/list/item/publications-list-item.component.html index e39c500..28a7cc7 100644 --- a/src/app/_modules/publications/list/item/publications-list-item.component.html +++ b/src/app/_modules/publications/list/item/publications-list-item.component.html @@ -8,16 +8,18 @@
-
{{publication.publishedAt | date : 'dd.MM.yy'}}
-
- -

{{publication.name}}

+
+
{{publication.publishedAt | date : 'dd.MM.yy'}}
+
+ + +
{{publication.excerpt}}
+ + Читать далее +
- - -
{{publication.excerpt}}
- - Читать далее - - \ No newline at end of file diff --git a/src/app/_modules/publications/list/item/publications-list-item.component.ts b/src/app/_modules/publications/list/item/publications-list-item.component.ts index 373136d..fba45ae 100644 --- a/src/app/_modules/publications/list/item/publications-list-item.component.ts +++ b/src/app/_modules/publications/list/item/publications-list-item.component.ts @@ -1,6 +1,7 @@ import {Component, Input} from '@angular/core'; import {FormsService, ListsService} from "@app/_services"; import {PublicationsService} from "@app/_services/publications.service"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'publications-list-item', @@ -12,7 +13,7 @@ export class PublicationsListItemComponent { @Input() editMode: boolean; currentPoster:any; - constructor(private publicationsService: PublicationsService, private formsService: FormsService, private listsService: ListsService) { + constructor(private publicationsService: PublicationsService, private formsService: FormsService, private listsService: ListsService, private dialog: DialogService) { } get listId() { @@ -23,22 +24,30 @@ export class PublicationsListItemComponent { return this.publication.posters?.data; } + get isPublished(){ + return this.publication.isPublished + } + ngOnInit() { if (this.publication.posters) this.currentPoster = this.posters[0]; } - edit() { this.formsService.editModel('publication', this.publication.id, null, this.listId); } delete() { - if (confirm('R u sure?')) { - this.publicationsService.delete(this.publication.id).subscribe(res => { - this.listsService.refresh(this.listId, true); - }); - } + this.dialog.confirm('Удалить эту новость?').subscribe( + resp=>{ + if (resp) { + this.publicationsService.delete(this.publication.id).subscribe(res => { + this.listsService.refresh(this.listId, true); + }); + } + } + ) } + } diff --git a/src/app/_modules/publications/publication/publication-page.component.html b/src/app/_modules/publications/publication/publication-page.component.html index 683ffb2..c360a6f 100644 --- a/src/app/_modules/publications/publication/publication-page.component.html +++ b/src/app/_modules/publications/publication/publication-page.component.html @@ -2,9 +2,15 @@

{{page.name}}

+
+ + + Назад + + diff --git a/src/app/_modules/publications/publication/publication-page.component.ts b/src/app/_modules/publications/publication/publication-page.component.ts index 148dbb9..33bca66 100644 --- a/src/app/_modules/publications/publication/publication-page.component.ts +++ b/src/app/_modules/publications/publication/publication-page.component.ts @@ -1,4 +1,5 @@ import {Component, Input} from '@angular/core'; +import { Router } from '@angular/router'; @Component({ selector: 'publication-page', @@ -9,13 +10,19 @@ export class PublicationPageComponent { @Input() page: any; @Input() editMode: boolean; - constructor() { + constructor( + private router: Router + ) { } get posters() { return this.page.posters?.data; } + back(): void { + window.history.back(); +} + ngOnInit() { } } diff --git a/src/app/_modules/users/list/item/users-list-item.component.ts b/src/app/_modules/users/list/item/users-list-item.component.ts index 997c64c..c3d25be 100644 --- a/src/app/_modules/users/list/item/users-list-item.component.ts +++ b/src/app/_modules/users/list/item/users-list-item.component.ts @@ -1,5 +1,6 @@ import {Component, Input} from '@angular/core'; import {FormsService, ListsService, UsersService} from "@app/_services"; +import { DialogService } from '@app/_services/dialog.service'; @Component({ selector: 'users-list-item', @@ -10,7 +11,7 @@ export class UsersListItemComponent { @Input() user: any; @Input() listId: string; - constructor(private usersService: UsersService, private formsService: FormsService, private listsService: ListsService) { + constructor(private usersService: UsersService, private formsService: FormsService, private listsService: ListsService, private dialog: DialogService) { } get role() { @@ -29,9 +30,12 @@ export class UsersListItemComponent { } delete() { - if (confirm(`Удалить пользователя ${this.user.name}?`)) this.usersService.delete(this.user.id).subscribe(res => { - this.listsService.refresh(this.listId, true); - }); + this.dialog.confirm(`Удалить пользователя ${this.user.name}?`).subscribe( + resp=>{ + if (resp) this.usersService.delete(this.user.id).subscribe(res => { + this.listsService.refresh(this.listId, true); + }); + } + ) } - } diff --git a/src/app/_modules/widjet/cms-dialog/cms-dialog.component.html b/src/app/_modules/widjet/cms-dialog/cms-dialog.component.html new file mode 100644 index 0000000..9db534c --- /dev/null +++ b/src/app/_modules/widjet/cms-dialog/cms-dialog.component.html @@ -0,0 +1,30 @@ + +
+

Внимание

+
+
+ {{allert}} +
+
+ +
+
+ + +
+

Подтверждение

+
+
+ {{prompt}} +
+
+ + +
+
diff --git a/src/app/_modules/widjet/cms-dialog/cms-dialog.component.scss b/src/app/_modules/widjet/cms-dialog/cms-dialog.component.scss new file mode 100644 index 0000000..a86f021 --- /dev/null +++ b/src/app/_modules/widjet/cms-dialog/cms-dialog.component.scss @@ -0,0 +1,6 @@ +[footer]{ + display: flex; + justify-content: flex-end; + gap: 20px; + margin-bottom: 24px; +} \ No newline at end of file diff --git a/src/app/_modules/widjet/cms-dialog/cms-dialog.component.ts b/src/app/_modules/widjet/cms-dialog/cms-dialog.component.ts new file mode 100644 index 0000000..e92ee26 --- /dev/null +++ b/src/app/_modules/widjet/cms-dialog/cms-dialog.component.ts @@ -0,0 +1,54 @@ +import { Component } from '@angular/core'; +import { DialogService } from '@app/_services/dialog.service'; +import { Subscription, BehaviorSubject } from 'rxjs'; + +@Component({ + selector: 'cms-dialog', + templateUrl: './cms-dialog.component.html', + styleUrls: ['./cms-dialog.component.scss'] +}) +export class CmsDialogComponent { + constructor( + private dialog: DialogService + ){} + + allert: string; + prompt: string; + resp: BehaviorSubject; + showAllert: boolean; + showPrompt: boolean; + + ngOnInit(){ + this.dialog.modalAllertSubject.subscribe( + allert=>{ + if (allert) { + this.allert = allert; + this.showAllert = true; + } + } + ) + this.dialog.modalPromptSubject.subscribe( + prompt=>{ + if (prompt) { + this.prompt = prompt; + this.showPrompt = true; + } + } + ) + } + + respYes(){ + this.dialog.modalRespSubject.next(true); + this.close(); + } + + respNo(){ + this.dialog.modalRespSubject.next(false); + this.close(); + } + + close(){ + this.showPrompt = this.showAllert = false; + } + +} diff --git a/src/app/_modules/widjet/cms-modal/cms-modal.component.html b/src/app/_modules/widjet/cms-modal/cms-modal.component.html new file mode 100644 index 0000000..3338f00 --- /dev/null +++ b/src/app/_modules/widjet/cms-modal/cms-modal.component.html @@ -0,0 +1,15 @@ +
+ +
+
+
+ + +
+
+ +
+ +
\ No newline at end of file diff --git a/src/app/_modules/widjet/cms-modal/cms-modal.component.scss b/src/app/_modules/widjet/cms-modal/cms-modal.component.scss new file mode 100644 index 0000000..f7be9c3 --- /dev/null +++ b/src/app/_modules/widjet/cms-modal/cms-modal.component.scss @@ -0,0 +1,114 @@ +:host{ + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + display: flex; + align-items: center; + justify-content: center; + z-index: 10000; + + font-family: PT Sans; + font-size: 16px; + font-style: normal; + font-weight: 400; + line-height: 24px; + + .cms-modal-overlay{ + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(62, 61, 64, 0.7); + z-index: 1000; + } + .cms-modal-bar{ + position: fixed; + max-height: 100vh; + width: 448px; + background-color: var(--white); + border: 1px solid var(--second-dis); + display: flex; + flex-direction: column; + border-radius: 4px; + padding: 24px 24px 0; + z-index: 1000; + overflow: hidden; + gap: 24px; + .cms-modal-header{ + display: flex; + justify-content: space-between; + align-items: center; + h4{ + font-family: PT Sans; + font-size: 20px; + font-style: normal; + font-weight: 700; + line-height: 28px; + margin: 0; + } + ico{ + cursor: pointer; + } + } + .cms-modal-body{ + overflow-y: auto; + } + .cms-modal-footer{ + display: flex; + justify-content: flex-end; + gap: 20px; + } + } + ::ng-deep{ + button{ + border-radius: 4px; + padding: 8px 20px; + font-family: PT Sans; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 24px; + letter-spacing: 0.56px; + text-transform: uppercase; + border: 1px solid; + &.prime{ + background-color: var(--prime); + color: var(--white); + border-color: var(--prime); + &:hover{ + background-color: var(--prime-act); + border-color: var(--prime-act); + } + } + &.outline{ + background-color: var(--white); + color: var(--prime); + &:hover{ + background-color: var(--white); + color: var(--prime-act); + border-color: var(--prime-act); + } + } + } + input{ + width: 100%; + height: 40px; + padding: 8px 16px; + border-radius: 4px; + border: solid 1px var(--second-dis); + font-family: PT Sans; + font-size: 16px; + font-style: normal; + font-weight: 400; + line-height: 24px; + } + input:autofill{ + background-color: var(--prime-dis); + border-color: var(--prime); + background-image: none !important; + } + } +} \ No newline at end of file diff --git a/src/app/_modules/widjet/cms-modal/cms-modal.component.ts b/src/app/_modules/widjet/cms-modal/cms-modal.component.ts new file mode 100644 index 0000000..8bb76b8 --- /dev/null +++ b/src/app/_modules/widjet/cms-modal/cms-modal.component.ts @@ -0,0 +1,24 @@ +import { Component, Output, EventEmitter } from '@angular/core'; +import {WindowScrollingService} from "@app/_services/window-scrolling.service"; + +@Component({ + selector: 'cms-modal', + templateUrl: './cms-modal.component.html', + styleUrls: ['./cms-modal.component.scss'] +}) +export class CmsModalComponent { + @Output() close = new EventEmitter(); + + constructor( private windowScrollingService: WindowScrollingService ){} + + ngOnInit(){ + this.windowScrollingService.disable(); + } + ngOnDestroy(){ + this.windowScrollingService.enable(); + } + + cls(){ + this.close.emit('close') + } +} diff --git a/src/app/_modules/widjet/locale/locale.component.html b/src/app/_modules/widjet/locale/locale.component.html index 4ac9254..9c9cc06 100644 --- a/src/app/_modules/widjet/locale/locale.component.html +++ b/src/app/_modules/widjet/locale/locale.component.html @@ -6,7 +6,7 @@