fix: fix tours and flights pagination on homepage
This commit is contained in:
@@ -4,8 +4,8 @@ namespace App\Enums\Flight;
|
|||||||
|
|
||||||
enum FlightScope:int
|
enum FlightScope:int
|
||||||
{
|
{
|
||||||
case Domestic = 1;
|
case Domestic = 0;
|
||||||
case International = 2;
|
case International = 1;
|
||||||
|
|
||||||
public function label(): string
|
public function label(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ namespace App\Enums\Flight;
|
|||||||
|
|
||||||
enum FlightType:int
|
enum FlightType:int
|
||||||
{
|
{
|
||||||
case Systematic = 1;
|
case Systematic = 0;
|
||||||
case Charter = 2;
|
case Charter = 1;
|
||||||
|
|
||||||
public function label(): string
|
public function label(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums\Tour;
|
||||||
|
|
||||||
|
enum TourStatus:int
|
||||||
|
{
|
||||||
|
case AVAILABLE = 0;
|
||||||
|
case FULL = 1;
|
||||||
|
case CANCELLED = 2;
|
||||||
|
case DRAFT = 3;
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::AVAILABLE => 'در دسترس',
|
||||||
|
self::FULL => 'تکمیل',
|
||||||
|
self::CANCELLED => 'کنسل شده',
|
||||||
|
self::DRAFT => 'در امتظار'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Enums\Flight;
|
namespace App\Enums\Tour;
|
||||||
|
|
||||||
enum TourType:int
|
enum TourType:int
|
||||||
{
|
{
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\Flight\FlightStatus;
|
||||||
|
use App\Enums\Tour\TourStatus;
|
||||||
use App\Models\Flight;
|
use App\Models\Flight;
|
||||||
use App\Models\Tour;
|
use App\Models\Tour;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -13,12 +15,14 @@ class IndexController extends Controller
|
|||||||
{
|
{
|
||||||
$title = 'صفحه اصلی';
|
$title = 'صفحه اصلی';
|
||||||
$flights = Flight::with('file')
|
$flights = Flight::with('file')
|
||||||
|
->where('status', '=' , FlightStatus::AVAILABLE)
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
->paginate(4);
|
->paginate(2, ['*'], 'flights_page');
|
||||||
|
|
||||||
$tours = Tour::with(['file' , 'originCity', 'city'])
|
$tours = Tour::with(['file' , 'originCity', 'city'])
|
||||||
|
->where('status', '=', TourStatus::AVAILABLE)
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
->paginate(4);
|
->paginate(2, ['*'], 'tours_page');e(4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -7,9 +7,10 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
|
||||||
use App\Enums\Flight\TourType;
|
|
||||||
use App\Enums\Tour\TourMode;
|
use App\Enums\Tour\TourMode;
|
||||||
use App\Enums\Tour\TourScope;
|
use App\Enums\Tour\TourScope;
|
||||||
|
use App\Enums\Tour\TourStatus;
|
||||||
|
use App\Enums\Tour\TourType;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Attributes\Scope;
|
use Illuminate\Database\Eloquent\Attributes\Scope;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
@@ -50,7 +51,8 @@ class Tour extends Model
|
|||||||
'tour_mode'=> TourMode::class,
|
'tour_mode'=> TourMode::class,
|
||||||
'tour_scope' => TourScope::class,
|
'tour_scope' => TourScope::class,
|
||||||
'tour_type' => TourType::class,
|
'tour_type' => TourType::class,
|
||||||
'views_count' => 'int'
|
'views_count' => 'int',
|
||||||
|
'status'=>TourStatus::class
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@@ -63,6 +65,7 @@ class Tour extends Model
|
|||||||
'tour_type',
|
'tour_type',
|
||||||
'tour_mode',
|
'tour_mode',
|
||||||
'tour_scope',
|
'tour_scope',
|
||||||
|
'status',
|
||||||
'views_count'
|
'views_count'
|
||||||
];
|
];
|
||||||
#[Scope]
|
#[Scope]
|
||||||
|
|||||||
@@ -96,27 +96,6 @@
|
|||||||
@endif
|
@endif
|
||||||
<!-- End::slide -->
|
<!-- End::slide -->
|
||||||
|
|
||||||
<!-- Start::slide -->
|
|
||||||
<li class="slide">
|
|
||||||
<a href="#"
|
|
||||||
class="side-menu__item ">
|
|
||||||
|
|
||||||
<i class="ri-settings-3-line side-menu__icon"></i>
|
|
||||||
<span class="side-menu__label"> تنظیمات سایت</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<!-- End::slide -->
|
|
||||||
|
|
||||||
<!-- Start::slide -->
|
|
||||||
<li class="slide">
|
|
||||||
<a href="#"
|
|
||||||
class="side-menu__item ">
|
|
||||||
|
|
||||||
<i class="ri-user-settings-line side-menu__icon"></i>
|
|
||||||
<span class="side-menu__label">پروفایل من</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<!-- End::slide -->
|
|
||||||
|
|
||||||
<!-- Start::slide -->
|
<!-- Start::slide -->
|
||||||
<li class="slide">
|
<li class="slide">
|
||||||
|
|||||||
@@ -271,7 +271,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endforelse
|
@endforelse
|
||||||
{{ $flights->links() }}
|
{{ $flights->appends(request()->except('flights_page'))->links() }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -295,7 +295,7 @@
|
|||||||
<p>در حال حاضر توری برای نمایش وجود ندارد.</p>
|
<p>در حال حاضر توری برای نمایش وجود ندارد.</p>
|
||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
{{ $tours->links() }}
|
{{ $tours->appends(request()->except('tours_page'))->links() }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,721 @@
|
|||||||
|
<?php $__env->startSection('breadcrumb'); ?>
|
||||||
|
<div>
|
||||||
|
<h1 class="page-title fw-medium fs-18 mb-2">ایجاد پرواز جدید</h1>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<?php $__env->stopSection(); ?>
|
||||||
|
|
||||||
|
<?php $__env->startSection('content'); ?>
|
||||||
|
<div class="container-fluid pt-4">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<form action="<?php echo e(route('admin.flights.store')); ?>"
|
||||||
|
method="POST"
|
||||||
|
enctype="multipart/form-data">
|
||||||
|
<?php echo csrf_field(); ?>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
شماره پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
class="form-control"
|
||||||
|
name="flight_number"
|
||||||
|
placeholder="مثال: IR-625"
|
||||||
|
value="<?php echo e(old('flight_number')); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_number'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
ایرلاین
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2" name="airline_id">
|
||||||
|
<option value="">ایرلاین را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = $airlines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $airline): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($airline->id); ?>"
|
||||||
|
<?php if(old('airline_id') == $airline->id): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e($airline->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['airline_id'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
گستره پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="flight_scope" id="flight_scope">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightScope::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $scope): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($scope->value); ?>"
|
||||||
|
<?php if(old('flight_scope') == $scope->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($scope, 'label') ? $scope->label() : $scope->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_scope'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
نوع پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="flight_type">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightType::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($type->value); ?>"
|
||||||
|
<?php if(old('flight_type') == $type->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($type, 'label') ? $type->label() : $type->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_type'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
نوع سفر
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="flight_trip_type">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightTripType::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tripType): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($tripType->value); ?>"
|
||||||
|
<?php if(old('flight_trip_type') == $tripType->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($tripType, 'label') ? $tripType->label() : $tripType->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_trip_type'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
وضعیت پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="status">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightStatus::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($status->value); ?>"
|
||||||
|
<?php if(old('status') == $status->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($status, 'label') ? $status->label() : $status->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['status'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6 country-wrapper">
|
||||||
|
<label class="form-label">
|
||||||
|
کشور مبدأ
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2" id="origin_country_id">
|
||||||
|
<option value="">کشور مبدأ را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($country->id); ?>"
|
||||||
|
<?php if(old('origin_country_id') == $country->id): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e($country->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6 country-wrapper">
|
||||||
|
<label class="form-label">
|
||||||
|
کشور مقصد
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2" id="destination_country_id">
|
||||||
|
<option value="">کشور مقصد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($country->id); ?>"
|
||||||
|
<?php if(old('destination_country_id') == $country->id): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e($country->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
شهر مبدأ
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
id="origin_city_id">
|
||||||
|
<option value="">ابتدا کشور مبدأ را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
شهر مقصد
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
id="destination_city_id">
|
||||||
|
<option value="">ابتدا کشور مقصد را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
فرودگاه مبدأ
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
name="origin_airport_id"
|
||||||
|
id="origin_airport_id">
|
||||||
|
<option value="">ابتدا شهر مبدأ را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['origin_airport_id'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
فرودگاه مقصد
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
name="airport_id"
|
||||||
|
id="airport_id">
|
||||||
|
<option value="">ابتدا شهر مقصد را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['airport_id'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="my-4">
|
||||||
|
|
||||||
|
<h6 class="fw-bold mb-3">زمانبندی و ظرفیت پرواز</h6>
|
||||||
|
|
||||||
|
<div class="row gy-3">
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
زمان حرکت
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
id="departureTimeInput"
|
||||||
|
class="form-control"
|
||||||
|
name="departure_time"
|
||||||
|
placeholder="تاریخ و ساعت حرکت"
|
||||||
|
value="<?php echo e(old('departure_time')); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['departure_time'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
زمان رسیدن
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
id="arrivalTimeInput"
|
||||||
|
class="form-control"
|
||||||
|
name="arrival_time"
|
||||||
|
placeholder="تاریخ و ساعت رسیدن"
|
||||||
|
value="<?php echo e(old('arrival_time')); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['arrival_time'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
قیمت (تومان)
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="number"
|
||||||
|
min="0"
|
||||||
|
class="form-control"
|
||||||
|
name="price"
|
||||||
|
placeholder="مثال: 3500000"
|
||||||
|
value="<?php echo e(old('price')); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['price'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
ظرفیت مسافر
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="number"
|
||||||
|
min="1"
|
||||||
|
class="form-control"
|
||||||
|
name="capacity"
|
||||||
|
placeholder="مثال: 180"
|
||||||
|
value="<?php echo e(old('capacity')); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['capacity'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="my-4">
|
||||||
|
|
||||||
|
<h6 class="fw-bold mb-2">گالری تصاویر پرواز</h6>
|
||||||
|
|
||||||
|
<div class="image-upload-wrapper d-flex flex-wrap gap-2 px-0 pt-0 mt-2"
|
||||||
|
id="imagePreviewContainer"
|
||||||
|
style="border-radius: 8px; padding: 10px;">
|
||||||
|
|
||||||
|
<label id="uploadPlaceholder"
|
||||||
|
class="upload-placeholder"
|
||||||
|
for="imageInput"
|
||||||
|
style="cursor: pointer; width:150px; height:150px; display:flex; justify-content:center; align-items:center; border:2px dashed #ccc; border-radius:8px; padding:20px; text-align:center;">
|
||||||
|
<div>
|
||||||
|
📷<br>
|
||||||
|
<strong>آپلود تصاویر</strong><br>
|
||||||
|
<small style="color:#999;">JPG / PNG / WEBP</small>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input id="imageInput"
|
||||||
|
name="images[]"
|
||||||
|
type="file"
|
||||||
|
accept=".jpg,.png,.jpeg,.webp"
|
||||||
|
multiple
|
||||||
|
style="display:none">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['images'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small d-block"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
|
||||||
|
<?php if($errors->has('images.*')): ?>
|
||||||
|
<?php $__currentLoopData = $errors->get('images.*'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $messages): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<?php $__currentLoopData = $messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<span class="text-danger small d-block"><?php echo e($message); ?></span>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer text-end">
|
||||||
|
<a href="<?php echo e(route('admin.flights.index')); ?>" class="btn btn-light">
|
||||||
|
انصراف
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
ثبت و ایجاد پرواز
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $__env->startPush('scripts'); ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
const iranCountryId = <?php echo e($iranCountry->id); ?>;
|
||||||
|
|
||||||
|
const citiesRoute = '<?php echo e(route('admin.flights.cities-by-country', ['country' => '__COUNTRY__'])); ?>';
|
||||||
|
const airportsRoute = '<?php echo e(route('admin.flights.airports-by-city', ['city' => '__CITY__'])); ?>';
|
||||||
|
|
||||||
|
const oldOriginAirportId = '<?php echo e(old('origin_airport_id')); ?>';
|
||||||
|
const oldDestinationAirportId = '<?php echo e(old('airport_id')); ?>';
|
||||||
|
|
||||||
|
const datePickerOptions = {
|
||||||
|
format: 'YYYY/MM/DD HH:mm',
|
||||||
|
timePicker: {
|
||||||
|
enabled: true,
|
||||||
|
meridiem: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
autoClose: false,
|
||||||
|
initialValue: false,
|
||||||
|
minDate: new persianDate().valueOf(),
|
||||||
|
toolbox: {
|
||||||
|
calendarSwitch: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#departureTimeInput').persianDatepicker(datePickerOptions);
|
||||||
|
$('#arrivalTimeInput').persianDatepicker(datePickerOptions);
|
||||||
|
|
||||||
|
function resetSelect(selector, placeholder) {
|
||||||
|
$(selector)
|
||||||
|
.html(`<option value="">${placeholder}</option>`)
|
||||||
|
.val('')
|
||||||
|
.trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let citiesRequestTokens = {};
|
||||||
|
let airportsRequestTokens = {};
|
||||||
|
|
||||||
|
function loadCities(countryId, citySelector, placeholder) {
|
||||||
|
resetSelect(citySelector, 'در حال دریافت شهرها...');
|
||||||
|
|
||||||
|
if (!countryId) {
|
||||||
|
resetSelect(citySelector, placeholder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
citiesRequestTokens[citySelector] = (citiesRequestTokens[citySelector] || 0) + 1;
|
||||||
|
const currentToken = citiesRequestTokens[citySelector];
|
||||||
|
|
||||||
|
const url = citiesRoute.replace('__COUNTRY__', countryId);
|
||||||
|
|
||||||
|
$.get(url, function (cities) {
|
||||||
|
|
||||||
|
if (currentToken !== citiesRequestTokens[citySelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = `<option value="">${placeholder}</option>`;
|
||||||
|
|
||||||
|
cities.forEach(function (city) {
|
||||||
|
options += `<option value="${city.id}">${city.name}</option>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(citySelector).html(options).trigger('change');
|
||||||
|
}).fail(function () {
|
||||||
|
if (currentToken !== citiesRequestTokens[citySelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetSelect(citySelector, 'خطا در دریافت شهرها');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadAirports(cityId, airportSelector, placeholder, selectedAirportId = null) {
|
||||||
|
resetSelect(airportSelector, 'در حال دریافت فرودگاهها...');
|
||||||
|
|
||||||
|
if (!cityId) {
|
||||||
|
resetSelect(airportSelector, placeholder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
airportsRequestTokens[airportSelector] = (airportsRequestTokens[airportSelector] || 0) + 1;
|
||||||
|
const currentToken = airportsRequestTokens[airportSelector];
|
||||||
|
|
||||||
|
const url = airportsRoute.replace('__CITY__', cityId);
|
||||||
|
|
||||||
|
$.get(url, function (airports) {
|
||||||
|
if (currentToken !== airportsRequestTokens[airportSelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = `<option value="">${placeholder}</option>`;
|
||||||
|
|
||||||
|
airports.forEach(function (airport) {
|
||||||
|
const code = airport.code ? ` (${airport.code})` : '';
|
||||||
|
const selected = String(airport.id) === String(selectedAirportId)
|
||||||
|
? 'selected'
|
||||||
|
: '';
|
||||||
|
|
||||||
|
options += `
|
||||||
|
<option value="${airport.id}" ${selected}>
|
||||||
|
${airport.name}${code}
|
||||||
|
</option>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(airportSelector).html(options).trigger('change');
|
||||||
|
}).fail(function () {
|
||||||
|
if (currentToken !== airportsRequestTokens[airportSelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetSelect(airportSelector, 'خطا در دریافت فرودگاهها');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetLocations() {
|
||||||
|
resetSelect('#origin_city_id', 'ابتدا کشور مبدأ را انتخاب کنید');
|
||||||
|
resetSelect('#destination_city_id', 'ابتدا کشور مقصد را انتخاب کنید');
|
||||||
|
resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید');
|
||||||
|
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleScopeUI() {
|
||||||
|
const scope = $('#flight_scope').val();
|
||||||
|
|
||||||
|
resetLocations();
|
||||||
|
|
||||||
|
if (scope === '1') {
|
||||||
|
$('.country-wrapper').hide();
|
||||||
|
|
||||||
|
$('#origin_country_id').val(iranCountryId).trigger('change');
|
||||||
|
$('#destination_country_id').val(iranCountryId).trigger('change');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scope === '2') {
|
||||||
|
$('.country-wrapper').show();
|
||||||
|
|
||||||
|
$('#origin_country_id').val('').trigger('change');
|
||||||
|
$('#destination_country_id').val('').trigger('change');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.country-wrapper').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#flight_scope').on('change', toggleScopeUI);
|
||||||
|
|
||||||
|
$('#origin_country_id').on('change', function () {
|
||||||
|
const countryId = $(this).val();
|
||||||
|
|
||||||
|
resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید');
|
||||||
|
|
||||||
|
loadCities(
|
||||||
|
countryId,
|
||||||
|
'#origin_city_id',
|
||||||
|
'شهر مبدأ را انتخاب کنید'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#destination_country_id').on('change', function () {
|
||||||
|
const countryId = $(this).val();
|
||||||
|
|
||||||
|
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
|
||||||
|
|
||||||
|
loadCities(
|
||||||
|
countryId,
|
||||||
|
'#destination_city_id',
|
||||||
|
'شهر مقصد را انتخاب کنید'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#origin_city_id').on('change', function () {
|
||||||
|
loadAirports(
|
||||||
|
$(this).val(),
|
||||||
|
'#origin_airport_id',
|
||||||
|
'فرودگاه مبدأ را انتخاب کنید',
|
||||||
|
oldOriginAirportId
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#destination_city_id').on('change', function () {
|
||||||
|
loadAirports(
|
||||||
|
$(this).val(),
|
||||||
|
'#airport_id',
|
||||||
|
'فرودگاه مقصد را انتخاب کنید',
|
||||||
|
oldDestinationAirportId
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#imageInput').on('change', function (event) {
|
||||||
|
const files = event.target.files;
|
||||||
|
const container = $('#imagePreviewContainer');
|
||||||
|
|
||||||
|
container.find('.image-preview-item').remove();
|
||||||
|
|
||||||
|
if (!files.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Array.from(files).forEach(function (file) {
|
||||||
|
const reader = new FileReader();
|
||||||
|
|
||||||
|
reader.onload = function (e) {
|
||||||
|
container.append(`
|
||||||
|
<div class="image-preview-item position-relative"
|
||||||
|
style="width:150px; height:150px;">
|
||||||
|
<img src="${e.target.result}"
|
||||||
|
alt="پیشنمایش تصویر"
|
||||||
|
style="width:100%; height:100%; object-fit:cover; border-radius:8px;">
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
toggleScopeUI();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php $__env->stopPush(); ?>
|
||||||
|
<?php $__env->stopSection(); ?>
|
||||||
|
|
||||||
|
<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\ASUS\Desktop\airline-agency\resources\views/admin/flights/create.blade.php ENDPATH**/ ?>
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php $__env->startSection('content'); ?>
|
||||||
|
<!-- Start::app-content -->
|
||||||
|
<div class="container-lg">
|
||||||
|
<div class="row justify-content-center align-items-center authentication authentication-basic h-100">
|
||||||
|
<div class="col-xxl-4 col-xl-5 col-lg-5 col-md-6 col-sm-8 col-12">
|
||||||
|
<div class="card custom-card my-4 auth-circle">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<p class="h4 mb-3 fw-semibold text-center">
|
||||||
|
ورود به پنل مدیریت
|
||||||
|
</p>
|
||||||
|
<p class="mb-4 text-muted text-center">
|
||||||
|
برای ورود به پنل مدیریت لطفا اطلاعات فرم را وارد کنید.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<form method="POST" action="<?php echo e(route('admin.auth.login.post')); ?>">
|
||||||
|
<?php echo csrf_field(); ?>
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<label for="login-email" class="form-label text-default">نام کاربری</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="username"
|
||||||
|
class="form-control"
|
||||||
|
id="login-username"
|
||||||
|
placeholder="نام کاربری خود را وارد کنید."
|
||||||
|
value="<?php echo e(old('username')); ?>"
|
||||||
|
/>
|
||||||
|
<?php $__errorArgs = ['username'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span style="color: red"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<label for="login-password" class="form-label text-default">رمز عبور</label>
|
||||||
|
<div class="position-relative">
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="password"
|
||||||
|
class="form-control"
|
||||||
|
id="login-password"
|
||||||
|
placeholder="رمز عبور را وارد کنید"
|
||||||
|
/>
|
||||||
|
<?php $__errorArgs = ['password'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span style="color: red"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid mt-4">
|
||||||
|
<button type="submit" class="btn btn-primary">ورود</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End::app-content -->
|
||||||
|
<?php $__env->stopSection(); ?>
|
||||||
|
|
||||||
|
<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\ASUS\Desktop\airline-agency\resources\views/admin/login.blade.php ENDPATH**/ ?>
|
||||||
@@ -269,7 +269,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php echo e($flights->links()); ?>
|
<?php echo e($flights->appends(request()->except('flights_page'))->links()); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -294,7 +294,7 @@
|
|||||||
<p>در حال حاضر توری برای نمایش وجود ندارد.</p>
|
<p>در حال حاضر توری برای نمایش وجود ندارد.</p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php echo e($tours->links()); ?>
|
<?php echo e($tours->appends(request()->except('tours_page'))->links()); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,781 @@
|
|||||||
|
<?php $__env->startSection('breadcrumb'); ?>
|
||||||
|
<div>
|
||||||
|
<h1 class="page-title fw-medium fs-18 mb-2">ویرایش پرواز</h1>
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<ol class="breadcrumb mb-0">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="<?php echo e(route('admin.flights.index')); ?>">مدیریت پروازها</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">
|
||||||
|
ویرایش پرواز
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<?php $__env->stopSection(); ?>
|
||||||
|
|
||||||
|
<?php $__env->startSection('content'); ?>
|
||||||
|
<div class="container-fluid pt-4">
|
||||||
|
|
||||||
|
<?php if(session('success')): ?>
|
||||||
|
<span style="color: green"><?php echo e(session('success')); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if(session('error')): ?>
|
||||||
|
<span style="color: red"><?php echo e(session('error')); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<form action="<?php echo e(route('admin.flights.update', $flight->id)); ?>"
|
||||||
|
method="POST"
|
||||||
|
enctype="multipart/form-data">
|
||||||
|
<?php echo csrf_field(); ?>
|
||||||
|
<?php echo method_field('PUT'); ?>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
شماره پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
class="form-control"
|
||||||
|
name="flight_number"
|
||||||
|
placeholder="مثال: IR-625"
|
||||||
|
value="<?php echo e(old('flight_number', $flight->flight_number)); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_number'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
ایرلاین
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2" name="airline_id">
|
||||||
|
<option value="">ایرلاین را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = $airlines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $airline): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($airline->id); ?>"
|
||||||
|
<?php if(old('airline_id', $flight->airline_id) == $airline->id): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e($airline->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['airline_id'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
گستره پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="flight_scope" id="flight_scope">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightScope::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $scope): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($scope->value); ?>"
|
||||||
|
<?php if(old('flight_scope', $flight->flight_scope?->value) == $scope->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($scope, 'label') ? $scope->label() : $scope->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_scope'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
نوع پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="flight_type">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightType::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($type->value); ?>"
|
||||||
|
<?php if(old('flight_type', $flight->flight_type?->value) == $type->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($type, 'label') ? $type->label() : $type->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_type'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
نوع سفر
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="flight_trip_type">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightTripType::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tripType): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($tripType->value); ?>"
|
||||||
|
<?php if(old('flight_trip_type', $flight->flight_trip_type?->value) == $tripType->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($tripType, 'label') ? $tripType->label() : $tripType->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['flight_trip_type'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-4">
|
||||||
|
<label class="form-label">
|
||||||
|
وضعیت پرواز
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control" name="status">
|
||||||
|
<option value="">یک مورد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = \App\Enums\Flight\FlightStatus::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($status->value); ?>"
|
||||||
|
<?php if(old('status', $flight->status?->value) == $status->value): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e(method_exists($status, 'label') ? $status->label() : $status->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['status'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6 country-wrapper">
|
||||||
|
<label class="form-label">
|
||||||
|
کشور مبدأ
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2" id="origin_country_id">
|
||||||
|
<option value="">کشور مبدأ را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($country->id); ?>"
|
||||||
|
<?php if(old('origin_country_id', $originCountryId) == $country->id): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e($country->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6 country-wrapper">
|
||||||
|
<label class="form-label">
|
||||||
|
کشور مقصد
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2" id="destination_country_id">
|
||||||
|
<option value="">کشور مقصد را انتخاب کنید</option>
|
||||||
|
|
||||||
|
<?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<option value="<?php echo e($country->id); ?>"
|
||||||
|
<?php if(old('destination_country_id', $destinationCountryId) == $country->id): echo 'selected'; endif; ?>>
|
||||||
|
<?php echo e($country->name); ?>
|
||||||
|
|
||||||
|
</option>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
شهر مبدأ
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
id="origin_city_id">
|
||||||
|
<option value="">ابتدا کشور مبدأ را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
شهر مقصد
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
id="destination_city_id">
|
||||||
|
<option value="">ابتدا کشور مقصد را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
فرودگاه مبدأ
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
name="origin_airport_id"
|
||||||
|
id="origin_airport_id">
|
||||||
|
<option value="">ابتدا شهر مبدأ را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['origin_airport_id'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-6">
|
||||||
|
<label class="form-label">
|
||||||
|
فرودگاه مقصد
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<select class="form-control select2"
|
||||||
|
name="airport_id"
|
||||||
|
id="airport_id">
|
||||||
|
<option value="">ابتدا شهر مقصد را انتخاب کنید</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['airport_id'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="my-4">
|
||||||
|
|
||||||
|
<h6 class="fw-bold mb-3">زمانبندی و ظرفیت پرواز</h6>
|
||||||
|
|
||||||
|
<div class="row gy-3">
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
زمان حرکت
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
id="departureTimeInput"
|
||||||
|
class="form-control"
|
||||||
|
name="departure_time"
|
||||||
|
placeholder="تاریخ و ساعت حرکت"
|
||||||
|
value="<?php echo e(old('departure_time', $flight->departure_time ? \Verta::instance($flight->departure_time)->format('Y/m/d H:i') : '')); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['departure_time'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
زمان رسیدن
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
id="arrivalTimeInput"
|
||||||
|
class="form-control"
|
||||||
|
name="arrival_time"
|
||||||
|
placeholder="تاریخ و ساعت رسیدن"
|
||||||
|
value="<?php echo e(old('arrival_time', $flight->arrival_time ? \Verta::instance($flight->arrival_time)->format('Y/m/d H:i') : '')); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['arrival_time'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
قیمت (تومان)
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="number"
|
||||||
|
min="0"
|
||||||
|
class="form-control"
|
||||||
|
name="price"
|
||||||
|
placeholder="مثال: 3500000"
|
||||||
|
value="<?php echo e(old('price', $flight->price)); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['price'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3">
|
||||||
|
<label class="form-label">
|
||||||
|
ظرفیت مسافر
|
||||||
|
<span class="text-danger">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input type="number"
|
||||||
|
min="1"
|
||||||
|
class="form-control"
|
||||||
|
name="capacity"
|
||||||
|
placeholder="مثال: 180"
|
||||||
|
value="<?php echo e(old('capacity', $flight->capacity)); ?>">
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['capacity'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="my-4">
|
||||||
|
|
||||||
|
<h6 class="fw-bold mb-2">گالری تصاویر فعلی</h6>
|
||||||
|
|
||||||
|
<div class="d-flex flex-wrap gap-2 mb-3">
|
||||||
|
<?php $__empty_1 = true; $__currentLoopData = $flight->images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
||||||
|
<div class="position-relative" style="width:120px;height:120px;">
|
||||||
|
<img src="<?php echo e(getFileUrl($image->file_id)); ?>"
|
||||||
|
class="w-100 h-100 rounded"
|
||||||
|
style="object-fit:cover;"
|
||||||
|
alt="<?php echo e($flight->flight_number); ?>">
|
||||||
|
<?php if($image->is_default): ?>
|
||||||
|
<span class="badge bg-primary position-absolute top-0 start-0 m-1">اصلی</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
|
||||||
|
<span class="text-muted">هیچ تصویری ثبت نشده است.</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h6 class="fw-bold mb-2">افزودن تصاویر جدید</h6>
|
||||||
|
|
||||||
|
<div class="image-upload-wrapper d-flex flex-wrap gap-2 px-0 pt-0 mt-2"
|
||||||
|
id="imagePreviewContainer"
|
||||||
|
style="border-radius: 8px; padding: 10px;">
|
||||||
|
|
||||||
|
<label id="uploadPlaceholder"
|
||||||
|
class="upload-placeholder"
|
||||||
|
for="imageInput"
|
||||||
|
style="cursor: pointer; width:150px; height:150px; display:flex; justify-content:center; align-items:center; border:2px dashed #ccc; border-radius:8px; padding:20px; text-align:center;">
|
||||||
|
<div>
|
||||||
|
📷<br>
|
||||||
|
<strong>آپلود تصاویر</strong><br>
|
||||||
|
<small style="color:#999;">JPG / PNG / WEBP</small>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input id="imageInput"
|
||||||
|
name="images[]"
|
||||||
|
type="file"
|
||||||
|
accept=".jpg,.png,.jpeg,.webp"
|
||||||
|
multiple
|
||||||
|
style="display:none">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $__errorArgs = ['images'];
|
||||||
|
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||||
|
if ($__bag->has($__errorArgs[0])) :
|
||||||
|
if (isset($message)) { $__messageOriginal = $message; }
|
||||||
|
$message = $__bag->first($__errorArgs[0]); ?>
|
||||||
|
<span class="text-danger small d-block"><?php echo e($message); ?></span>
|
||||||
|
<?php unset($message);
|
||||||
|
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||||
|
endif;
|
||||||
|
unset($__errorArgs, $__bag); ?>
|
||||||
|
|
||||||
|
<?php if($errors->has('images.*')): ?>
|
||||||
|
<?php $__currentLoopData = $errors->get('images.*'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $messages): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<?php $__currentLoopData = $messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<span class="text-danger small d-block"><?php echo e($message); ?></span>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer text-end">
|
||||||
|
<a href="<?php echo e(route('admin.flights.index')); ?>" class="btn btn-light">
|
||||||
|
انصراف
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
ذخیره تغییرات
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $__env->startPush('scripts'); ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
const iranCountryId = <?php echo e($iranCountry->id); ?>;
|
||||||
|
|
||||||
|
const citiesRoute = '<?php echo e(route('admin.flights.cities-by-country', ['country' => '__COUNTRY__'])); ?>';
|
||||||
|
const airportsRoute = '<?php echo e(route('admin.flights.airports-by-city', ['city' => '__CITY__'])); ?>';
|
||||||
|
|
||||||
|
const oldOriginAirportId = '<?php echo e(old('origin_airport_id', $flight->origin_airport_id)); ?>';
|
||||||
|
const oldDestinationAirportId = '<?php echo e(old('airport_id', $flight->airport_id)); ?>';
|
||||||
|
|
||||||
|
const oldOriginCityId = '<?php echo e(old('origin_city_id', $flight->originAirport?->city_id)); ?>';
|
||||||
|
const oldDestinationCityId = '<?php echo e(old('destination_city_id', $flight->airport?->city_id)); ?>';
|
||||||
|
|
||||||
|
const datePickerOptions = {
|
||||||
|
format: 'YYYY/MM/DD HH:mm',
|
||||||
|
timePicker: {
|
||||||
|
enabled: true,
|
||||||
|
meridiem: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
autoClose: false,
|
||||||
|
initialValue: false,
|
||||||
|
initialValueType: 'persian',
|
||||||
|
toolbox: {
|
||||||
|
calendarSwitch: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#departureTimeInput').persianDatepicker(datePickerOptions);
|
||||||
|
$('#arrivalTimeInput').persianDatepicker(datePickerOptions);
|
||||||
|
|
||||||
|
function resetSelect(selector, placeholder) {
|
||||||
|
$(selector)
|
||||||
|
.html(`<option value="">${placeholder}</option>`)
|
||||||
|
.val('')
|
||||||
|
.trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
let citiesRequestTokens = {};
|
||||||
|
let airportsRequestTokens = {};
|
||||||
|
|
||||||
|
function loadCities(countryId, citySelector, placeholder, selectedCityId = null) {
|
||||||
|
resetSelect(citySelector, 'در حال دریافت شهرها...');
|
||||||
|
|
||||||
|
if (!countryId) {
|
||||||
|
resetSelect(citySelector, placeholder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
citiesRequestTokens[citySelector] = (citiesRequestTokens[citySelector] || 0) + 1;
|
||||||
|
const currentToken = citiesRequestTokens[citySelector];
|
||||||
|
|
||||||
|
const url = citiesRoute.replace('__COUNTRY__', countryId);
|
||||||
|
|
||||||
|
$.get(url, function (cities) {
|
||||||
|
if (currentToken !== citiesRequestTokens[citySelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = `<option value="">${placeholder}</option>`;
|
||||||
|
|
||||||
|
cities.forEach(function (city) {
|
||||||
|
const selected = String(city.id) === String(selectedCityId)
|
||||||
|
? 'selected'
|
||||||
|
: '';
|
||||||
|
|
||||||
|
options += `<option value="${city.id}" ${selected}>${city.name}</option>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(citySelector).html(options).trigger('change');
|
||||||
|
}).fail(function () {
|
||||||
|
if (currentToken !== citiesRequestTokens[citySelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetSelect(citySelector, 'خطا در دریافت شهرها');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadAirports(cityId, airportSelector, placeholder, selectedAirportId = null) {
|
||||||
|
resetSelect(airportSelector, 'در حال دریافت فرودگاهها...');
|
||||||
|
|
||||||
|
if (!cityId) {
|
||||||
|
resetSelect(airportSelector, placeholder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
airportsRequestTokens[airportSelector] = (airportsRequestTokens[airportSelector] || 0) + 1;
|
||||||
|
const currentToken = airportsRequestTokens[airportSelector];
|
||||||
|
|
||||||
|
const url = airportsRoute.replace('__CITY__', cityId);
|
||||||
|
|
||||||
|
$.get(url, function (airports) {
|
||||||
|
if (currentToken !== airportsRequestTokens[airportSelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = `<option value="">${placeholder}</option>`;
|
||||||
|
|
||||||
|
airports.forEach(function (airport) {
|
||||||
|
const code = airport.code ? ` (${airport.code})` : '';
|
||||||
|
const selected = String(airport.id) === String(selectedAirportId)
|
||||||
|
? 'selected'
|
||||||
|
: '';
|
||||||
|
|
||||||
|
options += `
|
||||||
|
<option value="${airport.id}" ${selected}>
|
||||||
|
${airport.name}${code}
|
||||||
|
</option>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(airportSelector).html(options).trigger('change');
|
||||||
|
}).fail(function () {
|
||||||
|
if (currentToken !== airportsRequestTokens[airportSelector]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetSelect(airportSelector, 'خطا در دریافت فرودگاهها');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetLocations() {
|
||||||
|
resetSelect('#origin_city_id', 'ابتدا کشور مبدأ را انتخاب کنید');
|
||||||
|
resetSelect('#destination_city_id', 'ابتدا کشور مقصد را انتخاب کنید');
|
||||||
|
resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید');
|
||||||
|
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
|
||||||
|
}
|
||||||
|
|
||||||
|
function initLocations() {
|
||||||
|
const scope = $('#flight_scope').val();
|
||||||
|
|
||||||
|
if (scope === '1') {
|
||||||
|
$('.country-wrapper').hide();
|
||||||
|
|
||||||
|
$('#origin_country_id').val(iranCountryId);
|
||||||
|
$('#destination_country_id').val(iranCountryId);
|
||||||
|
} else if (scope === '2') {
|
||||||
|
$('.country-wrapper').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadCities(
|
||||||
|
$('#origin_country_id').val(),
|
||||||
|
'#origin_city_id',
|
||||||
|
'شهر مبدأ را انتخاب کنید',
|
||||||
|
oldOriginCityId
|
||||||
|
);
|
||||||
|
|
||||||
|
loadCities(
|
||||||
|
$('#destination_country_id').val(),
|
||||||
|
'#destination_city_id',
|
||||||
|
'شهر مقصد را انتخاب کنید',
|
||||||
|
oldDestinationCityId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleScopeUI() {
|
||||||
|
const scope = $('#flight_scope').val();
|
||||||
|
|
||||||
|
resetLocations();
|
||||||
|
|
||||||
|
if (scope === '1') {
|
||||||
|
$('.country-wrapper').hide();
|
||||||
|
|
||||||
|
$('#origin_country_id').val(iranCountryId).trigger('change');
|
||||||
|
$('#destination_country_id').val(iranCountryId).trigger('change');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scope === '2') {
|
||||||
|
$('.country-wrapper').show();
|
||||||
|
|
||||||
|
$('#origin_country_id').val('').trigger('change');
|
||||||
|
$('#destination_country_id').val('').trigger('change');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.country-wrapper').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#flight_scope').on('change', toggleScopeUI);
|
||||||
|
|
||||||
|
$('#origin_country_id').on('change', function () {
|
||||||
|
const countryId = $(this).val();
|
||||||
|
|
||||||
|
resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید');
|
||||||
|
|
||||||
|
loadCities(
|
||||||
|
countryId,
|
||||||
|
'#origin_city_id',
|
||||||
|
'شهر مبدأ را انتخاب کنید'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#destination_country_id').on('change', function () {
|
||||||
|
const countryId = $(this).val();
|
||||||
|
|
||||||
|
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
|
||||||
|
|
||||||
|
loadCities(
|
||||||
|
countryId,
|
||||||
|
'#destination_city_id',
|
||||||
|
'شهر مقصد را انتخاب کنید'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#origin_city_id').on('change', function () {
|
||||||
|
loadAirports(
|
||||||
|
$(this).val(),
|
||||||
|
'#origin_airport_id',
|
||||||
|
'فرودگاه مبدأ را انتخاب کنید',
|
||||||
|
oldOriginAirportId
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#destination_city_id').on('change', function () {
|
||||||
|
loadAirports(
|
||||||
|
$(this).val(),
|
||||||
|
'#airport_id',
|
||||||
|
'فرودگاه مقصد را انتخاب کنید',
|
||||||
|
oldDestinationAirportId
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#imageInput').on('change', function (event) {
|
||||||
|
const files = event.target.files;
|
||||||
|
const container = $('#imagePreviewContainer');
|
||||||
|
|
||||||
|
container.find('.image-preview-item').remove();
|
||||||
|
|
||||||
|
if (!files.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Array.from(files).forEach(function (file) {
|
||||||
|
const reader = new FileReader();
|
||||||
|
|
||||||
|
reader.onload = function (e) {
|
||||||
|
container.append(`
|
||||||
|
<div class="image-preview-item position-relative"
|
||||||
|
style="width:150px; height:150px;">
|
||||||
|
<img src="${e.target.result}"
|
||||||
|
alt="پیشنمایش تصویر"
|
||||||
|
style="width:100%; height:100%; object-fit:cover; border-radius:8px;">
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
initLocations();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php $__env->stopPush(); ?>
|
||||||
|
<?php $__env->stopSection(); ?>
|
||||||
|
|
||||||
|
<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\ASUS\Desktop\airline-agency\resources\views/admin/flights/edit.blade.php ENDPATH**/ ?>
|
||||||
Reference in New Issue
Block a user