feat: complete flight index blade
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
enum PassengerType: int
|
||||||
|
{
|
||||||
|
case ADULT = 0;
|
||||||
|
case CHILD = 1;
|
||||||
|
}
|
||||||
+28
-2
@@ -7,12 +7,14 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Attributes\Scope;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Flight
|
* Class Flight
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $title
|
* @property string $title
|
||||||
* @property int|null $file_id
|
* @property int|null $file_id
|
||||||
@@ -28,7 +30,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property int $status
|
* @property int $status
|
||||||
* @property Carbon $created_at
|
* @property Carbon $created_at
|
||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
*
|
*
|
||||||
* @property Airline $airline
|
* @property Airline $airline
|
||||||
* @property File|null $file
|
* @property File|null $file
|
||||||
* @property Airport $airport
|
* @property Airport $airport
|
||||||
@@ -49,6 +51,7 @@ class Flight extends Model
|
|||||||
'arrival_airport_id' => 'int',
|
'arrival_airport_id' => 'int',
|
||||||
'price' => 'float',
|
'price' => 'float',
|
||||||
'capacity' => 'int',
|
'capacity' => 'int',
|
||||||
|
'views' => 'int',
|
||||||
'status' => 'int'
|
'status' => 'int'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -64,6 +67,7 @@ class Flight extends Model
|
|||||||
'summary',
|
'summary',
|
||||||
'capacity',
|
'capacity',
|
||||||
'description',
|
'description',
|
||||||
|
'views',
|
||||||
'status'
|
'status'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -86,4 +90,26 @@ class Flight extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(Booking::class);
|
return $this->hasMany(Booking::class);
|
||||||
}
|
}
|
||||||
|
public function arrivalAirport()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Airport::class, 'arrival_airport_id');
|
||||||
|
}
|
||||||
|
public function departureAirport()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Airport::class, 'departure_airport_id');
|
||||||
|
}
|
||||||
|
public function comments()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Comment::class, 'flight_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Scope]
|
||||||
|
protected function applyFilter(Builder $query): void
|
||||||
|
{
|
||||||
|
$request = request();
|
||||||
|
|
||||||
|
if ($request->filled('flight_type')) {
|
||||||
|
$query->where('flight_type', $request->input('flight_type'));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,383 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<main class="main">
|
||||||
|
|
||||||
|
<div class="site-breadcrumb" style="background: url({{ asset('assets/img/banner/01.jpg') }})">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="breadcrumb-title">لیست پرواز</h2>
|
||||||
|
<ul class="breadcrumb-menu">
|
||||||
|
<li><a href="{{ route('index') }}">صفحه اصلی</a></li>
|
||||||
|
<li class="active">لیست پرواز</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-area">
|
||||||
|
<div class="container">
|
||||||
|
<div class="search-wrapper">
|
||||||
|
|
||||||
|
<div class="search-box flight-search">
|
||||||
|
<div class="search-form">
|
||||||
|
<form action="#">
|
||||||
|
|
||||||
|
<div class="flight-type">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="radio" checked value="one-way"
|
||||||
|
name="flight-type" id="flight-type1">
|
||||||
|
<label class="form-check-label" for="flight-type1">
|
||||||
|
یک طرفه
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="radio" value="round-way"
|
||||||
|
name="flight-type" id="flight-type2">
|
||||||
|
<label class="form-check-label" for="flight-type2">
|
||||||
|
راه دور
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="radio" value="multi-city"
|
||||||
|
name="flight-type" id="flight-type3">
|
||||||
|
<label class="form-check-label" for="flight-type3">
|
||||||
|
چند شهر
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flight-search-wrapper">
|
||||||
|
<div class="flight-search-content">
|
||||||
|
|
||||||
|
<div class="flight-search-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>از</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<input type="text" name="from-destination"
|
||||||
|
class="form-control swap-from" value="مشهد">
|
||||||
|
<i class="fal fa-plane-departure"></i>
|
||||||
|
</div>
|
||||||
|
<p>فرودگاه بین المللی مشهد
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="search-form-swap"><i class="far fa-repeat"></i>
|
||||||
|
</div>
|
||||||
|
<label>به</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<input type="text" name="to-destination"
|
||||||
|
class="form-control swap-to" value="تهران">
|
||||||
|
<i class="fal fa-plane-arrival"></i>
|
||||||
|
</div>
|
||||||
|
<p>فرودگاه بین المللی تهران</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="search-form-date">
|
||||||
|
<div class="search-form-journey">
|
||||||
|
<label>تاریخ سفر</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<input type="text" name="journey-date"
|
||||||
|
class="form-control date-picker journey-date">
|
||||||
|
<i class="fal fa-calendar-days"></i>
|
||||||
|
</div>
|
||||||
|
<p class="journey-day-name"></p>
|
||||||
|
</div>
|
||||||
|
<div class="search-form-return">
|
||||||
|
<label>تاریخ برگشت</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<input type="text" name="return-date"
|
||||||
|
class="form-control date-picker return-date">
|
||||||
|
</div>
|
||||||
|
<p class="return-day-name"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group dropdown static-dropdown passenger-box">
|
||||||
|
<div class="passenger-class" role="menu"
|
||||||
|
data-bs-toggle="dropdown" data-bs-display="static"
|
||||||
|
aria-expanded="false">
|
||||||
|
<label>مسافر، کلاس</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<div class="passenger-total"><span
|
||||||
|
class="passenger-total-amount">2</span>
|
||||||
|
مسافر
|
||||||
|
</div>
|
||||||
|
<i class="fal fa-user-plus"></i>
|
||||||
|
</div>
|
||||||
|
<p class="passenger-class-name">بیزنس</p>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-menu dropdown-menu-end">
|
||||||
|
<div class="dropdown-item">
|
||||||
|
<div class="passenger-item">
|
||||||
|
<div class="passenger-info">
|
||||||
|
<h6>بزرگسالان</h6>
|
||||||
|
<p>12+ سال</p>
|
||||||
|
</div>
|
||||||
|
<div class="passenger-qty">
|
||||||
|
<button type="button" class="minus-btn"><i
|
||||||
|
class="far fa-minus"></i></button>
|
||||||
|
<input type="text" name="adult"
|
||||||
|
class="qty-amount passenger-adult"
|
||||||
|
value="2" readonly>
|
||||||
|
<button type="button" class="plus-btn"><i
|
||||||
|
class="far fa-plus"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-item">
|
||||||
|
<div class="passenger-item">
|
||||||
|
<div class="passenger-info">
|
||||||
|
<h6>کودکان</h6>
|
||||||
|
<p>2-12 سال</p>
|
||||||
|
</div>
|
||||||
|
<div class="passenger-qty">
|
||||||
|
<button type="button" class="minus-btn"><i
|
||||||
|
class="far fa-minus"></i></button>
|
||||||
|
<input type="text" name="children"
|
||||||
|
class="qty-amount passenger-children"
|
||||||
|
value="0" readonly>
|
||||||
|
<button type="button" class="plus-btn"><i
|
||||||
|
class="far fa-plus"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-item">
|
||||||
|
<div class="passenger-item">
|
||||||
|
<div class="passenger-info">
|
||||||
|
<h6>نوزاد</h6>
|
||||||
|
<p>در زیر 2 سال</p>
|
||||||
|
</div>
|
||||||
|
<div class="passenger-qty">
|
||||||
|
<button type="button" class="minus-btn"><i
|
||||||
|
class="far fa-minus"></i></button>
|
||||||
|
<input type="text" name="infant"
|
||||||
|
class="qty-amount passenger-infant"
|
||||||
|
value="0" readonly>
|
||||||
|
<button type="button" class="plus-btn"><i
|
||||||
|
class="far fa-plus"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-item">
|
||||||
|
<h6 class="mb-3 mt-2">کلاس کابین</h6>
|
||||||
|
<div class="passenger-class-info">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="radio"
|
||||||
|
value="Economy" name="cabin-class"
|
||||||
|
id="cabin-class1">
|
||||||
|
<label class="form-check-label"
|
||||||
|
for="cabin-class1">
|
||||||
|
اقتصادی
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" checked
|
||||||
|
type="radio" value="Business"
|
||||||
|
name="cabin-class" id="cabin-class2">
|
||||||
|
<label class="form-check-label"
|
||||||
|
for="cabin-class2">
|
||||||
|
بیزنس
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="radio"
|
||||||
|
value="First Class" name="cabin-class"
|
||||||
|
id="cabin-class3">
|
||||||
|
<label class="form-check-label"
|
||||||
|
for="cabin-class3">
|
||||||
|
فرست کلس
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flight-search-item flight-multicity-item have-to-clone">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>از</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<input type="text" name="from-destination"
|
||||||
|
class="form-control swap-from" value="مشهد">
|
||||||
|
<i class="fal fa-plane-departure"></i>
|
||||||
|
</div>
|
||||||
|
<p>فرودگاه بین المللی مشهد
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="search-form-swap"><i class="far fa-repeat"></i>
|
||||||
|
</div>
|
||||||
|
<label>به</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<input type="text" name="to-destination"
|
||||||
|
class="form-control swap-to" value="تهران">
|
||||||
|
<i class="fal fa-plane-arrival"></i>
|
||||||
|
</div>
|
||||||
|
<p>فرودگاه بین المللی تهران</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="search-form-date">
|
||||||
|
<div class="search-form-journey">
|
||||||
|
<label>تاریخ سفر</label>
|
||||||
|
<div class="form-group-icon">
|
||||||
|
<input type="text" name="journey-date"
|
||||||
|
class="form-control date-picker journey-date">
|
||||||
|
<i class="fal fa-calendar-days"></i>
|
||||||
|
</div>
|
||||||
|
<p class="journey-day-name"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="multicity-btn">
|
||||||
|
<i class="fal fa-plus-circle"></i> اضافه
|
||||||
|
کردن پروازی دیگر
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="search-btn">
|
||||||
|
<button type="submit" class="theme-btn"><span class="far fa-search"></span>به
|
||||||
|
روز رسانی جستجو
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flight-booking flight-list py-120">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-lg-4 col-xl-3 mb-4">
|
||||||
|
<form action="{{ route('flights.index') }}" method="GET">
|
||||||
|
<div class="booking-sidebar">
|
||||||
|
<div class="booking-item">
|
||||||
|
<h4 class="booking-title">نوع پرواز</h4>
|
||||||
|
|
||||||
|
<div class="flight-class">
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="flight_type"
|
||||||
|
value="0"
|
||||||
|
id="flight-type-0"
|
||||||
|
{{ request('flight_type') == '0' ? 'checked' : '' }}
|
||||||
|
>
|
||||||
|
|
||||||
|
<label class="form-check-label" for="flight-type-0">
|
||||||
|
رفت
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="flight_type"
|
||||||
|
value="1"
|
||||||
|
id="flight-type-1"
|
||||||
|
{{ request('flight_type') == '1' ? 'checked' : '' }}
|
||||||
|
>
|
||||||
|
|
||||||
|
<label class="form-check-label" for="flight-type-1">
|
||||||
|
برگشت
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="flight_type"
|
||||||
|
value="2"
|
||||||
|
id="flight-type-2"
|
||||||
|
{{ request('flight_type') == '2' ? 'checked' : '' }}
|
||||||
|
>
|
||||||
|
|
||||||
|
<label class="form-check-label" for="flight-type-2">
|
||||||
|
رفت و برگشت
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-3">
|
||||||
|
<button type="submit" class="theme-btn">
|
||||||
|
<i class="far fa-filter"></i>
|
||||||
|
اعمال فیلتر
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-8 col-xl-9">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="booking-sort">
|
||||||
|
<h5>{{ $flights->total() }} نتیجه پیداشد</h5>
|
||||||
|
<div class="col-md-3 booking-sort-box">
|
||||||
|
<select class="select">
|
||||||
|
<option value="1">مرتب سازی پیشفرض</option>
|
||||||
|
<option value="2">بر اساس محبوبیت</option>
|
||||||
|
<option value="3">بر اساس پایین ترین قیمت</option>
|
||||||
|
<option value="4">بر اساس بالاترین قیمت</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
@forelse($flights as $flight)
|
||||||
|
@include('components.flight')
|
||||||
|
@empty
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="text-center py-5">
|
||||||
|
<i class="far fa-plane-slash fa-3x mb-3"></i>
|
||||||
|
<h4>پروازی یافت نشد</h4>
|
||||||
|
<p>در حال حاضر هیچ پروازی برای نمایش وجود ندارد.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
|
|
||||||
|
{{ $flights->links() }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
@endsection
|
||||||
Reference in New Issue
Block a user