diff --git a/src/app/services/storage/storage.service.ts b/src/app/services/storage/storage.service.ts index fd83c04..a41d5b2 100644 --- a/src/app/services/storage/storage.service.ts +++ b/src/app/services/storage/storage.service.ts @@ -101,6 +101,15 @@ export class StorageService { return this.set('booksIssued', issueBook); } + public async removeBookIssued(issue: bookIssued): Promise { + let issueBook: bookIssued[] = await this.getBooksIssued(); + issueBook = issueBook.filter((book) => { + return !(issue.bookId === book.bookId && issue.userId === book.userId); + }); + console.log(issueBook); + return await this.set('booksIssued', issueBook); + } + public async getBookIssuedUsers(bookId: string): Promise { const issueBook: bookIssued[] = await this.getBooksIssued(); const book: Array = issueBook.filter( diff --git a/src/app/tabs/RentPage/rent.page.html b/src/app/tabs/RentPage/rent.page.html index 1a31d0a..d0b6a66 100644 --- a/src/app/tabs/RentPage/rent.page.html +++ b/src/app/tabs/RentPage/rent.page.html @@ -18,21 +18,27 @@ - - + + + + + + + {{ item.book.volumeInfo.title }} + Выдан: {{ item.user?.fio }} + - - - - {{item.book.volumeInfo.title}} - Выдан: {{item.user?.fio}} - - - - Книга выдана {{dateParse(item.issue.date)}}. До {{dateParse(item.issue.dateTo)}} - - - - + + Книга выдана {{ dateParse(item.issue.date) }}. До {{ dateParse(item.issue.dateTo) }} + + + + + + + + + + diff --git a/src/app/tabs/RentPage/rent.page.scss b/src/app/tabs/RentPage/rent.page.scss index bbf5fe5..560b3a5 100644 --- a/src/app/tabs/RentPage/rent.page.scss +++ b/src/app/tabs/RentPage/rent.page.scss @@ -4,3 +4,10 @@ margin-top: 2vh; display: block; } + +.rent-card{ + display: block; + margin-left: auto; + margin-right: auto; + width: 100%; +} diff --git a/src/app/tabs/RentPage/rent.page.ts b/src/app/tabs/RentPage/rent.page.ts index 940be37..44887de 100644 --- a/src/app/tabs/RentPage/rent.page.ts +++ b/src/app/tabs/RentPage/rent.page.ts @@ -51,6 +51,14 @@ export class RentPage implements OnInit { }); } + public removeIssue(issue: bookIssued) { + this.storage.init().then(() => { + this.storage.removeBookIssued(issue).then(() => { + this.refresh(); + }); + }); + } + public dateParse(date: string) { let _date = new Date(date); return _date.toLocaleDateString();