|
@ -19,8 +19,12 @@ export class AdminComponent implements OnInit { |
|
|
public userName: string = '' |
|
|
public userName: string = '' |
|
|
public password: string = '' |
|
|
public password: string = '' |
|
|
public activeEditor: string = '' |
|
|
public activeEditor: string = '' |
|
|
public exhibitions: any = [] |
|
|
|
|
|
|
|
|
public sectionTitle: string = '' |
|
|
|
|
|
public activeModify: boolean = false |
|
|
|
|
|
public modifyId: number = null |
|
|
|
|
|
|
|
|
|
|
|
public exhibitions: any = [] |
|
|
|
|
|
public works: any = [] |
|
|
public selectedExhibitions: any = [] |
|
|
public selectedExhibitions: any = [] |
|
|
public selectedVideos: any = [] |
|
|
public selectedVideos: any = [] |
|
|
public selectedGallery: any = [] |
|
|
public selectedGallery: any = [] |
|
@ -34,7 +38,13 @@ export class AdminComponent implements OnInit { |
|
|
public videoType: string = '' |
|
|
public videoType: string = '' |
|
|
public videoURL: string = '' |
|
|
public videoURL: string = '' |
|
|
|
|
|
|
|
|
editorConfig: AngularEditorConfig = editorConfig |
|
|
|
|
|
|
|
|
public editorConfig: AngularEditorConfig = editorConfig |
|
|
|
|
|
public workSections: any = [ |
|
|
|
|
|
{title: 'Entertainment', section: 'entertainment'}, |
|
|
|
|
|
{title: 'Installations', section: 'installations'}, |
|
|
|
|
|
{title: 'Performances', section: 'performances'}, |
|
|
|
|
|
{title: 'Workshops', section: 'workshops'} |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
private authService: AuthService, |
|
|
private authService: AuthService, |
|
@ -54,6 +64,14 @@ export class AdminComponent implements OnInit { |
|
|
}).catch((e) => { |
|
|
}).catch((e) => { |
|
|
console.error('getPortfolio CATCH', e) |
|
|
console.error('getPortfolio CATCH', e) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.apisService.getPortfolio('portfolio').toPromise().then((response) => { |
|
|
|
|
|
this.works = response.items |
|
|
|
|
|
},(error) => { |
|
|
|
|
|
console.error('getPortfolio ERROR', error) |
|
|
|
|
|
}).catch((e) => { |
|
|
|
|
|
console.error('getPortfolio CATCH', e) |
|
|
|
|
|
}) |
|
|
},(error) => { |
|
|
},(error) => { |
|
|
console.error('Auth ERROR', error) |
|
|
console.error('Auth ERROR', error) |
|
|
}).catch((e) => { |
|
|
}).catch((e) => { |
|
@ -76,7 +94,20 @@ export class AdminComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
showEditor(section): void { |
|
|
showEditor(section): void { |
|
|
|
|
|
switch(section) { |
|
|
|
|
|
case 'works-add': |
|
|
|
|
|
this.sectionTitle = 'Add work' |
|
|
|
|
|
break; |
|
|
|
|
|
case 'works-modify': |
|
|
|
|
|
this.sectionTitle = 'Modify work' |
|
|
|
|
|
break; |
|
|
|
|
|
case 'works-delete': |
|
|
|
|
|
this.sectionTitle = 'Delete work' |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
this.activeModify = false |
|
|
this.activeEditor = section |
|
|
this.activeEditor = section |
|
|
|
|
|
this.resetFields() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
exhibitionAdd(id): void { |
|
|
exhibitionAdd(id): void { |
|
@ -147,6 +178,36 @@ export class AdminComponent implements OnInit { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
selectWork(id): void { |
|
|
|
|
|
|
|
|
|
|
|
this.activeModify = true |
|
|
|
|
|
this.modifyId = id |
|
|
|
|
|
this.apisService.getDetails('works', id).toPromise().then((response) => { |
|
|
|
|
|
const detail = response.item |
|
|
|
|
|
this.apisService.getPortfolio('exhibitions').toPromise().then((response) => { |
|
|
|
|
|
this.exhibitions = response.items |
|
|
|
|
|
this.title = detail.title |
|
|
|
|
|
this.content = detail.content |
|
|
|
|
|
this.type = detail.type |
|
|
|
|
|
this.tags = detail.tags |
|
|
|
|
|
this.selectedExhibitions = detail.exhibitions.length ? |
|
|
|
|
|
this.exhibitions.filter(item => detail.exhibitions.map(a => a.id).indexOf(item.id) > -1) : [] |
|
|
|
|
|
this.selectedGallery = detail.gallery ? JSON.parse(detail.gallery) : [] |
|
|
|
|
|
this.selectedVideos = detail.videos ? JSON.parse(detail.videos) : [] |
|
|
|
|
|
|
|
|
|
|
|
console.log(detail.exhibitions, this.selectedExhibitions) |
|
|
|
|
|
},(error) => { |
|
|
|
|
|
console.error(error) |
|
|
|
|
|
}).catch((e) => { |
|
|
|
|
|
console.error(e) |
|
|
|
|
|
}) |
|
|
|
|
|
},(error) => { |
|
|
|
|
|
console.error(error) |
|
|
|
|
|
}).catch((e) => { |
|
|
|
|
|
console.error(e) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
saveWork(): void { |
|
|
saveWork(): void { |
|
|
|
|
|
|
|
|
let error = false |
|
|
let error = false |
|
@ -167,9 +228,10 @@ export class AdminComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(error) { |
|
|
if(error) { |
|
|
console.log('ERORS:',errorMessages) |
|
|
|
|
|
|
|
|
console.log('ERRORS:',errorMessages) |
|
|
} else { |
|
|
} else { |
|
|
const body = { |
|
|
const body = { |
|
|
|
|
|
id: this.activeModify ? this.modifyId : null, |
|
|
token: window.sessionStorage.getItem('authToken'), |
|
|
token: window.sessionStorage.getItem('authToken'), |
|
|
title: this.title, |
|
|
title: this.title, |
|
|
content: this.content, |
|
|
content: this.content, |
|
@ -182,14 +244,9 @@ export class AdminComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.apisService.saveWork(body).toPromise().then((response) => { |
|
|
this.apisService.saveWork(body).toPromise().then((response) => { |
|
|
console.log(response) |
|
|
|
|
|
this.title = '' |
|
|
|
|
|
this.content = '' |
|
|
|
|
|
this.type = '' |
|
|
|
|
|
this.tags = '' |
|
|
|
|
|
this.selectedExhibitions = [] |
|
|
|
|
|
this.selectedGallery = [] |
|
|
|
|
|
this.selectedVideos = [] |
|
|
|
|
|
|
|
|
this.resetFields() |
|
|
|
|
|
|
|
|
|
|
|
this.works = response.items |
|
|
},(error) => { |
|
|
},(error) => { |
|
|
console.error(error) |
|
|
console.error(error) |
|
|
}).catch((e) => { |
|
|
}).catch((e) => { |
|
@ -197,4 +254,14 @@ export class AdminComponent implements OnInit { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
resetFields(): void { |
|
|
|
|
|
this.title = '' |
|
|
|
|
|
this.content = '' |
|
|
|
|
|
this.type = '' |
|
|
|
|
|
this.tags = '' |
|
|
|
|
|
this.selectedExhibitions = [] |
|
|
|
|
|
this.selectedGallery = [] |
|
|
|
|
|
this.selectedVideos = [] |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|