some progress

This commit is contained in:
2025-09-20 16:47:41 +03:00
parent e650f3c1b2
commit 2228469bcb
65 changed files with 3382 additions and 311 deletions
+38 -47
View File
@@ -1,49 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Category - 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="mb-6">
<h1 class="text-3xl font-bold text-indigo-700">Create New Category</h1>
</div>
@extends('layouts.app')
<div class="bg-white shadow-md rounded-lg p-6">
<form action="{{ route('categories.store') }}" method="POST">
@csrf
<div class="mb-4">
<label for="name" class="block text-gray-700 text-sm font-bold mb-2">Name:</label>
<input type="text" name="name" id="name" value="{{ old('name') }}"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('name') border-red-500 @enderror">
@error('name')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="mb-6">
<label for="description" class="block text-gray-700 text-sm font-bold mb-2">Description:</label>
<textarea name="description" id="description" rows="4"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('description') border-red-500 @enderror">{{ old('description') }}</textarea>
@error('description')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="flex items-center justify-between">
<button type="submit" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
Create Category
</button>
<a href="{{ route('categories.index') }}" class="text-indigo-600 hover:text-indigo-800">
Cancel
</a>
</div>
</form>
</div>
@section('content')
<div class="mb-6">
<h1 class="text-3xl font-bold text-indigo-700">Create New Category</h1>
</div>
</body>
</html>
<div class="bg-white shadow-md rounded-lg p-6">
<form action="{{ route('categories.store') }}" method="POST">
@csrf
<div class="mb-4">
<label for="name" class="block text-gray-700 text-sm font-bold mb-2">Name:</label>
<input type="text" name="name" id="name" value="{{ old('name') }}"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('name') border-red-500 @enderror">
@error('name')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="mb-6">
<label for="description" class="block text-gray-700 text-sm font-bold mb-2">Description:</label>
<textarea name="description" id="description" rows="4"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('description') border-red-500 @enderror">{{ old('description') }}</textarea>
@error('description')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="flex items-center justify-between">
<button type="submit" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
Create Category
</button>
<a href="{{ route('categories.index') }}" class="text-indigo-600 hover:text-indigo-800">
Cancel
</a>
</div>
</form>
</div>
@endsection
+39 -48
View File
@@ -1,50 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Category - 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="mb-6">
<h1 class="text-3xl font-bold text-indigo-700">Edit Category</h1>
</div>
@extends('layouts.app')
<div class="bg-white shadow-md rounded-lg p-6">
<form action="{{ route('categories.update', $category) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-4">
<label for="name" class="block text-gray-700 text-sm font-bold mb-2">Name:</label>
<input type="text" name="name" id="name" value="{{ old('name', $category->name) }}"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('name') border-red-500 @enderror">
@error('name')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="mb-6">
<label for="description" class="block text-gray-700 text-sm font-bold mb-2">Description:</label>
<textarea name="description" id="description" rows="4"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('description') border-red-500 @enderror">{{ old('description', $category->description) }}</textarea>
@error('description')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="flex items-center justify-between">
<button type="submit" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
Update Category
</button>
<a href="{{ route('categories.index') }}" class="text-indigo-600 hover:text-indigo-800">
Cancel
</a>
</div>
</form>
</div>
@section('content')
<div class="mb-6">
<h1 class="text-3xl font-bold text-indigo-700">Edit Category</h1>
</div>
</body>
</html>
<div class="bg-white shadow-md rounded-lg p-6">
<form action="{{ route('categories.update', $category) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-4">
<label for="name" class="block text-gray-700 text-sm font-bold mb-2">Name:</label>
<input type="text" name="name" id="name" value="{{ old('name', $category->name) }}"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('name') border-red-500 @enderror">
@error('name')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="mb-6">
<label for="description" class="block text-gray-700 text-sm font-bold mb-2">Description:</label>
<textarea name="description" id="description" rows="4"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('description') border-red-500 @enderror">{{ old('description', $category->description) }}</textarea>
@error('description')
<p class="text-red-500 text-xs italic mt-1">{{ $message }}</p>
@enderror
</div>
<div class="flex items-center justify-between">
<button type="submit" class="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
Update Category
</button>
<a href="{{ route('categories.index') }}" class="text-indigo-600 hover:text-indigo-800">
Cancel
</a>
</div>
</form>
</div>
@endsection
+63 -72
View File
@@ -1,74 +1,65 @@
<!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>
@extends('layouts.app')
@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>
@section('content')
<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>
</body>
</html>
@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>
@endsection
+50 -59
View File
@@ -1,65 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $category->name }} - 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="mb-6">
<h1 class="text-3xl font-bold text-indigo-700">{{ $category->name }}</h1>
@extends('layouts.app')
@section('content')
<div class="mb-6">
<h1 class="text-3xl font-bold text-indigo-700">{{ $category->name }}</h1>
</div>
<div class="bg-white shadow-md rounded-lg p-6 mb-6">
<h2 class="text-xl font-semibold mb-4">Category Details</h2>
<div class="mb-4">
<p class="text-gray-700"><span class="font-semibold">Name:</span> {{ $category->name }}</p>
</div>
<div class="bg-white shadow-md rounded-lg p-6 mb-6">
<h2 class="text-xl font-semibold mb-4">Category Details</h2>
<div class="mb-4">
<p class="text-gray-700"><span class="font-semibold">Name:</span> {{ $category->name }}</p>
</div>
<div class="mb-4">
<p class="text-gray-700"><span class="font-semibold">Description:</span></p>
<p class="text-gray-700 mt-2">{{ $category->description }}</p>
</div>
<div class="flex mt-6">
<a href="{{ route('categories.edit', $category) }}" class="bg-yellow-500 hover:bg-yellow-600 text-white font-bold py-2 px-4 rounded mr-2">
Edit
</a>
<form action="{{ route('categories.destroy', $category) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded" onclick="return confirm('Are you sure you want to delete this category?')">
Delete
</button>
</form>
</div>
<div class="mb-4">
<p class="text-gray-700"><span class="font-semibold">Description:</span></p>
<p class="text-gray-700 mt-2">{{ $category->description }}</p>
</div>
<div class="bg-white shadow-md rounded-lg p-6">
<h2 class="text-xl font-semibold mb-4">Books in this Category</h2>
@if($category->books->count() > 0)
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@foreach($category->books as $book)
<div class="border rounded-lg p-4 hover:shadow-md transition-shadow">
<h3 class="font-bold text-lg mb-1">{{ $book->title }}</h3>
<p class="text-gray-600 text-sm mb-2">By {{ $book->author }}</p>
<p class="text-gray-700 mb-3">{{ Str::limit($book->description, 100) }}</p>
<a href="{{ route('books.show', $book) }}" class="text-indigo-600 hover:text-indigo-800">View Details →</a>
</div>
@endforeach
</div>
@else
<p class="text-gray-700">No books found in this category.</p>
@endif
</div>
<div class="mt-6">
<a href="{{ route('categories.index') }}" class="text-indigo-600 hover:text-indigo-800">Back to Categories</a>
<div class="flex mt-6">
<a href="{{ route('categories.edit', $category) }}" class="bg-yellow-500 hover:bg-yellow-600 text-white font-bold py-2 px-4 rounded mr-2">
Edit
</a>
<form action="{{ route('categories.destroy', $category) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded" onclick="return confirm('Are you sure you want to delete this category?')">
Delete
</button>
</form>
</div>
</div>
</body>
</html>
<div class="bg-white shadow-md rounded-lg p-6">
<h2 class="text-xl font-semibold mb-4">Books in this Category</h2>
@if($category->books->count() > 0)
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@foreach($category->books as $book)
<div class="border rounded-lg p-4 hover:shadow-md transition-shadow">
<h3 class="font-bold text-lg mb-1">{{ $book->title }}</h3>
<p class="text-gray-600 text-sm mb-2">By {{ $book->author }}</p>
<p class="text-gray-700 mb-3">{{ Str::limit($book->description, 100) }}</p>
<a href="{{ route('books.show', $book) }}" class="text-indigo-600 hover:text-indigo-800">View Details →</a>
</div>
@endforeach
</div>
@else
<p class="text-gray-700">No books found in this category.</p>
@endif
</div>
<div class="mt-6">
<a href="{{ route('categories.index') }}" class="text-indigo-600 hover:text-indigo-800">Back to Categories</a>
</div>
@endsection