- Add Docker configuration (Dockerfile, docker-compose.yml) - Add Nginx and Supervisor configuration - Add deployment documentation (DEPLOYMENT.md) - Complete Phase 3 data migration (63 entries, 63 docs, 28 subs) - Add responsive PDF viewer component - Fix date format to American (MM/DD/YYYY) - Update typography to match v1.0 - Add admin dashboard with full CRUD operations - Configure PostgreSQL with secure password - Connect to caddy_network for reverse proxy - Ready for production deployment
136 lines
4.2 KiB
PHP
136 lines
4.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\DocketEntry;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
class DocketEntryController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index(): Response
|
|
{
|
|
$paginated = DocketEntry::with('documents')
|
|
->orderBy('date', 'desc')
|
|
->paginate(20);
|
|
|
|
return Inertia::render('Admin/DocketEntries/Index', [
|
|
'entries' => $paginated->map(fn ($entry) => [
|
|
'id' => $entry->id,
|
|
'date' => $entry->date->format('m/d/Y'),
|
|
'title' => $entry->title,
|
|
'summary' => $entry->summary,
|
|
'documents_count' => $entry->documents->count(),
|
|
])->toArray(),
|
|
'pagination' => [
|
|
'current_page' => $paginated->currentPage(),
|
|
'last_page' => $paginated->lastPage(),
|
|
'per_page' => $paginated->perPage(),
|
|
'total' => $paginated->total(),
|
|
],
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create(): Response
|
|
{
|
|
return Inertia::render('Admin/DocketEntries/Create');
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request): RedirectResponse
|
|
{
|
|
$validated = $request->validate([
|
|
'date' => 'required|date',
|
|
'title' => 'required|string|max:500',
|
|
'summary' => 'required|string',
|
|
'notes' => 'nullable|string',
|
|
]);
|
|
|
|
$entry = DocketEntry::create($validated);
|
|
|
|
return redirect()->route('admin.docket-entries.show', $entry->id)
|
|
->with('success', 'Docket entry created successfully.');
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(DocketEntry $docketEntry): Response
|
|
{
|
|
$docketEntry->load('documents');
|
|
|
|
return Inertia::render('Admin/DocketEntries/Show', [
|
|
'entry' => [
|
|
'id' => $docketEntry->id,
|
|
'date' => $docketEntry->date->format('m/d/Y'),
|
|
'title' => $docketEntry->title,
|
|
'summary' => $docketEntry->summary,
|
|
'notes' => $docketEntry->notes,
|
|
'documents' => $docketEntry->documents->map(fn ($doc) => [
|
|
'id' => $doc->id,
|
|
'title' => $doc->title,
|
|
'original_filename' => $doc->original_filename,
|
|
'file_size' => $doc->file_size,
|
|
'summary' => $doc->summary,
|
|
'display_order' => $doc->display_order,
|
|
]),
|
|
],
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(DocketEntry $docketEntry): Response
|
|
{
|
|
return Inertia::render('Admin/DocketEntries/Edit', [
|
|
'entry' => [
|
|
'id' => $docketEntry->id,
|
|
'date' => $docketEntry->date->format('Y-m-d'),
|
|
'title' => $docketEntry->title,
|
|
'summary' => $docketEntry->summary,
|
|
'notes' => $docketEntry->notes,
|
|
],
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, DocketEntry $docketEntry): RedirectResponse
|
|
{
|
|
$validated = $request->validate([
|
|
'date' => 'required|date',
|
|
'title' => 'required|string|max:500',
|
|
'summary' => 'required|string',
|
|
'notes' => 'nullable|string',
|
|
]);
|
|
|
|
$docketEntry->update($validated);
|
|
|
|
return redirect()->route('admin.docket-entries.show', $docketEntry->id)
|
|
->with('success', 'Docket entry updated successfully.');
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(DocketEntry $docketEntry): RedirectResponse
|
|
{
|
|
$docketEntry->delete();
|
|
|
|
return redirect()->route('admin.docket-entries.index')
|
|
->with('success', 'Docket entry deleted successfully.');
|
|
}
|
|
}
|