Files
shahrzadzandi09/resources/views/admin/tours/index.blade.php
T
2026-08-17 19:53:12 +03:30

62 lines
2.8 KiB
PHP

@extends('admin.layouts.app') {{-- فرض بر وجود لایوت ادمین --}}
@section('content')
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h2>مدیریت تورها</h2>
<a href="{{ route('admin.tours.create') }}" class="btn btn-primary">افزودن تور جدید</a>
</div>
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<div class="card shadow">
<div class="card-body">
<table class="table table-hover">
<thead class="table-light">
<tr>
<th>تصویر</th>
<th>عنوان تور</th>
<th>قیمت (تومان)</th>
<th>عملیات</th>
</tr>
</thead>
<tbody>
@forelse($tours as $tour)
<tr>
<td>
<img src="{{ asset('storage/' . ($tour->image ?? 'default.jpg')) }}" width="60" class="rounded">
</td>
<td>{{ $tour->title }}</td>
<td>{{ number_format($tour->price) }}</td>
<td>
<div class="btn-group" role="group">
<a href="{{ route('admin.tours.show', $tour->id) }}" class="btn btn-sm btn-info text-white">مشاهده</a>
<a href="{{ route('admin.tours.edit', $tour->id) }}" class="btn btn-sm btn-warning text-white">ویرایش</a>
<form action="{{ route('admin.tours.destroy', $tour->id) }}" method="POST" onsubmit="return confirm('آیا مطمئن هستید؟')">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-danger">حذف</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="text-center">هیچ توری یافت نشد.</td>
</tr>
@endforelse
</tbody>
</table>
{{-- بخش بسیار مهم برای آزمون: نمایش لینک‌های صفحه‌بندی --}}
<div class="d-flex justify-content-center mt-3">
{{ $tours->links() }}
</div>
</div>
</div>
</div>
@endsection