show.blade.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!--
  2. Copyright (C) 2022 Echedey López Romero <elr@disroot.org>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. -->
  14. @extends('layouts.app')
  15. @section('content')
  16. <div class="container">
  17. <div class="row mb-3">
  18. <h1 class="col-12 mb-0 text-center">Book information</h1>
  19. </div>
  20. <div class="row">
  21. <div class="col-xl-5 col-lg-6 col-md-8 col-12 mx-auto">
  22. <div class="container">
  23. <div class="row mb-3">
  24. <span class="col-xl-4 col-12 my-xl-auto mb-2">ISBN</span>
  25. <span class="col-xl-8 col-12 mb-xl-0 mb-2">{{ $book->isbn }}</span>
  26. </div>
  27. <div class="row mb-3">
  28. <span class="col-xl-4 col-12 my-xl-auto mb-2">Title</span>
  29. <span class="col-xl-8 col-12 mb-xl-0 mb-2">{{ $book->title }}</span>
  30. </div>
  31. <div class="row mb-3">
  32. <span class="col-xl-4 col-12 my-xl-auto mb-2">Image</span>
  33. <img src="{{ asset($book->image) }}" class="col-xl-6 col-12 mb-xl-0 mb-2 img-thumbnail" alt="{{ $book->title }}"/>
  34. </div>
  35. <div class="row mb-3">
  36. <span class="col-xl-4 col-12 my-xl-auto mb-2">Authors</span>
  37. <span class="col-xl-8 col-12 mb-xl-0 mb-2">{{ $book->authors }}</span>
  38. </div>
  39. <div class="row mb-3">
  40. <span class="col-xl-4 col-12 my-xl-auto mb-2">Year</span>
  41. <span class="col-xl-8 col-12 mb-xl-0 mb-2">{{ $book->year ? $book->year : 'Undated' }}</span>
  42. </div>
  43. <div class="row mb-3">
  44. <span class="col-xl-4 col-12 my-xl-auto mb-2">Editorial</span>
  45. <span class="col-xl-8 col-12 mb-xl-0 mb-2">{{ $book->editorial ? $book->editorial : 'Self-published' }}</span>
  46. </div>
  47. @if($book->document)
  48. <div class="row mb-3">
  49. <span class="col-xl-4 col-12 my-xl-auto mb-2">Document</span>
  50. <span class="col-xl-8 col-12 mb-xl-0 mb-2">
  51. <a href="{{ $book->document }}" target="_blank">Download</a>
  52. </span>
  53. </div>
  54. @endif
  55. <div class="row mb-3">
  56. <span class="col-xl-4 col-12 my-xl-auto mb-2">Category</span>
  57. <span class="col-xl-8 col-12 mb-xl-0 mb-2">{{ $book->category_id ? $book->category->name : 'Unclassified' }}</span>
  58. </div>
  59. <div class="row">
  60. <span class="col-xl-4 col-12 my-xl-auto mb-2">Availability</span>
  61. @if(\App\Models\Book::where('id', $book->id)
  62. ->whereHas('loans', function ($query) {
  63. $query->whereNull('end');
  64. })->exists())
  65. <span class="col-xl-8 col-12 mb-xl-0 mb-2">Unavailable</span>
  66. @else
  67. <span class="col-xl-8 col-12 mb-xl-0 mb-2">Available</span>
  68. @endif
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. @endsection