master
sergeybodin 2023-09-06 11:35:07 +03:00
parent 11af943e69
commit d64db2b459
44 changed files with 414 additions and 152 deletions

View File

@ -10,7 +10,7 @@ import {FormsService, ListsService} from "@app/_services";
})
export class PageComponent {
public page: any;
public editMode = false;
public editMode: boolean;
public loading = false;
private url: string;
private inited = false;
@ -64,10 +64,17 @@ export class PageComponent {
fetch() {
this.loading = true;
let include = ['parents', 'sections.type', 'sections.groups.fields.value', 'sidebars.groups.fields.value', 'sidebars.type', 'permissions'];
let include = [
'parents',
'sections.type',
'sections.groups.fields.value',
'sections.objectables.groups.fields.value',
'sidebars.groups.fields.value',
'sidebars.type',
'permissions'
];
this.pagesService.find(this.url, {include: include.join(',')}).subscribe(res => {
this.page = res?.data;
console.log(this.page?.image);
this.loading = false;
}, error => {
this.loading = false;
@ -85,7 +92,7 @@ export class PageComponent {
removeBackground() {
if (confirm('Вы деествительно хотите удалить этот фон?')) {
this.pagesService.deleteBackground(this.page.id).subscribe(res => {
console.log(res);
//console.log(res);
// this.listsService.refresh(this.listId, true);
});
}

View File

@ -7,11 +7,15 @@ import {Component, Input} from '@angular/core';
})
export class ContentPageComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor() {
}
ngOnInit() {
}
get sections() {
return this.page?.sections?.data;
}
@ -19,10 +23,4 @@ export class ContentPageComponent {
get sidebars() {
return this.page?.sidebars?.data;
}
ngOnInit() {
}
}

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PublicationsPageComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor() {
}

View File

@ -8,7 +8,7 @@ import {PagesService} from "@app/_services/pages.service";
})
export class RegistryPageComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor(private pagesService: PagesService) {
}

View File

@ -8,7 +8,7 @@ import {AdvisoriesService} from "@app/_services/advisories.service";
})
export class TkStructurePageComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
public mainCommittee: any;
public activeAdvisories = {};

View File

@ -1,6 +1,6 @@
<div class="section">
<add-section *ngIf="editMode" [page]="page" [ord]="ord" [modelType]="modelType"></add-section>
<page-menu [editMode]="editMode" [index]="index" [page]="page" [section]="section" [modelType]="modelType"></page-menu>
<page-menu [editMode]="editMode" [index]="index" [page]="page" [section]="section" [modelId]="modelId" [modelType]="modelType"></page-menu>
<div class="content" [ngSwitch]="type?.name">
<header-section [section]="section" *ngSwitchCase="'page-section-header'"></header-section>
<text-section [section]="section" *ngSwitchCase="'page-section-text'"></text-section>
@ -14,8 +14,8 @@
<contact-section [section]="section" *ngSwitchCase="'page-section-contacts'"></contact-section>
<feedback-section [section]="section" *ngSwitchCase="'page-section-feedback'"></feedback-section>
<maps-section [section]="section" *ngSwitchCase="'page-section-maps'"></maps-section>
<member-section [section]="section" *ngSwitchCase="'page-section-list-members'" [editMode]="editMode"></member-section>
<image-section [section]="section" *ngSwitchCase="'page-section-image'"></image-section>
<member-section [section]="section" *ngSwitchCase="'page-section-list-members'" [page]="page" [editMode]="editMode"></member-section>
<image-group-section [section]="section" *ngSwitchCase="'page-section-image-group'" [page]="page" [editMode]="editMode"></image-group-section>
<document-section [section]="section" *ngSwitchCase="'page-section-document'"></document-section>
<p *ngSwitchDefault>section {{type?.name}} is undefined</p>
</div>

View File

@ -9,7 +9,7 @@ export class PageSectionComponent {
@Input() page: any;
@Input() section: any;
@Input() index: number;
@Input() editMode = false;
@Input() editMode: boolean;
@Input() modelType: string;
constructor() {
@ -26,4 +26,8 @@ export class PageSectionComponent {
get ord() {
return this.section?.pivot?.ord;
}
get modelId() {
return this.page.id;
}
}

View File

@ -7,18 +7,17 @@ import {Component, Input} from '@angular/core';
})
export class PageSectionsComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
@Input() modelType: string = 'page';
constructor() {
}
ngOnInit() {
}
get sections() {
return this.page?.sections?.data;
}
ngOnInit() {
}
}

