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

404 lines
12 KiB
PHP

@extends('admin.layouts.app')
@section('content')
<div class="container mt-4">
{{-- ============================= --}}
{{-- هدر صفحه --}}
{{-- ============================= --}}
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h2 class="mb-1">
مدیریت تورها
</h2>
<p class="text-muted mb-0">
لیست تورهای ثبت شده در سیستم
</p>
</div>
<a
href="{{ route('admin.tours.create') }}"
class="btn btn-primary"
>
<i class="fa fa-plus"></i>
افزودن تور جدید
</a>
</div>
{{-- ============================= --}}
{{-- پیام موفقیت --}}
{{-- ============================= --}}
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show">
{{ session('success') }}
<button
type="button"
class="close"
data-dismiss="alert"
aria-label="Close"
>
<span>&times;</span>
</button>
</div>
@endif
{{-- ============================= --}}
{{-- خطاهای عمومی --}}
{{-- ============================= --}}
@if($errors->has('general'))
<div class="alert alert-danger">
{{ $errors->first('general') }}
</div>
@endif
{{-- ============================= --}}
{{-- جدول تورها --}}
{{-- ============================= --}}
<div class="card shadow-sm">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<strong>
لیست تورها
</strong>
<span class="badge badge-primary">
{{ $tours->total() }}
تور
</span>
</div>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover table-bordered mb-0">
<thead class="thead-light">
<tr>
<th style="width: 80px;">
#
</th>
<th style="width: 100px;">
تصویر
</th>
<th>
عنوان تور
</th>
<th>
قیمت
</th>
<th>
تاریخ حرکت
</th>
<th>
وضعیت
</th>
<th style="width: 230px;">
عملیات
</th>
</tr>
</thead>
<tbody>
@forelse($tours as $tour)
<tr>
{{-- شماره --}}
<td>
{{ $tours->firstItem() + $loop->index }}
</td>
{{-- تصویر --}}
<td>
@if($tour->image)
<img
src="{{ asset('storage/' . $tour->image) }}"
alt="{{ $tour->title }}"
width="70"
height="60"
class="rounded"
style="object-fit: cover;"
>
@else
<img
src="{{ asset('images/no-image.jpg') }}"
alt="بدون تصویر"
width="70"
height="60"
class="rounded"
style="object-fit: cover;"
>
@endif
</td>
{{-- عنوان --}}
<td>
<strong>
{{ $tour->title }}
</strong>
@if($tour->slug)
<small class="d-block text-muted">
{{ $tour->slug }}
</small>
@endif
</td>
{{-- قیمت --}}
<td>
@if($tour->price)
<strong>
{{ number_format($tour->price) }}
</strong>
تومان
@else
<span class="text-muted">
تعیین نشده
</span>
@endif
</td>
{{-- تاریخ حرکت --}}
<td>
@if($tour->start_date)
{{ $tour->start_date }}
@else
<span class="text-muted">
—
</span>
@endif
</td>
{{-- وضعیت --}}
<td>
@if($tour->status == 2)
<span class="badge badge-success">
تایید شده
</span>
@elseif($tour->status == 1)
<span class="badge badge-warning">
در انتظار تایید
</span>
@elseif($tour->status == 3)
<span class="badge badge-danger">
رد شده
</span>
@else
<span class="badge badge-secondary">
نامشخص
</span>
@endif
</td>
{{-- عملیات --}}
<td>
<div class="btn-group">
{{-- مشاهده --}}
<a
href="{{ route('admin.tours.show', $tour->id) }}"
class="btn btn-sm btn-info text-white"
>
<i class="fa fa-eye"></i>
مشاهده
</a>
{{-- ویرایش --}}
<a
href="{{ route('admin.tours.edit', $tour->id) }}"
class="btn btn-sm btn-warning text-white"
>
<i class="fa fa-edit"></i>
ویرایش
</a>
{{-- حذف --}}
<form
action="{{ route('admin.tours.destroy', $tour->id) }}"
method="POST"
onsubmit="return confirm('آیا از حذف این تور مطمئن هستید؟')"
style="display: inline;"
>
@csrf
@method('DELETE')
<button
type="submit"
class="btn btn-sm btn-danger"
>
<i class="fa fa-trash"></i>
حذف
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td
colspan="7"
class="text-center py-5"
>
<div class="text-muted">
<i
class="fa fa-plane"
style="font-size: 40px;"
></i>
<p class="mt-3 mb-0">
هیچ توری یافت نشد.
</p>
</div>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
{{-- ============================= --}}
{{-- Pagination --}}
{{-- ============================= --}}
@if($tours->hasPages())
<div class="card-footer">
<div class="d-flex justify-content-center">
{{ $tours->links() }}
</div>
</div>
@endif
</div>
</div>
@endsection