create.blade.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 creation</h1>
  19. </div>
  20. @if ($errors->any())
  21. <div class = "row mb-3">
  22. <div class="col-xl-6 col-lg-8 col-md-10 col-12 mx-auto alert alert-danger">
  23. <div class="container">
  24. <div class="row mb-2">
  25. <span class="col-12 text-center"><strong>Whoops!</strong> There were some problems with your input.</span>
  26. </div>
  27. <div class="row">
  28. <ul class="col-12 mb-0">
  29. @foreach ($errors->all() as $error)
  30. <li>{{ $error }}</li>
  31. @endforeach
  32. </ul>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. @endif
  38. <div class="row">
  39. <form class="col-xl-6 col-lg-8 col-md-10 col-12 mx-auto" action="{{ route('books.store') }}" method="POST" enctype="multipart/form-data">
  40. @csrf
  41. <div class="container">
  42. <div class="row mb-3">
  43. <div class="col-12">
  44. <label class="form-label" for="isbn">ISBN</label>
  45. <input class="form-control" type="text" id="isbn" name="isbn" value="{{ old('isbn') }}" required=""/>
  46. </div>
  47. </div>
  48. <div class="row mb-3">
  49. <div class="col-12">
  50. <label class="form-label" for="title">Title</label>
  51. <input class="form-control" type="text" id="title" name="title" value="{{ old('title') }}" required=""/>
  52. </div>
  53. </div>
  54. <div class="row mb-3">
  55. <div class="col-12">
  56. <label class="form-label" for="authors">Authors</label>
  57. <textarea class="form-control" rows="3" id="authors" name="authors" required="">{{ old('authors') }}</textarea>
  58. </div>
  59. </div>
  60. <div class="row mb-3">
  61. <div class="col-12">
  62. <label class="form-label" for="year">Year</label>
  63. <input class="form-control" type="number" id="year" name="year" step="1" min="0" value="{{ old('year') }}"/>
  64. </div>
  65. </div>
  66. <div class="row mb-3">
  67. <div class="col-12">
  68. <label class="form-label" for="editorial">Editorial</label>
  69. <input class="form-control" type="text" id="editorial" name="editorial" value="{{ old('editorial') }}"/>
  70. </div>
  71. </div>
  72. <div class="row mb-3">
  73. <div class="col-12">
  74. <label class="form-label" for="image">Image</label>
  75. <input class="form-control" type="file" id="image" name="image"/>
  76. </div>
  77. </div>
  78. <div class="row mb-3">
  79. <div class="col-12 px-0">
  80. <div class="container">
  81. <div class="row mb-2">
  82. <div class="col-12 px-0">
  83. <span class="fst-normal">Default image</span>
  84. </div>
  85. </div>
  86. <div class="row">
  87. <img src="{{ asset('/data/images/books/default_portrait.webp') }}" class="col-xl-8 col-lg-10 col-12 px-0 img-thumbnail" alt="Default book"/>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="row mb-3">
  93. <div class="col-12">
  94. <label class="form-label" for="document">Document</label>
  95. <input class="form-control" type="file" id="document" name="document"/>
  96. </div>
  97. </div>
  98. <div class="row mb-3">
  99. <div class="col-12">
  100. <label class="form-label" for="category">Category</label>
  101. <select class="form-control" id="category" name="category_id">
  102. <option value="">-- Choose --</option>
  103. @foreach ($categories as $category)
  104. @if ($category->id . '' === old('category_id'))
  105. <option value="{{ $category->id }}" selected="">{{ $category->name }}</option>
  106. @else
  107. <option value="{{ $category->id }}">{{ $category->name }}</option>
  108. @endif
  109. @endforeach
  110. </select>
  111. </div>
  112. </div>
  113. <div class="row">
  114. <div class="col-lg-6 col-12 mb-lg-0 mb-2">
  115. <div class="d-grid gap-2">
  116. <button type="submit" class="btn btn-primary">Add</button>
  117. </div>
  118. </div>
  119. <div class="col-lg-6 col-12">
  120. <div class="d-grid gap-2">
  121. <button type="reset" class="btn btn-danger">Reset</button>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </form>
  127. </div>
  128. </div>
  129. @endsection