View File

@ -9,13 +9,19 @@ import {FormsService, ListsService, ObjectsService} from "@app/_services";
export class PageMenuComponent {
@Input() page: any;
@Input() section: any;
@Input() editMode = false;
@Input() editMode: boolean;
@Input() index: number;
@Input() modelId: string;
@Input() modelType: string;
constructor(private formsService: FormsService, private objectsService: ObjectsService, private listsService: ListsService) {
}
ngOnInit() {
//console.log(this.section)
}
get ord() {
return this.section?.pivot?.ord;
}
@ -38,7 +44,7 @@ export class PageMenuComponent {
}
move(ord) {
this.objectsService.move(this.section.id, {modelType: this.modelType, modelId: this.page.id, ord: ord}).subscribe(res => {
this.objectsService.move(this.section.id, {modelType: this.modelType, modelId: this.modelId, ord: ord}).subscribe(res => {
this.listsService.refresh();
});
}

View File

@ -21,9 +21,11 @@ import {FeedbackSectionComponent} from "@app/_modules/pages/sections/types/basic
import {ContactSectionComponent} from "@app/_modules/pages/sections/types/basic/contact/contact-section.component";
import {MapsSectionComponent} from "@app/_modules/pages/sections/types/basic/maps/maps-section.component";
import {MemberSectionComponent} from "@app/_modules/pages/sections/types/basic/member/member-section.component";
import {ImageSectionComponent} from "@app/_modules/pages/sections/types/basic/image/image-section.component";
import {DocumentSectionComponent} from "@app/_modules/pages/sections/types/basic/document/document-section.component";
import {PageMenuComponent} from "@app/_modules/pages/sections/menu/page-menu.component";
import {ImageGroupSectionComponent} from "@app/_modules/pages/sections/types/basic/image-group/image-group-section.component";
import {MemberSectionItemComponent} from "@app/_modules/pages/sections/types/basic/member/item/member-section-item.component";
import {MemberSectionListComponent} from "@app/_modules/pages/sections/types/basic/member/list/member-section-list.component";
@NgModule({
imports: [
@ -51,8 +53,10 @@ import {PageMenuComponent} from "@app/_modules/pages/sections/menu/page-menu.com
ContactSectionComponent,
MapsSectionComponent,
MemberSectionComponent,
ImageSectionComponent,
ImageGroupSectionComponent,
DocumentSectionComponent,
MemberSectionItemComponent,
MemberSectionListComponent,
],
exports: [
PageSectionsComponent,

View File

@ -0,0 +1,16 @@
<div class="member">
<div class="add">
<div class="title" [innerHTML]="title"></div>
<div *ngIf="editMode" class="toggle" (click)="add()"></div>
</div>
<div class="list">
<div class="item" *ngFor="let member of members">
<page-menu [editMode]="editMode" [section]="member" [modelId]="modelId" [modelType]="modelType"></page-menu>
<ng-template ngFor let-group [ngForOf]="member.groups.data">
<div class="image">
<a [href]="getLink(group)" target="_blank"><img [src]="getImg(group)" /></a>
</div>
</ng-template>
</div>
</div>
</div>

View File

@ -0,0 +1,55 @@
.member {
display: flex;
flex-direction: column;
width: 100%;
max-width: 900px;
.add {
padding: 16px 12px;
display: flex;
justify-content: space-between;
width: 100%;
border-top: 1px solid #C0C0C0;
border-bottom: 1px solid #C0C0C0;
.title {
color: #6C6C6C;
font-size: 20px;
font-style: normal;
font-weight: 400;
line-height: 24px;
}
.toggle {
width: 24px;
height: 24px;
cursor: pointer;
background: url('~src/assets/images/icons/add_cirle_24dp.svg') center no-repeat;
}
}
.list {
margin: 32px 0;
display: grid;
gap: 32px 40px;
width: 100%;
grid-template-columns: repeat(3, 1fr);
.item {
object-fit: cover;
.menu {
}
.image {
img {
width: calc(100%);
border-radius: 12px;
}
}
.name {
}
.description {
}
.more {
}
}
}
}

View File

@ -0,0 +1,55 @@
import {Component, Input} from '@angular/core';
import {FormsService} from "@app/_services";
@Component({
selector: 'image-group-section',
templateUrl: 'image-group-section.component.html',
styleUrls: ['image-group-section.component.scss']
})
export class ImageGroupSectionComponent {
@Input() section: any;
@Input() editMode: boolean;
@Input() page: any;
constructor(private formsService: FormsService) {
}
ngOnInit() {
console.log(this.section);
}
get title() {
return this.section?.groups?.data[0]?.fields?.data[0]?.value?.data[0];
}
get members() {
return this.section?.objectables?.data;
}
get ord() {
return this.members.length + 1;
}
get modelId() {
return this.section.id;
}
get modelType() {
return 'object';
}
add() {
let attach = {modelType: 'object', group: 'sections', modelId: this.section.id, ord: this.ord};
this.formsService.createObject('page-section-list-image', {extraProps: {attach: attach}});
}
getLink(group: any) {
return group?.fields?.data[1]?.value?.data[0];
}
getImg(group: any) {
return group?.fields?.data[0]?.value?.data[0]?.links?.full;
}
}

View File

@ -1,18 +0,0 @@
import {Component, Input} from '@angular/core';
@Component({
selector: 'image-section',
templateUrl: 'image-section.component.html',
styleUrls: ['image-section.component.scss']
})
export class ImageSectionComponent {
@Input() section: any;
constructor(
) {
}
ngOnInit() {
console.log(this.section);
}
}

View File

@ -0,0 +1,10 @@
<div class="member">
<pre>{{item | json}}</pre>
<h1 [innerHTML]="name"></h1>
<img [src]="photo" />
<p [innerHTML]="position"></p>
<p><a [href]="document">Документ</a> </p>
<p><a href="mailto:{{email}}">{{email}}</a></p>
<p><a href="tel:{{phone}}">{{phone}}</a></p>
<p [innerHTML]="description"></p>
</div>

View File

@ -0,0 +1,59 @@
import {Component, Input} from '@angular/core';
import {FormsService, ObjectsService} from "@app/_services";
import {Router} from "@angular/router";
@Component({
selector: 'member-section-item',
templateUrl: 'member-section-item.component.html',
styleUrls: ['member-section-item.component.scss']
})
export class MemberSectionItemComponent {
@Input() id: any;
constructor(
private formsService: FormsService,
private router: Router,
private objectsService: ObjectsService,
) {
}
public item: any;
ngOnInit() {
this.fetch();
}
fetch() {
this.objectsService.fetchObject(this.id, {include: 'groups.fields.value'}).subscribe(res => {
this.item = res.data;
})
}
get name() {
return 'Иванов Иван Иванович';
}
get photo() {
return '/assets/images/_remove/photo1.png';
}
get position() {
return 'Директор по развитию'
}
get document() {
return '/assets/images/_remove/photo1.png'
}
get phone() {
return '+7(999)999-99-99'
}
get email() {
return 'ivan@ivanov.ru'
}
get description () {
return 'Описание описание описание описание описание описание описание описание описание описание описание '
}
}

View File

@ -0,0 +1,21 @@
<div class="members">
<div class="add">
<div class="title" [innerHTML]="title"></div>
<div *ngIf="editMode" class="toggle" (click)="add()"></div>
</div>
<div class="list">
<div class="item" *ngFor="let member of members">
<page-menu [editMode]="editMode" [section]="member" [modelId]="modelId" [modelType]="modelType"></page-menu>
<ng-template ngFor let-group [ngForOf]="member.groups.data">
<ng-template ngFor let-field [ngForOf]="group.fields.data">
<ng-container [ngSwitch]="field?.name">
<div *ngSwitchCase="'member-image'" class="image"><img [src]="field?.value?.data[0]?.links?.full" /></div>
<div *ngSwitchCase="'member-name-required'" class="name" [innerHTML]="field?.value?.data[0]"></div>
<div *ngSwitchCase="'member-position-required'" class="position" [innerHTML]="field?.value?.data[0]"></div>
</ng-container>
</ng-template>
<div class="more"><a [href]="getLink(member.id)">Подробнее</a></div>
</ng-template>
</div>
</div>
</div>

View File

@ -0,0 +1,55 @@
.members {
display: flex;
flex-direction: column;
width: 100%;
max-width: 900px;
.add {
padding: 16px 12px;
display: flex;
justify-content: space-between;
width: 100%;
border-top: 1px solid #C0C0C0;
border-bottom: 1px solid #C0C0C0;
.title {
color: #6C6C6C;
font-size: 20px;
font-style: normal;
font-weight: 400;
line-height: 24px;
}
.toggle {
width: 24px;
height: 24px;
cursor: pointer;
background: url('~src/assets/images/icons/add_cirle_24dp.svg') center no-repeat;
}
}
.list {
margin: 32px 0;
display: grid;
gap: 32px 40px;
width: 100%;
grid-template-columns: repeat(3, 1fr);
.item {
object-fit: cover;
.menu {
}
.image {
img {
width: calc(100%);
border-radius: 12px;
}
}
.name {
}
.description {
}
.more {
}
}
}
}

View File

@ -0,0 +1,54 @@
import {Component, Input} from '@angular/core';
import {FormsService} from "@app/_services";
import {Router} from "@angular/router";
@Component({
selector: 'member-section-list',
templateUrl: 'member-section-list.component.html',
styleUrls: ['member-section-list.component.scss']
})
export class MemberSectionListComponent {
@Input() section: any;
@Input() editMode: boolean;
@Input() page: any;
constructor(
private formsService: FormsService,
private router: Router,
) {
}
ngOnInit() {
}
get title() {
return this.section?.groups?.data[0]?.fields?.data[0]?.value?.data[0];
}
get members() {
return this.section?.objectables?.data;
}
get ord() {
return this.members.length + 1;
}
get modelId() {
return this.section.id;
}
get modelType() {
return 'object';
}
add() {
let attach = {modelType: 'object', group: 'sections', modelId: this.section.id, ord: this.ord};
this.formsService.createObject('page-section-list-member', {extraProps: {attach: attach}});
}
getLink(id: any) {
return this.router.url + '?id=' + id;
}
}

View File

@ -1,15 +1,2 @@
<div class="member">
<div class="add">
<div class="title" [innerHTML]="title"></div>
<div *ngIf="editMode" class="toggle" (click)="add()"></div>
</div>
<div class="list">
<div class="item">
<page-menu [editMode]="editMode" [section]="section"></page-menu>
<div class="photo"><img src="assets/images/_remove/photo1.png" /></div>
<div class="name">Давид Мерабович Гоготишвили</div>
<div class="description">Генеральный директор ЧУ СЦ «ВНИИГАЗ-Сертификат»</div>
<div class="more"><a [href]="getLink('gogotishviki')">Подробнее</a></div>
</div>
</div>
</div>
<member-section-item *ngIf="id" [id]="id"></member-section-item>
<member-section-list *ngIf="!id" [editMode]="editMode" [page]="page" [section]="section"></member-section-list>

View File

@ -1,55 +0,0 @@
.member {
display: flex;
flex-direction: column;
width: 100%;
max-width: 900px;
.add {
padding: 16px 12px;
display: flex;
justify-content: space-between;
width: 100%;
border-top: 1px solid #C0C0C0;
border-bottom: 1px solid #C0C0C0;
.title {
color: #6C6C6C;
font-size: 20px;
font-style: normal;
font-weight: 400;
line-height: 24px;
}
.toggle {
width: 24px;
height: 24px;
cursor: pointer;
background: url('~src/assets/images/icons/add_cirle_24dp.svg') center no-repeat;
}
}
.list {
margin: 32px 0;
display: grid;
gap: 32px 40px;
width: 100%;
grid-template-columns: repeat(3, 1fr);
.item {
object-fit: cover;
.menu {
}
.photo {
img {
width: calc(100%);
border-radius: 12px;
}
}
.name {
}
.description {
}
.more {
}
}
}
}

View File

@ -1,5 +1,6 @@
import {Component, Input} from '@angular/core';
import {FormsService} from "@app/_services";
import {FormsService, ObjectsService} from "@app/_services";
import {ActivatedRoute, Router} from "@angular/router";
@Component({
selector: 'member-section',
@ -8,24 +9,26 @@ import {FormsService} from "@app/_services";
})
export class MemberSectionComponent {
@Input() section: any;
@Input() editMode = false;
@Input() editMode: boolean;
@Input() page: any;
constructor(private formsService: FormsService,) {
constructor(
private formsService: FormsService,
private router: Router,
private objectsService: ObjectsService,
) {
}
public id: string = '';
public item: any;
ngOnInit() {
console.log();
}
get title() {
return this.section?.groups?.data[0]?.fields?.data[0]?.value?.data[0];
}
add() {
this.formsService.createObject('page-section-list-member');
}
getLink(slug: string) {
return '' + slug;
let links = this.router.url.split('?');
if (links.length > 0) {
this.id = links[1]?.split('=')[1];
this.objectsService.fetchObject(this.id, {include: 'groups.fields.value'}).subscribe(res => {
this.item = res.data;
})
}
}
}

View File

@ -10,7 +10,7 @@ export class PageSidebarComponent {
@Input() page: any;
@Input() sidebar: any;
@Input() index: number;
@Input() editMode = false;
@Input() editMode: boolean;
constructor(private objectsService: ObjectsService, private formsService: FormsService, private listsService: ListsService) {
}

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PageSidebarsComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor() {
}

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PublicationsListItemComponent {
@Input() item: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor(
) {

View File

@ -9,7 +9,7 @@ import {PublicationsService} from "@app/_services/publications.service";
})
export class PublicationsListItemMenuComponent {
@Input() data: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor(
private formsService: FormsService,

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PublicationsListItemNewsComponent {
@Input() item: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor() {
}

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PublicationsListItemPhotosComponent {
@Input() item: any;
@Input() editMode = false;
@Input() editMode: boolean;
public parsedPhotos: any[] = [];
public activePhoto: string = '';

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PublicationsListItemPortfolioComponent {
@Input() item: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor() {
}

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PublicationsListItemSmiComponent {
@Input() item: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor() {
}

View File

@ -8,7 +8,7 @@ import {DomSanitizer} from "@angular/platform-browser";
})
export class PublicationsListItemVideoComponent {
@Input() item: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor(
private sanitized: DomSanitizer

View File

@ -10,7 +10,7 @@ import {PublicationsService} from "@app/_services/publications.service";
})
export class PublicationsListComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
controlsSubscription?: Subscription;
resultsSubscription?: Subscription;

View File

@ -7,7 +7,7 @@ import {Component, Input} from '@angular/core';
})
export class PublicationsPublicationComponent {
@Input() page: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor(
) {

View File

@ -11,7 +11,7 @@ export class RegistryCategoryComponent {
@Input() registry: any;
@Input() parent: any;
@Input() category: any;
@Input() editMode = false;
@Input() editMode: boolean;
public isExpanded = false;
constructor(private categoriesService: RegistryCategoriesService, private formsService: FormsService, private listsService: ListsService) {

View File

@ -12,7 +12,7 @@ import {SortableOptions} from "sortablejs";
export class RegistryCategoriesComponent {
@Input() registry: any;
@Input() parent: any;
@Input() editMode = false;
@Input() editMode: boolean;
public categories = <any>[];
public options: SortableOptions = {

View File

@ -12,7 +12,7 @@ export class RegistryEntryComponent {
@Input() registry: any;
@Input() category: any;
@Input() entry: any;
@Input() editMode = false;
@Input() editMode: boolean;
public isExpanded = false;

View File

@ -12,7 +12,7 @@ import {SortableOptions} from "sortablejs";
export class RegistryEntriesComponent {
@Input() registry: any;
@Input() category: any;
@Input() editMode = false;
@Input() editMode: boolean;
public entries = <any>[];
public options: SortableOptions = {

View File

@ -10,7 +10,7 @@ import {RegistryEntriesService} from "@app/_services/registry-entries.service";
})
export class EntryOperationsComponent {
@Input() entry: any;
@Input() editMode = false;
@Input() editMode: boolean;
subscription: Subscription;

View File

@ -10,7 +10,7 @@ import {DatePipe} from "@angular/common";
export class EntryOperationComponent {
@Input() entry: any;
@Input() operation: any;
@Input() editMode = false;
@Input() editMode: boolean;
constructor(private formsService: FormsService, private listsService: ListsService,
private objectsService: ObjectsService, private datePipe: DatePipe) {

View File

@ -11,7 +11,7 @@ import {debounceTime} from "rxjs/operators";
})
export class RegistryComponent {
@Input() registry: any;
@Input() editMode = false;
@Input() editMode: boolean;
public filters: FormGroup;
public isFiltersApplied = false;

View File

@ -6,7 +6,7 @@ export const environment = {
production: false,
apiUrl: 'http://api.vniigazv2.lc',
clientId: 2,
clientSecret: 'ibcsrXeGLmzmilvgKw53otrIB8RdrhXsheW3aaWd',
clientSecret: 'tTuEbUSla2RfgM5ailI0TvHmekaR6YMTDr4aswhW',
};
/*