Boris Voropaev 2023-11-15 16:30:03 +03:00
commit 0ebc60cee1
20 changed files with 225 additions and 9 deletions

View File

@ -1,7 +1,7 @@
.footer {
width: 100%;
padding: 40px 100px;
padding: 40px 100px;
margin-top: 48px;
background-color: var(--prime-act);
color: white;
display: flex;
@ -16,7 +16,7 @@
}
display: flex;
flex-wrap: wrap;
grid-gap: 20px;
grid-gap: 20px;
&>div{
padding-bottom: 40px;
}

View File

@ -67,7 +67,7 @@ export class PageComponent {
'children',
'sections.type',
'sections.groups.fields.value',
'sections.objectables.groups.fields.value',
'sections.objects.groups.fields.value',
'sidebars.groups.fields.value',
'sidebars.type',
'permissions',

View File

@ -14,9 +14,10 @@
<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'" [page]="page" [editMode]="editMode"></member-section>
<cards-section [section]="section" *ngSwitchCase="'page-section-cards'"></cards-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>
<document-section [section]="section" *ngSwitchCase="'page-section-document'"></document-section-->
<p *ngSwitchDefault>section {{type?.name}} is undefined</p>
</div>
</div>

View File

@ -27,7 +27,7 @@ import {PageMenuComponent} from "@app/_modules/pages/sections/menu/page-menu.com
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";
import {CardsSectionModule} from "@app/_modules/pages/sections/types/basic/cards/cards-section.module";
@NgModule({
imports: [
@ -36,7 +36,8 @@ import {MemberSectionListComponent} from "@app/_modules/pages/sections/types/bas
ReactiveFormsModule,
ObjectsModule,
SwiperModule,
WidjetModule
WidjetModule,
CardsSectionModule
],
declarations: [
PageMenuComponent,
@ -59,7 +60,7 @@ import {MemberSectionListComponent} from "@app/_modules/pages/sections/types/bas
ImageGroupSectionComponent,
DocumentSectionComponent,
MemberSectionItemComponent,
MemberSectionListComponent,
MemberSectionListComponent
],
exports: [
PageSectionsComponent,

View File

@ -0,0 +1,4 @@
<div class="add">
<button type="button" class="btn" (click)="add()">Добавить карточку</button>
</div>
<cards-section-items [cards]="cards" [type]="type"></cards-section-items>

View File

@ -0,0 +1,3 @@
.add {
margin-bottom: 24px;
}

View File

@ -0,0 +1,32 @@
import {Component, Input} from '@angular/core';
import {FormsService, ObjectsService} from "@app/_services";
@Component({
selector: 'cards-section',
templateUrl: 'cards-section.component.html',
styleUrls: ['cards-section.component.scss']
})
export class CardsSectionComponent {
@Input() section: any;
constructor(private objectsService: ObjectsService, private formsService: FormsService) {
}
get type() {
return this.objectsService.getValue(this.section, 'cards-section-type');
}
get cards() {
return this.section?.objects?.data;
}
ngOnInit() {
}
add() {
let attach = {modelType: 'object', group: 'sections', modelId: this.section.id};
this.formsService.createObject(this.type.name, {extraProps: {attach: attach}});
}
}

View File

@ -0,0 +1,26 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {CardsSectionComponent} from "@app/_modules/pages/sections/types/basic/cards/cards-section.component";
import {CardsSectionItemsComponent} from "@app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component";
import {CardsSectionItemComponent} from "@app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component";
import {CardsItemPersonsComponent} from "@app/_modules/pages/sections/types/basic/cards/items/item/types/persons/cards-item-persons.component";
import {CardsItemPartnersComponent} from "@app/_modules/pages/sections/types/basic/cards/items/item/types/partners/cards-item-partners.component";
@NgModule({
imports: [
CommonModule
],
declarations: [
CardsSectionComponent,
CardsSectionItemsComponent,
CardsSectionItemComponent,
CardsItemPersonsComponent,
CardsItemPartnersComponent
],
exports: [
CardsSectionComponent
]
})
export class CardsSectionModule {
}

View File

@ -0,0 +1,3 @@
<div class="items {{type?.name}}">
<cards-section-item [card]="card" [type]="type" *ngFor="let card of cards"></cards-section-item>
</div>

View File

@ -0,0 +1,11 @@
.items {
display: flex;
flex-direction: row;
align-items: stretch;
gap: 24px;
flex-wrap: wrap;
cards-section-item {
width: 25%;
}
}

View File

@ -0,0 +1,20 @@
import {Component, Input} from '@angular/core';
import {ObjectsService} from "@app/_services";
@Component({
selector: 'cards-section-items',
templateUrl: 'cards-section-items.component.html',
styleUrls: ['cards-section-items.component.scss']
})
export class CardsSectionItemsComponent {
@Input() cards = <any>[];
@Input() type: any;
constructor() {
}
ngOnInit() {
}
}

View File

@ -0,0 +1,5 @@
<div class="card" [ngSwitch]="type?.name">
<cards-item-persons *ngSwitchCase="'cards-section-persons'" [card]="card"></cards-item-persons>
<cards-item-partners *ngSwitchCase="'cards-section-partners'" [card]="card"></cards-item-partners>
<p *ngSwitchDefault>{{type?.name}} is undefined</p>
</div>

View File

@ -0,0 +1,5 @@
.card {
height: 100%;
padding: 12px;
border: #dedede solid 1px;
}

View File

@ -0,0 +1,24 @@
import {Component, Input} from '@angular/core';
import {FormsService, ObjectsService} from "@app/_services";
@Component({
selector: 'cards-section-item',
templateUrl: 'cards-section-item.component.html',
styleUrls: ['cards-section-item.component.scss']
})
export class CardsSectionItemComponent {
@Input() card: any;
@Input() type: any;
constructor(private objectsService: ObjectsService, private formsService: FormsService) {
}
ngOnInit() {
}
edit() {
this.formsService.editObject(this.card.id);
}
}

View File

@ -0,0 +1,3 @@
<div class="image">
<a [href]="link" target="_blank"><img [src]="image?.links?.thumb" /></a>
</div>

View File

@ -0,0 +1,5 @@
.image {
img {
width: 100%;
}
}

View File

@ -0,0 +1,26 @@
import {Component, Input} from '@angular/core';
import {ObjectsService} from "@app/_services";
@Component({
selector: 'cards-item-partners',
templateUrl: 'cards-item-partners.component.html',
styleUrls: ['cards-item-partners.component.scss']
})
export class CardsItemPartnersComponent {
@Input() card: any;
constructor(private objectsService: ObjectsService) {
}
get image() {
return this.objectsService.getValue(this.card, 'image-required');
}
get link() {
return this.objectsService.getValue(this.card, 'link-required');
}
ngOnInit() {
}
}

View File

@ -0,0 +1,8 @@
<div class="image">
<img [src]="image?.links?.thumb" />
</div>
<div class="title">{{name}}</div>
<div class="subtitle">{{position}}</div>
<div class="phone">{{phone}}</div>
<div class="email">{{email}}</div>

View File

@ -0,0 +1,5 @@
.image {
img {
width: 100%;
}
}

View File

@ -0,0 +1,34 @@
import {Component, Input} from '@angular/core';
import {ObjectsService} from "@app/_services";
@Component({
selector: 'cards-item-persons',
templateUrl: 'cards-item-persons.component.html',
styleUrls: ['cards-item-persons.component.scss']
})
export class CardsItemPersonsComponent {
@Input() card: any;
constructor(private objectsService: ObjectsService) {
}
get image() {
return this.objectsService.getValue(this.card, 'image');
}
get name() {
return this.objectsService.getValue(this.card, 'person-name');
}
get position() {
return this.objectsService.getValue(this.card, 'person-position');
}
get phone() {
return this.objectsService.getValue(this.card, 'contact-phone');
}
get email() {
return this.objectsService.getValue(this.card, 'contact-email');
}
ngOnInit() {
}
}