Files
opentextsummaries/resources/views/categories/index.blade.php
T
2025-09-13 17:39:17 +03:00

75 lines
3.6 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Categories - Open Text Summaries</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100">
<div class="container mx-auto px-4 py-8">
<div class="flex justify-between items-center mb-6">
<h1 class="text-3xl font-bold text-indigo-700">Categories</h1>
<a href="{{ route('categories.create') }}" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded">
Add New Category
</a>
</div>
@if (session('success'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline">{{ session('success') }}</span>
</div>
@endif
<div class="bg-white shadow-md rounded-lg overflow-hidden">
<table class="min-w-full bg-white">
<thead class="bg-gray-100 text-gray-600 uppercase text-sm leading-normal">
<tr>
<th class="py-3 px-6 text-left">Name</th>
<th class="py-3 px-6 text-left">Description</th>
<th class="py-3 px-6 text-center">Actions</th>
</tr>
</thead>
<tbody class="text-gray-600 text-sm">
@forelse ($categories as $category)
<tr class="border-b border-gray-200 hover:bg-gray-50">
<td class="py-3 px-6 text-left">
<div class="font-medium">{{ $category->name }}</div>
</td>
<td class="py-3 px-6 text-left">
<div>{{ Str::limit($category->description, 100) }}</div>
</td>
<td class="py-3 px-6 text-center">
<div class="flex justify-center">
<a href="{{ route('categories.show', $category) }}" class="text-blue-500 hover:text-blue-700 mx-1">
View
</a>
<a href="{{ route('categories.edit', $category) }}" class="text-yellow-500 hover:text-yellow-700 mx-1">
Edit
</a>
<form action="{{ route('categories.destroy', $category) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700 mx-1" onclick="return confirm('Are you sure you want to delete this category?')">
Delete
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="3" class="py-3 px-6 text-center">No categories found</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-6">
<a href="/" class="text-indigo-600 hover:text-indigo-800">Back to Home</a>
</div>
</div>
</body>
</html>