diff --git a/src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.html b/src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.html deleted file mode 100644 index 76219ee..0000000 --- a/src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.html +++ /dev/null @@ -1,20 +0,0 @@ - -
-
- - {{asset.name}} - - -
- -
- - - - -
- - -
-
-
diff --git a/src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.ts b/src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.ts deleted file mode 100644 index b28ffb4..0000000 --- a/src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component, EventEmitter, Input, Output } from '@angular/core'; -import {FormGroup, FormControl} from "@angular/forms"; - -@Component({ - selector: 'field-document-meta', - templateUrl: './field-document-meta.component.html', - styleUrls: ['./field-document-meta.component.scss'] -}) -export class FieldDocumentMetaComponent { - - @Input() asset: any; - @Output() delete = new EventEmitter; - - public formGroup: FormGroup; - public edit:any; - - - ngOnInit(){ - console.log(this.asset) - this.default() - } - - default(){ - this.formGroup = new FormGroup({ - name: new FormControl(this.asset.name), - description: new FormControl(this.asset.description), - }); - } - - setFile(asset){ - console.log(this.asset, this.formGroup.value) - this.edit = {off:true}; - } - - close(){ - this.edit = {off:true}; - } - - del(){ - this.delete.emit(this.asset) - } - -} diff --git a/src/app/_modules/form-fields/types/document/form-field-document.module.ts b/src/app/_modules/form-fields/types/document/form-field-document.module.ts index 4c8d007..b2cf679 100644 --- a/src/app/_modules/form-fields/types/document/form-field-document.module.ts +++ b/src/app/_modules/form-fields/types/document/form-field-document.module.ts @@ -6,7 +6,7 @@ import {FieldDocumentReadonlyComponent} from "@app/_modules/form-fields/types/do import {FieldDocumentSingleComponent} from "@app/_modules/form-fields/types/document/single/field-document-single.component"; import {FieldDocumentMultipleComponent} from "@app/_modules/form-fields/types/document/multiple/field-document-multiple.component"; import { WidjetModule } from '@app/_modules/widjet/widjet.module'; -import { FieldDocumentMetaComponent } from './field-document-meta/field-document-meta.component'; +import {FieldDocumentValueComponent} from "@app/_modules/form-fields/types/document/value/field-document-value.component"; @NgModule({ imports: [ @@ -19,7 +19,8 @@ import { FieldDocumentMetaComponent } from './field-document-meta/field-document FieldDocumentReadonlyComponent, FieldDocumentSingleComponent, FieldDocumentMultipleComponent, - FieldDocumentMetaComponent + FieldDocumentValueComponent, + FieldDocumentValueComponent ], exports: [ FormFieldDocumentComponent diff --git a/src/app/_modules/form-fields/types/document/multiple/field-document-multiple.component.html b/src/app/_modules/form-fields/types/document/multiple/field-document-multiple.component.html index 100944a..4d2b5ab 100644 --- a/src/app/_modules/form-fields/types/document/multiple/field-document-multiple.component.html +++ b/src/app/_modules/form-fields/types/document/multiple/field-document-multiple.component.html @@ -1,6 +1,6 @@
-

Перетащите сюда или выберите файлы +

Перетащите сюда или выберите файлы в формате PDF, XLS, DOC, JPG, PPTX

@@ -10,8 +10,5 @@
-
- -
- +
diff --git a/src/app/_modules/form-fields/types/document/single/field-document-single.component.html b/src/app/_modules/form-fields/types/document/single/field-document-single.component.html index 093f645..a3f30c1 100644 --- a/src/app/_modules/form-fields/types/document/single/field-document-single.component.html +++ b/src/app/_modules/form-fields/types/document/single/field-document-single.component.html @@ -1,7 +1,7 @@
-

Перетащите сюда или - выберите файл +

Перетащите сюда или + выберите файл в формате PDF, XLS, DOC, JPG, PPTX

