75 lines
3.7 KiB
PHP
75 lines
3.7 KiB
PHP
<?php
|
|
|
|
use App\Models\Participant;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use function Livewire\Volt\{state, mount, rules};
|
|
|
|
state(['participants' => Collection::class]);
|
|
|
|
mount(function () {
|
|
$this->participants = Participant::all();
|
|
});
|
|
|
|
?>
|
|
|
|
<div class="p-6 bg-gray-100 min-h-screen">
|
|
<div class="max-w-7xl mx-auto">
|
|
|
|
@if($participants->isEmpty())
|
|
<div class="p-4 text-center text-gray-500 bg-white shadow rounded-lg">
|
|
No record
|
|
</div>
|
|
@else
|
|
<div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">User ID</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Giving To (ID)</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Prompt</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Submission URL</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Desperate?</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Token (ULID)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
@foreach($participants as $participant)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{{ $participant->id }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $participant->user_id }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $participant->giving_id ?? 'N/A' }}</td>
|
|
|
|
<td class="px-6 py-4 text-sm text-gray-500 max-w-xs truncate" title="{{ $participant->prompt }}">
|
|
{{ Str::limit($participant->prompt, 50) }}
|
|
</td>
|
|
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-blue-600 hover:underline">
|
|
@if($participant->submission_url)
|
|
<a href="{{ $participant->submission_url }}" target="_blank">View Link</a>
|
|
@else
|
|
N/A
|
|
@endif
|
|
</td>
|
|
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full
|
|
{{ $participant->desperate ? 'bg-red-100 text-red-800' : 'bg-green-100 text-green-800' }}">
|
|
{{ $participant->desperate ? 'YES' : 'No' }}
|
|
</span>
|
|
</td>
|
|
|
|
<td class="px-6 py-4 text-sm font-mono text-gray-500 truncate" title="{{ $participant->token }}">
|
|
{{ Str::limit($participant->token, 15, '...') }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
|
|
</div>
|