diff --git a/frontend/src/components/AuthorOverview.vue b/frontend/src/components/AuthorOverview.vue index b208186..d5c9e92 100644 --- a/frontend/src/components/AuthorOverview.vue +++ b/frontend/src/components/AuthorOverview.vue @@ -14,16 +14,7 @@ -
-
-
- {{ author.Forename }} -
-
-
- {{ author.Lastname }} -
-
+ @@ -38,7 +29,8 @@ return { user: auth.user, author: {}, - authorID: this.$route.params.id + authorID: this.$route.params.id, + authorList: [] } }, created () { @@ -55,6 +47,19 @@ HTTP.get(`authors/` + this.authorID) .then(response => { this.author = response.data + + // Make a list + this.authorList = [ + { + header: this.translate('authors').forename, + content: this.author.Forename + }, + { + header: this.translate('authors').lastname, + content: this.author.Lastname + } + ] + this.loading = false }) .catch(e => { diff --git a/frontend/src/components/BookOverview.vue b/frontend/src/components/BookOverview.vue index a63ad38..ff6c82f 100644 --- a/frontend/src/components/BookOverview.vue +++ b/frontend/src/components/BookOverview.vue @@ -14,39 +14,7 @@ -
-
-
- {{ book.Isbn }} -
-
-
- {{ book.Year }} -
-
-
- {{ book.Price }} -
-
-
- {{ book.Status }} -
-
-
- - {{ book.PublisherFull.Name }} - -
-
-
- -
-
+ @@ -63,7 +31,9 @@ user: auth.user, book: {}, allStatus: [], - bookID: this.$route.params.id + bookID: this.$route.params.id, + bookList: {}, + AuthorList: [] } }, created () { @@ -96,18 +66,57 @@ .then(response => { this.book = response.data - // Get all authors and concat them into one singe string + // Get all authors and build an array with them let authors = this.book.Authors for (const au in authors) { - this.book.Author += authors[au].Forename + ' ' + authors[au].Lastname - if (authors.length > au + 1) { - this.book.Author += ', ' - } + this.AuthorList.push({ + content: authors[au].Forename + ' ' + authors[au].Lastname, + link: { + name: 'author-show', + params: { + id: authors[au].ID + } + } + }) } // Make Status a name, not an id this.book.Status = this.getStatusByID(this.book.Status) this.loading = false + + // Build the list object + this.bookList = [ + { + header: this.translate('books').gridColumns.isbn, + content: this.book.Isbn + }, + { + header: this.translate('books').gridColumns.year, + content: this.book.Year + }, + { + header: this.translate('books').gridColumns.price, + content: this.book.Price + }, + { + header: this.translate('books').gridColumns.status, + content: this.book.Status + }, + { + header: this.translate('books').gridColumns.publisher, + content: this.book.PublisherFull.Name, + link: { + name: 'publisher-show', + params: { + id: this.book.PublisherFull.ID + } + } + }, + { + header: this.translate('books').gridColumns.authors, + content: this.AuthorList + } + ] }) .catch(e => { this.loading = false diff --git a/frontend/src/components/List.vue b/frontend/src/components/List.vue new file mode 100644 index 0000000..a7f8a49 --- /dev/null +++ b/frontend/src/components/List.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/frontend/src/components/PublisherOverview.vue b/frontend/src/components/PublisherOverview.vue index 0c39088..f6a9de3 100644 --- a/frontend/src/components/PublisherOverview.vue +++ b/frontend/src/components/PublisherOverview.vue @@ -13,12 +13,7 @@ -
-
-
- {{ publisher.Name }} -
-
+ @@ -33,7 +28,8 @@ return { user: auth.user, publisher: {}, - publisherID: this.$route.params.id + publisherID: this.$route.params.id, + publisherList: [] } }, created () { @@ -50,6 +46,15 @@ HTTP.get(`publishers/` + this.publisherID) .then(response => { this.publisher = response.data + + // Make a list + this.publisherList = [ + { + header: this.translate('general').name, + content: this.publisher.Name + } + ] + this.loading = false }) .catch(e => { diff --git a/frontend/src/main.js b/frontend/src/main.js index 9915412..643dc3b 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -31,6 +31,9 @@ import language from './lang/lang' // Notifications import Notifications from 'vue-notification' +// List Component +import List from './components/List' + // Notifications Vue.use(Notifications) @@ -49,6 +52,9 @@ Vue.component('grid', Grid) // Register Grid component Vue.component('modal', Modal) +// List Component Setup +Vue.component('list', List) + // Paginate setup Vue.use(VuePaginate)