Files
shahrzadzandi09/resources/views/admin/favorites/index.blade.php
T

59 lines
2.6 KiB
PHP

@extends('admin.layouts.app')
@section('title', 'لیست علاقه‌مندی‌ها')
@section('content')
<div class="container-fluid py-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="mb-0">علاقه‌مندی‌های کاربران</h4>
<span class="badge text-bg-info">{{ $favorites->total() }} مورد</span>
</div>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<div class="card shadow-sm">
<table class="table table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th>کاربر</th>
<th>نوع آیتم</th>
<th>شناسه آیتم</th>
<th>تاریخ ثبت</th>
<th class="text-center">عملیات</th>
</tr>
</thead>
<tbody>
@forelse ($favorites as $favorite)
<tr>
<td>{{ $favorite->user?->name ?? 'نامشخص' }}</td>
<td>
<span
class="badge text-bg-secondary">{{ class_basename($favorite->favoritable_type) }}</span>
</td>
<td>{{ $favorite->favoritable_id }}</td>
<td class="text-muted small">{{ $favorite->created_at->format('Y/m/d') }}</td>
<td class="text-center">
<div class="btn-group btn-group-sm">
<a href="{{ route('admin.favorites.show', $favorite) }}" class="btn btn-outline-info">نمایش</a>
<form action="{{ route('admin.favorites.destroy', $favorite) }}" method="POST"
onsubmit="return confirm('حذف شود؟')">
@csrf @method('DELETE')
<button class="btn btn-outline-danger">حذف</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="text-center">موردی یافت نشد.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-3">{{ $favorites->links() }}</div>
</div>
@endsection