Files
hatame.andarza09/resources/views/admin/tours/index.blade.php
T

290 lines
6.0 KiB
PHP

@extends('admin.layouts.app')
@section('content')
<div class="container">
<div class="d-flex justify-content-between mb-4">
<h4>
مدیریت تورها
</h4>
<a href="{{ route('admin.tours.create') }}"
class="btn btn-primary">
ثبت تور جدید
</a>
</div>
<form method="GET"
action="{{ route('admin.tours.index') }}"
class="mb-3">
<div class="row">
<div class="col-md-4">
<input type="text"
name="search"
class="form-control"
placeholder="جستجو..."
value="{{ request('search') }}">
</div>
<div class="col-md-3">
<select name="type" class="form-control">
<option value="">
همه انواع
</option>
<option value="0"
@selected(request('type')=='0')>
داخلی
</option>
<option value="2"
@selected(request('type')=='2')>
خارجی
</option>
<option value="3"
@selected(request('type')=='3')>
چارتر
</option>
</select>
</div>
<div class="col-md-3">
<select name="sort"
class="form-control">
<option value="newest">
جدیدترین
</option>
<option value="price_asc">
ارزان‌ترین
</option>
<option value="price_desc">
گران‌ترین
</option>
</select>
</div>
<div class="col-md-2">
<button class="btn btn-dark w-100">
جستجو
</button>
</div>
</div>
</form>
<table class="table table-bordered text-center">
<thead>
<tr>
<th>
شناسه
</th>
<th>
عنوان تور
</th>
<th>
تصویر
</th>
<th>
نوع سفر
</th>
<th>
تاریخ حرکت
</th>
<th>
قیمت
</th>
<th>
بازدید
</th>
<th>
وضعیت
</th>
<th>
عملیات
</th>
</tr>
</thead>
<tbody>
@forelse($tours as $tour)
<tr>
<td>
{{ $loop->iteration }}
</td>
<td>
{{ $tour->title }}
</td>
<td>
@if($tour->image)
<img src="{{ getImageUrl($tour->image) }}"
width="120">
@endif
</td>
<td>
{{ $tour->travelType->name ?? '-' }}
</td>
<td>
{{ verta($tour->departure_date)->format('Y/m/d') }}
</td>
<td>
{{ number_format($tour->price) }}
</td>
<td>
{{ $tour->views }}
</td>
<td>
@switch($tour->status)
@case(0)
پیش نویس
@break
@case(1)
فعال
@break
@case(2)
غیرفعال
@break
@case(3)
تمام شده
@break
@case(4)
لغو شده
@break
@endswitch
</td>
<td>
<a href="{{ route('admin.tours.edit',$tour) }}"
class="btn btn-warning btn-sm">
ویرایش
</a>
<form action="{{ route('admin.tours.destroy',$tour) }}"
method="POST"
class="d-inline">
@csrf
@method('DELETE')
<button class="btn btn-danger btn-sm"
onclick="return confirm('حذف شود؟')">
حذف
</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="9">
موردی یافت نشد
</td>
</tr>
@endforelse
</tbody>
</table>
{{ $tours->links() }}
</div>
@endsection