73 lines
4.8 KiB
PHP
73 lines
4.8 KiB
PHP
<x-app-layout>
|
|||
|
|
<section class="bg-white dark:bg-gray-900 border-b border-gray-100 dark:border-gray-800">
|
||
|
|
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-8">
|
||
|
|
<div class="flex items-center justify-between">
|
||
|
|
<div>
|
||
|
|
<h1 class="text-2xl sm:text-3xl font-extrabold tracking-tight text-gray-900 dark:text-white">Manage Exercises</h1>
|
||
|
|
<p class="mt-2 text-gray-600 dark:text-gray-300">Create, edit, and delete exercises in the library.</p>
|
||
|
|
</div>
|
||
|
|
<a href="{{ route('admin.exercises.create') }}" class="inline-flex items-center rounded-xl bg-gradient-to-r from-fuchsia-600 to-indigo-600 px-4 py-2 text-sm font-semibold text-white shadow hover:from-fuchsia-500 hover:to-indigo-500">New Exercise</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
|
||
|
|
<section class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6">
|
||
|
|
@if(session('status'))
|
||
|
|
<div class="mb-4 rounded-xl bg-emerald-50 text-emerald-700 px-4 py-3">{{ session('status') }}</div>
|
||
|
|
@endif
|
||
|
|
|
||
|
|
<form action="{{ route('admin.exercises.index') }}" method="GET" class="mb-4 flex items-end gap-3 bg-white dark:bg-gray-800 rounded-2xl p-4 ring-1 ring-gray-200 dark:ring-gray-700">
|
||
|
|
<div class="w-full sm:w-80">
|
||
|
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">Search</label>
|
||
|
|
<input type="text" name="q" value="{{ $q }}" placeholder="Search by name or slug" class="mt-1 w-full rounded-xl border-gray-300 dark:border-gray-700 bg-white/80 dark:bg-gray-900 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:border-indigo-500 focus:ring-indigo-500 px-3 py-2">
|
||
|
|
</div>
|
||
|
|
<div class="ml-auto">
|
||
|
|
<button type="submit" class="inline-flex items-center rounded-xl bg-indigo-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-indigo-500">Apply</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
|
||
|
|
<div class="overflow-hidden rounded-2xl ring-1 ring-gray-200 dark:ring-gray-700 bg-white dark:bg-gray-800">
|
||
|
|
<div class="overflow-x-auto">
|
||
|
|
<table class="min-w-full text-sm">
|
||
|
|
<thead class="bg-gray-50 dark:bg-gray-900/50">
|
||
|
|
<tr>
|
||
|
|
<th class="px-4 py-3 text-left font-semibold text-gray-700 dark:text-gray-300">Name</th>
|
||
|
|
<th class="px-4 py-3 text-left font-semibold text-gray-700 dark:text-gray-300">Slug</th>
|
||
|
|
<th class="px-4 py-3 text-left font-semibold text-gray-700 dark:text-gray-300">GIF</th>
|
||
|
|
<th class="px-4 py-3 text-right font-semibold text-gray-700 dark:text-gray-300">Actions</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
||
|
|
@forelse($exercises as $ex)
|
||
|
|
<tr>
|
||
|
|
<td class="px-4 py-3 text-gray-900 dark:text-gray-100">{{ $ex->name }}</td>
|
||
|
|
<td class="px-4 py-3 text-gray-600 dark:text-gray-300">{{ $ex->slug }}</td>
|
||
|
|
<td class="px-4 py-3 text-gray-600 dark:text-gray-300 truncate max-w-[240px]">
|
||
|
|
@if($ex->gif_url)
|
||
|
|
<a href="{{ $ex->gif_url }}" target="_blank" class="text-indigo-600 hover:text-indigo-500">{{ \Illuminate\Support\Str::limit($ex->gif_url, 40) }}</a>
|
||
|
|
@else
|
||
|
|
<span class="text-gray-400">—</span>
|
||
|
|
@endif
|
||
|
|
</td>
|
||
|
|
<td class="px-4 py-3 text-right">
|
||
|
|
<a href="{{ route('admin.exercises.edit', $ex) }}" class="text-indigo-600 hover:text-indigo-500">Edit</a>
|
||
|
|
<form method="POST" action="{{ route('admin.exercises.destroy', $ex) }}" class="inline" onsubmit="return confirm('Delete this exercise?');">
|
||
|
|
@csrf
|
||
|
|
@method('DELETE')
|
||
|
|
<button type="submit" class="ms-3 text-red-600 hover:text-red-500">Delete</button>
|
||
|
|
</form>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
@empty
|
||
|
|
<tr><td colspan="4" class="px-4 py-6 text-center text-gray-600 dark:text-gray-300">No exercises found.</td></tr>
|
||
|
|
@endforelse
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-800">
|
||
|
|
{{ $exercises->links() }}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
</x-app-layout>
|