Files

212 lines
11 KiB
PHP
Raw Permalink Normal View History

2026-02-21 15:50:32 +02:00
@extends('layouts.app')
@section('content')
<div class="bg-gray-50 dark:bg-gray-900 min-h-screen">
<div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Header -->
<div class="mb-8">
<div class="flex items-center justify-between">
<div>
<h1 class="text-3xl font-bold text-gray-900 dark:text-white">Edit Comment</h1>
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">Modify comment content</p>
</div>
<a
href="{{ route('moderation.comments.index') }}"
class="px-4 py-2 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-md font-medium transition-colors"
>
Back to Comments
</a>
</div>
</div>
<!-- Comment Info -->
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6 mb-6">
<h3 class="text-sm font-medium text-gray-900 dark:text-white mb-4">Comment Information</h3>
<div class="grid grid-cols-2 gap-4 text-sm">
<div>
<span class="text-gray-500 dark:text-gray-400">Author:</span>
<a href="{{ route('profile.show', $comment->user) }}" class="ml-2 text-primary-600 dark:text-primary-400 hover:underline">
{{ $comment->user->name }}
</a>
</div>
<div>
<span class="text-gray-500 dark:text-gray-400">Product:</span>
<a href="{{ route('products.show', $comment->product) }}" class="ml-2 text-primary-600 dark:text-primary-400 hover:underline">
{{ $comment->product->name }}
</a>
</div>
<div>
<span class="text-gray-500 dark:text-gray-400">Posted:</span>
<span class="ml-2 text-gray-900 dark:text-white">{{ $comment->created_at->format('M d, Y h:i A') }}</span>
</div>
<div>
<span class="text-gray-500 dark:text-gray-400">Status:</span>
@if($comment->isPending())
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200">
Pending
</span>
@elseif($comment->isApproved())
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200">
Approved
</span>
@else
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200">
Rejected
</span>
@endif
</div>
</div>
@if($comment->moderated_at)
<div class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-700">
<div class="text-xs text-gray-600 dark:text-gray-400">
<strong>Moderated by:</strong> {{ $comment->moderator->name ?? 'Unknown' }}
<span class="mx-2">•</span>
<strong>Date:</strong> {{ $comment->moderated_at->format('M d, Y h:i A') }}
</div>
@if($comment->moderation_note)
<div class="text-xs text-gray-600 dark:text-gray-400 mt-1">
<strong>Note:</strong> {{ $comment->moderation_note }}
</div>
@endif
</div>
@endif
</div>
<!-- Edit Form -->
<form action="{{ route('moderation.comments.update', $comment) }}" method="POST" class="space-y-6">
@csrf
@method('PUT')
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6">
<div>
<label for="body" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
Comment Content <span class="text-red-500">*</span>
</label>
<textarea
name="body"
id="body"
rows="6"
required
class="w-full rounded-md border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm focus:border-primary-500 focus:ring-primary-500 @error('body') border-red-500 @enderror"
>{{ old('body', $comment->body) }}</textarea>
@error('body')
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>
@enderror
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
Edit the comment content if needed (max 1000 characters)
</p>
</div>
</div>
<!-- Actions -->
<div class="flex items-center justify-between">
<a
href="{{ route('moderation.comments.index') }}"
class="px-4 py-2 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-md font-medium transition-colors"
>
Cancel
</a>
<button
type="submit"
class="px-6 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-md font-medium transition-colors"
>
Update Comment
</button>
</div>
</form>
<!-- Moderation Actions -->
<div class="mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6">
<h3 class="text-sm font-medium text-gray-900 dark:text-white mb-4">Change Comment Status</h3>
@if($comment->isPending())
<div class="flex gap-3">
<form action="{{ route('moderation.comments.approve', $comment) }}" method="POST" class="flex-1">
@csrf
<button
type="submit"
class="w-full inline-flex items-center justify-center px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md font-medium transition-colors"
>
<svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
Approve Comment
</button>
</form>
<form action="{{ route('moderation.comments.reject', $comment) }}" method="POST" class="flex-1">
@csrf
<button
type="submit"
class="w-full inline-flex items-center justify-center px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md font-medium transition-colors"
>
<svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
Reject Comment
</button>
</form>
</div>
@elseif($comment->isApproved())
<div class="flex gap-3">
<form action="{{ route('moderation.comments.setPending', $comment) }}" method="POST" class="flex-1">
@csrf
<button
type="submit"
class="w-full inline-flex items-center justify-center px-4 py-2 bg-yellow-600 hover:bg-yellow-700 text-white rounded-md font-medium transition-colors"
>
<svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
Set to Pending
</button>
</form>
<form action="{{ route('moderation.comments.reject', $comment) }}" method="POST" class="flex-1">
@csrf
<button
type="submit"
class="w-full inline-flex items-center justify-center px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md font-medium transition-colors"
>
<svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
Reject Comment
</button>
</form>
</div>
@else
<div class="flex gap-3">
<form action="{{ route('moderation.comments.setPending', $comment) }}" method="POST" class="flex-1">
@csrf
<button
type="submit"
class="w-full inline-flex items-center justify-center px-4 py-2 bg-yellow-600 hover:bg-yellow-700 text-white rounded-md font-medium transition-colors"
>
<svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
Set to Pending
</button>
</form>
<form action="{{ route('moderation.comments.approve', $comment) }}" method="POST" class="flex-1">
@csrf
<button
type="submit"
class="w-full inline-flex items-center justify-center px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md font-medium transition-colors"
>
<svg class="h-5 w-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
Approve Comment
</button>
</form>
</div>
@endif
</div>
</div>
</div>
@endsection