feat: complete flights in admin side

This commit is contained in:
2026-08-20 08:11:43 -07:00
parent d9d9d2eaf9
commit 5cbbb11ee6
6 changed files with 1144 additions and 63 deletions
@@ -0,0 +1,66 @@
<?php
namespace App\Console\Commands;
use App\Enums\AdminStatus;
use App\Models\Admin;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
class AdminGeneratorCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:admin-generator';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$admin=Admin::create([
'full_name' => 'Admin',
'username' => 'admin',
'password' => Hash::make('12345678'),
'status' => AdminStatus::ENABLE
]);
AdminPermission::create([
'admin_id' => $admin->id,
'flight_create' => true,
'flight_edit' => true,
'flight_delete' => true,
'tour_create' => true,
'tour_edit' => true,
'tour_delete' => true,
'booking_view' => true,
'booking_edit' => true,
'booking_delete' => true,
'user_view' => true,
'user_edit' => true,
'user_delete' => true,
'admin_view' => true,
'admin_create' => true,
'admin_edit' => true,
'admin_delete' => true,
]);
$this->info('Admin created successfully');
}
}
@@ -0,0 +1,359 @@
@extends('admin.layouts.app')
@section('content')
<div class="main-content app-content">
<div class="container-fluid pt-4">
<div class="row">
<div class="col-xl-12">
<form action="{{ route('admin.flights.store') }}" method="POST" enctype="multipart/form-data">
@csrf
@error('general')
<span class="text-danger">{{ $message }}</span>
@enderror
<div class="card custom-card">
<div class="card-header">
<div class="card-title">
ایجاد پرواز
</div>
</div>
<div class="card-body pt-0">
<div class="row gy-3">
<!-- Title -->
<div class="col-xl-6">
<label class="form-label">عنوان پرواز</label>
<input
type="text"
class="form-control"
name="title"
placeholder="عنوان پرواز را وارد کنید"
value="{{ old('title') }}"
>
@error('title')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Airline -->
<div class="col-xl-6">
<label class="form-label">شرکت هواپیمایی</label>
<select class="form-control" name="airline_id">
<option value="">
یک شرکت هواپیمایی انتخاب کنید
</option>
@foreach($airlines as $airline)
<option
value="{{ $airline->id }}"
@selected(old('airline_id') == $airline->id)
>
{{ $airline->name }}
</option>
@endforeach
</select>
@error('airline_id')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Flight Type -->
<div class="col-xl-6">
<label class="form-label">نوع پرواز</label>
<select class="form-control" name="flight_type">
<option
value="0"
@selected(old('flight_type') == '0')
>
رفت
</option>
<option
value="1"
@selected(old('flight_type') == '1')
>
برگشت
</option>
<option
value="2"
@selected(old('flight_type') == '2')
>
رفت و برگشت
</option>
</select>
@error('flight_type')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Departure Airport -->
<div class="col-xl-6">
<label class="form-label">فرودگاه مبدأ</label>
<select class="form-control" name="departure_airport_id">
<option value="">
فرودگاه مبدأ را انتخاب کنید
</option>
@foreach($airports as $airport)
<option
value="{{ $airport->id }}"
@selected(old('departure_airport_id') == $airport->id)
>
{{ $airport->name }}
@if($airport->city)
- {{ $airport->city->name }}
@endif
</option>
@endforeach
</select>
@error('departure_airport_id')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Arrival Airport -->
<div class="col-xl-6">
<label class="form-label">فرودگاه مقصد</label>
<select class="form-control" name="arrival_airport_id">
<option value="">
فرودگاه مقصد را انتخاب کنید
</option>
@foreach($airports as $airport)
<option
value="{{ $airport->id }}"
@selected(old('arrival_airport_id') == $airport->id)
>
{{ $airport->name }}
@if($airport->city)
- {{ $airport->city->name }}
@endif
</option>
@endforeach
</select>
@error('arrival_airport_id')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Departure Time -->
<div class="col-xl-6">
<label class="form-label">زمان حرکت</label>
<input
type="text"
class="form-control"
name="departure_time_jalali"
id="departure_time_jalali"
data-jdp
data-jdp-target-value-input="#departure_time_gregorian"
data-jdp-target-value-type="gregorian"
autocomplete="off"
placeholder="مثلاً 1403/05/29 14:30"
value="{{ old('departure_time_jalali') }}"
>
<input
type="hidden"
name="departure_time"
id="departure_time_gregorian"
value="{{ old('departure_time') }}"
>
@error('departure_time')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Price -->
<div class="col-xl-6">
<label class="form-label">قیمت</label>
<input
type="number"
class="form-control"
name="price"
placeholder="قیمت پرواز را وارد کنید"
value="{{ old('price') }}"
>
@error('price')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Capacity -->
<div class="col-xl-6">
<label class="form-label">ظرفیت</label>
<input
type="number"
class="form-control"
name="capacity"
placeholder="ظرفیت پرواز را وارد کنید"
value="{{ old('capacity') }}"
>
@error('capacity')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Status -->
<div class="col-xl-6">
<label class="form-label">وضعیت</label>
<select class="form-control" name="status">
<option
value="0"
@selected(old('status') == '0')
>
غیرفعال
</option>
<option
value="1"
@selected(old('status', '1') == '1')
>
فعال
</option>
</select>
@error('status')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Summary -->
<div class="col-xl-12">
<label class="form-label">خلاصه</label>
<input
type="text"
class="form-control"
name="summary"
placeholder="خلاصه‌ای از پرواز"
value="{{ old('summary') }}"
>
@error('summary')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Description -->
<div class="col-xl-12">
<label class="form-label">توضیحات</label>
<textarea
class="form-control"
name="description"
rows="4"
placeholder="توضیحات پرواز را وارد کنید"
>{{ old('description') }}</textarea>
@error('description')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Image -->
<div class="col-xl-12">
<label class="form-label">تصویر پرواز</label>
<input
type="file"
class="form-control"
name="image"
accept=".jpg,.jpeg,.png,.webp"
>
@error('image')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
</div>
</div>
<div class="card-footer text-end">
<button type="submit" class="btn btn-primary">
ایجاد پرواز
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.css">
<script src="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.js"></script>
<script>
jalaliDatepicker.startWatch({
date: true,
time: true,
hasSecond: false,
targetValueInput: 'attr',
targetValueType: 'attr'
});
</script>
@endsection
+350 -17
View File
@@ -1,18 +1,351 @@
@extends('admin.layouts.app') @extends('admin.layouts.app')
@section('breadcrumb')<div><h1 class="page-title fw-medium fs-18 mb-1">{{ isset($flight) ? 'ویرایش پرواز' : 'درج پرواز' }}</h1><span class="text-muted fs-12">اطلاعات مورد نیاز سفر</span></div>@endsection
@section('content')<div class="container-fluid pt-4">@include('admin.partials.errors') @section('content')
<form action="{{ isset($flight) ? route('admin.flights.update',$flight) : route('admin.flights.store') }}" method="POST" enctype="multipart/form-data">@csrf @if(isset($flight)) @method('PUT') @endif <div class="main-content app-content">
<div class="row g-3"><div class="col-xl-8"><div class="card custom-card"><div class="card-header"><div class="card-title">اطلاعات پرواز</div></div><div class="card-body"><div class="row gy-3"> <div class="container-fluid pt-4">
<div class="col-md-6"><label class="form-label">عنوان سفر *</label><input class="form-control" name="title" value="{{ old('title',$flight->title ?? '') }}" required></div>
<div class="col-md-6"><label class="form-label">نوع سفر *</label><select class="form-control" name="flight_type" required><option value="1" @selected((string)old('flight_type',$flight->flight_type ?? '')==='1')>داخلی</option><option value="2" @selected((string)old('flight_type',$flight->flight_type ?? '')==='2')>خارجی</option><option value="3" @selected((string)old('flight_type',$flight->flight_type ?? '')==='3')>چارتر</option></select></div> <div class="row">
<div class="col-md-6"><label class="form-label">فرودگاه مبدأ</label><select class="form-control" name="departure_airport_id" required><option value="">انتخاب فرودگاه</option>@foreach(($airports ?? []) as $airport)<option value="{{ $airport->id }}" @selected((string)old('departure_airport_id',$flight->departure_airport_id ?? '')===(string)$airport->id)>{{ $airport->title ?? $airport->name ?? ('#'.$airport->id) }}</option>@endforeach</select></div> <div class="col-xl-12">
<div class="col-md-6"><label class="form-label">فرودگاه مقصد</label><select class="form-control" name="arrival_aiport_id" required><option value="">انتخاب فرودگاه</option>@foreach(($airports ?? []) as $airport)<option value="{{ $airport->id }}" @selected((string)old('arrival_aiport_id',$flight->arrival_aiport_id ?? '')===(string)$airport->id)>{{ $airport->title ?? $airport->name ?? ('#'.$airport->id) }}</option>@endforeach</select></div>
<div class="col-md-6"><label class="form-label">شرکت هواپیمایی</label><select class="form-control" name="airline_id" required><option value="">انتخاب ایرلاین</option>@foreach(($airlines ?? []) as $airline)<option value="{{ $airline->id }}" @selected((string)old('airline_id',$flight->airline_id ?? '')===(string)$airline->id)>{{ $airline->title ?? $airline->name ?? ('#'.$airline->id) }}</option>@endforeach</select></div> @error('error')
<div class="col-md-6"><label class="form-label">تاریخ حرکت (شمسی) *</label><input type="text" class="form-control jalali-date" name="departure_time_jalali" value="{{ old('departure_time_jalali', isset($flight) && $flight->departure_time ? $flight->departure_time->toJalali()->format('Y/m/d H:i') : '') }}" placeholder="1405/06/01 12:00" autocomplete="off" required><small class="text-muted">تاریخ حرکت نباید قبل از امروز باشد.</small></div> <span class="text-danger">{{ $message }}</span>
<div class="col-md-4"><label class="form-label">قیمت *</label><input type="number" min="0" class="form-control" name="price" value="{{ old('price',$flight->price ?? '') }}" required></div> @enderror
<div class="col-md-4"><label class="form-label">ظرفیت *</label><input type="number" min="1" class="form-control" name="capacity" value="{{ old('capacity',$flight->capacity ?? '') }}" required></div>
<div class="col-md-4"><label class="form-label">وضعیت</label><select class="form-control" name="status"><option value="1" @selected((string)old('status',$flight->status ?? 1)==='1')>فعال</option><option value="0" @selected((string)old('status',$flight->status ?? 1)==='0')>غیرفعال</option></select></div>
<div class="col-12"><label class="form-label">خلاصه سفر *</label><textarea class="form-control" name="summary" rows="4" required>{{ old('summary',$flight->summary ?? '') }}</textarea></div> <form action="{{ route('admin.flights.update', $flight) }}" method="POST" enctype="multipart/form-data">
</div></div></div></div><div class="col-xl-4"><div class="card custom-card"><div class="card-header"><div class="card-title">تصویر سفر</div></div><div class="card-body"><input type="file" class="form-control" name="image" accept="image/*"><small class="text-muted d-block mt-2">تصویر اختیاری است.</small></div></div></div></div> @csrf
<div class="card custom-card mt-3"><div class="card-footer d-flex justify-content-end gap-2"><a href="{{ route('admin.flights.index') }}" class="btn btn-light">انصراف</a><button class="btn btn-primary">{{ isset($flight) ? 'ذخیره تغییرات' : 'ثبت پرواز' }}</button></div></div></form></div>@endsection @method('put')
@push('scripts')<script>$(function(){ if($.fn.persianDatepicker){ $('.jalali-date').persianDatepicker({format:'YYYY/MM/DD HH:mm',timePicker:{enabled:true},autoClose:true}); }});</script>@endpush
<div class="card custom-card">
<div class="card-header">
<div class="card-title">
ویرایش پرواز
</div>
</div>
<div class="card-body pt-0">
<div class="row gy-3">
<!-- Title -->
<div class="col-xl-6">
<label class="form-label">عنوان پرواز</label>
<input
type="text"
class="form-control"
name="title"
placeholder="عنوان پرواز را وارد کنید"
value="{{ old('title', $flight->title) }}"
>
@error('title')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Airline -->
<div class="col-xl-6">
<label class="form-label">شرکت هواپیمایی</label>
<select class="form-control" name="airline_id">
<option value="">یک شرکت هواپیمایی انتخاب کنید</option>
@foreach($airlines as $airline)
<option
value="{{ $airline->id }}"
@selected(old('airline_id', $flight->airline_id) == $airline->id)
>
{{ $airline->name }}
</option>
@endforeach
</select>
@error('airline_id')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Flight Type -->
<div class="col-xl-6">
<label class="form-label">نوع پرواز</label>
<select class="form-control" name="flight_type">
<option
value="0"
@selected(old('flight_type', $flight->flight_type) == 0)
>
رفت
</option>
<option
value="1"
@selected(old('flight_type', $flight->flight_type) == 1)
>
برگشت
</option>
<option
value="2"
@selected(old('flight_type', $flight->flight_type) == 2)
>
رفت و برگشت
</option>
</select>
@error('flight_type')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Departure Airport -->
<div class="col-xl-6">
<label class="form-label">فرودگاه مبدأ</label>
<select class="form-control" name="departure_airport_id">
<option value="">فرودگاه مبدأ را انتخاب کنید</option>
@foreach($airports as $airport)
<option
value="{{ $airport->id }}"
@selected(old('departure_airport_id', $flight->departure_airport_id) == $airport->id)
>
{{ $airport->name }}
@if($airport->city)
- {{ $airport->city->name }}
@endif
</option>
@endforeach
</select>
@error('departure_airport_id')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Arrival Airport -->
<div class="col-xl-6">
<label class="form-label">فرودگاه مقصد</label>
<select class="form-control" name="arrival_airport_id">
<option value="">فرودگاه مقصد را انتخاب کنید</option>
@foreach($airports as $airport)
<option
value="{{ $airport->id }}"
@selected(old('arrival_airport_id', $flight->arrival_airport_id) == $airport->id)
>
{{ $airport->name }}
@if($airport->city)
- {{ $airport->city->name }}
@endif
</option>
@endforeach
</select>
@error('arrival_airport_id')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Departure Time -->
<div class="col-xl-6">
<label class="form-label">زمان حرکت</label>
<input
type="text"
class="form-control"
name="departure_time_jalali"
id="departure_time_jalali"
data-jdp
data-jdp-target-value-input="#departure_time_gregorian"
data-jdp-target-value-type="gregorian"
autocomplete="off"
placeholder="مثلاً 1403/05/29 14:30"
value="{{ old('departure_time_jalali', $flight->departure_time ? verta($flight->departure_time)->format('Y/m/d H:i') : '') }}"
>
<input
type="hidden"
name="departure_time"
id="departure_time_gregorian"
value="{{ old('departure_time', optional($flight->departure_time)->format('Y-m-d H:i:s')) }}"
>
@error('departure_time')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Price -->
<div class="col-xl-6">
<label class="form-label">قیمت</label>
<input
type="number"
class="form-control"
name="price"
placeholder="قیمت پرواز را وارد کنید"
value="{{ old('price', $flight->price) }}"
>
@error('price')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Capacity -->
<div class="col-xl-6">
<label class="form-label">ظرفیت</label>
<input
type="number"
class="form-control"
name="capacity"
placeholder="ظرفیت پرواز را وارد کنید"
value="{{ old('capacity', $flight->capacity) }}"
>
@error('capacity')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Status -->
<div class="col-xl-6">
<label class="form-label">وضعیت</label>
<select class="form-control" name="status">
<option
value="0"
@selected(old('status', $flight->status) == 0)
>
غیرفعال
</option>
<option
value="1"
@selected(old('status', $flight->status) == 1)
>
فعال
</option>
</select>
@error('status')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Summary -->
<div class="col-xl-12">
<label class="form-label">خلاصه</label>
<input
type="text"
class="form-control"
name="summary"
placeholder="خلاصه‌ای از پرواز"
value="{{ old('summary', $flight->summary) }}"
>
@error('summary')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Description -->
<div class="col-xl-12">
<label class="form-label">توضیحات</label>
<textarea
class="form-control"
name="description"
rows="4"
placeholder="توضیحات پرواز را وارد کنید"
>{{ old('description', $flight->description) }}</textarea>
@error('description')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<!-- Image -->
<div class="col-xl-12">
<label class="form-label">تصویر پرواز</label>
<input
type="file"
class="form-control"
name="image"
accept=".jpg,.jpeg,.png,.webp"
>
@error('image')
<span class="text-danger">{{ $message }}</span>
@enderror
@if($flight->file)
<div class="mt-3">
<img
src="{{ getFileUrl($flight->file->id) }}"
alt="{{ $flight->title }}"
style="width:150px;height:150px;object-fit:cover;border-radius:8px;"
>
</div>
@endif
</div>
</div>
</div>
<div class="card-footer text-end">
<button type="submit" class="btn btn-primary">
ذخیره تغییرات
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.css">
<script src="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.js"></script>
<script>
jalaliDatepicker.startWatch({
date: true,
time: true,
hasSecond: false,
targetValueInput: 'attr',
targetValueType: 'attr'
});
</script>
@endsection
+316 -4
View File
@@ -1,5 +1,317 @@
@extends('admin.layouts.app') @extends('admin.layouts.app')
@section('breadcrumb')<div><h1 class="page-title fw-medium fs-18 mb-1">مدیریت پروازها</h1><span class="text-muted fs-12">درج، ویرایش، حذف و جستجوی پروازهای داخلی، خارجی و چارتر</span></div>@endsection
@section('content')<div class="container-fluid pt-4">@include('admin.partials.errors') @section('breadcrumb')
<div class="card custom-card"><div class="card-body"><form method="GET"><div class="row g-2"><div class="col-md-4"><input class="form-control" name="search" value="{{ request('search') }}" placeholder="عنوان یا مسیر پرواز"></div><div class="col-md-2"><select class="form-control" name="flight_type"><option value="">همه انواع</option><option value="1" @selected(request('flight_type')==='1')>داخلی</option><option value="2" @selected(request('flight_type')==='2')>خارجی</option><option value="3" @selected(request('flight_type')==='3')>چارتر</option></select></div><div class="col-md-2"><select class="form-control" name="status"><option value="">همه وضعیت‌ها</option><option value="1" @selected(request('status')==='1')>فعال</option><option value="0" @selected(request('status')==='0')>غیرفعال</option></select></div><div class="col-md-2"><button class="btn btn-light w-100">جستجو</button></div><div class="col-md-2"><a href="{{ route('admin.flights.create') }}" class="btn btn-primary w-100"><i class="ri-add-line"></i> پرواز جدید</a></div></div></form></div></div> <div>
<div class="card custom-card mt-3"><div class="table-responsive"><table class="table text-nowrap table-hover mb-0"><thead><tr><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><div class="fw-semibold">{{ $flight->title }}</div><small class="text-muted">#{{ $flight->id }}</small></td><td>@switch((int)$flight->flight_type) @case(1) داخلی @break @case(2) خارجی @break @case(3) چارتر @break @default - @endswitch</td><td>{{ isset($flight->departure_time) ? $flight->departure_time->toJalali()->format('Y/m/d H:i') : '-' }}</td><td>{{ number_format($flight->price) }} تومان</td><td>{{ number_format($flight->capacity) }}</td><td>{{ number_format($flight->views ?? 0) }}</td><td>@if($flight->status)<span class="badge bg-success-transparent">فعال</span>@else<span class="badge bg-danger-transparent">غیرفعال</span>@endif</td><td><div class="hstack gap-2"><a href="{{ route('admin.flights.show',$flight) }}" class="btn btn-primary-light btn-icon btn-sm"><i class="ri-eye-line"></i></a><a href="{{ route('admin.flights.edit',$flight) }}" class="btn btn-secondary-light btn-icon btn-sm"><i class="ri-edit-line"></i></a><form method="POST" action="{{ route('admin.flights.destroy',$flight) }}" onsubmit="return confirm('حذف این پرواز؟')">@csrf @method('DELETE')<button class="btn btn-danger-light btn-icon btn-sm"><i class="ri-delete-bin-line"></i></button></form></div></td></tr>@empty<tr><td colspan="8" class="text-center py-5 text-muted">پروازی ثبت نشده است.</td></tr>@endforelse</tbody></table></div></div>{{ ($flights ?? collect())->links() }}</div>@endsection <h1 class="page-title fw-medium fs-18 mb-2">لیست پروازها</h1>
<div>
<nav>
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item">
<a href="javascript:void(0)">مدیریت پروازها</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
لیست پروازها
</li>
</ol>
</nav>
</div>
</div>
@endsection
@section('content')
<div class="main-content app-content">
<div class="container-fluid pt-4">
@error('success')
<span class="text-success">{{ $message }}</span>
@enderror
@error('$errors')
<span class="text-danger">{{ $message }}</span>
@enderror
<div class="row">
<div class="col-xl-12">
<div class="card custom-card">
<div class="card-body p-3">
<form method="GET">
<div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
<div class="d-flex flex-wrap gap-1 project-list-main align-items-center">
<div class="d-flex me-2">
<input
class="form-control me-2"
type="search"
name="search"
placeholder="جستجو پرواز"
value="{{ request()->input('search') }}"
aria-label="جستجو"
>
<button class="btn btn-light" type="submit">
جستجو
</button>
</div>
<select
id="choices-single-default"
class="form-control"
name="sort"
>
<option value="" selected>
مرتب‌سازی بر اساس
</option>
<option
value="created_at"
@selected(request()->input('sort') == 'created_at')
>
جدیدترین
</option>
<option
value="price_asc"
@selected(request()->input('sort') == 'price_asc')
>
قیمت (کم به زیاد)
</option>
<option
value="price_desc"
@selected(request()->input('sort') == 'price_desc')
>
قیمت (زیاد به کم)
</option>
<option
value="departure_time_asc"
@selected(request()->input('sort') == 'departure_time_asc')
>
زمان حرکت (زودترین)
</option>
<option
value="departure_time_desc"
@selected(request()->input('sort') == 'departure_time_desc')
>
زمان حرکت (دیرترین)
</option>
</select>
</div>
@if(auth('admin')->user()->permission?->flight_create)
<div class="d-flex">
<a
href="{{ route('admin.flights.create') }}"
class="btn btn-primary me-2"
>
<i class="ri-add-line me-1 fw-medium align-middle"></i>
ایجاد پرواز
</a>
</div>
@endif
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Flights Table -->
<div class="row">
<div class="col-xl-12">
<div class="card custom-card">
<div class="table-responsive">
<table class="table text-nowrap table-bordered">
<thead>
<tr>
<th>عکس</th>
<th>عنوان</th>
<th>ایرلاین</th>
<th>نوع پرواز</th>
<th>زمان حرکت</th>
<th>مبدا</th>
<th>مقصد</th>
<th>قیمت</th>
<th>ظرفیت</th>
<th>وضعیت</th>
<th>تاریخ ثبت</th>
<th>عملیات</th>
</tr>
</thead>
<tbody>
@foreach($flights as $flight)
<tr>
<td>
<span class="avatar avatar-md avatar-square bg-light">
@if($flight->file?->id)
<img
src="{{ getFileUrl($flight->file->id) }}"
class="w-100 h-100"
alt="{{ $flight->title }}"
>
@else
<img
src="{{ asset('images/no-image.png') }}"
class="w-100 h-100"
alt="{{ $flight->title }}"
>
@endif
</span>
</td>
<td>
<span class="fw-semibold">
{{ $flight->title }}
</span>
</td>
<td>
{{ $flight->airline?->name}}
</td>
<td>
@switch($flight->flight_type)
@case(0)
<span class="badge bg-primary-transparent">
رفت
</span>
@break
@case(1)
<span class="badge bg-warning-transparent">
برگشت
</span>
@break
@case(2)
<span class="badge bg-success-transparent">
رفت و برگشت
</span>
@break
@default
-
@endswitch
</td>
<td>
{{ $flight->departure_time->toJalali()->format('H:i Y-m-d') }}
</td>
<td>
{{ $flight->departureAirport?->city?->name }}
</td>
<td>
{{ $flight->arrivalAirport?->city?->name }}
</td>
<td>
{{ number_format($flight->price) }}
تومان
</td>
<td>
{{ $flight->capacity }}
</td>
<td>
@if(\App\Enums\FlightStatus::ENABLE)
<span class="badge bg-primary-transparent">
فعال
</span>
@elseif(\App\Enums\FlightStatus::DISABLE)
<span class="badge bg-warning-transparent">
غیرفعال
</span>
@endif
</td>
<td>
{{ $flight->created_at->toJalali()->format('H:i Y-m-d') }}
</td>
<td>
<div class="hstack gap-2 fs-15">
@if(auth('admin')->user()->permission?->flight_edit)
<a
href="{{ route('admin.flights.edit', $flight->id) }}"
class="btn btn-secondary-light btn-icon btn-sm"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="ویرایش"
>
<i class="ti ti-pencil"></i>
</a>
@endif
@if(auth('admin')->user()->permission?->flight_delete)
<form
action="{{ route('admin.flights.destroy', $flight->id) }}"
method="POST"
onsubmit="return confirm('آیا از حذف این پرواز مطمئن هستید؟')"
>
@csrf
@method('DELETE')
<button
type="submit"
class="btn btn-icon btn-sm btn-danger-light"
title="حذف"
>
<i class="ri-delete-bin-line"></i>
</button>
</form>
@endif
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
{{ $flights->links() }}
</div>
</div>
</div>
</div>
@endsection
+15 -13
View File
@@ -86,19 +86,21 @@
<!-- End::slide --> <!-- End::slide -->
<!-- Start::slide --> <!-- Start::slide -->
<li class="slide "> @if(auth('admin')->user()->permission?->admin_view)
<a href="" <li class="slide ">
class="side-menu__item {{activeAdminSidebar(['admin.product.index', 'admin.product.show', 'admin.product.edit' , 'admin.product.create'])}}"> <a href="{{ route('admin.flights.index') }}"
<svg xmlns="http://www.w3.org/2000/svg" class="side-menu__icon" class="side-menu__item {{activeAdminSidebar(['admin.product.index', 'admin.product.show', 'admin.product.edit' , 'admin.product.create'])}}">
width="1em" height="1em" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" class="side-menu__icon"
<path fill="none" stroke="currentColor" stroke-linecap="round" width="1em" height="1em" viewBox="0 0 24 24">
stroke-linejoin="round" stroke-width="1.5" <path fill="none" stroke="currentColor" stroke-linecap="round"
d="M4 11v4c0 3.3 0 4.95 1.025 5.975S7.7 22 11 22h2c3.3 0 4.95 0 5.975-1.025S20 18.3 20 15v-4M3 9c0-.748 0-1.122.201-1.4a1.4 1.4 0 0 1 .549-.44C4.098 7 4.565 7 5.5 7h13c.935 0 1.402 0 1.75.16c.228.106.417.258.549.44C21 7.878 21 8.252 21 9s0 1.121-.201 1.4a1.4 1.4 0 0 1-.549.44c-.348.16-.815.16-1.75.16h-13c-.935 0-1.402 0-1.75-.16a1.4 1.4 0 0 1-.549-.44C3 10.121 3 9.748 3 9m3-5.214C6 2.799 6.8 2 7.786 2h.357A3.857 3.857 0 0 1 12 5.857V7H9.214A3.214 3.214 0 0 1 6 3.786m12 0C18 2.799 17.2 2 16.214 2h-.357A3.857 3.857 0 0 0 12 5.857V7h2.786A3.214 3.214 0 0 0 18 3.786M12 11v11" stroke-linejoin="round" stroke-width="1.5"
color="currentColor"></path> d="M4 11v4c0 3.3 0 4.95 1.025 5.975S7.7 22 11 22h2c3.3 0 4.95 0 5.975-1.025S20 18.3 20 15v-4M3 9c0-.748 0-1.122.201-1.4a1.4 1.4 0 0 1 .549-.44C4.098 7 4.565 7 5.5 7h13c.935 0 1.402 0 1.75.16c.228.106.417.258.549.44C21 7.878 21 8.252 21 9s0 1.121-.201 1.4a1.4 1.4 0 0 1-.549.44c-.348.16-.815.16-1.75.16h-13c-.935 0-1.402 0-1.75-.16a1.4 1.4 0 0 1-.549-.44C3 10.121 3 9.748 3 9m3-5.214C6 2.799 6.8 2 7.786 2h.357A3.857 3.857 0 0 1 12 5.857V7H9.214A3.214 3.214 0 0 1 6 3.786m12 0C18 2.799 17.2 2 16.214 2h-.357A3.857 3.857 0 0 0 12 5.857V7h2.786A3.214 3.214 0 0 0 18 3.786M12 11v11"
</svg> color="currentColor"></path>
<span class="side-menu__label">مدیریت محصولات</span> </svg>
</a> <span class="side-menu__label">مدیریت پروازها</span>
</li> </a>
</li>
@endif
<!-- End::slide --> <!-- End::slide -->
<!-- Start::slide --> <!-- Start::slide -->
+38 -29
View File
@@ -1,36 +1,45 @@
<div class="col-md-6 col-lg-3">
<div class="flight-item">
<div class="flight-img">
@if(getFileUrl($flight->file_id))
<img
src="{{ getFileUrl($flight->file_id) }}"
alt="{{ $flight->title }}"
style="width: 100%; height: 200px; object-fit: cover;"
>
@else
<img src="{{ asset('assets/img/flight/01.jpg') }}" alt
style="width: 100%; height: 200px; object-fit: cover;">
@endif
<div class="col-md-6 col-lg-3"> <a href="{{ route('account.wishlist.toggle', [
<div class="flight-item"> 'type' => 'flight',
<div class="flight-img"> 'id' => $flight->id
<img src="assets/img/flight/01.jpg" alt> ]) }}" class="add-wishlist">
<i class="far fa-heart"></i>
<a href="{{ route('account.wishlist.toggle', [ </a>
'type' => 'flight', </div>
'id' => $flight->id <div class="flight-content">
]) }}" class="add-wishlist"> <div class="flight-title">
<i class="far fa-heart"></i> <div class="flight-title-info">
</a> <img src="{{ asset('assets/img/flight/airline-1.png') }}" alt>
</div> <h4><a href="#">{{ $flight->departureAirport->city->name }}<i
<div class="flight-content"> class="far fa-exchange"></i> {{ $flight->arrivalAirport->city->name }} </a></h4>
<div class="flight-title">
<div class="flight-title-info">
<img src="assets/img/flight/airline-1.png" alt>
<h4><a href="#">{{ $flight->departureAirport->city->name }}<i
class="far fa-exchange"></i> {{ $flight->arrivalAirport->city->name }} </a></h4>
</div>
<p class="flight-date"><i
class="far fa-calendar-days"></i>{{ $flight->departure_time->toJalali()->format('Y/m/d H:i') }}
</p>
</div> </div>
<div class="flight-bottom"> <p class="flight-date"><i
<div class="flight-price"> class="far fa-calendar-days"></i>{{ $flight->departure_time->toJalali()->format('Y/m/d H:i') }}
از <span> {{ number_format($flight->price) }} تومان </span> </p>
</div> </div>
<div class="flight-text-btn"> <div class="flight-bottom">
<a href="{{ route('flights.show', $flight->id) }}">نمایش جزئیات <i class="fas fa-arrow-left"></i></a> <div class="flight-price">
</div> از <span> {{ number_format($flight->price) }} تومان </span>
</div>
<div class="flight-text-btn">
<a href="{{ route('flights.show', $flight->id) }}">نمایش جزئیات <i
class="fas fa-arrow-left"></i></a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>