feat: add a list for flights in admin panel and add edit and delete for flights in admin panel
This commit is contained in:
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Admins\FlightUpdatePostRequest;
|
||||||
|
use App\Models\Airline;
|
||||||
|
use App\Models\Airport;
|
||||||
|
use App\Models\Flight;
|
||||||
|
use Hekmatinasser\Verta\Verta;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class FlightController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$flights = Flight::query()
|
||||||
|
->with([
|
||||||
|
'airline',
|
||||||
|
'airport',
|
||||||
|
'destinationAirport',
|
||||||
|
])
|
||||||
|
->latest('id')
|
||||||
|
->paginate(10);
|
||||||
|
foreach ($flights as $flight) {
|
||||||
|
$flight->start_date_fa = $flight->start_time
|
||||||
|
? $flight->start_time->toJalali()->format('Y/m/d')
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$flight->end_date_fa = $flight->end_time
|
||||||
|
? $flight->end_time->toJalali()->format('Y/m/d')
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$flight->start_time_fa = $flight->start_time
|
||||||
|
? $flight->start_time->format('H:i')
|
||||||
|
: null;
|
||||||
|
|
||||||
|
$flight->end_time_fa = $flight->end_time
|
||||||
|
? $flight->end_time->format('H:i')
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
return view('admin.flights.index', compact('flights'));
|
||||||
|
}
|
||||||
|
public function edit(Flight $flight)
|
||||||
|
{
|
||||||
|
$airlines = Airline::query()
|
||||||
|
->orderBy('name')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$airports = Airport::query()
|
||||||
|
->orderBy('name')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('admin.flights.edit', compact('flight', 'airlines', 'airports'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified flight.
|
||||||
|
*/
|
||||||
|
public function update(FlightUpdatePostRequest $request, Flight $flight)
|
||||||
|
{
|
||||||
|
$data = $request->validated();
|
||||||
|
|
||||||
|
$start = verta::parse($data['start_time'])->datetime();
|
||||||
|
$end = verta::parse($data['end_time'])->datetime();
|
||||||
|
|
||||||
|
$data['start_time'] = $start;
|
||||||
|
$data['end_time'] = $end;
|
||||||
|
|
||||||
|
$flight->update($data);
|
||||||
|
|
||||||
|
return redirect()->route('admin.flights.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$airports = Airport::all();
|
||||||
|
|
||||||
|
return view('admin.flights.create', compact('airports'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Flight $flight)
|
||||||
|
{
|
||||||
|
$flight->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.flights.index')
|
||||||
|
->with('success', 'پرواز با موفقیت حذف شد.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admins;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class FlightUpdatePostRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'flight_number' => [
|
||||||
|
'required',
|
||||||
|
'int',
|
||||||
|
'digits:10',
|
||||||
|
],
|
||||||
|
|
||||||
|
'airline_id' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'exists:airlines,id',
|
||||||
|
],
|
||||||
|
|
||||||
|
'origin_airports_id' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'exists:airports,id',
|
||||||
|
],
|
||||||
|
|
||||||
|
'destination_airports_id' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'exists:airports,id',
|
||||||
|
'different:origin_airports_id',
|
||||||
|
],
|
||||||
|
|
||||||
|
'start_time' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
],
|
||||||
|
|
||||||
|
'end_time' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
],
|
||||||
|
|
||||||
|
'price' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'min:0',
|
||||||
|
],
|
||||||
|
|
||||||
|
'capacity' => [
|
||||||
|
'required',
|
||||||
|
'integer',
|
||||||
|
'min:1',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
/**
|
/**
|
||||||
* Class Flight
|
* Class Flight
|
||||||
*
|
*
|
||||||
@@ -59,6 +59,7 @@ class Flight extends Model
|
|||||||
/**
|
/**
|
||||||
* @var mixed|string
|
* @var mixed|string
|
||||||
*/
|
*/
|
||||||
|
use SoftDeletes;
|
||||||
public mixed $end_date_fa;
|
public mixed $end_date_fa;
|
||||||
protected $table = 'flights';
|
protected $table = 'flights';
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"hekmatinasser/verta": "^9.0",
|
"hekmatinasser/verta": "^9.0",
|
||||||
"laravel/framework": "^12.0",
|
"laravel/framework": "^12.0",
|
||||||
"laravel/tinker": "^2.10.1",
|
"laravel/tinker": "^2.10.1",
|
||||||
|
"morilog/jalali": "^3.5",
|
||||||
"sadegh19b/laravel-persian-validation": "^2.1"
|
"sadegh19b/laravel-persian-validation": "^2.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|||||||
Generated
+133
-1
@@ -4,8 +4,75 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "d2f9c73ad216c4d120251d41cec0c1ee",
|
"content-hash": "680dc3ad2c8f1547466b6104dd7f0c6f",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "beberlei/assert",
|
||||||
|
"version": "v3.3.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/beberlei/assert.git",
|
||||||
|
"reference": "f193f4613c7d7fbcee2c05e4daff4061d49c040e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/beberlei/assert/zipball/f193f4613c7d7fbcee2c05e4daff4061d49c040e",
|
||||||
|
"reference": "f193f4613c7d7fbcee2c05e4daff4061d49c040e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"php": "^7.1 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "*",
|
||||||
|
"phpstan/phpstan": "*",
|
||||||
|
"phpunit/phpunit": ">=6.0.0",
|
||||||
|
"yoast/phpunit-polyfills": "^0.1.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"lib/Assert/functions.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Assert\\": "lib/Assert"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-2-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Benjamin Eberlei",
|
||||||
|
"email": "kontakt@beberlei.de",
|
||||||
|
"role": "Lead Developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Richard Quadling",
|
||||||
|
"email": "rquadling@gmail.com",
|
||||||
|
"role": "Collaborator"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Thin assertion library for input validation in business models.",
|
||||||
|
"keywords": [
|
||||||
|
"assert",
|
||||||
|
"assertion",
|
||||||
|
"validation"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/beberlei/assert/issues",
|
||||||
|
"source": "https://github.com/beberlei/assert/tree/v3.3.4"
|
||||||
|
},
|
||||||
|
"time": "2026-06-10T19:47:05+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
"version": "0.14.8",
|
"version": "0.14.8",
|
||||||
@@ -2311,6 +2378,71 @@
|
|||||||
],
|
],
|
||||||
"time": "2026-01-02T08:56:05+00:00"
|
"time": "2026-01-02T08:56:05+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "morilog/jalali",
|
||||||
|
"version": "v3.5.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/morilog/jalali.git",
|
||||||
|
"reference": "40b906c405b72edd20e73797b40be1e650e872c1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/morilog/jalali/zipball/40b906c405b72edd20e73797b40be1e650e872c1",
|
||||||
|
"reference": "40b906c405b72edd20e73797b40be1e650e872c1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"beberlei/assert": "^3.0",
|
||||||
|
"nesbot/carbon": "^1.21 || ^2.0 || ^3.0",
|
||||||
|
"php": "^7.1 | ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": ">4.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/helpers.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Morilog\\Jalali\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Milad Rey",
|
||||||
|
"email": "miladr@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Morteza Parvini",
|
||||||
|
"email": "m.parvini@outlook.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.",
|
||||||
|
"keywords": [
|
||||||
|
"Jalali",
|
||||||
|
"date",
|
||||||
|
"datetime",
|
||||||
|
"laravel",
|
||||||
|
"morilog"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/morilog/jalali/issues",
|
||||||
|
"source": "https://github.com/morilog/jalali/tree/v3.5.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://issuehunt.io/r/morilog",
|
||||||
|
"type": "issuehunt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2025-12-25T07:12:28+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "nesbot/carbon",
|
"name": "nesbot/carbon",
|
||||||
"version": "3.13.2",
|
"version": "3.13.2",
|
||||||
|
|||||||
@@ -0,0 +1,269 @@
|
|||||||
|
@extends('dashboard.layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'ویرایش پرواز')
|
||||||
|
|
||||||
|
@section('account-content')
|
||||||
|
|
||||||
|
<div class="user-profile-wrapper">
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="col-lg-12 mb-3">
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="user-profile-card">
|
||||||
|
|
||||||
|
<h4 class="user-profile-card-title">
|
||||||
|
ویرایش پرواز
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<div class="user-profile-form">
|
||||||
|
|
||||||
|
<form action="{{ route('admin.flights.update', $flight->id) }}" method="POST">
|
||||||
|
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>شماره پرواز</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="flight_number"
|
||||||
|
class="form-control"
|
||||||
|
value="{{ old('flight_number', $flight->flight_number) }}"
|
||||||
|
placeholder="شماره پرواز"
|
||||||
|
>
|
||||||
|
|
||||||
|
@error('flight_number')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>ایرلاین</label>
|
||||||
|
|
||||||
|
<select name="airline_id" class="form-control">
|
||||||
|
|
||||||
|
<option value="">
|
||||||
|
انتخاب ایرلاین
|
||||||
|
</option>
|
||||||
|
|
||||||
|
@foreach($airlines as $airline)
|
||||||
|
|
||||||
|
<option
|
||||||
|
value="{{ $airline->id }}"
|
||||||
|
{{ old('airline_id', $flight->airline_id) == $airline->id ? 'selected' : '' }}
|
||||||
|
>
|
||||||
|
{{ $airline->name }}
|
||||||
|
</option>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
@error('airline_id')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>مبدأ</label>
|
||||||
|
|
||||||
|
<select name="origin_airports_id" class="form-control">
|
||||||
|
|
||||||
|
<option value="">
|
||||||
|
انتخاب مبدأ
|
||||||
|
</option>
|
||||||
|
|
||||||
|
@foreach($airports as $airport)
|
||||||
|
|
||||||
|
<option
|
||||||
|
value="{{ $airport->id }}"
|
||||||
|
{{ old('origin_airports_id', $flight->origin_airports_id) == $airport->id ? 'selected' : '' }}
|
||||||
|
>
|
||||||
|
{{ $airport->city }}
|
||||||
|
</option>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
@error('origin_airports_id')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>مقصد</label>
|
||||||
|
|
||||||
|
<select name="destination_airports_id" class="form-control">
|
||||||
|
|
||||||
|
<option value="">
|
||||||
|
انتخاب مقصد
|
||||||
|
</option>
|
||||||
|
|
||||||
|
@foreach($airports as $airport)
|
||||||
|
|
||||||
|
<option
|
||||||
|
value="{{ $airport->id }}"
|
||||||
|
{{ old('destination_airports_id', $flight->destination_airports_id) == $airport->id ? 'selected' : '' }}
|
||||||
|
>
|
||||||
|
{{ $airport->city }}
|
||||||
|
</option>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
@error('destination_airports_id')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>تاریخ و ساعت حرکت</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="start_time"
|
||||||
|
id="start_time"
|
||||||
|
class="form-control"
|
||||||
|
value="{{ old('start_time', verta($flight->start_time)->format('Y/m/d H:i')) }}"
|
||||||
|
placeholder="تاریخ و ساعت حرکت"
|
||||||
|
>
|
||||||
|
|
||||||
|
@error('start_time')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>تاریخ و ساعت رسیدن</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="end_time"
|
||||||
|
id="end_time"
|
||||||
|
class="form-control"
|
||||||
|
value="{{ old('end_time', verta($flight->end_time)->format('Y/m/d H:i')) }}"
|
||||||
|
placeholder="تاریخ و ساعت رسیدن"
|
||||||
|
>
|
||||||
|
|
||||||
|
@error('end_time')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>قیمت</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="price"
|
||||||
|
class="form-control"
|
||||||
|
value="{{ old('price', $flight->price) }}"
|
||||||
|
placeholder="قیمت"
|
||||||
|
>
|
||||||
|
|
||||||
|
@error('price')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>ظرفیت</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="capacity"
|
||||||
|
class="form-control"
|
||||||
|
value="{{ old('capacity', $flight->capacity) }}"
|
||||||
|
placeholder="ظرفیت"
|
||||||
|
>
|
||||||
|
|
||||||
|
@error('capacity')
|
||||||
|
<span class="text-danger">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="theme-btn mt-4">
|
||||||
|
بروزرسانی پرواز
|
||||||
|
<i class="far fa-edit"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('scripts')
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$('#start_time').persianDatepicker({
|
||||||
|
format: 'YYYY/MM/DD HH:mm',
|
||||||
|
autoClose: true,
|
||||||
|
timePicker: {
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#end_time').persianDatepicker({
|
||||||
|
format: 'YYYY/MM/DD HH:mm',
|
||||||
|
autoClose: true,
|
||||||
|
timePicker: {
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
@extends('dashboard.layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'لیست پروازها')
|
||||||
|
|
||||||
|
@section('account-content')
|
||||||
|
|
||||||
|
<div class="user-profile-wrapper">
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="col-lg-12 mb-3">
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="user-profile-card">
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center justify-content-between mb-4">
|
||||||
|
<h4 class="user-profile-card-title mb-0">
|
||||||
|
لیست پروازها
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<a href="{{ route('admin.flights.create') }}" class="theme-btn">
|
||||||
|
ساخت پرواز
|
||||||
|
<i class="far fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="user-profile-form">
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<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>
|
||||||
|
{{ $flights->firstItem() + $loop->index }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ $flight->flight_number }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ $flight->airline?->name ?? '-' }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ $flight->airport?->city ?? '-' }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ $flight->destinationAirport?->city ?? '-' }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ $flight->start_date_fa ?? '-' }}
|
||||||
|
<br>
|
||||||
|
<small>{{ $flight->start_time_fa ?? '-' }}</small>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ $flight->end_date_fa ?? '-' }}
|
||||||
|
<br>
|
||||||
|
<small>{{ $flight->end_time_fa ?? '-' }}</small>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ number_format($flight->price) }} تومان
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ $flight->capacity }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<div class="d-flex align-items-center gap-2">
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="{{ route('admin.flights.edit', $flight->id) }}"
|
||||||
|
title="ویرایش"
|
||||||
|
class="btn btn-outline-secondary btn-sm"
|
||||||
|
>
|
||||||
|
<i class="far fa-pen"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<form
|
||||||
|
action="{{ route('admin.flights.destroy', $flight->id) }}"
|
||||||
|
method="POST"
|
||||||
|
style="display: inline-block;"
|
||||||
|
>
|
||||||
|
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
title="حذف"
|
||||||
|
onclick="return confirm('آیا از حذف این پرواز مطمئن هستید؟')"
|
||||||
|
class="btn btn-outline-secondary btn-sm"
|
||||||
|
>
|
||||||
|
<i class="far fa-trash-can"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@empty
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="10" class="text-center">
|
||||||
|
هیچ پروازی ثبت نشده است.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@endforelse
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-4">
|
||||||
|
{{ $flights->links() }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -77,7 +77,6 @@
|
|||||||
<div class="price-info">
|
<div class="price-info">
|
||||||
<span class="price-amount">{{ number_format($flight->price) }} تومان</span>
|
<span class="price-amount">{{ number_format($flight->price) }} تومان</span>
|
||||||
</div>
|
</div>
|
||||||
<a href="#" class="theme-btn">اکنون ثبت کن<i class="far fa-arrow-left"></i></a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flight-booking-detail">
|
<div class="flight-booking-detail">
|
||||||
|
|||||||
Reference in New Issue
Block a user