create.blade.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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">Loan 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('loans.store') }}" method="POST">
  40. @csrf
  41. <div class="container">
  42. <div class="row mb-3">
  43. <div class="col-12">
  44. <label class="form-label" for="user">User</label>
  45. <select class="form-control" id="user" name="user_id" required="">
  46. <option value="">-- Choose --</option>
  47. @foreach ($users as $user)
  48. @if ($user->id . '' === old('user_id'))
  49. <option value="{{ $user->id }}" selected="">{{ $user->name }}</option>
  50. @else
  51. <option value="{{ $user->id }}">{{ $user->name }}</option>
  52. @endif
  53. @endforeach
  54. </select>
  55. </div>
  56. </div>
  57. <div class="row mb-3">
  58. <div class="col-12">
  59. <label class="form-label" for="book">Book</label>
  60. <select class="form-control" id="book" name="book_id" required="">
  61. <option value="">-- Choose --</option>
  62. @foreach ($books as $book)
  63. @if ($book->id . '' === old('book_id'))
  64. <option value="{{ $book->id }}" selected="">{{ $book->title . ' - ' . $book->authors }}</option>
  65. @else
  66. <option value="{{ $book->id }}">{{ $book->title . ' - ' . $book->authors }}</option>
  67. @endif
  68. @endforeach
  69. </select>
  70. </div>
  71. </div>
  72. <div class="row mb-3">
  73. <div class="col-12">
  74. <label class="form-label" for="start">Start</label>
  75. <input class="form-control" type="date" id="start" name="start" value="{{ old('start') }}" required=""/>
  76. </div>
  77. </div>
  78. <div class="row">
  79. <div class="col-lg-6 col-12 mb-lg-0 mb-2">
  80. <div class="d-grid gap-2">
  81. <button type="submit" class="btn btn-primary">Add</button>
  82. </div>
  83. </div>
  84. <div class="col-lg-6 col-12">
  85. <div class="d-grid gap-2">
  86. <button type="reset" class="btn btn-danger">Reset</button>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </form>
  92. </div>
  93. </div>
  94. @endsection