lots of design improvements
This commit is contained in:
@@ -1,215 +1,300 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-10">
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
{{ session('success') }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<!-- Success Message -->
|
||||
@if(session('success'))
|
||||
<div class="mb-6 rounded-md bg-green-50 p-4">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-5 w-5 text-green-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm font-medium text-green-800">{{ session('success') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
|
||||
<!-- Product Header -->
|
||||
<div class="px-6 py-8 border-b border-gray-200">
|
||||
<div class="flex flex-col md:flex-row md:items-start md:justify-between gap-4">
|
||||
<div class="flex-1">
|
||||
<div class="flex items-center gap-3 mb-3">
|
||||
<h1 class="text-3xl font-bold text-gray-900">{{ $product->title }}</h1>
|
||||
|
||||
<!-- Status Badges -->
|
||||
@if($product->isPending())
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-yellow-100 text-yellow-800">
|
||||
Pending Review
|
||||
</span>
|
||||
@elseif($product->isApproved())
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-green-100 text-green-800">
|
||||
Approved
|
||||
</span>
|
||||
@elseif($product->isRejected())
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium bg-red-100 text-red-800">
|
||||
Rejected
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3 text-sm text-gray-600">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-md bg-primary-100 text-primary-800 font-medium">
|
||||
{{ $product->category->name }}
|
||||
</span>
|
||||
<span>•</span>
|
||||
<a href="{{ route('profile.show', $product->user) }}" class="hover:text-primary-600">
|
||||
by {{ $product->user->name }}
|
||||
</a>
|
||||
<span>•</span>
|
||||
<span>{{ $product->created_at->format('M j, Y') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="flex items-center gap-2">
|
||||
@auth
|
||||
<!-- Upvote Button -->
|
||||
<button
|
||||
class="upvote-btn flex items-center gap-2 px-4 py-2 rounded-md border transition-colors {{ $product->isUpvotedBy(auth()->user()) ? 'border-primary-500 bg-primary-50 text-primary-700' : 'border-gray-300 bg-white text-gray-700 hover:border-primary-500 hover:bg-primary-50' }}"
|
||||
data-product-id="{{ $product->id }}"
|
||||
data-upvoted="{{ $product->isUpvotedBy(auth()->user()) ? 'true' : 'false' }}">
|
||||
<svg class="h-5 w-5" fill="{{ $product->isUpvotedBy(auth()->user()) ? 'currentColor' : 'none' }}" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
<span class="upvote-count font-semibold">{{ $product->upvotes()->count() }}</span>
|
||||
</button>
|
||||
|
||||
<!-- Bookmark Button -->
|
||||
<button
|
||||
class="bookmark-btn p-2 rounded-md border transition-colors {{ $product->isBookmarkedBy(auth()->user()) ? 'border-primary-500 bg-primary-50 text-primary-700' : 'border-gray-300 bg-white text-gray-700 hover:border-gray-400' }}"
|
||||
data-product-id="{{ $product->id }}"
|
||||
data-bookmarked="{{ $product->isBookmarkedBy(auth()->user()) ? 'true' : 'false' }}">
|
||||
<svg class="h-5 w-5" fill="{{ $product->isBookmarkedBy(auth()->user()) ? 'currentColor' : 'none' }}" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
@else
|
||||
<div class="flex items-center gap-2 px-4 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-700">
|
||||
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
<span class="font-semibold">{{ $product->upvotes()->count() }}</span>
|
||||
</div>
|
||||
@endauth
|
||||
|
||||
@can('edit-product', $product)
|
||||
<a href="{{ route('products.edit', $product) }}" class="inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
||||
Edit
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('delete-product', $product)
|
||||
<form action="{{ route('products.destroy', $product) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this product?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="inline-flex items-center px-3 py-2 border border-red-300 shadow-sm text-sm font-medium rounded-md text-red-700 bg-white hover:bg-red-50">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Product Content -->
|
||||
<div class="px-6 py-8">
|
||||
<!-- Product Thumbnail -->
|
||||
@if($product->thumbnail_url)
|
||||
<div class="mb-8 rounded-lg overflow-hidden border border-gray-200">
|
||||
<img src="{{ $product->thumbnail_url }}"
|
||||
alt="{{ $product->title }}"
|
||||
class="w-full h-auto max-h-96 object-contain bg-gray-50">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- Product Header -->
|
||||
<div class="d-flex justify-content-between align-items-start mb-4">
|
||||
<div class="flex-grow-1">
|
||||
<h1 class="mb-2">{{ $product->title }}</h1>
|
||||
<p class="text-muted mb-0">
|
||||
<span class="badge bg-secondary">{{ $product->category->name }}</span>
|
||||
@if($product->isPending())
|
||||
<span class="badge bg-warning text-dark">Pending Review</span>
|
||||
@elseif($product->isApproved())
|
||||
<span class="badge bg-success">Approved</span>
|
||||
@elseif($product->isRejected())
|
||||
<span class="badge bg-danger">Rejected</span>
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
@auth
|
||||
<!-- Upvote Button -->
|
||||
<button
|
||||
class="btn btn-outline-primary upvote-btn {{ $product->isUpvotedBy(auth()->user()) ? 'active' : '' }}"
|
||||
data-product-id="{{ $product->id }}"
|
||||
data-upvoted="{{ $product->isUpvotedBy(auth()->user()) ? 'true' : 'false' }}">
|
||||
<i class="bi bi-arrow-up-circle"></i>
|
||||
<span class="upvote-count">{{ $product->upvotes()->count() }}</span>
|
||||
</button>
|
||||
<!-- Product Description -->
|
||||
<div class="mb-8">
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-4">About</h2>
|
||||
<p class="text-gray-700 text-lg leading-relaxed whitespace-pre-line">{{ $product->description }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Bookmark Button -->
|
||||
<button
|
||||
class="btn btn-outline-secondary bookmark-btn {{ $product->isBookmarkedBy(auth()->user()) ? 'active' : '' }}"
|
||||
data-product-id="{{ $product->id }}"
|
||||
data-bookmarked="{{ $product->isBookmarkedBy(auth()->user()) ? 'true' : 'false' }}">
|
||||
<i class="bi {{ $product->isBookmarkedBy(auth()->user()) ? 'bi-bookmark-fill' : 'bi-bookmark' }}"></i>
|
||||
</button>
|
||||
<!-- Visit Website Button -->
|
||||
<div class="mb-8">
|
||||
<a href="{{ $product->website_url }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 shadow-sm">
|
||||
Visit Website
|
||||
<svg class="ml-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Product Metadata -->
|
||||
@if($product->isApproved() && $product->approved_at)
|
||||
<div class="pt-6 border-t border-gray-200">
|
||||
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Submitted by</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">
|
||||
<a href="{{ route('profile.show', $product->user) }}" class="hover:text-primary-600">
|
||||
{{ $product->user->name }}
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Submitted on</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $product->created_at->format('F j, Y') }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Approved on</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $product->approved_at->format('F j, Y') }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">Category</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $product->category->name }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Comments Section -->
|
||||
<div class="bg-white rounded-lg shadow-sm border border-gray-200 mt-6">
|
||||
<div class="px-6 py-4 border-b border-gray-200">
|
||||
<h2 class="text-xl font-semibold text-gray-900">
|
||||
Comments ({{ $product->comments()->count() }})
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="px-6 py-6">
|
||||
@auth
|
||||
<!-- Comment Form -->
|
||||
<form action="{{ route('products.comments.store', $product) }}" method="POST" class="mb-8">
|
||||
@csrf
|
||||
<div>
|
||||
<label for="body" class="sr-only">Add a comment</label>
|
||||
<textarea
|
||||
id="body"
|
||||
name="body"
|
||||
rows="3"
|
||||
required
|
||||
maxlength="1000"
|
||||
placeholder="Share your thoughts about this product..."
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 sm:text-sm @error('body') border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500 @enderror">{{ old('body') }}</textarea>
|
||||
@error('body')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="mt-3 flex justify-end">
|
||||
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
|
||||
Post Comment
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@else
|
||||
<div class="text-center py-6 bg-gray-50 rounded-lg mb-8">
|
||||
<p class="text-gray-600">
|
||||
<a href="{{ route('login') }}" class="font-medium text-primary-600 hover:text-primary-500">Log in</a>
|
||||
to post a comment
|
||||
</p>
|
||||
</div>
|
||||
@endauth
|
||||
|
||||
<!-- Comments List -->
|
||||
<div class="space-y-6">
|
||||
@forelse($product->comments as $comment)
|
||||
<div class="flex gap-4">
|
||||
<!-- Avatar -->
|
||||
<div class="flex-shrink-0">
|
||||
@if($comment->user->avatar_url)
|
||||
<img src="{{ $comment->user->avatar_url }}"
|
||||
alt="{{ $comment->user->name }}"
|
||||
class="h-10 w-10 rounded-full object-cover">
|
||||
@else
|
||||
<div class="text-muted">
|
||||
<i class="bi bi-arrow-up-circle"></i>
|
||||
<span>{{ $product->upvotes()->count() }}</span> upvotes
|
||||
<div class="h-10 w-10 rounded-full bg-gradient-to-br from-primary-500 to-accent-500 flex items-center justify-center text-white font-semibold">
|
||||
{{ strtoupper(substr($comment->user->name, 0, 1)) }}
|
||||
</div>
|
||||
@endauth
|
||||
|
||||
@can('edit-product', $product)
|
||||
<a href="{{ route('products.edit', $product) }}" class="btn btn-sm btn-outline-primary">Edit</a>
|
||||
@endcan
|
||||
@can('delete-product', $product)
|
||||
<form action="{{ route('products.destroy', $product) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this product?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger">Delete</button>
|
||||
</form>
|
||||
@endcan
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Product Thumbnail -->
|
||||
@if($product->thumbnail_url)
|
||||
<div class="mb-4">
|
||||
<img src="{{ $product->thumbnail_url }}" alt="{{ $product->title }}" class="img-fluid rounded" style="max-height: 400px;">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Product Description -->
|
||||
<div class="mb-4">
|
||||
<h4>About</h4>
|
||||
<p class="lead">{{ $product->description }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Product Links -->
|
||||
<div class="mb-4">
|
||||
<a href="{{ $product->website_url }}" target="_blank" rel="noopener" class="btn btn-primary btn-lg">
|
||||
Visit Website →
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Product Metadata -->
|
||||
<hr>
|
||||
<div class="row text-muted small">
|
||||
<div class="col-md-6">
|
||||
<strong>Submitted by:</strong>
|
||||
<a href="{{ route('profile.show', $product->user) }}">{{ $product->user->name }}</a>
|
||||
</div>
|
||||
<div class="col-md-6 text-md-end">
|
||||
<strong>Submitted:</strong> {{ $product->created_at->format('F j, Y') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($product->isApproved() && $product->approved_at)
|
||||
<div class="row text-muted small mt-2">
|
||||
<div class="col-md-12">
|
||||
<strong>Approved:</strong> {{ $product->approved_at->format('F j, Y') }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Comments Section -->
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Comments ({{ $product->comments()->count() }})</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@auth
|
||||
<!-- Comment Form -->
|
||||
<form action="{{ route('products.comments.store', $product) }}" method="POST" class="mb-4">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<textarea
|
||||
class="form-control @error('body') is-invalid @enderror"
|
||||
name="body"
|
||||
rows="3"
|
||||
placeholder="Share your thoughts about this product..."
|
||||
required
|
||||
maxlength="1000">{{ old('body') }}</textarea>
|
||||
@error('body')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Post Comment</button>
|
||||
</form>
|
||||
@else
|
||||
<p class="text-muted">
|
||||
<a href="{{ route('login') }}">Login</a> to post a comment.
|
||||
</p>
|
||||
@endauth
|
||||
|
||||
<!-- Comments List -->
|
||||
@forelse($product->comments as $comment)
|
||||
<div class="border-top pt-3 mt-3">
|
||||
<div class="d-flex">
|
||||
<div class="me-3">
|
||||
@if($comment->user->avatar_url)
|
||||
<img src="{{ $comment->user->avatar_url }}" alt="{{ $comment->user->name }}" class="rounded-circle" style="width: 40px; height: 40px; object-fit: cover;">
|
||||
@else
|
||||
<div class="bg-secondary text-white rounded-circle d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
|
||||
{{ strtoupper(substr($comment->user->name, 0, 1)) }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<div class="d-flex justify-content-between align-items-start">
|
||||
<div>
|
||||
<strong>{{ $comment->user->name }}</strong>
|
||||
<span class="text-muted small">· {{ $comment->created_at->diffForHumans() }}</span>
|
||||
</div>
|
||||
@can('delete-comment', $comment)
|
||||
<form action="{{ route('comments.destroy', $comment) }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-sm btn-link text-danger p-0" onclick="return confirm('Are you sure you want to delete this comment?');">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
@endcan
|
||||
</div>
|
||||
<p class="mb-0 mt-2">{{ $comment->body }}</p>
|
||||
<!-- Comment Content -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('profile.show', $comment->user) }}" class="font-medium text-gray-900 hover:text-primary-600">
|
||||
{{ $comment->user->name }}
|
||||
</a>
|
||||
<span class="text-gray-500 text-sm">·</span>
|
||||
<span class="text-gray-500 text-sm">{{ $comment->created_at->diffForHumans() }}</span>
|
||||
</div>
|
||||
@can('delete-comment', $comment)
|
||||
<form action="{{ route('comments.destroy', $comment) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this comment?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-sm text-red-600 hover:text-red-700">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-muted text-center py-4">No comments yet. Be the first to comment!</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Moderator Actions -->
|
||||
@can('approve-product')
|
||||
@if($product->isPending() || $product->isRejected())
|
||||
<div class="card mt-3">
|
||||
<div class="card-header bg-warning">
|
||||
<h5 class="mb-0">Moderator Actions</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('products.approve', $product) }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-success">Approve Product</button>
|
||||
</form>
|
||||
<form action="{{ route('products.reject', $product) }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to reject this product?');">Reject Product</button>
|
||||
</form>
|
||||
<p class="mt-2 text-gray-700 whitespace-pre-line">{{ $comment->body }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endcan
|
||||
|
||||
<div class="mt-3">
|
||||
<a href="{{ route('products.index') }}" class="btn btn-secondary">← Back to Products</a>
|
||||
@empty
|
||||
<div class="text-center py-12 bg-gray-50 rounded-lg">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path>
|
||||
</svg>
|
||||
<p class="mt-2 text-gray-600">No comments yet. Be the first to share your thoughts!</p>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('styles')
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
@endpush
|
||||
<!-- Moderator Actions -->
|
||||
@can('approve-product')
|
||||
@if($product->isPending() || $product->isRejected())
|
||||
<div class="bg-yellow-50 border border-yellow-200 rounded-lg mt-6">
|
||||
<div class="px-6 py-4 border-b border-yellow-200 bg-yellow-100">
|
||||
<h3 class="text-lg font-semibold text-yellow-900">Moderator Actions</h3>
|
||||
</div>
|
||||
<div class="px-6 py-4 flex gap-3">
|
||||
<form action="{{ route('products.approve', $product) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700">
|
||||
Approve Product
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('products.reject', $product) }}" method="POST" onsubmit="return confirm('Are you sure you want to reject this product?');">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700">
|
||||
Reject Product
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endcan
|
||||
|
||||
<!-- Back Button -->
|
||||
<div class="mt-6">
|
||||
<a href="{{ route('products.index') }}" class="inline-flex items-center text-sm font-medium text-gray-600 hover:text-gray-900">
|
||||
<svg class="mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
|
||||
</svg>
|
||||
Back to Products
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
@@ -234,10 +319,16 @@
|
||||
if (data.success) {
|
||||
// Update button state
|
||||
this.setAttribute('data-upvoted', data.upvoted ? 'true' : 'false');
|
||||
|
||||
const svg = this.querySelector('svg');
|
||||
if (data.upvoted) {
|
||||
this.classList.add('active');
|
||||
this.classList.remove('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-primary-500', 'hover:bg-primary-50');
|
||||
this.classList.add('border-primary-500', 'bg-primary-50', 'text-primary-700');
|
||||
svg.setAttribute('fill', 'currentColor');
|
||||
} else {
|
||||
this.classList.remove('active');
|
||||
this.classList.remove('border-primary-500', 'bg-primary-50', 'text-primary-700');
|
||||
this.classList.add('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-primary-500', 'hover:bg-primary-50');
|
||||
svg.setAttribute('fill', 'none');
|
||||
}
|
||||
|
||||
// Update count
|
||||
@@ -270,16 +361,16 @@
|
||||
if (data.success) {
|
||||
// Update button state
|
||||
this.setAttribute('data-bookmarked', data.bookmarked ? 'true' : 'false');
|
||||
const icon = this.querySelector('i');
|
||||
|
||||
const svg = this.querySelector('svg');
|
||||
if (data.bookmarked) {
|
||||
this.classList.add('active');
|
||||
icon.classList.remove('bi-bookmark');
|
||||
icon.classList.add('bi-bookmark-fill');
|
||||
this.classList.remove('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-gray-400');
|
||||
this.classList.add('border-primary-500', 'bg-primary-50', 'text-primary-700');
|
||||
svg.setAttribute('fill', 'currentColor');
|
||||
} else {
|
||||
this.classList.remove('active');
|
||||
icon.classList.remove('bi-bookmark-fill');
|
||||
icon.classList.add('bi-bookmark');
|
||||
this.classList.remove('border-primary-500', 'bg-primary-50', 'text-primary-700');
|
||||
this.classList.add('border-gray-300', 'bg-white', 'text-gray-700', 'hover:border-gray-400');
|
||||
svg.setAttribute('fill', 'none');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user