feat(admin): implement full flight management for panel admin

This commit is contained in:
2026-08-22 10:21:46 +03:30
parent 93bbc6fbc0
commit e02399dd69
22 changed files with 3537 additions and 523 deletions
-4
View File
@@ -7,9 +7,7 @@ enum AdminPermission:string
case MANAGE_ADMINS = 'manage-admins'; case MANAGE_ADMINS = 'manage-admins';
case MANAGE_TOURS = 'manage-tours'; case MANAGE_TOURS = 'manage-tours';
case MANAGE_FLIGHTS = 'manage-flights'; case MANAGE_FLIGHTS = 'manage-flights';
case MANAGE_COMMENTS = 'manage-comments';
case MANAGE_USERS = 'manage-users'; case MANAGE_USERS = 'manage-users';
case MANAGE_SETTINGS = 'manage-settings';
public function label(): string public function label(): string
{ {
@@ -17,9 +15,7 @@ enum AdminPermission:string
self::MANAGE_ADMINS => 'مدیریت مدیران', self::MANAGE_ADMINS => 'مدیریت مدیران',
self::MANAGE_TOURS => 'مدیریت تورها', self::MANAGE_TOURS => 'مدیریت تورها',
self::MANAGE_FLIGHTS => 'مدیریت پروازها', self::MANAGE_FLIGHTS => 'مدیریت پروازها',
self::MANAGE_COMMENTS => 'مدیریت نظرات',
self::MANAGE_USERS => 'مدیریت کاربران', self::MANAGE_USERS => 'مدیریت کاربران',
self::MANAGE_SETTINGS => 'تنظیمات سایت',
}; };
} }
} }
+260 -6
View File
@@ -4,13 +4,20 @@ namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\Flight\FlightStoreRequest; use App\Http\Requests\Admin\Flight\FlightStoreRequest;
use App\Http\Requests\Admin\Flight\FlightUpdateRequest;
use App\Models\Airline; use App\Models\Airline;
use App\Models\Airport; use App\Models\Airport;
use App\Models\City; use App\Models\City;
use App\Models\Country; use App\Models\Country;
use App\Models\File;
use App\Models\Flight; use App\Models\Flight;
use App\Models\FlightImage;
use Hekmatinasser\Verta\Verta;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class FlightController extends Controller class FlightController extends Controller
{ {
@@ -62,6 +69,7 @@ class FlightController extends Controller
)); ));
} }
public function citiesByCountry(Country $country): JsonResponse public function citiesByCountry(Country $country): JsonResponse
{ {
$cities = City::query() $cities = City::query()
@@ -74,6 +82,7 @@ class FlightController extends Controller
return response()->json($cities); return response()->json($cities);
} }
public function airportsByCity(City $city): JsonResponse public function airportsByCity(City $city): JsonResponse
{ {
$airports = Airport::query() $airports = Airport::query()
@@ -89,7 +98,78 @@ class FlightController extends Controller
public function store(FlightStoreRequest $request) public function store(FlightStoreRequest $request)
{ {
$data = $request->validated();
DB::beginTransaction();
try {
$departureTime = Verta::parse(
$data['departure_time']
)->datetime();
$arrivalTime = Verta::parse(
$data['arrival_time']
)->datetime();
$flight = Flight::create([
'airline_id' => $data['airline_id'],
'origin_airport_id' => $data['origin_airport_id'],
'destination_airport_id' => $data['destination_airport_id'],
'flight_number' => $data['flight_number'],
'trip_type' => $data['trip_type'],
'flight_type' => $data['flight_type'],
'flight_scope' => $data['flight_scope'],
'departure_time' => $departureTime,
'arrival_time' => $arrivalTime,
'price' => $data['price'],
'capacity' => $data['capacity'],
'status' => $data['status'],
]);
$isDefault = true;
if (!empty($data['images'])) {
foreach ($data['images'] as $image) {
$imageName = $flight->id . '_' . time() . rand(11111, 99999) . '.' . $image->extension();
$path = $image->storeAs('flight_images', $imageName, 'public');
$file = File::create([
'name' => $imageName,
'size' => $image->getSize(),
'original_name' => $image->getClientOriginalName(),
'path' => $path,
'extension' => $image->extension(),
]);
FlightImage::create([
'flight_id' => $flight->id,
'file_id' => $file->id,
'is_default' => $isDefault,
]);
$isDefault = false;
}
}
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
Log::error($exception);
return back()
->withInput()
->with('error', 'ثبت پرواز با خطا مواجه شد.');
}
return redirect()
->route('admin.flights.index')
->with('success', 'پرواز با موفقیت ثبت شد.');
} }
public function edit(Flight $flight) public function edit(Flight $flight)
@@ -117,21 +197,195 @@ class FlightController extends Controller
)); ));
} }
public function update() public function destroyImage(Flight $flight, FlightImage $image)
{ {
$image = $flight->images()
->with('file')
->findOrFail($image->id);
$file = $image->file;
DB::transaction(function () use ($flight, $image) {
$image->delete();
$hasDefaultImage = $flight->images()
->where('is_default', true)
->exists();
if (! $hasDefaultImage) {
$newDefaultImage = $flight->images()
->orderBy('sort_order')
->orderBy('id')
->first();
$newDefaultImage?->update([
'is_default' => true,
]);
}
});
deleteFile($file);
return redirect()
->route('admin.flights.edit', $flight)
->with('success', 'تصویر پرواز با موفقیت حذف شد.');
} }
public function destroy() public function update(FlightUpdateRequest $request, Flight $flight)
{ {
$data = $request->validated();
DB::beginTransaction();
try {
$departureTime = Verta::parse(
$data['departure_time']
)->datetime();
$arrivalTime = Verta::parse(
$data['arrival_time']
)->datetime();
$flight->update([
'airline_id' => $data['airline_id'],
'origin_airport_id' => $data['origin_airport_id'],
'destination_airport_id' => $data['destination_airport_id'],
'flight_number' => $data['flight_number'],
'trip_type' => $data['trip_type'],
'flight_type' => $data['flight_type'],
'flight_scope' => $data['flight_scope'],
'departure_time' => $departureTime,
'arrival_time' => $arrivalTime,
'price' => $data['price'],
'capacity' => $data['capacity'],
'status' => $data['status'],
]);
if (!empty($data['images'])) {
$hasDefault = $flight->images()
->where('is_default', true)
->exists();
$nextSort = (int)$flight->images()
->max('sort_order');
foreach ($data['images'] as $index => $image) {
$imageName = $flight->id . '_' . time() . rand(11111, 99999) . '.' . $image->extension();
$path = $image->storeAs(
'flight_images',
$imageName,
'public'
);
$file = File::create([
'name' => $imageName,
'size' => $image->getSize(),
'original_name' => $image->getClientOriginalName(),
'path' => $path,
'extension' => $image->extension(),
]);
FlightImage::create([
'flight_id' => $flight->id,
'file_id' => $file->id,
'sort_order' => $nextSort + $index + 1,
'is_default' => !$hasDefault && $index === 0,
]);
}
}
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
Log::error($exception);
return back()
->withInput()
->with('error', 'ویرایش پرواز با خطا مواجه شد.');
}
return redirect()
->route('admin.flights.index')
->with('success', 'پرواز با موفقیت ویرایش شد.');
} }
public function restore()
{
public function destroy(Flight $flight)
{
$flight->delete();
return redirect()
->route('admin.flights.index')
->with('success', 'پرواز با موفقیت به سطل زباله منتقل شد.');
} }
public function forceDelete()
{
public function trash()
{
$title = 'پروازهای حذف شده';
$flights = Flight::onlyTrashed()
->with([
'airline',
'origin_airport.city',
'airport.city',
'coverImage.file',
])
->orderByDesc('deleted_at')
->paginate(4);
return view('admin.flights.trash', compact('title', 'flights'));
}
public function restore($id)
{
$flight = Flight::onlyTrashed()
->findOrFail($id);
$flight->restore();
return redirect()
->route('admin.flights.trash.index')
->with('success', 'پرواز با موفقیت بازگردانی شد.');
}
public function forceDelete($id)
{
$flight = Flight::onlyTrashed()
->with('images.file')
->findOrFail($id);
try {
DB::transaction(function () use ($flight) {
foreach ($flight->images as $image) {
$file = $image->file;
if ($file) {
Storage::disk('public')->delete($file->path);
$file->delete();
}
$image->delete();
}
$flight->forceDelete();
});
return redirect()
->route('admin.flights.trash.index')
->with('success', 'پرواز و تمام اطلاعات مرتبط با موفقیت حذف دائمی شدند.');
} catch (\Throwable $exception) {
report($exception);
return back()
->with('error', 'حذف دائمی پرواز انجام نشد.');
}
} }
} }
@@ -2,8 +2,14 @@
namespace App\Http\Requests\Admin\Flight; namespace App\Http\Requests\Admin\Flight;
use App\Enums\Flight\FlightScope;
use App\Enums\Flight\FlightStatus;
use App\Enums\Flight\FlightTripType;
use App\Enums\Flight\FlightType;
use Hekmatinasser\Verta\Facades\Verta;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class FlightStoreRequest extends FormRequest class FlightStoreRequest extends FormRequest
{ {
@@ -12,7 +18,7 @@ class FlightStoreRequest extends FormRequest
*/ */
public function authorize(): bool public function authorize(): bool
{ {
return false; return true;
} }
/** /**
@@ -23,7 +29,112 @@ class FlightStoreRequest extends FormRequest
public function rules(): array public function rules(): array
{ {
return [ return [
// 'flight_number' => [
'required',
'string',
'max:20',
'unique:flights,flight_number',
],
'airline_id' => [
'required',
'integer',
'exists:airlines,id',
],
'flight_scope' => [
'required',
Rule::enum(FlightScope::class),
],
'flight_type' => [
'required',
Rule::enum(FlightType::class),
],
'trip_type' => [
'required',
Rule::enum(FlightTripType::class),
],
'status' => [
'required',
Rule::enum(FlightStatus::class),
],
'origin_country_id' => [
'required',
'integer',
'exists:countries,id',
],
'destination_country_id' => [
'required',
'integer',
'exists:countries,id',
],
'origin_city_id' => [
'required',
'integer',
'exists:cities,id',
'different:destination_city_id'
],
'destination_city_id' => [
'required',
'integer',
'exists:cities,id',
],
'origin_airport_id' => [
'required',
'integer',
'exists:airports,id',
'different:destination_airport_id',
],
'destination_airport_id' => [
'required',
'integer',
'exists:airports,id',
],
'departure_time' => ['required', 'string'],
'arrival_time' => [
'required',
'string',
function ($attribute, $value, $fail) {
$departure = $this->input('departure_time');
if ($departure && Verta::parse($value)->datetime() <= Verta::parse($departure)->datetime()) {
$fail('زمان رسیدن باید بعد از زمان حرکت باشد.');
}
},
],
'price' => [
'required',
'integer',
'min:0',
],
'capacity' => [
'required',
'integer',
'min:1',
'max:1000',
],
'images' => [
'nullable',
'array',
'max:5',
],
'images.*' => [
'file',
'image',
'mimes:jpg,jpeg,png,webp',
'max:800',
],
]; ];
} }
} }
@@ -0,0 +1,151 @@
<?php
namespace App\Http\Requests\Admin\Flight;
use App\Enums\Flight\FlightScope;
use App\Enums\Flight\FlightStatus;
use App\Enums\Flight\FlightTripType;
use App\Enums\Flight\FlightType;
use Hekmatinasser\Verta\Verta;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class FlightUpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'flight_number' => [
'required',
'string',
'max:20',
Rule::unique('flights', 'flight_number')
->ignore($this->route('flight')),
],
'airline_id' => [
'required',
'exists:airlines,id',
],
'flight_scope' => [
'required',
Rule::enum(FlightScope::class),
],
'flight_type' => [
'required',
Rule::enum(FlightType::class),
],
'trip_type' => [
'required',
Rule::enum(FlightTripType::class),
],
'status' => [
'required',
Rule::enum(FlightStatus::class),
],
'origin_country_id' => [
'required',
'exists:countries,id',
],
'destination_country_id' => [
'required',
'exists:countries,id',
],
'origin_city_id' => [
'required',
'exists:cities,id',
'different:destination_city_id',
],
'destination_city_id' => [
'required',
'exists:cities,id',
],
'origin_airport_id' => [
'required',
'exists:airports,id',
'different:destination_airport_id',
],
'destination_airport_id' => [
'required',
'exists:airports,id',
],
'departure_time' => [
'required',
'string',
function (string $attribute, mixed $value, \Closure $fail) {
try {
Verta::parse($value);
} catch (\Throwable $e) {
$fail('فرمت زمان حرکت معتبر نیست.');
}
},
],
'arrival_time' => [
'required',
'string',
function (string $attribute, mixed $value, \Closure $fail) {
try {
$departureTime = Verta::parse($this->input('departure_time'));
$arrivalTime = Verta::parse($value);
if ($arrivalTime->timestamp <= $departureTime->timestamp) {
$fail('زمان رسیدن باید بعد از زمان حرکت باشد.');
}
} catch (\Throwable $e) {
$fail('فرمت زمان رسیدن معتبر نیست.');
}
},
],
'price' => [
'required',
'numeric',
'min:0',
],
'capacity' => [
'required',
'integer',
'min:1',
],
'images' => [
'nullable',
'array',
'max:5',
],
'images.*' => [
'image',
'mimes:jpg,jpeg,png,webp',
'max:800',
],
];
}
}
+7 -2
View File
@@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Attributes\Scope;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Flight * Class Flight
@@ -43,6 +44,7 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class Flight extends Model class Flight extends Model
{ {
use SoftDeletes;
protected $table = 'flights'; protected $table = 'flights';
public static $snakeAttributes = false; public static $snakeAttributes = false;
@@ -52,12 +54,13 @@ class Flight extends Model
'destination_airport_id' => 'int', 'destination_airport_id' => 'int',
'file_id' => 'int', 'file_id' => 'int',
'departure_time' => 'datetime', 'departure_time' => 'datetime',
'arrival_time'=> 'datetime',
'price' => 'int', 'price' => 'int',
'capacity' => 'int', 'capacity' => 'int',
'status' => FlightStatus::class, 'status' => FlightStatus::class,
'trip_type' => FlightTripType::class, 'trip_type' => FlightTripType::class,
'flight_scope'=> FlightScope::class, 'flight_scope'=> FlightScope::class,
'flight_type', FlightType::class, 'flight_type'=> FlightType::class,
'views_count' => 'int' 'views_count' => 'int'
]; ];
@@ -67,6 +70,7 @@ class Flight extends Model
'destination_airport_id', 'destination_airport_id',
'file_id', 'file_id',
'flight_number', 'flight_number',
'arrival_time',
'departure_time', 'departure_time',
'price', 'price',
'capacity', 'capacity',
@@ -74,7 +78,8 @@ class Flight extends Model
'trip_type', 'trip_type',
'flight_scope', 'flight_scope',
'flight_type', 'flight_type',
'views_count' 'views_count',
'is_default'
]; ];
#[Scope] #[Scope]
protected function applySort(Builder $query, ?string $sort = null): void protected function applySort(Builder $query, ?string $sort = null): void
+28 -18
View File
@@ -124,18 +124,18 @@
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control" name="flight_trip_type"> <select class="form-control" name="trip_type">
<option value="">یک مورد را انتخاب کنید</option> <option value="">یک مورد را انتخاب کنید</option>
@foreach(\App\Enums\Flight\FlightTripType::cases() as $tripType) @foreach(\App\Enums\Flight\FlightTripType::cases() as $tripType)
<option value="{{ $tripType->value }}" <option value="{{ $tripType->value }}"
@selected(old('flight_trip_type') == $tripType->value)> @selected(old('trip_type') == $tripType->value)>
{{ method_exists($tripType, 'label') ? $tripType->label() : $tripType->name }} {{ method_exists($tripType, 'label') ? $tripType->label() : $tripType->name }}
</option> </option>
@endforeach @endforeach
</select> </select>
@error('flight_trip_type') @error('trip_type')
<span class="text-danger small">{{ $message }}</span> <span class="text-danger small">{{ $message }}</span>
@enderror @enderror
</div> </div>
@@ -168,7 +168,7 @@
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" id="origin_country_id"> <select class="form-control select2" name="origin_country_id" id="origin_country_id">
<option value="">کشور مبدأ را انتخاب کنید</option> <option value="">کشور مبدأ را انتخاب کنید</option>
@foreach($countries as $country) @foreach($countries as $country)
@@ -178,6 +178,9 @@
</option> </option>
@endforeach @endforeach
</select> </select>
@error('origin_country_id')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div> </div>
<div class="col-xl-6 country-wrapper"> <div class="col-xl-6 country-wrapper">
@@ -186,7 +189,7 @@
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" id="destination_country_id"> <select class="form-control select2" name="destination_country_id" id="destination_country_id">
<option value="">کشور مقصد را انتخاب کنید</option> <option value="">کشور مقصد را انتخاب کنید</option>
@foreach($countries as $country) @foreach($countries as $country)
@@ -196,6 +199,9 @@
</option> </option>
@endforeach @endforeach
</select> </select>
@error('destination_country_id')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div> </div>
<div class="col-xl-6"> <div class="col-xl-6">
@@ -204,10 +210,12 @@
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" <select class="form-control select2" name="origin_city_id" id="origin_city_id">
id="origin_city_id">
<option value="">ابتدا کشور مبدأ را انتخاب کنید</option> <option value="">ابتدا کشور مبدأ را انتخاب کنید</option>
</select> </select>
@error('origin_city_id')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div> </div>
<div class="col-xl-6"> <div class="col-xl-6">
@@ -216,10 +224,12 @@
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" <select class="form-control select2" name="destination_city_id" id="destination_city_id">
id="destination_city_id">
<option value="">ابتدا کشور مقصد را انتخاب کنید</option> <option value="">ابتدا کشور مقصد را انتخاب کنید</option>
</select> </select>
@error('destination_city_id')
<span class="text-danger small">{{ $message }}</span>
@enderror
</div> </div>
<div class="col-xl-6"> <div class="col-xl-6">
@@ -246,12 +256,12 @@
</label> </label>
<select class="form-control select2" <select class="form-control select2"
name="airport_id" name="destination_airport_id"
id="airport_id"> id="destination_airport_id">
<option value="">ابتدا شهر مقصد را انتخاب کنید</option> <option value="">ابتدا شهر مقصد را انتخاب کنید</option>
</select> </select>
@error('airport_id') @error('destination_airport_id')
<span class="text-danger small">{{ $message }}</span> <span class="text-danger small">{{ $message }}</span>
@enderror @enderror
</div> </div>
@@ -399,7 +409,7 @@
const airportsRoute = '{{ route('admin.flights.airports-by-city', ['city' => '__CITY__']) }}'; const airportsRoute = '{{ route('admin.flights.airports-by-city', ['city' => '__CITY__']) }}';
const oldOriginAirportId = '{{ old('origin_airport_id') }}'; const oldOriginAirportId = '{{ old('origin_airport_id') }}';
const oldDestinationAirportId = '{{ old('airport_id') }}'; const oldDestinationAirportId = '{{ old('destination_airport_id') }}';
const datePickerOptions = { const datePickerOptions = {
format: 'YYYY/MM/DD HH:mm', format: 'YYYY/MM/DD HH:mm',
@@ -515,7 +525,7 @@
resetSelect('#origin_city_id', 'ابتدا کشور مبدأ را انتخاب کنید'); resetSelect('#origin_city_id', 'ابتدا کشور مبدأ را انتخاب کنید');
resetSelect('#destination_city_id', 'ابتدا کشور مقصد را انتخاب کنید'); resetSelect('#destination_city_id', 'ابتدا کشور مقصد را انتخاب کنید');
resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید'); resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید');
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید'); resetSelect('#destination_airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
} }
function toggleScopeUI() { function toggleScopeUI() {
@@ -523,7 +533,7 @@
resetLocations(); resetLocations();
if (scope === '1') { if (scope === '0') {
$('.country-wrapper').hide(); $('.country-wrapper').hide();
$('#origin_country_id').val(iranCountryId).trigger('change'); $('#origin_country_id').val(iranCountryId).trigger('change');
@@ -532,7 +542,7 @@
return; return;
} }
if (scope === '2') { if (scope === '1') {
$('.country-wrapper').show(); $('.country-wrapper').show();
$('#origin_country_id').val('').trigger('change'); $('#origin_country_id').val('').trigger('change');
@@ -561,7 +571,7 @@
$('#destination_country_id').on('change', function () { $('#destination_country_id').on('change', function () {
const countryId = $(this).val(); const countryId = $(this).val();
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید'); resetSelect('#destination_airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
loadCities( loadCities(
countryId, countryId,
@@ -582,7 +592,7 @@
$('#destination_city_id').on('change', function () { $('#destination_city_id').on('change', function () {
loadAirports( loadAirports(
$(this).val(), $(this).val(),
'#airport_id', '#destination_airport_id',
'فرودگاه مقصد را انتخاب کنید', 'فرودگاه مقصد را انتخاب کنید',
oldDestinationAirportId oldDestinationAirportId
); );
File diff suppressed because it is too large Load Diff
@@ -214,11 +214,6 @@
<td> <td>
<div class="hstack gap-2 fs-15"> <div class="hstack gap-2 fs-15">
<a href="{{ route('admin.flights.show', $flight->id) }}"
class="btn btn-info-light btn-icon btn-sm"
title="مشاهده">
<i class="ri-eye-line"></i>
</a>
<a href="{{ route('admin.flights.edit', $flight->id) }}" <a href="{{ route('admin.flights.edit', $flight->id) }}"
class="btn btn-secondary-light btn-icon btn-sm" class="btn btn-secondary-light btn-icon btn-sm"
+1
View File
@@ -104,6 +104,7 @@ Route::prefix('admin')->name('admin.')->group(function () {
Route::get('edit', 'edit')->name('edit'); Route::get('edit', 'edit')->name('edit');
Route::put('update', 'update')->name('update'); Route::put('update', 'update')->name('update');
Route::delete('destroy', 'destroy')->name('destroy'); Route::delete('destroy', 'destroy')->name('destroy');
Route::delete('/images/{image}', 'destroyImage')->name('images.destroy');
}); });
}); });
@@ -360,128 +360,13 @@
</div> </div>
<div class="flight-booking-detail"> <div class="flight-booking-detail">
<div class="flight-booking-detail-header"> <div class="flight-booking-detail-header">
<p>قابل استرداد جزئی</p>
<a href="#flight-booking-collapse1" data-bs-toggle="collapse" <a href="<?php echo e(route('flights.show' , $flight->id)); ?>" >
role="button" مشاهده جزئیات<i class="fas fa-arrow-left"></i>
aria-expanded="false" aria-controls="flight-booking-collapse1">
اطلاعات پرواز <i class="far fa-angle-down"></i>
</a> </a>
</div> </div>
<div class="collapse" id="flight-booking-collapse1">
<div class="flight-booking-detail-wrapper">
<div class="row">
<div class="col-lg-12 col-xl-6">
<div class="flight-booking-detail-left">
<ul class="nav nav-tabs" id="flTab1" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="fl-tab1"
data-bs-toggle="tab"
data-bs-target="#fl-tab-pane1"
type="button"
role="tab" aria-controls="fl-tab-pane1"
aria-selected="true"><?php echo e($flight->origin_airport->city->name); ?>
- <?php echo e($flight->airport->city->name); ?>
</button>
</li>
</ul>
<div class="tab-content" id="flTabContent1">
<div class="tab-pane fade show active"
id="fl-tab-pane1"
role="tabpanel" aria-labelledby="fl-tab1"
tabindex="0">
<div class="flight-booking-detail-info">
<div class="flight-booking-airline">
<div class="flight-airline-img">
<img
src="assets/img/flight/airline-7.png"
alt>
</div>
<div
class="flight-airline-info flex-grow-1">
<h5 class="flight-airline-name">شرکت
هواپیمایی <?php echo e($flight->airline?->name); ?></h5>
</div>
<p class="flight-airline-class">
باشه واسه بعد</p>
</div>
<div class="flight-booking-time">
<div class="start-time">
<div class="start-time-icon">
<i class="fal fa-plane-departure"></i>
</div>
<div class="start-time-info">
<h6 class="start-time-text">
<?php echo e(\Hekmatinasser\Verta\Verta::instance($flight->departure_time)->format('H:i')); ?>
</h6>
<p class="flight-full-date">
<?php echo e(\Hekmatinasser\Verta\Verta::instance($flight->departure_time)->format('l, d F Y')); ?>
</p>
<span
class="flight-destination"><?php echo e($flight->origin_airport->city->name); ?></span>
</div>
</div>
<div class="flight-stop">
<div
class="flight-stop-arrow"></div>
</div>
<div class="end-time">
<div class="start-time-icon">
<i class="fal fa-plane-arrival"></i>
</div>
<div class="start-time-info">
<h6 class="end-time-text"></h6>
<p class="flight-full-date">
<?php echo e(\Hekmatinasser\Verta\Verta::instance($flight->arrival_time)->format('l, d F Y')); ?>
</p>
<span
class="flight-destination"><?php echo e($flight->airport->city->name); ?></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-12 col-xl-6">
<div class="flight-booking-detail-right">
<div class="tab-content" id="frTabContent1">
<div class="tab-pane fade show active"
id="fr-tab-pane1"
role="tabpanel" aria-labelledby="fr-tab1"
tabindex="0">
<div class="flight-booking-detail-info">
<table class="table table-borderless">
<tr>
<th>پرواز ها</th>
</tr>
<tr>
<td><?php echo e($flight->origin_airport->city->name); ?>
- <?php echo e($flight->airport->city->name); ?></td>
</tr>
</table>
</div>
</div>
</div>
<div class="flight-booking-detail-price">
<h6 class="flight-booking-detail-price-title">مجموع
(2
مسافر)</h6>
<div class="flight-detail-price-amount">
10000 تومان
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
@@ -18,7 +18,6 @@
</div> </div>
<ul class="user-profile-sidebar-list"> <ul class="user-profile-sidebar-list">
<li><a class="active" href="<?php echo e(route('accounts.profile')); ?>"><i class="far fa-user"></i> نمایه من</a></li> <li><a class="active" href="<?php echo e(route('accounts.profile')); ?>"><i class="far fa-user"></i> نمایه من</a></li>
<li><a href="profile-booking.html"><i class="far fa-shopping-bag"></i> رزرو من</a></li>
<li><a href="<?php echo e(route('accounts.favorites.index')); ?>"><i class="far fa-heart"></i> علاقه مندی های من</a></li> <li><a href="<?php echo e(route('accounts.favorites.index')); ?>"><i class="far fa-heart"></i> علاقه مندی های من</a></li>
<li><a href="<?php echo e(route('accounts.comments')); ?>"><i class="fas fa-comments"></i> کامنت‌های من</a></li> <li><a href="<?php echo e(route('accounts.comments')); ?>"><i class="fas fa-comments"></i> کامنت‌های من</a></li>
<li><a href="<?php echo e(route('accounts.edit-profile.index')); ?>"><i class="far fa-cog"></i> ویرایش حساب کاربری</a></li> <li><a href="<?php echo e(route('accounts.edit-profile.index')); ?>"><i class="far fa-cog"></i> ویرایش حساب کاربری</a></li>
@@ -153,19 +153,19 @@ unset($__errorArgs, $__bag); ?>
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control" name="flight_trip_type"> <select class="form-control" name="trip_type">
<option value="">یک مورد را انتخاب کنید</option> <option value="">یک مورد را انتخاب کنید</option>
<?php $__currentLoopData = \App\Enums\Flight\FlightTripType::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tripType): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?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); ?>" <option value="<?php echo e($tripType->value); ?>"
<?php if(old('flight_trip_type') == $tripType->value): echo 'selected'; endif; ?>> <?php if(old('trip_type') == $tripType->value): echo 'selected'; endif; ?>>
<?php echo e(method_exists($tripType, 'label') ? $tripType->label() : $tripType->name); ?> <?php echo e(method_exists($tripType, 'label') ? $tripType->label() : $tripType->name); ?>
</option> </option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select> </select>
<?php $__errorArgs = ['flight_trip_type']; <?php $__errorArgs = ['trip_type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default'); $__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) : if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; } if (isset($message)) { $__messageOriginal = $message; }
@@ -213,7 +213,7 @@ unset($__errorArgs, $__bag); ?>
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" id="origin_country_id"> <select class="form-control select2" name="origin_country_id" id="origin_country_id">
<option value="">کشور مبدأ را انتخاب کنید</option> <option value="">کشور مبدأ را انتخاب کنید</option>
<?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
@@ -224,6 +224,16 @@ unset($__errorArgs, $__bag); ?>
</option> </option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select> </select>
<?php $__errorArgs = ['origin_country_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>
<div class="col-xl-6 country-wrapper"> <div class="col-xl-6 country-wrapper">
@@ -232,7 +242,7 @@ unset($__errorArgs, $__bag); ?>
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" id="destination_country_id"> <select class="form-control select2" name="destination_country_id" id="destination_country_id">
<option value="">کشور مقصد را انتخاب کنید</option> <option value="">کشور مقصد را انتخاب کنید</option>
<?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
@@ -243,6 +253,16 @@ unset($__errorArgs, $__bag); ?>
</option> </option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select> </select>
<?php $__errorArgs = ['destination_country_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>
<div class="col-xl-6"> <div class="col-xl-6">
@@ -251,10 +271,19 @@ unset($__errorArgs, $__bag); ?>
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" <select class="form-control select2" name="origin_city_id" id="origin_city_id">
id="origin_city_id">
<option value="">ابتدا کشور مبدأ را انتخاب کنید</option> <option value="">ابتدا کشور مبدأ را انتخاب کنید</option>
</select> </select>
<?php $__errorArgs = ['origin_city_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>
<div class="col-xl-6"> <div class="col-xl-6">
@@ -263,10 +292,19 @@ unset($__errorArgs, $__bag); ?>
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<select class="form-control select2" <select class="form-control select2" name="destination_city_id" id="destination_city_id">
id="destination_city_id">
<option value="">ابتدا کشور مقصد را انتخاب کنید</option> <option value="">ابتدا کشور مقصد را انتخاب کنید</option>
</select> </select>
<?php $__errorArgs = ['destination_city_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>
<div class="col-xl-6"> <div class="col-xl-6">
@@ -300,12 +338,12 @@ unset($__errorArgs, $__bag); ?>
</label> </label>
<select class="form-control select2" <select class="form-control select2"
name="airport_id" name="destination_airport_id"
id="airport_id"> id="destination_airport_id">
<option value="">ابتدا شهر مقصد را انتخاب کنید</option> <option value="">ابتدا شهر مقصد را انتخاب کنید</option>
</select> </select>
<?php $__errorArgs = ['airport_id']; <?php $__errorArgs = ['destination_airport_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default'); $__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) : if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; } if (isset($message)) { $__messageOriginal = $message; }
@@ -495,7 +533,7 @@ unset($__errorArgs, $__bag); ?>
const airportsRoute = '<?php echo e(route('admin.flights.airports-by-city', ['city' => '__CITY__'])); ?>'; const airportsRoute = '<?php echo e(route('admin.flights.airports-by-city', ['city' => '__CITY__'])); ?>';
const oldOriginAirportId = '<?php echo e(old('origin_airport_id')); ?>'; const oldOriginAirportId = '<?php echo e(old('origin_airport_id')); ?>';
const oldDestinationAirportId = '<?php echo e(old('airport_id')); ?>'; const oldDestinationAirportId = '<?php echo e(old('destination_airport_id')); ?>';
const datePickerOptions = { const datePickerOptions = {
format: 'YYYY/MM/DD HH:mm', format: 'YYYY/MM/DD HH:mm',
@@ -611,7 +649,7 @@ unset($__errorArgs, $__bag); ?>
resetSelect('#origin_city_id', 'ابتدا کشور مبدأ را انتخاب کنید'); resetSelect('#origin_city_id', 'ابتدا کشور مبدأ را انتخاب کنید');
resetSelect('#destination_city_id', 'ابتدا کشور مقصد را انتخاب کنید'); resetSelect('#destination_city_id', 'ابتدا کشور مقصد را انتخاب کنید');
resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید'); resetSelect('#origin_airport_id', 'ابتدا شهر مبدأ را انتخاب کنید');
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید'); resetSelect('#destination_airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
} }
function toggleScopeUI() { function toggleScopeUI() {
@@ -619,7 +657,7 @@ unset($__errorArgs, $__bag); ?>
resetLocations(); resetLocations();
if (scope === '1') { if (scope === '0') {
$('.country-wrapper').hide(); $('.country-wrapper').hide();
$('#origin_country_id').val(iranCountryId).trigger('change'); $('#origin_country_id').val(iranCountryId).trigger('change');
@@ -628,7 +666,7 @@ unset($__errorArgs, $__bag); ?>
return; return;
} }
if (scope === '2') { if (scope === '1') {
$('.country-wrapper').show(); $('.country-wrapper').show();
$('#origin_country_id').val('').trigger('change'); $('#origin_country_id').val('').trigger('change');
@@ -657,7 +695,7 @@ unset($__errorArgs, $__bag); ?>
$('#destination_country_id').on('change', function () { $('#destination_country_id').on('change', function () {
const countryId = $(this).val(); const countryId = $(this).val();
resetSelect('#airport_id', 'ابتدا شهر مقصد را انتخاب کنید'); resetSelect('#destination_airport_id', 'ابتدا شهر مقصد را انتخاب کنید');
loadCities( loadCities(
countryId, countryId,
@@ -678,7 +716,7 @@ unset($__errorArgs, $__bag); ?>
$('#destination_city_id').on('change', function () { $('#destination_city_id').on('change', function () {
loadAirports( loadAirports(
$(this).val(), $(this).val(),
'#airport_id', '#destination_airport_id',
'فرودگاه مقصد را انتخاب کنید', 'فرودگاه مقصد را انتخاب کنید',
oldDestinationAirportId oldDestinationAirportId
); );
@@ -0,0 +1,109 @@
<?php $__env->startSection('title' , 'کامنت های من'); ?>
<?php $__env->startSection('account-content'); ?>
<div class="user-profile-wrapper">
<?php if(session('success')): ?>
<div class="col-lg-12 mb-3">
<div class="alert alert-success">
<?php echo e(session('success')); ?>
</div>
</div>
<?php endif; ?>
<?php if(session('error')): ?>
<div class="col-lg-12 mb-3">
<div class="alert alert-danger">
<?php echo e(session('error')); ?>
</div>
</div>
<?php endif; ?>
<div class="col-lg-12">
<div class="user-profile-card">
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="user-profile-card-title mb-0">
<i class="far fa-comments"></i>
کامنت‌های من
</h4>
<span class="badge bg-primary">
<?php echo e($comments->total()); ?> کامنت
</span>
</div>
<?php $__empty_1 = true; $__currentLoopData = $comments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $comment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<div class="border rounded p-3 mb-3">
<div class="d-flex justify-content-between align-items-center mb-3">
<?php if($comment->tour): ?>
<span class="badge bg-info px-3 py-2" style="font-size: 0.95rem;">
<i class="fas fa-umbrella-beach me-1"></i>
تور:
<a href="<?php echo e(route('tours.show', $comment->tour->id)); ?>"
class="text-white text-decoration-none fw-semibold">
<?php echo e($comment->tour->title ?? ('تور شماره ' . $comment->tour->id)); ?>
</a>
</span>
<?php elseif($comment->flight): ?>
<span class="badge bg-primary px-3 py-2" style="font-size: 0.95rem;">
<i class="fas fa-plane-departure me-1"></i>
پرواز:
<a href="<?php echo e(route('flights.show', $comment->flight->id)); ?>"
class="text-white text-decoration-none fw-semibold">
<?php echo e($comment->flight->flight_number ?? ('پرواز شماره ' . $comment->flight->id)); ?>
</a>
</span>
<?php else: ?>
<span class="badge bg-secondary px-3 py-2" style="font-size: 0.95rem;">
عمومی
</span>
<?php endif; ?>
<span class="text-muted">
<i class="far fa-calendar-alt"></i>
<?php echo e(\Hekmatinasser\Verta\Verta::instance($comment->created_at)->format('Y/m/d - H:i')); ?>
</span>
<?php if(isset($comment->status)): ?>
<?php if($comment->status == \App\Enums\CommentStatus::PENDING): ?>
<span class="badge bg-success"><?php echo e($comment->status->label()); ?></span>
<?php elseif($comment->status == \App\Enums\CommentStatus::CONFIRMED): ?>
<span class="badge bg-warning text-dark"><?php echo e($comment->status->label()); ?></span>
<?php elseif($comment->status == \App\Enums\CommentStatus::REJECTED): ?>
<span class="badge bg-danger"><?php echo e($comment->status->label()); ?></span>
<?php endif; ?>
<?php endif; ?>
</div>
<p class="mb-0">
<?php echo e($comment->content); ?>
</p>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<div class="text-center py-5">
<i class="far fa-comment-dots fa-3x text-muted mb-3"></i>
<h5>هنوز کامنتی ثبت نکرده‌اید.</h5>
<p class="text-muted mb-0">
بعد از ثبت نظر برای تورها یا پروازها، کامنت‌هایتان در این بخش نمایش داده می‌شوند.
</p>
</div>
<?php endif; ?>
<?php if($comments->hasPages()): ?>
<div class="mt-4 d-flex justify-content-center">
<?php echo e($comments->links()); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('account.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\ASUS\Desktop\airline-agency\resources\views/account/comments.blade.php ENDPATH**/ ?>
@@ -0,0 +1,562 @@
<?php $__env->startSection('breadcrumb'); ?>
<div>
<h1 class="page-title fw-medium fs-18 mb-2">
افزودن مدیر جدید
</h1>
<div>
<nav>
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item">
<a href="<?php echo e(route('admin.admins.index')); ?>">
مدیران
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
افزودن مدیر
</li>
</ol>
</nav>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-4">
<div class="row">
<?php if(session('success')): ?>
<div class="alert alert-success">
<?php echo e(session('success')); ?>
</div>
<?php endif; ?>
<?php if(session('error')): ?>
<div class="alert alert-danger">
<?php echo e(session('error')); ?>
</div>
<?php endif; ?>
<div class="col-xl-12">
<form
action="<?php echo e(route('admin.admins.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">
<div class="row gy-3">
<div class="col-xl-6">
<label class="form-label">
نام
</label>
<input
type="text"
class="form-control"
name="first_name"
value="<?php echo e(old('first_name')); ?>"
placeholder="نام را وارد کنید"
>
<?php $__errorArgs = ['first_name'];
$__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">
<?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">
نام خانوادگی
</label>
<input
type="text"
class="form-control"
name="last_name"
value="<?php echo e(old('last_name')); ?>"
placeholder="نام خانوادگی را وارد کنید"
>
<?php $__errorArgs = ['last_name'];
$__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">
<?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">
نام کاربری
</label>
<input
type="text"
class="form-control"
name="username"
value="<?php echo e(old('username')); ?>"
placeholder="نام کاربری را وارد کنید"
>
<?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 class="text-danger">
<?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">
ایمیل
</label>
<input
type="email"
class="form-control"
name="email"
value="<?php echo e(old('email')); ?>"
placeholder="ایمیل را وارد کنید"
>
<?php $__errorArgs = ['email'];
$__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">
<?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">
شماره موبایل
</label>
<input
type="text"
class="form-control"
name="mobile"
value="<?php echo e(old('mobile')); ?>"
placeholder="شماره موبایل را وارد کنید"
>
<?php $__errorArgs = ['mobile'];
$__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">
<?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">
رمز عبور
</label>
<input
type="password"
class="form-control"
name="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 class="text-danger">
<?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">
نقش مدیر
</label>
<select
class="form-control"
name="role"
id="adminRole"
>
<?php $__currentLoopData = \App\Enums\Admin\AdminRole::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option
value="<?php echo e($role->value); ?>"
<?php if(old('role') == $role->value): echo 'selected'; endif; ?>
>
<?php echo e($role->label()); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['role'];
$__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">
<?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">
وضعیت
</label>
<select
class="form-control"
name="status"
>
<?php $__currentLoopData = \App\Enums\Admin\AdminStatus::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option
value="<?php echo e($status->value); ?>"
<?php if(
old(
'status',
\App\Enums\Admin\AdminStatus::ACTIVE->value
) == $status->value
): echo 'selected'; endif; ?>
>
<?php echo e($status->label()); ?>
</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">
<?php echo e($message); ?>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</div>
</div>
<div class="col-xl-12 mt-4">
<div class="card custom-card">
<div class="card-header">
<div class="card-title">
سطح دسترسی
</div>
</div>
<div class="card-body">
<div class="row gy-3">
<?php $__currentLoopData = \App\Enums\Admin\AdminPermission::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $permission): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="col-xl-3 col-lg-4 col-md-6">
<div class="form-check">
<input
class="form-check-input permission-checkbox"
type="checkbox"
name="permissions[]"
value="<?php echo e($permission->value); ?>"
id="permission_<?php echo e($permission->value); ?>"
data-permission="<?php echo e($permission->value); ?>"
<?php if(
in_array(
$permission->value,
old('permissions', [])
)
): echo 'checked'; endif; ?>
>
<label
class="form-check-label"
for="permission_<?php echo e($permission->value); ?>"
>
<?php echo e($permission->label()); ?>
</label>
</div>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php $__errorArgs = ['permissions'];
$__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">
<?php echo e($message); ?>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
<?php $__errorArgs = ['permissions.*'];
$__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">
<?php echo e($message); ?>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</div>
</div>
</div>
<div class="card-avatar mt-4">
<div class="text-center">
<label class="form-label d-block fw-semibold">
تصویر پروفایل
</label>
<label
class="avatar-picker"
id="avatarPreview"
style="
background-image:
url('<?php echo e(asset('assets/admin/images/faces/DefaultAvatar.jpg')); ?>')
"
>
<input
type="file"
name="image"
accept="image/*"
onchange="previewAvatar(this)"
>
</label>
</div>
</div>
<?php $__errorArgs = ['image'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
<div class="mt-2">
<span class="text-danger">
<?php echo e($message); ?>
</span>
</div>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</div>
<div class="card-footer text-end">
<a
href="<?php echo e(route('admin.admins.index')); ?>"
class="btn btn-light"
>
انصراف
</a>
<button
type="submit"
class="btn btn-primary"
>
ثبت اطلاعات
</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('scripts'); ?>
<script>
document.addEventListener('DOMContentLoaded', function () {
const roleSelect = document.getElementById('adminRole');
const superAdminRole =
<?php echo json_encode(\App\Enums\Admin\AdminRole::SUPERADMIN->value, 15, 512) ?>;
const manageAdminsPermission =
<?php echo json_encode(\App\Enums\Admin\AdminPermission::MANAGE_ADMINS->value, 15, 512) ?>;
function handleAdminPermissions() {
const isSuperAdmin =
roleSelect.value === superAdminRole;
document
.querySelectorAll('.permission-checkbox')
.forEach(function (checkbox) {
if (
checkbox.dataset.permission ===
manageAdminsPermission
) {
if (!isSuperAdmin) {
checkbox.checked = false;
checkbox.disabled = true;
} else {
checkbox.disabled = false;
}
}
});
}
roleSelect.addEventListener(
'change',
handleAdminPermissions
);
handleAdminPermissions();
});
</script>
<?php $__env->stopPush(); ?>
<?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/admins/create.blade.php ENDPATH**/ ?>
@@ -0,0 +1,434 @@
<?php $__env->startSection('breadcrumb'); ?>
<div>
<div>
<h1 class="page-title fw-medium fs-18 mb-2">ویرایش تور</h1>
<div>
<nav>
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="<?php echo e(route('admin.tours.index')); ?>">مدیریت تورها</a></li>
<li class="breadcrumb-item active" aria-current="page">ویرایش تور</li>
</ol>
</nav>
</div>
</div>
</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.tours.update', $tour->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-6">
<label class="form-label">عنوان تور <span class="text-danger">*</span></label>
<input type="text" class="form-control" name="title"
value="<?php echo e(old('title', $tour->title)); ?>">
<?php $__errorArgs = ['title'];
$__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" name="tour_scope" id="tourScopeSelect">
<option value="">یک مورد را انتخاب کنید</option>
<?php $__currentLoopData = \App\Enums\Tour\TourScope::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $scope): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($scope->value); ?>"
<?php echo e(old('tour_scope', $tour->tour_scope?->value) == $scope->value ? 'selected' : ''); ?>>
<?php echo e($scope->label()); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['tour_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-6">
<label class="form-label">نوع حمل و نقل / سفر <span
class="text-danger">*</span></label>
<select class="form-control" name="tour_mode">
<option value="">یک مورد را انتخاب کنید</option>
<?php $__currentLoopData = \App\Enums\Tour\TourMode::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mode): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($mode->value); ?>"
<?php echo e(old('tour_mode', $tour->tour_mode?->value) == $mode->value ? 'selected' : ''); ?>>
<?php echo e($mode->label()); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['tour_mode'];
$__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" name="tour_type">
<option value="">یک مورد را انتخاب کنید</option>
<?php $__currentLoopData = \App\Enums\Tour\TourType::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($type->value); ?>"
<?php echo e(old('tour_type', $tour->tour_type?->value) == $type->value ? 'selected' : ''); ?>>
<?php echo e($type->label()); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['tour_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-6">
<label class="form-label">شهر مبدا <span class="text-danger">*</span></label>
<select class="form-control select2" name="origin_city_id">
<option value="">شهر مبدا را انتخاب کنید</option>
<?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($city->id); ?>"
<?php echo e(old('origin_city_id', $tour->origin_city_id) == $city->id ? 'selected' : ''); ?>>
<?php echo e($city->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['origin_city_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" id="countryWrapper"
style="<?php echo e($tour->tour_scope === \App\Enums\Tour\TourScope::INTERNATIONAL ? '' : 'display:none;'); ?>">
<label class="form-label">کشور مقصد</label>
<select class="form-control" id="country_id"
<?php echo e($tour->tour_scope === \App\Enums\Tour\TourScope::INTERNATIONAL ? '' : 'disabled'); ?>>
<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 echo e($selectedCountryId == $country->id ? 'selected' : ''); ?>>
<?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" name="destination_city_id">
<option value="">شهر مقصد را انتخاب کنید</option>
<?php $__currentLoopData = $destinationCities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($city->id); ?>"
<?php echo e(old('destination_city_id', $tour->destination_city_id) == $city->id ? 'selected' : ''); ?>>
<?php echo e($city->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['destination_city_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-12">
<label class="form-label">خلاصه تور</label>
<textarea class="form-control" name="summary"
rows="2"><?php echo e(old('summary', $tour->summary)); ?></textarea>
<?php $__errorArgs = ['summary'];
$__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-12">
<label class="form-label">توضیحات کامل و برنامه سفر</label>
<textarea class="form-control" name="description"
rows="5"><?php echo e(old('description', $tour->description)); ?></textarea>
<?php $__errorArgs = ['description'];
$__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">تاریخ رفت (شروع)</label>
<input
type="text"
id="startDateInput"
class="form-control"
name="start_date"
value="<?php echo e(old(
'start_date',$departure?->start_date ? Verta::instance($departure->start_date)->format('Y/m/d H:i') : '' )); ?>">
<?php $__errorArgs = ['start_date'];
$__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">تاریخ برگشت (پایان)</label>
<input
type="text"
id="endDateInput"
class="form-control"
name="end_date"
value="<?php echo e(old('end_date',$departure?->end_date ? Verta::instance($departure->end_date)->format('Y/m/d H:i') : '')); ?>">
<?php $__errorArgs = ['end_date'];
$__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">قیمت (تومان)</label>
<input type="text" class="form-control" name="price"
value="<?php echo e(old('price', $departure?->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">ظرفیت مسافر</label>
<input type="number" class="form-control" name="capacity"
value="<?php echo e(old('capacity', $departure?->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 = $tour->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($tour->title); ?>">
<?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></div>
<small style="color:#999;">JPG / PNG / WEBP</small>
</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); ?>
</div>
<div class="card-footer text-end">
<button type="submit" class="btn btn-primary">ذخیره تغییرات</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php $__env->startPush('scripts'); ?>
<script>
$(document).ready(function () {
$('#startDateInput').persianDatepicker({
format: 'YYYY/MM/DD HH:mm',
timePicker: {
enabled: true,
meridiem: {
enabled: false
}
},
autoClose: false,
initialValue: false,
initialValueType: 'persian',
toolbox: {
calendarSwitch: {
enabled: false
}
}
});
$('#endDateInput').persianDatepicker({
format: 'YYYY/MM/DD HH:mm',
timePicker: {
enabled: true,
meridiem: {
enabled: false
}
},
autoClose: false,
initialValue: false,
initialValueType: 'persian',
toolbox: {
calendarSwitch: {
enabled: false
}
}
});
function toggleScopeUI() {
const scope = $('#tourScopeSelect').val();
if (scope === '1') {
$('#countryWrapper').show();
$('#country_id').prop('disabled', false);
} else {
$('#countryWrapper').hide();
$('#country_id').prop('disabled', true).val('');
}
}
$('#tourScopeSelect').on('change', toggleScopeUI);
$('#country_id').on('change', function () {
const countryId = $(this).val();
if (!countryId) return;
$.get(`/admin/tours/cities-by-country/${countryId}`, function (cities) {
let options = '<option value="">شهر را انتخاب کنید</option>';
cities.forEach(function (city) {
options += `<option value="${city.id}">${city.name}</option>`;
});
$('select[name="destination_city_id"]').html(options).trigger('change');
}).fail(function () {
alert('خطا در دریافت لیست شهرهای این کشور');
});
});
});
</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/tours/edit.blade.php ENDPATH**/ ?>
@@ -1,8 +1,15 @@
<div class="col-md-6 col-lg-3"> <div class="col-md-6 col-lg-3">
<div class="activity-item wow fadeInUp" data-wow-duration="1s" data-wow-delay=".25s"> <div class="activity-item wow fadeInUp" data-wow-duration="1s" data-wow-delay=".25s">
<div class="activity-img"> <div class="activity-img">
<img src="<?php echo e($flight->file?->url ?? asset('assets/img/activity/01.jpg')); ?>" <?php if($flight->coverImage?->file_id): ?>
alt="<?php echo e($flight->flight_number); ?>"> <img src="<?php echo e(getFileUrl($flight->coverImage->file_id)); ?>"
class="w-100 h-100"
alt="<?php echo e($flight->flight_number); ?>">
<?php else: ?>
<img src="<?php echo e(asset('assets/img/account/user.jpg')); ?>"
class="w-100 h-100"
alt="<?php echo e($flight->title); ?>">
<?php endif; ?>
<?php if(auth()->guard()->check()): ?> <?php if(auth()->guard()->check()): ?>
<form action="<?php echo e(route('accounts.favorites.flight.toggle', ['flight' => $flight->id])); ?>" <form action="<?php echo e(route('accounts.favorites.flight.toggle', ['flight' => $flight->id])); ?>"
method="POST" method="POST"
@@ -241,12 +241,9 @@
<div class="tour-content"> <div class="tour-content">
<div class="tour-top"> <div class="tour-top">
<a href="#" class="tour-category"><i <a href="#" class="tour-category"><i
class="far fa-tag"></i> <?php echo e($tour->tour_type); ?></a> class="far fa-tag"></i> <?php echo e($tour->tour_type->label()); ?></a>
</div> </div>
<h4 class="tour-title"><a href="#"><?php echo e($tour->title); ?></a></h4> <h4 class="tour-title"><a href="#"><?php echo e($tour->title); ?></a></h4>
<div class="tour-duration"><i class="far fa-clock"></i>
سفر <?php echo e(tourDuration($tour)); ?></div>
<div class="tour-date"><?php echo e(tourDateRange($tour)); ?></div>
<div class="tour-bottom"> <div class="tour-bottom">
<div class="tour-price"> <div class="tour-price">
<span><?php echo e(number_format($tour->tourDepartures->first()->price)); ?> تومان</span> <span><?php echo e(number_format($tour->tourDepartures->first()->price)); ?> تومان</span>
@@ -0,0 +1,5 @@
<?php $__env->startSection('title', __('Forbidden')); ?>
<?php $__env->startSection('code', '403'); ?>
<?php $__env->startSection('message', __($exception->getMessage() ?: 'Forbidden')); ?>
<?php echo $__env->make('errors::minimal', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\ASUS\Desktop\airline-agency\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions/views/403.blade.php ENDPATH**/ ?>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
<div class="listing-price"> <div class="listing-price">
<h4 class="listing-price-tag">پرواز</h4> <h4 class="listing-price-tag">پرواز</h4>
<div class="listing-price-amount"> <div class="listing-price-amount">
<span> <?php echo e(number_format($flight->price)); ?> تومان</span> <span> <?php echo e(number_format($flight->price)); ?> تومان</span>
</div> </div>
</div> </div>
<div class="search-form"> <div class="search-form">
@@ -15,14 +15,14 @@
<div class="col-lg-12"> <div class="col-lg-12">
<div class="form-group"> <div class="form-group">
<div class="search-form-date"> <div class="search-form-date">
<label for="departure_date">تاریخ رفت</label> <label for="departure_date">تاریخ رفت</label>
<input <input
type="text" type="text"
id="departure_date" id="departure_date"
class="form-control" class="form-control"
value="<?php echo e(verta($flight->departure_time)->format('Y/m/d - H:i')); ?>" value="<?php echo e(verta($flight->departure_time)->format('Y/m/d - H:i')); ?>"
disabled disabled
> >
</div> </div>
</div> </div>
</div> </div>
@@ -30,21 +30,22 @@
<div class="form-group"> <div class="form-group">
<div class="search-form-date"> <div class="search-form-date">
<div class="search-form-return"> <div class="search-form-return">
<label for="return_date">تاریخ برگشت</label> <label for="return_date">تاریخ برگشت</label>
<input <input
type="text" type="text"
id="return_date" id="return_date"
class="form-control" class="form-control"
value="<?php echo e($flight->arrival_time); ?>" value="<?php echo e($flight->arrival_time); ?>"
disabled disabled
> >
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="listing-side-btn"> <div class="listing-side-btn">
<button type="submit" class="theme-btn"><span class="far fa-shopping-bag"></span>اکنون ثبت کن</button> <button type="submit" class="theme-btn"><span class="far fa-shopping-bag"></span>اکنون ثبت کن
</button>
</div> </div>
</div> </div>
</form> </form>
@@ -0,0 +1,266 @@
<?php $__env->startSection('breadcrumb'); ?>
<div>
<div>
<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">
<a href="<?php echo e(route('admin.flights.index')); ?>">
لیست پروازها
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
سطل زباله پروازها
</li>
</ol>
</nav>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-4">
<div class="row">
<div class="col-xl-12">
<div class="card custom-card">
<div class="card-body p-3">
<div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
<div>
<h6 class="mb-0 fw-semibold">
پروازهای حذف‌شده
</h6>
</div>
<div class="d-flex">
<a href="<?php echo e(route('admin.flights.index')); ?>"
class="btn btn-primary me-2">
<i class="ri-arrow-go-back-line me-1 fw-medium align-middle"></i>
بازگشت به لیست پروازها
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<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>
</tr>
</thead>
<tbody>
<?php if(session('success')): ?>
<tr>
<td colspan="11">
<span style="color: green">
<?php echo e(session('success')); ?>
</span>
</td>
</tr>
<?php endif; ?>
<?php if(session('error')): ?>
<tr>
<td colspan="11">
<span style="color: red">
<?php echo e(session('error')); ?>
</span>
</td>
</tr>
<?php endif; ?>
<?php if($errors->any()): ?>
<tr>
<td colspan="11">
<?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<span class="d-block" style="color: red">
<?php echo e($error); ?>
</span>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</td>
</tr>
<?php endif; ?>
<?php $__empty_1 = true; $__currentLoopData = $flights; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $flight): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr>
<td>
<span class="avatar avatar-md avatar-square bg-light">
<?php if($flight->coverImage?->file): ?>
<img src="<?php echo e(getFileUrl($flight->coverImage->file_id)); ?>"
class="w-100 h-100"
alt="<?php echo e($flight->flight_number); ?>">
<?php else: ?>
<img src="<?php echo e(asset('assets/admin/images/faces/DefaultAvatar.jpg')); ?>"
class="w-100 h-100"
alt="<?php echo e($flight->flight_number); ?>">
<?php endif; ?>
</span>
</td>
<td>
<div class="fw-medium">
<?php echo e($flight->flight_number ?? '-'); ?>
</div>
</td>
<td>
<?php echo e($flight->airline?->name ?? '-'); ?>
</td>
<td>
<div>
<?php echo e($flight->origin_airport?->name ?? '-'); ?>
</div>
<small class="text-muted">
<?php echo e($flight->origin_airport?->city?->name ?? '-'); ?>
</small>
</td>
<td>
<div>
<?php echo e($flight->airport?->name ?? '-'); ?>
</div>
<small class="text-muted">
<?php echo e($flight->airport?->city?->name ?? '-'); ?>
</small>
</td>
<td>
<?php if($flight->flight_type): ?>
<span class="badge bg-success-transparent">
<?php echo e($flight->flight_type->label()); ?>
</span>
<?php else: ?>
-
<?php endif; ?>
</td>
<td>
<?php if($flight->flight_scope): ?>
<span class="badge bg-primary-transparent">
<?php echo e($flight->flight_scope->label()); ?>
</span>
<?php else: ?>
-
<?php endif; ?>
</td>
<td>
<?php if($flight->status): ?>
<span class="badge bg-warning-transparent">
<?php echo e($flight->status->label()); ?>
</span>
<?php else: ?>
-
<?php endif; ?>
</td>
<td>
<?php echo e($flight->created_at?->toJalali()->format('H:i Y/m/d') ?? '-'); ?>
</td>
<td>
<?php echo e($flight->deleted_at?->toJalali()->format('H:i Y/m/d') ?? '-'); ?>
</td>
<td>
<div class="hstack gap-2 fs-15">
<form action="<?php echo e(route('admin.flights.trash.restore', $flight->id)); ?>"
method="POST">
<?php echo csrf_field(); ?>
<button type="submit"
class="btn btn-icon btn-sm btn-success-light"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="بازگردانی پرواز">
<i class="ri-arrow-go-back-line"></i>
</button>
</form>
<form action="<?php echo e(route('admin.flights.trash.forceDelete', $flight->id)); ?>"
method="POST"
onsubmit="return confirm('آیا از حذف دائمی این پرواز مطمئن هستید؟ این عملیات قابل بازگشت نیست.')">
<?php echo csrf_field(); ?>
<?php echo method_field('DELETE'); ?>
<button type="submit"
class="btn btn-icon btn-sm btn-danger-light"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="حذف دائمی پرواز">
<i class="ri-delete-bin-6-line"></i>
</button>
</form>
</div>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<tr>
<td colspan="11" class="text-center text-muted py-4">
پروازی در سطل زباله وجود ندارد.
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<div class="card-footer d-flex justify-content-center align-items-center">
<?php echo e($flights->links()); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?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/trash.blade.php ENDPATH**/ ?>
@@ -0,0 +1,426 @@
<?php $__env->startSection('breadcrumb'); ?>
<div>
<div>
<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>
</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.tours.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-6">
<label class="form-label">عنوان تور <span class="text-danger">*</span></label>
<input
type="text"
class="form-control"
name="title"
placeholder="مثال: تور تفریحی استانبول ویژه نوروز"
value="<?php echo e(old('title')); ?>"
/>
<?php $__errorArgs = ['title'];
$__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" name="tour_scope">
<option value="">یک مورد را انتخاب کنید</option>
<?php $__currentLoopData = \App\Enums\Tour\TourScope::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $scope): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option
value="<?php echo e($scope->value); ?>" <?php echo e(old('tour_scope') == $scope->value ? 'selected' : ''); ?>>
<?php echo e(method_exists($scope, 'label') ? $scope->label() : $scope->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['tour_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-6" id="countryWrapper" style="display:none;">
<label class="form-label">کشور مقصد <span class="text-danger">*</span></label>
<select class="form-control" id="country_id" disabled>
<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 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" name="tour_mode">
<option value="">یک مورد را انتخاب کنید</option>
<?php $__currentLoopData = \App\Enums\Tour\TourMode::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mode): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option
value="<?php echo e($mode->value); ?>" <?php echo e(old('tour_mode') == $mode->value ? 'selected' : ''); ?>>
<?php echo e(method_exists($mode, 'label') ? $mode->label() : $mode->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['tour_mode'];
$__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" name="tour_type">
<option value="">یک مورد را انتخاب کنید</option>
<?php $__currentLoopData = \App\Enums\Tour\TourType::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option
value="<?php echo e($type->value); ?>" <?php echo e(old('tour_type') == $type->value ? 'selected' : ''); ?>>
<?php echo e(method_exists($type, 'label') ? $type->label() : $type->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['tour_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-6">
<label class="form-label">شهر مبدا <span class="text-danger">*</span></label>
<select class="form-control select2" name="origin_city_id">
<option value="">شهر مبدا را انتخاب کنید</option>
<?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option
value="<?php echo e($city->id); ?>" <?php echo e(old('origin_city_id') == $city->id ? 'selected' : ''); ?>>
<?php echo e($city->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['origin_city_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="destination_city_id">
<option value="">شهر مقصد را انتخاب کنید</option>
<?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option
value="<?php echo e($city->id); ?>" <?php echo e(old('destination_city_id') == $city->id ? 'selected' : ''); ?>>
<?php echo e($city->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['destination_city_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-12">
<label class="form-label">خلاصه تور</label>
<textarea class="form-control" name="summary" rows="2"
placeholder="توضیح کوتاه و جذاب در مورد تور..."><?php echo e(old('summary')); ?></textarea>
<?php $__errorArgs = ['summary'];
$__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-12">
<label class="form-label">توضیحات کامل و برنامه سفر</label>
<textarea class="form-control" name="description" rows="5"
placeholder="جزئیات برنامه سفر، خدمات تور و توضیحات تکمیلی..."><?php echo e(old('description')); ?></textarea>
<?php $__errorArgs = ['description'];
$__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">تاریخ رفت (شروع)</label>
<input type="text" id="startDateInput" class="form-control" name="start_date"
placeholder="تاریخ رفت را وارد کنید" value="<?php echo e(old('start_date')); ?>">
<?php $__errorArgs = ['start_date'];
$__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">تاریخ برگشت (پایان)</label>
<input type="text" id="endDateInput" class="form-control" name="end_date"
placeholder="تاریخ برگشت را وارد کنید" value="<?php echo e(old('end_date')); ?>">
<?php $__errorArgs = ['end_date'];
$__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">قیمت (تومان)</label>
<input type="text" class="form-control" name="price" placeholder="مثال: ۱۵۰۰۰۰۰۰"
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">ظرفیت مسافر</label>
<input type="number" class="form-control" name="capacity" placeholder="مثال: ۳۰"
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></div>
<small style="color:#999;">JPG / PNG / WEBP</small>
</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">
<button type="submit" class="btn btn-primary">ثبت و ایجاد تور</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php $__env->startPush('scripts'); ?>
<script>
$(document).ready(function () {
$('#startDateInput').persianDatepicker({
format: 'YYYY/MM/DD HH:mm',
timePicker: {
enabled: true,
meridiem: {
enabled: false
}
},
autoClose: false,
initialValue: false,
minDate: new persianDate().valueOf(),
toolbox: {
calendarSwitch: {
enabled: false
}
}
});
$('#endDateInput').persianDatepicker({
format: 'YYYY/MM/DD HH:mm',
timePicker: {
enabled: true,
meridiem: {
enabled: false
}
},
autoClose: false,
initialValue: false,
minDate: new persianDate().valueOf(),
toolbox: {
calendarSwitch: {
enabled: false
}
}
});
const originalDestHtml = $('select[name="destination_city_id"]').html();
function toggleScopeUI() {
const scope = $('select[name="tour_scope"]').val();
if (scope === '1') {
$('#countryWrapper').show();
$('#country_id').prop('disabled', false);
} else {
$('#countryWrapper').hide();
$('#country_id').prop('disabled', true).val('');
$('select[name="destination_city_id"]').html(originalDestHtml).trigger('change');
}
}
$('select[name="tour_scope"]').on('change', toggleScopeUI);
toggleScopeUI();
$('#country_id').on('change', function () {
const countryId = $(this).val();
if (!countryId) return;
$.get(`/admin/tours/cities-by-country/${countryId}`, function (cities) {
let options = '<option value="">شهر را انتخاب کنید</option>';
cities.forEach(function (city) {
options += `<option value="${city.id}">${city.name}</option>`;
});
$('select[name="destination_city_id"]').html(options).trigger('change');
}).fail(function () {
alert('خطا در دریافت لیست شهرهای این کشور');
});
});
});
</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/tours/create.blade.php ENDPATH**/ ?>