auditionadmin/resources/views/components/doubler-block.blade.php

44 lines
2.2 KiB
PHP

@php use App\Models\Audition; @endphp
@props(['student'])
{{--complete badge--}}
{{--<p class="mt-0.5 whitespace-nowrap rounded-md bg-green-50 px-1.5 py-0.5 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20">Complete</p>--}}
{{--in progress badge--}}
{{--<p class="mt-0.5 whitespace-nowrap rounded-md bg-gray-50 px-1.5 py-0.5 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">In progress</p>--}}
<ul role="list" class="divide-y divide-gray-100">
@foreach($student->entries as $entry)
<li class="flex items-center justify-between gap-x-1 py-5">
<div class="min-w-0">
<div class="flex items-start gap-x-3">
<p class="text-sm font-semibold leading-6 text-gray-900">
<a href="/tabulation/auditions/{{ $entry->audition->id }}">
{{ $entry->audition->name }}
</a>
</p>
@if(Audition::getCompleteAuditions()->contains('id', $entry->audition->id))
<p class="mt-0.5 whitespace-nowrap rounded-md bg-green-50 px-1.5 py-0.5 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20">Complete</p>
@else
<p class="mt-0.5 whitespace-nowrap rounded-md bg-gray-50 px-1.5 py-0.5 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">In progress</p>
@endif
</div>
<div class="mt-1 flex items-center gap-x-2 text-xs leading-5 text-gray-500">
@if(Audition::getCompleteAuditions()->contains('id', $entry->audition->id))
@php
$entryPlace = $entry->audition->rankedEntries()->search(function ($rankedEntry) use ($entry) {
return $rankedEntry->id == $entry->id;
});
@endphp
@if($entryPlace !== false)
Rank: {{ $entryPlace +1 }}{{-- The place of $entry->id in the array is $entryPlace --}}
@endif
@endif
</div>
</div>
</li>
@endforeach
</ul>