film.blade.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <x-app-layout>
  2. <x-slot name="header">
  3. <div class="float-right flex space-x-2">
  4. <a href="https://themoviedb.org/movie/{{ $tmdb->getId() }}"><img src="/img/tmdb.svg" class="max-h-7 w-8"></a>
  5. <a href="https://imdb.com/title/{{ $tmdb->getImdbId() }}"><img src="/img/IMDb_Logo_Square.svg" class="max-h-7"></a>
  6. </div>
  7. <h2 class="font-semibold text-xl text-burnt leading-tight">
  8. {{ $tmdb->getTitle() }}
  9. </h2>
  10. <div class="text-burnt italic mt-2 text-lg">{{ $tmdb->getTagline() }}</div>
  11. </x-slot>
  12. <div class="py-12">
  13. <div class="max-w-7xl mx-auto sm:px-6 lg:px-8 text-crayola" x-data="{ tab: 'fact' }">
  14. <!-- Session Status -->
  15. <x-auth-session-status class="mb-4 border border-burnt p-2 rounded-lg bg-coal mx-auto max-w-xs" :status="session('status')" />
  16. @if (!is_null($film->seen))
  17. <div id="gesehen" class="border border-burnt p-2 rounded-lg flex mb-6 bg-coal mx-auto max-w-xs sm:ml-0">
  18. <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
  19. <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
  20. </svg>
  21. Gesehen am {{ \Carbon\Carbon::parse($film->seen)->format('d.m.Y') }}
  22. </div>
  23. @elseif (!is_null($film->rejected))
  24. <div id="gesehen" class="border border-burnt p-2 rounded-lg flex mb-6 bg-coal mx-auto max-w-xs sm:ml-0">
  25. <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
  26. <path stroke-linecap="round" stroke-linejoin="round" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" />
  27. </svg>
  28. Abgelehnt am {{ \Carbon\Carbon::parse($film->rejected)->format('d.m.Y') }}
  29. </div>
  30. @elseif(!is_null(auth()->user()) && auth()->user()->isAdmin())
  31. <div class="flex content-start" x-data="{confseen: false, confdel: false, confnext: false}">
  32. @if(!$film->isNext())
  33. <div
  34. class="border p-2 rounded-lg flex mb-6 bg-coal max-w-xs mr-2 ml-2 sm:ml-0 cursor-pointer hover:text-coal border-burnt"
  35. :class="confnext ? 'bg-burnt text-coal hover:bg-crayola' : 'hover:bg-burnt'"
  36. @click="confnext ? location.href='/film/mark/{{ $film->id }}/next' : confnext = true"
  37. @click.outside="confnext = false"
  38. >
  39. <span x-text="confnext ? 'Als nächstes sehen?' : ''"></span>
  40. <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mx-1" viewBox="0 0 640 512" stroke="currentColor">
  41. <path fill="currentColor" d="M592 0H48A48 48 0 0 0 0 48v320a48 48 0 0 0 48 48h240v32H112a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H352v-32h240a48 48 0 0 0 48-48V48a48 48 0 0 0-48-48zm-16 352H64V64h512z"/>
  42. </svg>
  43. </div>
  44. @endif
  45. <div
  46. class="border p-2 rounded-lg flex mb-6 bg-coal max-w-xs mr-2 ml-2 sm:ml-0 cursor-pointer hover:text-coal border-burnt"
  47. :class="confseen ? 'bg-burnt text-coal hover:bg-crayola' : 'hover:bg-burnt'"
  48. @click="confseen ? location.href='/film/mark/{{ $film->id }}/seen' : confseen = true"
  49. @click.outside="confseen = false"
  50. >
  51. <span x-text="confseen ? 'Wirklich gesehen?' : ''"></span>
  52. <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
  53. <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
  54. </svg>
  55. </div>
  56. <div
  57. class="border p-2 rounded-lg flex mb-6 bg-coal max-w-xs mr-2 cursor-pointer hover:text-coal border-burnt"
  58. :class="confdel ? 'bg-burnt text-coal hover:bg-crayola' : 'hover:bg-burnt'"
  59. @click="confdel ? location.href='/film/mark/{{ $film->id }}/deny' : confdel = true"
  60. @click.outside="confdel = false">
  61. <span x-text="confdel ? 'Wirklich ablehnen?' : ''"></span>
  62. <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
  63. <path stroke-linecap="round" stroke-linejoin="round" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" />
  64. </svg>
  65. </div>
  66. </div>
  67. @endif
  68. <img src="{{ $image->getUrl($tmdb->getPosterImage(), 'w342') }}" alt="{{ $tmdb->getTitle() }} Poster" class="rounded-lg mx-auto mb-6 lg:float-right lg:mx-0 lg:ml-6 shadow-md shadow-burnt">
  69. <div class="sm:rounded-lg bg-coal flex mb-6 px-4">
  70. <a class="p-6 hover:text-yelmax cursor-pointer" x-bind:class="tab == 'fact' ? 'border-b-2 border-yelmax' : ''" @@click="tab = 'fact'">Allgemein</a>
  71. <a class="p-6 hover:text-yelmax cursor-pointer" x-bind:class="tab == 'cast' ? 'border-b-2 border-yelmax' : ''" @@click="tab = 'cast'">Schauspieler</a>
  72. <a class="p-6 hover:text-yelmax cursor-pointer" x-bind:class="tab == 'vids' ? 'border-b-2 border-yelmax' : ''" @@click="tab = 'vids'">Trailer</a>
  73. </div>
  74. <div id="#allgemein" class="px-4 grid grid-cols-2 gap-2" x-show="tab == 'fact'" x-transition>
  75. <div class="font-bold">Vorgeschlagen von</div>
  76. <div class="flex"><img src="/avatar/{{$film->suggester->getAvatar() }}" class="max-h-7 rounded-lg mr-2"> {{ $film->suggester->name }}</div>
  77. <div class="font-bold">Originaltitel</div>
  78. <div>„{{ $tmdb->getOriginalTitle() }}“ ({{ $tmdb->getOriginalLanguage() }})</div>
  79. <div class="font-bold">Laufzeit</div>
  80. <div>{{ $tmdb->getRuntime() }} Minuten</div>
  81. <div class="font-bold">Erschienen</div>
  82. <div>{{ $tmdb->getReleaseDate()->format('d.m.Y') }} -
  83. @foreach ($tmdb->getProductionCountries() as $co)
  84. <abbr title="{{$co->getName()}}">{{$co->getIso31661()}}</abbr>
  85. @endforeach
  86. </div>
  87. <div class="font-bold">Genre</div>
  88. <div class="flex flex-wrap space-x-1">
  89. @foreach ($tmdb->getGenres() as $genre)
  90. <div class="bg-coal rounded-lg p-1">{{ $genre->getName() }}</div>
  91. @endforeach
  92. </div>
  93. <div class="font-bold">TMDB Bewertung</div>
  94. <div class="">{{ $tmdb->getVoteAverage() }} von 10</div>
  95. @if($film->getBewertung() > 0)
  96. <div class="font-bold">Dumbo Bewertung</div>
  97. <div class="">{{ number_format($film->getBewertung(), 2, '.', '')}} von 10</div>
  98. @endif
  99. <div class="font-bold">Flatrate Stream</div>
  100. <div class="flex flex-wrap space-x-1">
  101. @forelse($tmdb->getWatchProviders()->filter(
  102. function($key, $value) {
  103. return $value->getIso31661() == 'DE' && count($value->getFlatrate()) > 0;
  104. }
  105. ) as $wp)
  106. @foreach($wp->getFlatrate() as $p)
  107. <img src="{{ $image->getUrl($p->getLogoPath(), 'w45') }}" title="{{ $p->getName() }}" class="rounded-lg max-h-8">
  108. @endforeach
  109. @empty
  110. <div class="italic">Keine</div>
  111. @endforelse
  112. </div>
  113. <div class="font-bold">Kaufen / Leihen</div>
  114. <div class="flex flex-wrap space-x-1">
  115. @foreach($tmdb->getWatchProviders()->filter(
  116. function($key, $value) {
  117. return $value->getIso31661() == 'DE' && (count($value->getRent()) > 0 || count($value->getBuy()) > 0);
  118. }
  119. ) as $wp)
  120. @foreach($wp->getRent() as $p)
  121. <img src="{{ $image->getUrl($p->getLogoPath(), 'w45') }}" title="{{ $p->getName() }}" class="rounded-lg max-h-8">
  122. @endforeach
  123. @endforeach
  124. </div>
  125. <div class="col-span-2 font-bold">Handlung</div>
  126. <div class="col-span-2 font-serif border-l-4 border-burnt pl-6">{{ $tmdb->getOverview() }}</div>
  127. </div>
  128. <div id="#schauspieler" class="px-4 grid grid-cols-4 gap-2" x-show="tab == 'cast'" x-transition>
  129. @foreach($tmdb->getCredits()->getCast() as $role)
  130. @if ($loop->index > 11)
  131. @break
  132. @endif
  133. <div class="pb-2">
  134. @if ($role->getProfileImage() != "")
  135. <img src="{{ $image->getUrl($role->getProfileImage() , "w185") }}" class="rounded-lg mb-1">
  136. @else
  137. <img src="/img/no-portrait.png" class="rounded-lg mb-1">
  138. @endif
  139. <div class="font-bold">{{ $role->getName() }}</div>
  140. <div class="text-burnt">{{ $role->getCharacter() }}</div>
  141. </div>
  142. @endforeach
  143. </div>
  144. <div id="trailer" class="px-4" x-show="tab == 'vids'" x-transition>
  145. @foreach ($tmdb->getVideos()->filter(
  146. function($key, $value) {
  147. return $value->getType() == "Trailer";
  148. }
  149. ) as $vid)
  150. <div class="font-bold">{{ $vid->getName() }}</div>
  151. <div class="relative overflow-hidden w-full sm:w-[calc(100%-384px)] after:block after:pt-[56.25%]">
  152. <iframe class="absolute top-0 left-0 w-full h-full" src="//www.youtube.com/embed/{{ $vid->getKey() }}" frameborder="0" allowfullscreen></iframe>
  153. </div>
  154. @endforeach
  155. </div>
  156. </div>
  157. </div>
  158. @php
  159. $votes = $film->votes()->count();
  160. if(!is_null(auth()->user()))
  161. $uvote = $film->votes()->where('user', auth()->id())->first();
  162. @endphp
  163. @if( $votes > 0 || (is_null($film->seen) && is_null($film->rejected)))
  164. <div class="py-6 " id="voting">
  165. <div class="max-w-7xl mx-auto sm:px-6 lg:px-8 text-crayola ">
  166. <h2 class="font-semibold text-xl text-crayola leading-tight sm:rounded-lg bg-coal mb-6 p-4">
  167. Abstimmung
  168. </h2>
  169. @if($votes > 0)
  170. <div class="px-2">
  171. <p>
  172. Insgesamt haben <b>{{ $votes }}</b> Personen abgestimmt.
  173. <b>{{ $film->votes->where('vote', 1)->count() }}</b> waren <i>dafür</i>.
  174. @if(!is_null(auth()->user()))
  175. Du hast {!! is_null($uvote) ? '<i>nicht</i> ab' : ($uvote->vote == 0 ? '<i>nicht dafür</i> ' : '<i>dafür</i> ') !!}gestimmt.
  176. @endif
  177. </p>
  178. <div class="grid grid-cols-2 gap-2">
  179. <div class="text-burnt">Dafür</div>
  180. <div class="text-burnt">Nicht dafür</div>
  181. <div class="flex flex-col sm:flex-row flex-wrap">
  182. @foreach($film->votes->reject( function ($v) { return $v->vote == 0; }) as $vote)
  183. <div class="flex mb-1 mr-1 p-2 border border-burnt rounded-lg {{ $vote->voter->isActive() ? '' : 'italic border-coal text-field' }}"><img src="/avatar/{{$vote->voter->getAvatar() }}" class="max-h-6 rounded-lg mr-1"> {{ $vote->voter->name }}</div>
  184. @endforeach
  185. </div>
  186. <div class="flex flex-col sm:flex-row flex-wrap">
  187. @foreach($film->votes->reject( function ($v) { return $v->vote == 1; }) as $vote)
  188. <div class="flex mb-1 mr-1 p-2 border border-burnt rounded-lg {{ $vote->voter->isActive() ? '' : 'italic border-coal text-field' }}"><img src="/avatar/{{$vote->voter->getAvatar() }}" class="max-h-6 rounded-lg mr-1"> {{ $vote->voter->name }}</div>
  189. @endforeach
  190. </div>
  191. </div>
  192. </div>
  193. @endif
  194. @if(is_null($film->seen) && is_null($film->rejected) && !is_null(auth()->user()))
  195. <div class="py-6">
  196. <div class="flex mx-auto w-80">
  197. <a href="/film/vote/{{ $film->id }}/1" class="flex rounded-l-lg border-2 border-r-0 border-burnt p-4 w-40">
  198. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-burnt" viewBox="0 0 20 20" fill="currentColor">
  199. <path d="M9 2a1 1 0 000 2h2a1 1 0 100-2H9z" />
  200. <path fill-rule="evenodd" d="M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
  201. </svg>
  202. Dafür
  203. </a>
  204. <a href="/film/vote/{{ $film->id }}/0" class="flex rounded-r-lg border-2 border-l-1 border-burnt p-4 w-40">
  205. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-burnt" viewBox="0 0 20 20" fill="currentColor">
  206. <path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z" />
  207. <path d="M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z" />
  208. </svg>
  209. Nicht dafür
  210. </a>
  211. </div>
  212. </div>
  213. @endif
  214. </div>
  215. </div>
  216. @endif
  217. <div class="py-6 ">
  218. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-crayola">
  219. <h2 class="font-semibold text-xl text-crayola leading-tight sm:rounded-lg bg-coal mb-6 p-4">
  220. Kommentare
  221. </h2>
  222. <div class="px-2" x-data="{xnew: false, comments: {{$film->comments->count()}}}">
  223. @if (is_null(auth()->user()))
  224. <p>Melde Dich an, um diesen Film zu kommentieren.</p>
  225. @else
  226. <button x-show="comments > 0" class="text-yelmax float-right" @@click="xnew = !xnew" x-text="xnew ? 'Abbrechen' : '+ Kommentar und Bewertung hinzufügen'"></button>
  227. <div x-show="xnew || comments < 1" x-transition>
  228. <img src="/avatar/{{ auth()->user()->getAvatar() }}" alt="User Avatar" class="rounded-lg w-16 float-left mr-2">
  229. <div class="">
  230. <form method="POST" action="/comment/new/{{ $film->id }}/">
  231. @csrf
  232. <h4 class="font-semibold">Neuer Kommentar</h4>
  233. @if($film->userMayEvaluate(auth()->user()->id))
  234. <div class="flex" x-data="{ stars: 0 }">
  235. <input type="hidden" name="vote" id="vote" x-bind:value="stars">
  236. <p @@click="stars = 0">Bewerten: </p>
  237. <div @@click="stars = 1">
  238. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 1 ? 'text-burnt' : ''">
  239. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  240. </svg>
  241. </div>
  242. <div @@click="stars = 2">
  243. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 2 ? 'text-burnt' : ''">
  244. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  245. </svg>
  246. </div>
  247. <div @@click="stars = 3">
  248. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 3 ? 'text-burnt' : ''">
  249. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  250. </svg>
  251. </div>
  252. <div @@click="stars = 4">
  253. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 4 ? 'text-burnt' : ''">
  254. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  255. </svg>
  256. </div>
  257. <div @@click="stars = 5">
  258. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 5 ? 'text-burnt' : ''">
  259. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  260. </svg>
  261. </div>
  262. <div @@click="stars = 6">
  263. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 6 ? 'text-burnt' : ''">
  264. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  265. </svg>
  266. </div>
  267. <div @@click="stars = 7">
  268. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 7 ? 'text-burnt' : ''">
  269. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  270. </svg>
  271. </div>
  272. <div @@click="stars = 8">
  273. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 8 ? 'text-burnt' : ''">
  274. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  275. </svg>
  276. </div>
  277. <div @@click="stars = 9">
  278. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 9 ? 'text-burnt' : ''">
  279. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  280. </svg>
  281. </div>
  282. <div @@click="stars = 10">
  283. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 10 ? 'text-burnt' : ''">
  284. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  285. </svg>
  286. </div>
  287. <span x-text="' (' + stars + ')'"></span>
  288. </div>
  289. @endif
  290. <textarea name="body" id="body" class="block w-[calc(100%-4.5rem)] my-1 rounded-lg border-1 border-field bg-coal"></textarea>
  291. <x-button class="ml-[4.5rem]">Absenden</x-button>
  292. </form>
  293. </div>
  294. </div>
  295. @endif
  296. @foreach ($film->comments()->orderBy('created_at', 'DESC')->get() as $comment)
  297. <div class="clear-left my-2 min-h-[5rem]" x-data="{edit: false}">
  298. <img src="/avatar/{{ $comment->author->getAvatar() }}" alt="{{ $comment->author->name }} Avatar" class="rounded-lg w-16 float-left mr-2">
  299. <h4 class="font-bold">
  300. {{ $comment->author->name }}
  301. <span class="text-sm font-light">
  302. {{ \Carbon\Carbon::parse($comment->created_at)->format('d.m.Y H:i') }}
  303. @if ($comment->updated_at != $comment->created_at)
  304. &mdash; Zuletzt bearbeitet: {{ \Carbon\Carbon::parse($comment->updated_at)->format('d.m.Y H:i') }}
  305. @endif
  306. </span>
  307. </h4>
  308. @if($comment->evaluation > 0)
  309. <div class="flex" title="{{ $comment->evaluation }}" x-show="!edit">
  310. @for ($i = 0; $i < $comment->evaluation; $i++)
  311. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-burnt" viewBox="0 0 20 20" fill="currentColor">
  312. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  313. </svg>
  314. @endfor
  315. <span>({{$comment->evaluation}})</span>
  316. </div>
  317. @endif
  318. @if(!is_null(auth()->user()) && auth()->user()->id == $comment->author->id)
  319. <button class="text-yelmax float-right" @@click="edit = !edit" x-text="edit ? 'Abbrechen' : 'Bearbeiten'"></button>
  320. <p x-show="!edit" x-transition>{{ $comment->body }}</p>
  321. <div x-show="edit" x-transition>
  322. <form method="post" action="/comment/edit/{{ $comment->id }}">
  323. @csrf
  324. @if($comment->evaluation > 0)
  325. <div class="flex" x-data="{ stars: {{ $comment->evaluation }} }">
  326. <input type="hidden" name="vote" id="vote" x-bind:value="stars">
  327. <p @@click="stars = 0">Bewerten: </p>
  328. <div @@click="stars = 1">
  329. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 1 ? 'text-burnt' : ''">
  330. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  331. </svg>
  332. </div>
  333. <div @@click="stars = 2">
  334. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 2 ? 'text-burnt' : ''">
  335. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  336. </svg>
  337. </div>
  338. <div @@click="stars = 3">
  339. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 3 ? 'text-burnt' : ''">
  340. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  341. </svg>
  342. </div>
  343. <div @@click="stars = 4">
  344. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 4 ? 'text-burnt' : ''">
  345. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  346. </svg>
  347. </div>
  348. <div @@click="stars = 5">
  349. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 5 ? 'text-burnt' : ''">
  350. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  351. </svg>
  352. </div>
  353. <div @@click="stars = 6">
  354. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 6 ? 'text-burnt' : ''">
  355. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  356. </svg>
  357. </div>
  358. <div @@click="stars = 7">
  359. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 7 ? 'text-burnt' : ''">
  360. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  361. </svg>
  362. </div>
  363. <div @@click="stars = 8">
  364. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 8 ? 'text-burnt' : ''">
  365. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  366. </svg>
  367. </div>
  368. <div @@click="stars = 9">
  369. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 9 ? 'text-burnt' : ''">
  370. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  371. </svg>
  372. </div>
  373. <div @@click="stars = 10">
  374. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" x-bind:class="stars >= 10 ? 'text-burnt' : ''">
  375. <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
  376. </svg>
  377. </div>
  378. <span x-text="' (' + stars + ')'"></span>
  379. </div>
  380. @endif
  381. <textarea name="body" id="body" class="block w-[calc(100%-4.5rem)] my-1 rounded-lg border-1 border-field bg-coal">{{ $comment->body }}</textarea>
  382. <x-button class="ml-[4.5rem]">Speichern</x-button>
  383. </form>
  384. </div>
  385. @else
  386. <p>{{ $comment->body }}</p>
  387. @endif
  388. </div>
  389. @endforeach
  390. </div>
  391. </div>
  392. </div>
  393. </x-app-layout>