la_bloger/resources/views/admin/taxonomy/index.blade.php

75 lines
3.3 KiB
PHP

@extends('admin::layouts.app')
@section('title', 'Taxonomy')
@section('content')
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-xl font-semibold text-gray-900">
Taxonomy <span class="font-normal text-gray-500">{{ $channel->name }}</span>
</h1>
<p class="text-sm text-gray-400 mt-0.5">Prefix: /{{ $channel->taxonomy_slug }}</p>
</div>
<a href="{{ route('admin.taxonomy.create') }}"
class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded">
New term
</a>
</div>
<div class="bg-white rounded shadow overflow-hidden mb-4">
<table class="w-full text-sm">
<thead>
<tr class="border-b border-gray-200 text-left text-xs font-medium text-gray-500 uppercase tracking-wide">
<th class="px-4 py-3">Title</th>
<th class="px-4 py-3">Slug</th>
<th class="px-4 py-3">Posts</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($terms as $term)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 font-medium text-gray-900">{{ $term->title }}</td>
<td class="px-4 py-3 text-gray-400 font-mono text-xs">{{ $term->slug }}</td>
<td class="px-4 py-3 text-gray-500">{{ $term->publications_count }}</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('admin.taxonomy.edit', $term) }}"
class="text-indigo-600 hover:underline mr-3">Edit</a>
<form method="POST" action="{{ route('admin.taxonomy.destroy', $term) }}"
class="inline" onsubmit="return confirm('Delete term {{ addslashes($term->title) }}?')">
@csrf @method('DELETE')
<button type="submit" class="text-red-500 hover:underline">Delete</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-4 py-8 text-center text-gray-400">No terms yet.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
{{-- Quick add --}}
<div class="bg-white rounded shadow p-4" x-data="{ open: false }">
<button type="button" @click="open = !open"
class="text-sm text-indigo-600 hover:underline font-medium">
+ Quick add term
</button>
<form method="POST" action="{{ route('admin.taxonomy.store') }}"
x-show="open" x-transition style="display:none" class="mt-3 flex items-start gap-3">
@csrf
<div class="flex-1">
<input type="text" name="title" value="{{ old('title') }}"
placeholder="Term title"
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 @error('title') border-red-500 @enderror">
@error('title') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
</div>
<button type="submit"
class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded">
Add
</button>
</form>
</div>
@endsection