diff --git a/src/app/_modules/pages/sections/item/page-section.component.html b/src/app/_modules/pages/sections/item/page-section.component.html index f1968c3..ab61d21 100644 --- a/src/app/_modules/pages/sections/item/page-section.component.html +++ b/src/app/_modules/pages/sections/item/page-section.component.html @@ -14,7 +14,7 @@ - + diff --git a/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.html b/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.html index 5522854..5290d1a 100644 --- a/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.html +++ b/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.html @@ -1,4 +1,4 @@ -
+
- + diff --git a/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.ts b/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.ts index 45dcdf9..65bb6c1 100644 --- a/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.ts +++ b/src/app/_modules/pages/sections/types/basic/cards/cards-section.component.ts @@ -8,6 +8,7 @@ import {FormsService, ObjectsService} from "@app/_services"; }) export class CardsSectionComponent { @Input() section: any; + @Input() editMode = false; constructor(private objectsService: ObjectsService, private formsService: FormsService) { } @@ -24,7 +25,7 @@ export class CardsSectionComponent { add() { - let attach = {modelType: 'object', group: 'sections', modelId: this.section.id}; + let attach = {modelType: 'object', modelId: this.section.id, group: 'default'}; this.formsService.createObject(this.type.name, {extraProps: {attach: attach}}); } diff --git a/src/app/_modules/pages/sections/types/basic/cards/cards-section.module.ts b/src/app/_modules/pages/sections/types/basic/cards/cards-section.module.ts index 9ec40eb..ad4604f 100644 --- a/src/app/_modules/pages/sections/types/basic/cards/cards-section.module.ts +++ b/src/app/_modules/pages/sections/types/basic/cards/cards-section.module.ts @@ -5,11 +5,13 @@ import {CardsSectionItemsComponent} from "@app/_modules/pages/sections/types/bas 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"; +import {SortablejsModule} from "ngx-sortablejs"; @NgModule({ imports: [ - CommonModule + CommonModule, + SortablejsModule ], declarations: [ CardsSectionComponent, diff --git a/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.html b/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.html index 87c8d2b..8fa372a 100644 --- a/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.html +++ b/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.html @@ -1,3 +1,6 @@ -
- +
+ +
+
+
diff --git a/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.ts b/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.ts index 41d4f43..be35a39 100644 --- a/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.ts +++ b/src/app/_modules/pages/sections/types/basic/cards/items/cards-section-items.component.ts @@ -1,5 +1,6 @@ import {Component, Input} from '@angular/core'; import {ObjectsService} from "@app/_services"; +import {SortableOptions} from "sortablejs"; @Component({ selector: 'cards-section-items', @@ -7,14 +8,31 @@ import {ObjectsService} from "@app/_services"; styleUrls: ['cards-section-items.component.scss'] }) export class CardsSectionItemsComponent { - @Input() cards = []; + @Input() section: any; @Input() type: any; + @Input() editMode = false; - constructor() { + public options: SortableOptions = { + onUpdate: (event: any) => { + this.move(event); + } + }; + + constructor(private objectsService: ObjectsService) { } + get cards() { + return this.section.objects?.data; + } ngOnInit() { } + + move(event: any) { + this.objectsService.move(event.item.id, {modelType: 'object', modelId: this.section.id, ord: event.newIndex}).subscribe(res => { + }); + } + + } diff --git a/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.html b/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.html index 626c66f..44abacf 100644 --- a/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.html +++ b/src/app/_modules/pages/sections/types/basic/cards/items/item/cards-section-item.component.html @@ -1,4 +1,8 @@
+

{{type?.name}} is undefined

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 53340b4..3cfd02f 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,5 @@ import {Component, Input} from '@angular/core'; -import {FormsService, ObjectsService} from "@app/_services"; +import {FormsService, ListsService, ObjectsService} from "@app/_services"; @Component({ selector: 'cards-section-item', @@ -9,8 +9,9 @@ import {FormsService, ObjectsService} from "@app/_services"; export class CardsSectionItemComponent { @Input() card: any; @Input() type: any; + @Input() editMode = false; - constructor(private objectsService: ObjectsService, private formsService: FormsService) { + constructor(private objectsService: ObjectsService, private formsService: FormsService, private listsService: ListsService) { } @@ -20,5 +21,12 @@ export class CardsSectionItemComponent { edit() { this.formsService.editObject(this.card.id); } + + delete() { + if (confirm('r u sure?')) this.objectsService.destroy(this.card.id).subscribe(res => { + this.listsService.refresh(); + }); + } + } diff --git a/src/app/_modules/pages/tree/pages-tree.component.ts b/src/app/_modules/pages/tree/pages-tree.component.ts index aa347e7..eb9a429 100644 --- a/src/app/_modules/pages/tree/pages-tree.component.ts +++ b/src/app/_modules/pages/tree/pages-tree.component.ts @@ -75,7 +75,7 @@ export class PagesTreeComponent { move(event: any) { - if(this.parent?.id){ + if(this.parent?.id) { this.pagesService.move(event.item.id, {parent: this.parent?.id, ord: event.newIndex}).subscribe(res => { this.listsService.changed.next(event); }); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index fda3ea8..3c540fb 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -6,7 +6,7 @@ export const environment = { production: false, apiUrl: 'http://api.nircms.lc', clientId: 2, - clientSecret: 'Hq1egniGo6Ozvz1QAcHrMqLhwuVnYXmV0SRKKg5l', + clientSecret: 'Q0p5wSWfodfhFdQ2xHpzFOBuQEJy090ho10Deh4O', project: null, defaultLocale: 'ru' };