@@ -10,9 +10,5 @@
-
- - {{asset.name}} - -
-
\ No newline at end of file + + 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 new file mode 100644 index 0000000..ae5d25f --- /dev/null +++ b/src/app/_modules/form-fields/types/document/value/field-document-value.component.html @@ -0,0 +1,22 @@ +
+
+ +
+ +
{{asset.description}}
+
+ + +
+ +
+ + + + +
+ + +
+
+
diff --git a/src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.scss b/src/app/_modules/form-fields/types/document/value/field-document-value.component.scss similarity index 100% rename from src/app/_modules/form-fields/types/document/field-document-meta/field-document-meta.component.scss rename to src/app/_modules/form-fields/types/document/value/field-document-value.component.scss diff --git a/src/app/_modules/form-fields/types/document/value/field-document-value.component.ts b/src/app/_modules/form-fields/types/document/value/field-document-value.component.ts new file mode 100644 index 0000000..63c5682 --- /dev/null +++ b/src/app/_modules/form-fields/types/document/value/field-document-value.component.ts @@ -0,0 +1,47 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import {FormGroup, FormControl} from "@angular/forms"; +import {AssetsService} from "@app/_services"; + +@Component({ + selector: 'field-document-value', + templateUrl: 'field-document-value.component.html', + styleUrls: ['field-document-value.component.scss'] +}) +export class FieldDocumentValueComponent { + @Input() asset: any; + @Output() delete = new EventEmitter; + public formGroup: FormGroup; + public edit:any; + + + constructor(private assetsService: AssetsService) { + } + + + ngOnInit(){ + this.default(); + } + + default() { + this.formGroup = new FormGroup({ + name: new FormControl(this.asset.name), + description: new FormControl(this.asset.description) + }); + } + + update() { + this.assetsService.update(this.asset.id, this.formGroup.value).subscribe(res => { + this.asset = res.data; + this.edit = {off:true}; + }); + } + + close(){ + this.edit = {off:true}; + } + + del(){ + this.delete.emit(this.asset) + } + +} diff --git a/src/app/_modules/pages/page/page.component.ts b/src/app/_modules/pages/page/page.component.ts index 4b629ef..95eec07 100644 --- a/src/app/_modules/pages/page/page.component.ts +++ b/src/app/_modules/pages/page/page.component.ts @@ -5,7 +5,6 @@ import {PagesService} from "@app/_services/pages.service"; import {ListsService} from "@app/_services"; import {Title} from "@angular/platform-browser"; - @Component({ templateUrl: 'page.component.html', styleUrls: ['page.component.scss'] diff --git a/src/app/_modules/widjet/swiper-gallery/swiper-gallery.component.ts b/src/app/_modules/widjet/swiper-gallery/swiper-gallery.component.ts index 61fd916..385bfe7 100644 --- a/src/app/_modules/widjet/swiper-gallery/swiper-gallery.component.ts +++ b/src/app/_modules/widjet/swiper-gallery/swiper-gallery.component.ts @@ -13,7 +13,7 @@ export class SwiperGalleryComponent { @Input() start = 0; @Input() closing:boolean; - @Output() event = new EventEmitter() + @Output() event = new EventEmitter() @ViewChild('swiper', { static: false }) swiper?: SwiperComponent; @ViewChild('thumb', { static: false }) thumb?: SwiperComponent; @@ -22,7 +22,7 @@ export class SwiperGalleryComponent { handleKeyDown(event: KeyboardEvent) { if (event.key === 'Escape') this.event.emit('close') } - + public active:number; public single: boolean; @@ -44,8 +44,8 @@ export class SwiperGalleryComponent { freeMode: true, watchSlidesProgress: true, } - - + + ngOnInit(){ this.active = this.start; this.single = this.items.length === 1; diff --git a/src/app/_services/assets.service.ts b/src/app/_services/assets.service.ts index fa00d99..257650a 100644 --- a/src/app/_services/assets.service.ts +++ b/src/app/_services/assets.service.ts @@ -8,6 +8,10 @@ export class AssetsService { constructor(private http: HttpClient) { } + update(id: string, data: any): Observable { + return this.http.put(`${environment.apiUrl}/api/assets/${id}`, data); + } + upload(file: any, params?: any): Observable { let formData = new FormData(); formData.append('file', file); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 3372d84..7fb86bf 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: 'SoQdwJzNSVfFd9Bqa4wAEYxCTxzdvKd5PJZIlGqo', + clientSecret: 'gVk3jjKq6rWWM52025xgXlw2XGW1UACowyMIyhRR', project: null, defaultLocale: 'ru' };