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

276 lines
5.8 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.flights.create') }}"
class="btn btn-primary">
ثبت پرواز جدید
</a>
</div>
<form method="GET"
action="{{ route('admin.flights.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($flights as $flight)
<tr>
<td>
{{ $loop->iteration }}
</td>
<td>
{{ $flight->airline }}
</td>
<td>
@if($flight->image)
<img src="{{ getImageUrl($flight->image) }}"
width="120">
@endif
</td>
<td>
{{ $flight->flight_number }}
</td>
<td>
{{ $flight->origin }}
-
{{ $flight->destination }}
</td>
<td>
@switch($flight->type)
@case(0)
داخلی
@break
@case(2)
خارجی
@break
@case(3)
چارتر
@break
@endswitch
</td>
<td>
{{ number_format($flight->price) }}
</td>
<td>
{{ $flight->status }}
</td>
<td>
<a href="{{ route('admin.flights.edit',$flight) }}"
class="btn btn-warning btn-sm">
ویرایش
</a>
<form action="{{ route('admin.flights.destroy',$flight) }}"
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="8">
موردی یافت نشد
</td>
</tr>
@endforelse
</tbody>
</table>
{{ $flights->links() }}
</div>
@endsection