Compare commits
3 Commits
931d67cdd8
...
3ec77fd4d8
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ec77fd4d8 | |||
| 123b43fb38 | |||
| 81d2aa1acb |
@@ -4,6 +4,12 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
|
||||
use App\Http\Requests\FlightStoreRequest;
|
||||
use App\Http\Requests\FlightUpdateRequest;
|
||||
use App\Models\Flight;
|
||||
use App\Models\TravelType;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FlightController extends Controller
|
||||
@@ -13,103 +19,100 @@ class FlightController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return 'Flights index';
|
||||
}
|
||||
abort_unless(auth('admin')->user()?->canManageFlights('view'), 403);
|
||||
|
||||
$flights = Flight::query()
|
||||
->with('travelType')
|
||||
->latest()
|
||||
->when(request('q'), function ($query, $q) {
|
||||
$query->where(function ($query) use ($q) {
|
||||
$query->where('flight_number', 'like', "%{$q}%")
|
||||
->orWhere('airline_name', 'like', "%{$q}%")
|
||||
->orWhere('origin', 'like', "%{$q}%")
|
||||
->orWhere('destination', 'like', "%{$q}%");
|
||||
});
|
||||
})
|
||||
->when(request('status') !== null, function ($query) {
|
||||
$query->where('status', request('status'));
|
||||
})
|
||||
->paginate(10)
|
||||
->withQueryString();
|
||||
|
||||
$travelTypes = TravelType::where('status', 1)->get();
|
||||
|
||||
return view('admin.flights.index', compact('flights', 'travelTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* نمایش فرم ایجاد پرواز
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return 'Flights create';
|
||||
}
|
||||
abort_unless(auth('admin')->user()?->canManageFlights('create'), 403);
|
||||
|
||||
$travelTypes = TravelType::where('status', 1)->get();
|
||||
|
||||
return view('admin.flights.create', compact('travelTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* ذخیره پرواز جدید
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(FlightStoreRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
abort_unless(auth('admin')->user()?->canManageFlights('create'), 403);
|
||||
|
||||
Flight::create($request->validated());
|
||||
|
||||
return redirect()->route('admin.flights.index')
|
||||
->with('success', 'پرواز با موفقیت ثبت شد.');
|
||||
}
|
||||
|
||||
/**
|
||||
* نمایش جزئیات یک پرواز
|
||||
*/
|
||||
public function show($flight)
|
||||
public function show(Flight $flight)
|
||||
{
|
||||
return 'Flights show';
|
||||
}
|
||||
abort_unless(auth('admin')->user()?->canManageFlights('view'), 403);
|
||||
|
||||
return view('admin.flights.show', compact('flight'));
|
||||
}
|
||||
|
||||
/**
|
||||
* نمایش فرم ویرایش پرواز
|
||||
*/
|
||||
public function edit($flight)
|
||||
public function edit(Flight $flight)
|
||||
{
|
||||
return 'Flights edit';
|
||||
}
|
||||
abort_unless(auth('admin')->user()?->canManageFlights('update'), 403);
|
||||
|
||||
$travelTypes = TravelType::where('status', 1)->get();
|
||||
|
||||
return view('admin.flights.edit', compact('flight', 'travelTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* بروزرسانی پرواز
|
||||
*/
|
||||
public function update(Request $request, $flight)
|
||||
public function update(FlightUpdateRequest $request, Flight $flight)
|
||||
{
|
||||
//
|
||||
}
|
||||
abort_unless(auth('admin')->user()?->canManageFlights('update'), 403);
|
||||
|
||||
$flight->update($request->validated());
|
||||
|
||||
return redirect()->route('admin.flights.index')
|
||||
->with('success', 'پرواز با موفقیت بهروزرسانی شد.');
|
||||
}
|
||||
|
||||
/**
|
||||
* حذف پرواز
|
||||
*/
|
||||
public function destroy($flight)
|
||||
public function destroy(Flight $flight)
|
||||
{
|
||||
//
|
||||
abort_unless(auth('admin')->user()?->canManageFlights('delete'), 403);
|
||||
|
||||
$flight->delete();
|
||||
|
||||
return redirect()->route('admin.flights.index')
|
||||
->with('success', 'پرواز با موفقیت حذف شد.');
|
||||
}
|
||||
}
|
||||
//
|
||||
//namespace App\Http\Controllers\Admin;
|
||||
//
|
||||
//use App\Http\Controllers\Controller;
|
||||
//use Illuminate\Http\Request;
|
||||
//
|
||||
//class FlightController extends Controller
|
||||
//{
|
||||
// public function index()
|
||||
// {
|
||||
// return 'Flights index';
|
||||
// }
|
||||
//
|
||||
// public function create()
|
||||
// {
|
||||
// return 'Flights create';
|
||||
// }
|
||||
//
|
||||
// public function store()
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
//
|
||||
// public function show($flight)
|
||||
// {
|
||||
// return 'Flights show';
|
||||
// }
|
||||
//
|
||||
// public function edit($flight)
|
||||
// {
|
||||
// return 'Flights edit';
|
||||
// }
|
||||
//
|
||||
// public function update($flight)
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
//
|
||||
// public function destroy($flight)
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -5,43 +5,72 @@ namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\TourStoreRequest;
|
||||
use App\Models\Tour;
|
||||
use App\Models\TravelType;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TourController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$tour = Tour::latest()->paginate(10);
|
||||
return view('admin.tours.index', compact($tour));
|
||||
}
|
||||
$tours = Tour::latest()->paginate(10);
|
||||
return view('admin.tours.index', compact('tours'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
public function create()
|
||||
{
|
||||
return view('admin.tours.create');
|
||||
}
|
||||
}
|
||||
|
||||
public function store(TourStoreRequest $request)
|
||||
public function store(TourStoreRequest $request)
|
||||
{
|
||||
|
||||
Tour::create($request->validated());
|
||||
// Tour::create($request->validated());
|
||||
|
||||
|
||||
$tour = Tour::create($request->only([
|
||||
'travel_type_id', 'title', 'slug', 'description',
|
||||
'start_date', 'end_date', 'price', 'capacity', 'status'
|
||||
]));
|
||||
|
||||
$this->uploadImages($tour, $request->file('images'));
|
||||
return view('admin.tours.index')
|
||||
->with('success', 'تور با موفقیت ایجاد شد.');
|
||||
}
|
||||
}
|
||||
|
||||
public function show(Tour $tour)
|
||||
{
|
||||
return view('admin.tours.show', compact('tour'));
|
||||
}
|
||||
|
||||
public function edit(Tour $tour)
|
||||
{
|
||||
return view('admin.tours.edit', compact('tour'));
|
||||
$travelTypes = TravelType::all();
|
||||
return view('admin.tours.edit', compact('tour', 'travelTypes'));
|
||||
}
|
||||
|
||||
public function update(TourStoreRequest $request, Tour $tour)
|
||||
{
|
||||
$tour->update($request->validated());
|
||||
|
||||
|
||||
// ذخیره فایل و گرفتن مسیر (بدون پسوند)
|
||||
$path = $request->file('image')->store('photos', 'public');
|
||||
|
||||
$extension = $request->file('image')->getClientOriginalExtension();
|
||||
|
||||
// ایجاد رکورد
|
||||
$tour->files()->create([
|
||||
'name' => $path,
|
||||
'extension' => $extension,
|
||||
'size' => $request->file('image')->getSize(),
|
||||
'original_name' => $request->file('image')->getClientOriginalName(),
|
||||
]);
|
||||
|
||||
|
||||
return redirect()->route('admin.tours.index')
|
||||
->with('success', 'تور با موفقیت بهروزرسانی شد.');
|
||||
}
|
||||
|
||||
public function destroy(Tour $tour)
|
||||
{
|
||||
$tour->delete();
|
||||
@@ -50,7 +79,7 @@ class TourController extends Controller
|
||||
->with('success', 'تور با موفقیت حذف شد.');
|
||||
}
|
||||
|
||||
public function removeImage(Tour $tour, $image)
|
||||
public function removeImage(Tour $tour, $image)
|
||||
{
|
||||
// منطق حذف تصویر — بسته به جدول تصاویر
|
||||
return back()->with('success', 'تصویر حذف شد.');
|
||||
|
||||
@@ -1,45 +1,251 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\UserStoreRequest;
|
||||
use App\Http\Requests\UserPasswordUpdateRequest;
|
||||
use App\Http\Requests\UserUpdateRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function index()
|
||||
/**
|
||||
* لیست + جستجوی چندپارامتری
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$users = User::latest()->paginate(15);
|
||||
// چک دسترسی: فقط مدیرانی که مجوز «مشاهده کاربران» دارند
|
||||
abort_unless(auth('admin')->user()->canManageUsers('view'), 403);
|
||||
|
||||
$query = User::query();
|
||||
|
||||
// جستجوی کلی: نام / ایمیل / موبایل
|
||||
if ($request->filled('search')) {
|
||||
$query->where(function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%')
|
||||
->orWhere('email', 'like', '%' . $request->search . '%')
|
||||
->orWhere('mobile', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
// فیلتر وضعیت
|
||||
if ($request->filled('status')) {
|
||||
$query->where('status', $request->status);
|
||||
}
|
||||
|
||||
// فیلتر تاریخ عضویت
|
||||
if ($request->filled('from_date')) {
|
||||
$query->whereDate('created_at', '>=', $request->from_date);
|
||||
}
|
||||
if ($request->filled('to_date')) {
|
||||
$query->whereDate('created_at', '<=', $request->to_date);
|
||||
}
|
||||
|
||||
// withQueryString => فیلترها هنگام صفحهبندی حفظ میشوند
|
||||
$users = $query->latest()->paginate(10)->withQueryString();
|
||||
|
||||
return view('admin.users.index', compact('users'));
|
||||
}
|
||||
|
||||
public function show(User $user)
|
||||
{
|
||||
return view('admin.users.show', compact('user'));
|
||||
}
|
||||
|
||||
public function edit(User $user)
|
||||
{
|
||||
abort_unless(auth('admin')->user()->canManageUsers('edit'), 403);
|
||||
|
||||
return view('admin.users.edit', compact('user'));
|
||||
}
|
||||
|
||||
public function update(UserStoreRequest $request, User $user)
|
||||
public function update(UserUpdateRequest $request, User $user)
|
||||
{
|
||||
$user->update($request->validated());
|
||||
abort_unless(auth('admin')->user()->canManageUsers('edit'), 403);
|
||||
|
||||
return redirect()
|
||||
->route('admin.users.index')
|
||||
->with('success', 'کاربر با موفقیت بروزرسانی شد.');
|
||||
$data = $request->validated();
|
||||
|
||||
// اگر رمز خالی بود تغییرش نده (گزینهای)
|
||||
unset($data['password']);
|
||||
|
||||
$user->update($data);
|
||||
|
||||
return redirect()->route('admin.users.index')
|
||||
->with('success', 'اطلاعات کاربر با موفقیت ویرایش شد.');
|
||||
}
|
||||
|
||||
public function destroy(User $user)
|
||||
{
|
||||
abort_unless(auth('admin')->user()->canManageUsers('delete'), 403);
|
||||
|
||||
$user->delete();
|
||||
|
||||
return redirect()
|
||||
->route('admin.users.index')
|
||||
return redirect()->route('admin.users.index')
|
||||
->with('success', 'کاربر با موفقیت حذف شد.');
|
||||
}
|
||||
|
||||
public function changePassword(User $user)
|
||||
{
|
||||
abort_unless(auth('admin')->user()->canManageUsers('password'), 403);
|
||||
|
||||
return view('admin.users.change-password', compact('user'));
|
||||
}
|
||||
|
||||
public function updatePassword(UserPasswordUpdateRequest $request, User $user)
|
||||
{
|
||||
abort_unless(auth('admin')->user()->canManageUsers('password'), 403);
|
||||
|
||||
$user->update([
|
||||
'password' => Hash::make($request->password),
|
||||
]);
|
||||
|
||||
return redirect()->route('admin.users.index')
|
||||
->with('success', 'رمز عبور کاربر با موفقیت تغییر کرد.');
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//namespace App\Http\Controllers\Admin;
|
||||
//
|
||||
//use App\Http\Controllers\Controller;
|
||||
//use App\Http\Requests\UserPasswordUpdateRequest;
|
||||
//use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
//use App\Http\Requests\UserUpdateRequest;
|
||||
//use App\Models\User;
|
||||
//use Illuminate\Http\Request;
|
||||
//use Illuminate\Support\Facades\Hash;
|
||||
//
|
||||
//class UserController extends Controller
|
||||
//{
|
||||
//
|
||||
// /**
|
||||
// * لیست + جستجوی چندپارامتری
|
||||
// */
|
||||
// public function index(Request $request)
|
||||
// {
|
||||
// // چک دسترسی: فقط مدیرانی که مجوز «مشاهده کاربران» دارند
|
||||
// $this->authorize('users.view');
|
||||
//
|
||||
// $query = User::query();
|
||||
//
|
||||
// // جستجوی کلی: نام / ایمیل / موبایل
|
||||
// if ($request->filled('search')) {
|
||||
// $query->where(function ($q) use ($request) {
|
||||
// $q->where('name', 'like', '%' . $request->search . '%')
|
||||
// ->orWhere('email', 'like', '%' . $request->search . '%')
|
||||
// ->orWhere('mobile', 'like', '%' . $request->search . '%');
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// // فیلتر وضعیت
|
||||
// if ($request->filled('status')) {
|
||||
// $query->where('status', $request->status);
|
||||
// }
|
||||
//
|
||||
// // فیلتر تاریخ عضویت
|
||||
// if ($request->filled('from_date')) {
|
||||
// $query->whereDate('created_at', '>=', $request->from_date);
|
||||
// }
|
||||
// if ($request->filled('to_date')) {
|
||||
// $query->whereDate('created_at', '<=', $request->to_date);
|
||||
// }
|
||||
//
|
||||
// // withQueryString => فیلترها هنگام صفحهبندی حفظ میشوند
|
||||
// $users = $query->latest()->paginate(10)->withQueryString();
|
||||
//
|
||||
// return view('admin.users.index', compact('users'));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public function edit(User $user)
|
||||
// {
|
||||
// $this->authorize('users.edit');
|
||||
//
|
||||
// return view('admin.users.edit', compact('user'));
|
||||
// }
|
||||
//
|
||||
// public function update(UserUpdateRequest $request, User $user)
|
||||
// {
|
||||
// $data = $request->validated();
|
||||
//
|
||||
// // اگر رمز خالی بود تغییرش نده (گزینهای)
|
||||
// unset($data['password']);
|
||||
//
|
||||
// $user->update($data);
|
||||
//
|
||||
// return redirect()->route('admin.users.index')
|
||||
// ->with('success', 'اطلاعات کاربر با موفقیت ویرایش شد.');
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public function destroy(User $user)
|
||||
// {
|
||||
// $this->authorize('users.delete');
|
||||
//
|
||||
// $user->delete();
|
||||
//
|
||||
// return redirect()->route('admin.users.index')
|
||||
// ->with('success', 'کاربر با موفقیت حذف شد.');
|
||||
// }
|
||||
//
|
||||
// public function changePassword(User $user)
|
||||
// {
|
||||
// $this->authorize('users.change-password');
|
||||
//
|
||||
// return view('admin.users.change-password', compact('user'));
|
||||
// }
|
||||
//
|
||||
// public function updatePassword(UserPasswordUpdateRequest $request, User $user)
|
||||
// {
|
||||
// $user->update([
|
||||
// 'password' => Hash::make($request->password),
|
||||
// ]);
|
||||
//
|
||||
// return redirect()->route('admin.users.index')
|
||||
// ->with('success', 'رمز عبور کاربر با موفقیت تغییر کرد.');
|
||||
// }
|
||||
//}
|
||||
//
|
||||
////
|
||||
////namespace App\Http\Controllers\Admin;
|
||||
////
|
||||
////use App\Http\Controllers\Controller;
|
||||
////use App\Http\Requests\UserStoreRequest;
|
||||
////use App\Models\User;
|
||||
////
|
||||
////class UserController extends Controller
|
||||
////{
|
||||
//// public function index()
|
||||
//// {
|
||||
//// $users = User::latest()->paginate(15);
|
||||
////
|
||||
//// return view('admin.users.index', compact('users'));
|
||||
//// }
|
||||
////
|
||||
//// public function show(User $user)
|
||||
//// {
|
||||
//// return view('admin.users.show', compact('user'));
|
||||
//// }
|
||||
////
|
||||
//// public function edit(User $user)
|
||||
//// {
|
||||
//// return view('admin.users.edit', compact('user'));
|
||||
//// }
|
||||
////
|
||||
//// public function update(UserStoreRequest $request, User $user)
|
||||
//// {
|
||||
//// $user->update($request->validated());
|
||||
////
|
||||
//// return redirect()
|
||||
//// ->route('admin.users.index')
|
||||
//// ->with('success', 'کاربر با موفقیت بروزرسانی شد.');
|
||||
//// }
|
||||
////
|
||||
//// public function destroy(User $user)
|
||||
//// {
|
||||
//// $user->delete();
|
||||
////
|
||||
//// return redirect()
|
||||
//// ->route('admin.users.index')
|
||||
//// ->with('success', 'کاربر با موفقیت حذف شد.');
|
||||
//// }
|
||||
////}
|
||||
|
||||
@@ -74,6 +74,18 @@ class TourStoreRequest extends FormRequest
|
||||
'required',
|
||||
'integer',
|
||||
'min:0'],
|
||||
'images' =>
|
||||
[
|
||||
'required',
|
||||
'array'
|
||||
],
|
||||
'images.*' =>
|
||||
[
|
||||
'image',
|
||||
'mimes:jpeg,png,jpg,webp',
|
||||
'max:2048'
|
||||
],
|
||||
|
||||
'status' =>
|
||||
[
|
||||
'nullable',
|
||||
|
||||
+146
-54
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
@@ -12,64 +13,155 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Flight
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $travel_type_id
|
||||
* @property string $flight_number
|
||||
* @property string $airline_name
|
||||
* @property string $origin
|
||||
* @property string $destination
|
||||
* @property Carbon $departure_date
|
||||
* @property Carbon $departure_time
|
||||
* @property Carbon $arrival_date
|
||||
* @property Carbon $arrival_time
|
||||
* @property string $duration
|
||||
* @property float $price
|
||||
* @property int $capacity
|
||||
* @property int $status
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @property Collection|Tour[] $tours
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Flight extends Model
|
||||
{
|
||||
protected $table = 'flights';
|
||||
public static $snakeAttributes = false;
|
||||
protected $table = 'flights';
|
||||
|
||||
protected $casts = [
|
||||
'travel_type_id' => 'int',
|
||||
'departure_date' => 'datetime',
|
||||
'departure_time' => 'datetime',
|
||||
'arrival_date' => 'datetime',
|
||||
'arrival_time' => 'datetime',
|
||||
'price' => 'float',
|
||||
'capacity' => 'int',
|
||||
'status' => 'int'
|
||||
];
|
||||
protected $casts = [
|
||||
'travel_type_id' => 'int',
|
||||
'departure_date' => 'date',
|
||||
'arrival_date' => 'date',
|
||||
'departure_time' => 'datetime',
|
||||
'arrival_time' => 'datetime',
|
||||
'price' => 'decimal:2',
|
||||
'capacity' => 'int',
|
||||
'status' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'travel_type_id',
|
||||
'flight_number',
|
||||
'airline_name',
|
||||
'origin',
|
||||
'destination',
|
||||
'departure_date',
|
||||
'departure_time',
|
||||
'arrival_date',
|
||||
'arrival_time',
|
||||
'duration',
|
||||
'price',
|
||||
'capacity',
|
||||
'status'
|
||||
];
|
||||
protected $fillable = [
|
||||
'travel_type_id',
|
||||
'flight_number',
|
||||
'airline_name',
|
||||
'origin',
|
||||
'destination',
|
||||
'departure_date',
|
||||
'departure_time',
|
||||
'arrival_date',
|
||||
'arrival_time',
|
||||
'duration',
|
||||
'price',
|
||||
'capacity',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function tours()
|
||||
{
|
||||
return $this->belongsToMany(Tour::class, 'tour_flights')
|
||||
->withPivot('id')
|
||||
->withTimestamps();
|
||||
}
|
||||
/* ------------------------- روابط (Relations) ------------------------- */
|
||||
|
||||
/**
|
||||
* نوع سفر (داخلی/خارجی/چارتر) مرتبط با این پرواز
|
||||
*/
|
||||
public function travelType()
|
||||
{
|
||||
return $this->belongsTo(TravelType::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* تورهای مرتبط با این پرواز
|
||||
*/
|
||||
public function tours()
|
||||
{
|
||||
return $this->belongsToMany(Tour::class, 'tour_flights')
|
||||
->withPivot('id')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
/* --------------------------- Helper ها ------------------------------ */
|
||||
|
||||
public function statusLabel(): string
|
||||
{
|
||||
return $this->status == 1 ? 'فعال' : 'غیرفعال';
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return (int)$this->status === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* اسکوپ برای پروازهای فعال
|
||||
*/
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('status', 1);
|
||||
}
|
||||
|
||||
public function getRouteKeyName(): string
|
||||
{
|
||||
return 'id';
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
///**
|
||||
// * Created by Reliese Model.
|
||||
// */
|
||||
//
|
||||
//namespace App\Models;
|
||||
//
|
||||
//use Carbon\Carbon;
|
||||
//use Illuminate\Database\Eloquent\Collection;
|
||||
//use Illuminate\Database\Eloquent\Model;
|
||||
//
|
||||
///**
|
||||
// * Class Flight
|
||||
// *
|
||||
// * @property int $id
|
||||
// * @property int $travel_type_id
|
||||
// * @property string $flight_number
|
||||
// * @property string $airline_name
|
||||
// * @property string $origin
|
||||
// * @property string $destination
|
||||
// * @property Carbon $departure_date
|
||||
// * @property Carbon $departure_time
|
||||
// * @property Carbon $arrival_date
|
||||
// * @property Carbon $arrival_time
|
||||
// * @property string $duration
|
||||
// * @property float $price
|
||||
// * @property int $capacity
|
||||
// * @property int $status
|
||||
// * @property Carbon $created_at
|
||||
// * @property Carbon $updated_at
|
||||
// *
|
||||
// * @property Collection|Tour[] $tours
|
||||
// *
|
||||
// * @package App\Models
|
||||
// */
|
||||
//class Flight extends Model
|
||||
//{
|
||||
// protected $table = 'flights';
|
||||
// public static $snakeAttributes = false;
|
||||
//
|
||||
// protected $casts = [
|
||||
// 'travel_type_id' => 'int',
|
||||
// 'departure_date' => 'datetime',
|
||||
// 'departure_time' => 'datetime',
|
||||
// 'arrival_date' => 'datetime',
|
||||
// 'arrival_time' => 'datetime',
|
||||
// 'price' => 'float',
|
||||
// 'capacity' => 'int',
|
||||
// 'status' => 'int'
|
||||
// ];
|
||||
//
|
||||
// protected $fillable = [
|
||||
// 'travel_type_id',
|
||||
// 'flight_number',
|
||||
// 'airline_name',
|
||||
// 'origin',
|
||||
// 'destination',
|
||||
// 'departure_date',
|
||||
// 'departure_time',
|
||||
// 'arrival_date',
|
||||
// 'arrival_time',
|
||||
// 'duration',
|
||||
// 'price',
|
||||
// 'capacity',
|
||||
// 'status'
|
||||
// ];
|
||||
//
|
||||
// public function tours()
|
||||
// {
|
||||
// return $this->belongsToMany(Tour::class, 'tour_flights')
|
||||
// ->withPivot('id')
|
||||
// ->withTimestamps();
|
||||
// }
|
||||
//}
|
||||
|
||||
+18
-7
@@ -38,12 +38,17 @@ class Tour extends Model
|
||||
public static $snakeAttributes = false;
|
||||
|
||||
protected $casts = [
|
||||
'travel_type_id' => 'int',
|
||||
'start_date' => 'datetime',
|
||||
'end_date' => 'datetime',
|
||||
'price' => 'float',
|
||||
'capacity' => 'int',
|
||||
'status' => 'int'
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
'price' => 'decimal:2',
|
||||
'status' => 'integer',
|
||||
|
||||
// 'travel_type_id' => 'int',
|
||||
// 'start_date' => 'datetime',
|
||||
// 'end_date' => 'datetime',
|
||||
// 'price' => 'float',
|
||||
// 'capacity' => 'int',
|
||||
// 'status' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
@@ -56,7 +61,8 @@ class Tour extends Model
|
||||
'end_date',
|
||||
'price',
|
||||
'capacity',
|
||||
'status'
|
||||
'status',
|
||||
'image',
|
||||
];
|
||||
|
||||
public function travelType()
|
||||
@@ -93,5 +99,10 @@ class Tour extends Model
|
||||
return 'slug';
|
||||
}
|
||||
|
||||
public function getStatusLabelAttribute()
|
||||
{
|
||||
return $this->status == 1 ? 'فعال' : 'پیشنویس';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,536 @@
|
||||
<div>
|
||||
<!-- Nothing in life is to be feared, it is only to be understood. Now is the time to understand more, so that we may fear less. - Maria Skłodowska-Curie -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'ثبت پرواز جدید')
|
||||
|
||||
@section('breadcrumb')
|
||||
|
||||
<div>
|
||||
|
||||
<h1 class="page-title fw-medium fs-18 mb-2">
|
||||
ثبت پرواز جدید
|
||||
</h1>
|
||||
|
||||
<nav>
|
||||
<ol class="breadcrumb mb-0">
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('admin.dashboard.index') }}">
|
||||
داشبورد
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('admin.flights.index') }}">
|
||||
مدیریت پروازها
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active">
|
||||
ثبت پرواز
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="container-fluid pt-4">
|
||||
|
||||
{{-- پیام خطاهای کلی --}}
|
||||
@if($errors->any())
|
||||
|
||||
<div class="alert alert-danger">
|
||||
|
||||
<strong>
|
||||
لطفاً خطاهای زیر را بررسی کنید:
|
||||
</strong>
|
||||
|
||||
<ul class="mb-0 mt-2">
|
||||
|
||||
@foreach($errors->all() as $error)
|
||||
|
||||
<li>
|
||||
{{ $error }}
|
||||
</li>
|
||||
|
||||
@endforeach
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xl-12">
|
||||
|
||||
<div class="card custom-card">
|
||||
|
||||
<div class="card-header">
|
||||
|
||||
<div>
|
||||
|
||||
<h5 class="mb-1">
|
||||
اطلاعات پرواز
|
||||
</h5>
|
||||
|
||||
<p class="text-muted fs-12 mb-0">
|
||||
اطلاعات کامل پرواز را وارد کنید.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form
|
||||
action="{{ route('admin.flights.store') }}"
|
||||
method="POST"
|
||||
>
|
||||
|
||||
@csrf
|
||||
|
||||
|
||||
{{-- نوع سفر --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
نوع سفر
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<select
|
||||
name="travel_type_id"
|
||||
class="form-select @error('travel_type_id') is-invalid @enderror"
|
||||
>
|
||||
|
||||
<option value="">
|
||||
انتخاب نوع سفر
|
||||
</option>
|
||||
|
||||
@foreach($travelTypes as $travelType)
|
||||
|
||||
<option
|
||||
value="{{ $travelType->id }}"
|
||||
{{ old('travel_type_id') == $travelType->id ? 'selected' : '' }}
|
||||
>
|
||||
{{ $travelType->title }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@error('travel_type_id')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- شماره پرواز --}}
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
شماره پرواز
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="flight_number"
|
||||
class="form-control @error('flight_number') is-invalid @enderror"
|
||||
value="{{ old('flight_number') }}"
|
||||
placeholder="مثلاً IR721"
|
||||
>
|
||||
|
||||
@error('flight_number')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- ایرلاین --}}
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
نام ایرلاین
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="airline_name"
|
||||
class="form-control @error('airline_name') is-invalid @enderror"
|
||||
value="{{ old('airline_name') }}"
|
||||
placeholder="مثلاً ایران ایر"
|
||||
>
|
||||
|
||||
@error('airline_name')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
|
||||
{{-- مسیر --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
مبدأ
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="origin"
|
||||
class="form-control @error('origin') is-invalid @enderror"
|
||||
value="{{ old('origin') }}"
|
||||
placeholder="مثلاً تهران"
|
||||
>
|
||||
|
||||
@error('origin')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
مقصد
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="destination"
|
||||
class="form-control @error('destination') is-invalid @enderror"
|
||||
value="{{ old('destination') }}"
|
||||
placeholder="مثلاً استانبول"
|
||||
>
|
||||
|
||||
@error('destination')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
|
||||
{{-- زمان حرکت --}}
|
||||
<h6 class="fw-semibold mb-3">
|
||||
زمان حرکت
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
تاریخ حرکت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="departure_date"
|
||||
class="form-control @error('departure_date') is-invalid @enderror"
|
||||
value="{{ old('departure_date') }}"
|
||||
placeholder="1405/05/30"
|
||||
autocomplete="off"
|
||||
>
|
||||
|
||||
<small class="text-muted">
|
||||
تاریخ را به صورت شمسی وارد کنید.
|
||||
</small>
|
||||
|
||||
@error('departure_date')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
ساعت حرکت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="time"
|
||||
name="departure_time"
|
||||
class="form-control @error('departure_time') is-invalid @enderror"
|
||||
value="{{ old('departure_time') }}"
|
||||
>
|
||||
|
||||
@error('departure_time')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- زمان رسیدن --}}
|
||||
<h6 class="fw-semibold mb-3 mt-3">
|
||||
زمان رسیدن
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
تاریخ رسیدن
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="arrival_date"
|
||||
class="form-control @error('arrival_date') is-invalid @enderror"
|
||||
value="{{ old('arrival_date') }}"
|
||||
placeholder="1405/05/30"
|
||||
autocomplete="off"
|
||||
>
|
||||
|
||||
<small class="text-muted">
|
||||
تاریخ را به صورت شمسی وارد کنید.
|
||||
</small>
|
||||
|
||||
@error('arrival_date')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
ساعت رسیدن
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="time"
|
||||
name="arrival_time"
|
||||
class="form-control @error('arrival_time') is-invalid @enderror"
|
||||
value="{{ old('arrival_time') }}"
|
||||
>
|
||||
|
||||
@error('arrival_time')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
|
||||
{{-- اطلاعات تجاری --}}
|
||||
<h6 class="fw-semibold mb-3">
|
||||
اطلاعات تجاری و ظرفیت
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
مدت پرواز
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="duration"
|
||||
class="form-control @error('duration') is-invalid @enderror"
|
||||
value="{{ old('duration') }}"
|
||||
placeholder="مثلاً 2 ساعت و 30 دقیقه"
|
||||
>
|
||||
|
||||
@error('duration')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
قیمت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
name="price"
|
||||
min="0"
|
||||
class="form-control @error('price') is-invalid @enderror"
|
||||
value="{{ old('price') }}"
|
||||
placeholder="مثلاً 8500000"
|
||||
>
|
||||
|
||||
@error('price')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
ظرفیت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
name="capacity"
|
||||
min="1"
|
||||
class="form-control @error('capacity') is-invalid @enderror"
|
||||
value="{{ old('capacity') }}"
|
||||
placeholder="مثلاً 180"
|
||||
>
|
||||
|
||||
@error('capacity')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- وضعیت --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
وضعیت
|
||||
</label>
|
||||
|
||||
<select
|
||||
name="status"
|
||||
class="form-select @error('status') is-invalid @enderror"
|
||||
>
|
||||
|
||||
<option
|
||||
value="1"
|
||||
{{ old('status', 1) == 1 ? 'selected' : '' }}
|
||||
>
|
||||
فعال
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="0"
|
||||
{{ old('status') === '0' ? 'selected' : '' }}
|
||||
>
|
||||
غیرفعال
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
@error('status')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- دکمه ها --}}
|
||||
<div class="d-flex justify-content-end gap-2 mt-4">
|
||||
|
||||
<a
|
||||
href="{{ route('admin.flights.index') }}"
|
||||
class="btn btn-light"
|
||||
>
|
||||
انصراف
|
||||
</a>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<i class="ri-save-line me-1"></i>
|
||||
ثبت پرواز
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +1,538 @@
|
||||
<div>
|
||||
<!-- He who is contented is rich. - Laozi -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'ویرایش پرواز')
|
||||
|
||||
@section('breadcrumb')
|
||||
|
||||
<div>
|
||||
|
||||
<h1 class="page-title fw-medium fs-18 mb-2">
|
||||
ویرایش پرواز
|
||||
</h1>
|
||||
|
||||
<nav>
|
||||
|
||||
<ol class="breadcrumb mb-0">
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('admin.dashboard.index') }}">
|
||||
داشبورد
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('admin.flights.index') }}">
|
||||
مدیریت پروازها
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active">
|
||||
ویرایش پرواز
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="container-fluid pt-4">
|
||||
|
||||
@if($errors->any())
|
||||
|
||||
<div class="alert alert-danger">
|
||||
|
||||
<strong>
|
||||
لطفاً خطاهای زیر را بررسی کنید:
|
||||
</strong>
|
||||
|
||||
<ul class="mb-0 mt-2">
|
||||
|
||||
@foreach($errors->all() as $error)
|
||||
|
||||
<li>
|
||||
{{ $error }}
|
||||
</li>
|
||||
|
||||
@endforeach
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xl-12">
|
||||
|
||||
<div class="card custom-card">
|
||||
|
||||
<div class="card-header">
|
||||
|
||||
<div>
|
||||
|
||||
<h5 class="mb-1">
|
||||
ویرایش پرواز
|
||||
</h5>
|
||||
|
||||
<p class="text-muted fs-12 mb-0">
|
||||
|
||||
پرواز
|
||||
{{ $flight->flight_number }}
|
||||
|
||||
را ویرایش میکنید.
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form
|
||||
action="{{ route('admin.flights.update', $flight) }}"
|
||||
method="POST"
|
||||
>
|
||||
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
|
||||
{{-- نوع سفر --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
نوع سفر
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<select
|
||||
name="travel_type_id"
|
||||
class="form-select @error('travel_type_id') is-invalid @enderror"
|
||||
>
|
||||
|
||||
<option value="">
|
||||
انتخاب نوع سفر
|
||||
</option>
|
||||
|
||||
@foreach($travelTypes as $travelType)
|
||||
|
||||
<option
|
||||
value="{{ $travelType->id }}"
|
||||
{{ old('travel_type_id', $flight->travel_type_id) == $travelType->id ? 'selected' : '' }}
|
||||
>
|
||||
{{ $travelType->title }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@error('travel_type_id')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- شماره پرواز --}}
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
شماره پرواز
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="flight_number"
|
||||
class="form-control @error('flight_number') is-invalid @enderror"
|
||||
value="{{ old('flight_number', $flight->flight_number) }}"
|
||||
>
|
||||
|
||||
@error('flight_number')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- ایرلاین --}}
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
نام ایرلاین
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="airline_name"
|
||||
class="form-control @error('airline_name') is-invalid @enderror"
|
||||
value="{{ old('airline_name', $flight->airline_name) }}"
|
||||
>
|
||||
|
||||
@error('airline_name')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
|
||||
{{-- مسیر --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
مبدأ
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="origin"
|
||||
class="form-control @error('origin') is-invalid @enderror"
|
||||
value="{{ old('origin', $flight->origin) }}"
|
||||
>
|
||||
|
||||
@error('origin')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
مقصد
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="destination"
|
||||
class="form-control @error('destination') is-invalid @enderror"
|
||||
value="{{ old('destination', $flight->destination) }}"
|
||||
>
|
||||
|
||||
@error('destination')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
|
||||
<h6 class="fw-semibold mb-3">
|
||||
زمان حرکت
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
تاریخ حرکت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="departure_date"
|
||||
class="form-control @error('departure_date') is-invalid @enderror"
|
||||
value="{{ old('departure_date', $flight->departure_date?->toJalali()->format('Y/m/d')) }}"
|
||||
autocomplete="off"
|
||||
>
|
||||
|
||||
@error('departure_date')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
ساعت حرکت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="time"
|
||||
name="departure_time"
|
||||
class="form-control @error('departure_time') is-invalid @enderror"
|
||||
value="{{ old('departure_time', $flight->departure_time?->format('H:i')) }}"
|
||||
>
|
||||
|
||||
@error('departure_time')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h6 class="fw-semibold mb-3 mt-3">
|
||||
زمان رسیدن
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
تاریخ رسیدن
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="arrival_date"
|
||||
class="form-control @error('arrival_date') is-invalid @enderror"
|
||||
value="{{ old('arrival_date', $flight->arrival_date?->toJalali()->format('Y/m/d')) }}"
|
||||
autocomplete="off"
|
||||
>
|
||||
|
||||
@error('arrival_date')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
ساعت رسیدن
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="time"
|
||||
name="arrival_time"
|
||||
class="form-control @error('arrival_time') is-invalid @enderror"
|
||||
value="{{ old('arrival_time', $flight->arrival_time?->format('H:i')) }}"
|
||||
>
|
||||
|
||||
@error('arrival_time')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
|
||||
<h6 class="fw-semibold mb-3">
|
||||
اطلاعات تجاری و ظرفیت
|
||||
</h6>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
مدت پرواز
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="duration"
|
||||
class="form-control @error('duration') is-invalid @enderror"
|
||||
value="{{ old('duration', $flight->duration) }}"
|
||||
>
|
||||
|
||||
@error('duration')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
قیمت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
name="price"
|
||||
min="0"
|
||||
class="form-control @error('price') is-invalid @enderror"
|
||||
value="{{ old('price', $flight->price) }}"
|
||||
>
|
||||
|
||||
@error('price')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
ظرفیت
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
name="capacity"
|
||||
min="1"
|
||||
class="form-control @error('capacity') is-invalid @enderror"
|
||||
value="{{ old('capacity', $flight->capacity) }}"
|
||||
>
|
||||
|
||||
@error('capacity')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- وضعیت --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 mb-3">
|
||||
|
||||
<label class="form-label">
|
||||
وضعیت
|
||||
</label>
|
||||
|
||||
<select
|
||||
name="status"
|
||||
class="form-select @error('status') is-invalid @enderror"
|
||||
>
|
||||
|
||||
<option
|
||||
value="1"
|
||||
{{ old('status', $flight->status) == 1 ? 'selected' : '' }}
|
||||
>
|
||||
فعال
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="0"
|
||||
{{ old('status', $flight->status) == 0 ? 'selected' : '' }}
|
||||
>
|
||||
غیرفعال
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
@error('status')
|
||||
<div class="invalid-feedback">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mt-4">
|
||||
|
||||
<div>
|
||||
|
||||
<a
|
||||
href="{{ route('admin.flights.show', $flight) }}"
|
||||
class="btn btn-info-light"
|
||||
>
|
||||
مشاهده جزئیات
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
|
||||
<a
|
||||
href="{{ route('admin.flights.index') }}"
|
||||
class="btn btn-light"
|
||||
>
|
||||
انصراف
|
||||
</a>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary"
|
||||
>
|
||||
<i class="ri-save-line me-1"></i>
|
||||
ذخیره تغییرات
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +1,534 @@
|
||||
<div>
|
||||
<!-- He who is contented is rich. - Laozi -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'مدیریت پروازها')
|
||||
|
||||
@section('breadcrumb')
|
||||
|
||||
<div>
|
||||
|
||||
<h1 class="page-title fw-medium fs-18 mb-2">
|
||||
مدیریت پروازها
|
||||
</h1>
|
||||
|
||||
<nav>
|
||||
<ol class="breadcrumb mb-0">
|
||||
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{{ route('admin.dashboard.index') }}">
|
||||
داشبورد
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active">
|
||||
مدیریت پروازها
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@section('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>
|
||||
|
||||
<h5 class="mb-1">
|
||||
مدیریت پروازها
|
||||
</h5>
|
||||
|
||||
<p class="text-muted mb-0 fs-12">
|
||||
لیست پروازهای ثبت شده در سیستم
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
@if(auth('admin')->user()?->canManageFlights('create'))
|
||||
|
||||
<a href="{{ route('admin.flights.create') }}"
|
||||
class="btn btn-primary">
|
||||
|
||||
<i class="fa fa-plus me-1"></i>
|
||||
|
||||
پرواز جدید
|
||||
|
||||
</a>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- جستجو و فیلتر --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xl-12">
|
||||
|
||||
<div class="card custom-card">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form
|
||||
method="GET"
|
||||
action="{{ route('admin.flights.index') }}"
|
||||
>
|
||||
|
||||
<div class="row g-3 align-items-end">
|
||||
|
||||
{{-- جستجو --}}
|
||||
<div class="col-xl-6 col-lg-5 col-md-6">
|
||||
|
||||
<label class="form-label">
|
||||
جستجوی پرواز
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="q"
|
||||
class="form-control"
|
||||
placeholder="شماره پرواز، ایرلاین، مبدأ یا مقصد..."
|
||||
value="{{ request('q') }}"
|
||||
>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- وضعیت --}}
|
||||
<div class="col-xl-2 col-lg-3 col-md-3">
|
||||
|
||||
<label class="form-label">
|
||||
وضعیت
|
||||
</label>
|
||||
|
||||
<select
|
||||
name="status"
|
||||
class="form-select"
|
||||
>
|
||||
|
||||
<option value="">
|
||||
همه وضعیتها
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="1"
|
||||
{{ request('status') === '1' ? 'selected' : '' }}
|
||||
>
|
||||
فعال
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="0"
|
||||
{{ request('status') === '0' ? 'selected' : '' }}
|
||||
>
|
||||
غیرفعال
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- جستجو --}}
|
||||
<div class="col-xl-2 col-lg-2 col-md-3">
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary w-100"
|
||||
>
|
||||
|
||||
<i class="fa fa-search me-1"></i>
|
||||
|
||||
جستجو
|
||||
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- پاک کردن --}}
|
||||
<div class="col-xl-2 col-lg-2 col-md-3">
|
||||
|
||||
<a
|
||||
href="{{ route('admin.flights.index') }}"
|
||||
class="btn btn-light w-100"
|
||||
>
|
||||
|
||||
<i class="fa fa-refresh me-1"></i>
|
||||
|
||||
پاک کردن
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- جدول پروازها --}}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xl-12">
|
||||
|
||||
<div class="card custom-card">
|
||||
|
||||
<div class="card-body p-0">
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table table-hover align-middle text-nowrap mb-0">
|
||||
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>
|
||||
#
|
||||
</th>
|
||||
|
||||
<th>
|
||||
شماره پرواز
|
||||
</th>
|
||||
|
||||
<th>
|
||||
نوع سفر
|
||||
</th>
|
||||
|
||||
<th>
|
||||
ایرلاین
|
||||
</th>
|
||||
|
||||
<th>
|
||||
مسیر
|
||||
</th>
|
||||
|
||||
<th>
|
||||
تاریخ حرکت
|
||||
</th>
|
||||
|
||||
<th>
|
||||
قیمت
|
||||
</th>
|
||||
|
||||
<th>
|
||||
وضعیت
|
||||
</th>
|
||||
|
||||
<th>
|
||||
عملیات
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
|
||||
@forelse($flights as $flight)
|
||||
|
||||
<tr>
|
||||
|
||||
{{-- شناسه --}}
|
||||
<td>
|
||||
{{ $flight->id }}
|
||||
</td>
|
||||
|
||||
|
||||
{{-- شماره پرواز --}}
|
||||
<td>
|
||||
|
||||
<span class="fw-semibold">
|
||||
{{ $flight->flight_number }}
|
||||
</span>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
{{-- نوع سفر --}}
|
||||
<td>
|
||||
|
||||
@if($flight->travelType)
|
||||
|
||||
<span class="badge bg-primary-transparent">
|
||||
{{ $flight->travelType->title }}
|
||||
</span>
|
||||
|
||||
@else
|
||||
|
||||
<span class="text-muted">
|
||||
—
|
||||
</span>
|
||||
|
||||
@endif
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
{{-- ایرلاین --}}
|
||||
<td>
|
||||
{{ $flight->airline_name }}
|
||||
</td>
|
||||
|
||||
|
||||
{{-- مسیر --}}
|
||||
<td>
|
||||
|
||||
<span class="badge bg-primary-transparent">
|
||||
{{ $flight->origin }}
|
||||
</span>
|
||||
|
||||
<span class="mx-1 text-muted">
|
||||
←
|
||||
</span>
|
||||
|
||||
<span class="badge bg-info-transparent">
|
||||
{{ $flight->destination }}
|
||||
</span>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
{{-- تاریخ حرکت --}}
|
||||
<td>
|
||||
|
||||
@if($flight->departure_date)
|
||||
|
||||
<span class="fw-medium">
|
||||
|
||||
{{ $flight->departure_date
|
||||
->toJalali()
|
||||
->format('Y/m/d') }}
|
||||
|
||||
</span>
|
||||
|
||||
@else
|
||||
|
||||
<span class="text-muted">
|
||||
—
|
||||
</span>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
@if($flight->departure_time)
|
||||
|
||||
<br>
|
||||
|
||||
<small class="text-muted">
|
||||
|
||||
{{ $flight->departure_time->format('H:i') }}
|
||||
|
||||
</small>
|
||||
|
||||
@endif
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
{{-- قیمت --}}
|
||||
<td>
|
||||
|
||||
<span class="fw-medium">
|
||||
|
||||
{{ number_format($flight->price) }}
|
||||
|
||||
</span>
|
||||
|
||||
<small class="text-muted">
|
||||
تومان
|
||||
</small>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
{{-- وضعیت --}}
|
||||
<td>
|
||||
|
||||
@if((int) $flight->status === 1)
|
||||
|
||||
<span class="badge bg-success-transparent">
|
||||
فعال
|
||||
</span>
|
||||
|
||||
@else
|
||||
|
||||
<span class="badge bg-danger-transparent">
|
||||
غیرفعال
|
||||
</span>
|
||||
|
||||
@endif
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
{{-- عملیات --}}
|
||||
<td>
|
||||
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
|
||||
{{-- مشاهده --}}
|
||||
@if(auth('admin')->user()?->canManageFlights('view'))
|
||||
|
||||
<a
|
||||
href="{{ route('admin.flights.show', $flight) }}"
|
||||
class="btn btn-info-light btn-sm"
|
||||
>
|
||||
|
||||
<i class="fa fa-eye me-1"></i>
|
||||
|
||||
مشاهده
|
||||
|
||||
</a>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
{{-- ویرایش --}}
|
||||
@if(auth('admin')->user()?->canManageFlights('update'))
|
||||
|
||||
<a
|
||||
href="{{ route('admin.flights.edit', $flight) }}"
|
||||
class="btn btn-warning-light btn-sm"
|
||||
>
|
||||
|
||||
<i class="fa fa-edit me-1"></i>
|
||||
|
||||
ویرایش
|
||||
|
||||
</a>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
{{-- حذف --}}
|
||||
@if(auth('admin')->user()?->canManageFlights('delete'))
|
||||
|
||||
<form
|
||||
action="{{ route('admin.flights.destroy', $flight) }}"
|
||||
method="POST"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('آیا از حذف این پرواز مطمئن هستید؟');"
|
||||
>
|
||||
|
||||
@csrf
|
||||
|
||||
@method('DELETE')
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-danger-light btn-sm"
|
||||
>
|
||||
|
||||
<i class="fa fa-trash me-1"></i>
|
||||
|
||||
حذف
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@empty
|
||||
|
||||
<tr>
|
||||
|
||||
<td
|
||||
colspan="9"
|
||||
class="text-center py-5"
|
||||
>
|
||||
|
||||
<div class="text-muted">
|
||||
|
||||
<i class="fa fa-plane fs-2 mb-3 d-block"></i>
|
||||
|
||||
<div>
|
||||
پروازی برای نمایش وجود ندارد.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@endforelse
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{-- Pagination --}}
|
||||
@if($flights->hasPages())
|
||||
|
||||
<div class="card-footer">
|
||||
|
||||
<div class="d-flex justify-content-center">
|
||||
|
||||
{{ $flights->links() }}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,3 +1,70 @@
|
||||
<div>
|
||||
<!-- Well begun is half done. - Aristotle -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'جزئیات پرواز')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-8 mx-auto">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">جزئیات پرواز {{ $flight->flight_number }}</h5>
|
||||
<div>
|
||||
<a href="{{ route('admin.flights.edit', $flight) }}"
|
||||
class="btn btn-sm btn-warning">ویرایش</a>
|
||||
<a href="{{ route('admin.flights.index') }}"
|
||||
class="btn btn-sm btn-secondary">بازگشت</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-sm-4">شماره پرواز</dt>
|
||||
<dd class="col-sm-8">{{ $flight->flight_number }}</dd>
|
||||
|
||||
<dt class="col-sm-4">نوع سفر</dt>
|
||||
<dd class="col-sm-8">{{ $flight->travelType?->title ?? '—' }}</dd>
|
||||
|
||||
<dt class="col-sm-4">ایرلاین</dt>
|
||||
<dd class="col-sm-8">{{ $flight->airline_name }}</dd>
|
||||
|
||||
<dt class="col-sm-4">مبدأ</dt>
|
||||
<dd class="col-sm-8">{{ $flight->origin }}</dd>
|
||||
|
||||
<dt class="col-sm-4">مقصد</dt>
|
||||
<dd class="col-sm-8">{{ $flight->destination }}</dd>
|
||||
|
||||
<dt class="col-sm-4">تاریخ و ساعت حرکت</dt>
|
||||
<dd class="col-sm-8">
|
||||
{{ $flight->departure_date->toJalali()->format('Y/m/d') }} —
|
||||
{{ $flight->departure_time->format('H:i') }}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-4">تاریخ و ساعت رسیدن</dt>
|
||||
<dd class="col-sm-8">
|
||||
{{ $flight->arrival_date->toJalali()->format('Y/m/d') }} —
|
||||
{{ $flight->arrival_time->format('H:i') }}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-4">مدت پرواز</dt>
|
||||
<dd class="col-sm-8">{{ $flight->duration }}</dd>
|
||||
|
||||
<dt class="col-sm-4">قیمت</dt>
|
||||
<dd class="col-sm-8">{{ number_format($flight->price) }} تومان</dd>
|
||||
|
||||
<dt class="col-sm-4">ظرفیت</dt>
|
||||
<dd class="col-sm-8">{{ $flight->capacity }} نفر</dd>
|
||||
|
||||
<dt class="col-sm-4">وضعیت</dt>
|
||||
<dd class="col-sm-8">
|
||||
@if($flight->status == 1)
|
||||
<span class="badge bg-success">فعال</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">غیرفعال</span>
|
||||
@endif
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,3 +1,62 @@
|
||||
<div>
|
||||
<!-- It always seems impossible until it is done. - Nelson Mandela -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-4">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h4 class="mb-0">ثبت تور جدید</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.tours.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">عنوان تور</label>
|
||||
<input type="text" name="title"
|
||||
class="form-control @error('title') is-invalid @enderror"
|
||||
value="{{ old('title') }}">
|
||||
@error('title')
|
||||
<div class="invalid-feedback">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">توضیحات</label>
|
||||
<textarea name="description"
|
||||
class="form-control @error('description') is-invalid @enderror"
|
||||
rows="4">{{ old('description') }}</textarea>
|
||||
@error('description')
|
||||
<div class="invalid-feedback">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">قیمت</label>
|
||||
<input type="number" name="price"
|
||||
class="form-control @error('price') is-invalid @enderror"
|
||||
value="{{ old('price') }}">
|
||||
@error('price')
|
||||
<div class="invalid-feedback">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">تصویر تور</label>
|
||||
<input type="file" name="image"
|
||||
class="form-control @error('image') is-invalid @enderror">
|
||||
@error('image')
|
||||
<div class="invalid-feedback">{{ $message }}</div> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 d-flex justify-content-between">
|
||||
<a href="{{ route('admin.tours.index') }}" class="btn btn-secondary">انصراف</a>
|
||||
<button type="submit" class="btn btn-success">ذخیره تور</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,3 +1,86 @@
|
||||
<div>
|
||||
<!-- It is not the man who has too little, but the man who craves more, that is poor. - Seneca -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4>ویرایش تور: {{ $tour->title }}</h4>
|
||||
<a href="{{ route('admin.tours.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</div>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger">
|
||||
<ul class="mb-0">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.tours.update', $tour->id) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="row">
|
||||
<!-- عنوان -->
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">عنوان تور</label>
|
||||
<input type="text" name="title" class="form-control"
|
||||
value="{{ old('title', $tour->title) }}" required>
|
||||
</div>
|
||||
|
||||
<!-- نوع سفر -->
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">نوع سفر</label>
|
||||
<select name="travel_type_id" class="form-select">
|
||||
@foreach($travelTypes as $type)
|
||||
<option
|
||||
value="{{ $type->id }}" {{ $tour->travel_type_id == $type->id ? 'selected' : '' }}>
|
||||
{{ $type->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- قیمت -->
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label">قیمت (تومان)</label>
|
||||
<input type="number" name="price" class="form-control"
|
||||
value="{{ old('price', $tour->price) }}">
|
||||
</div>
|
||||
|
||||
<!-- ظرفیت -->
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label">ظرفیت</label>
|
||||
<input type="number" name="capacity" class="form-control"
|
||||
value="{{ old('capacity', $tour->capacity) }}">
|
||||
</div>
|
||||
|
||||
<!-- وضعیت -->
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label">وضعیت</label>
|
||||
<select name="status" class="form-select">
|
||||
<option value="0" {{ $tour->status == 0 ? 'selected' : '' }}>پیشنویس</option>
|
||||
<option value="1" {{ $tour->status == 1 ? 'selected' : '' }}>فعال</option>
|
||||
<option value="2" {{ $tour->status == 2 ? 'selected' : '' }}>منتشر شده</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- توضیحات -->
|
||||
<div class="col-12 mb-3">
|
||||
<label class="form-label">توضیحات</label>
|
||||
<textarea name="description" class="form-control"
|
||||
rows="5">{{ old('description', $tour->description) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="submit" class="btn btn-primary px-4">ذخیره تغییرات</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +1,61 @@
|
||||
<div>
|
||||
<!-- Nothing worth having comes easy. - Theodore Roosevelt -->
|
||||
</div>
|
||||
@extends('admin.layouts.app') {{-- فرض بر وجود لایوت ادمین --}}
|
||||
|
||||
@section('content')
|
||||
<div class="container mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h2>مدیریت تورها</h2>
|
||||
<a href="{{ route('admin.tours.create') }}" class="btn btn-primary">افزودن تور جدید</a>
|
||||
</div>
|
||||
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
@endif
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>تصویر</th>
|
||||
<th>عنوان تور</th>
|
||||
<th>قیمت (تومان)</th>
|
||||
<th>عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($tours as $tour)
|
||||
<tr>
|
||||
<td>
|
||||
<img src="{{ asset('storage/' . ($tour->image ?? 'default.jpg')) }}" width="60" class="rounded">
|
||||
</td>
|
||||
<td>{{ $tour->title }}</td>
|
||||
<td>{{ number_format($tour->price) }}</td>
|
||||
<td>
|
||||
<div class="btn-group" role="group">
|
||||
<a href="{{ route('admin.tours.show', $tour->id) }}" class="btn btn-sm btn-info text-white">مشاهده</a>
|
||||
<a href="{{ route('admin.tours.edit', $tour->id) }}" class="btn btn-sm btn-warning text-white">ویرایش</a>
|
||||
|
||||
<form action="{{ route('admin.tours.destroy', $tour->id) }}" method="POST" onsubmit="return confirm('آیا مطمئن هستید؟')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-sm btn-danger">حذف</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">هیچ توری یافت نشد.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{-- بخش بسیار مهم برای آزمون: نمایش لینکهای صفحهبندی --}}
|
||||
<div class="d-flex justify-content-center mt-3">
|
||||
{{ $tours->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +1,80 @@
|
||||
<div>
|
||||
<!-- Simplicity is an acquired taste. - Katharine Gerould -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'جزئیات تور')
|
||||
|
||||
@section('content')
|
||||
{{-- هدر صفحه --}}
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h3 class="mb-0">
|
||||
<i class="bi bi-airplane me-2"></i>
|
||||
جزئیات تور
|
||||
</h3>
|
||||
<div>
|
||||
<a href="{{ route('admin.tours.edit', $tour) }}" class="btn btn-warning">
|
||||
<i class="bi bi-pencil-square me-1"></i>ویرایش
|
||||
</a>
|
||||
<a href="{{ route('admin.tours.index') }}" class="btn btn-secondary">
|
||||
<i class="bi bi-arrow-right me-1"></i>بازگشت به لیست
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- کارت اطلاعات --}}
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-header bg-white py-3">
|
||||
<span class="fw-bold">{{ $tour->title }}</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-bordered table-striped align-middle mb-0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="bg-light" style="width: 200px;">عنوان</th>
|
||||
<td>{{ $tour->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">مبدا</th>
|
||||
<td>{{ $tour->origin }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">مقصد</th>
|
||||
<td>{{ $tour->destination }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">تاریخ شروع</th>
|
||||
<td>{{ \Carbon\Carbon::parse($tour->start_date)->format('Y/m/d') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">تاریخ پایان</th>
|
||||
<td>{{ \Carbon\Carbon::parse($tour->end_date)->format('Y/m/d') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">قیمت</th>
|
||||
<td>{{ number_format($tour->price) }} <small>تومان</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">ظرفیت</th>
|
||||
<td>{{ $tour->capacity }} <small>نفر</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">وضعیت</th>
|
||||
<td>
|
||||
@if($tour->status == 0)
|
||||
<span class="badge bg-danger">غیرفعال</span>
|
||||
@elseif($tour->status == 1)
|
||||
<span class="badge bg-warning text-dark">فعال / پیشنویس</span>
|
||||
@elseif($tour->status == 2)
|
||||
<span class="badge bg-success">منتشرشده</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">نامشخص</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">توضیحات</th>
|
||||
<td>{!! nl2br(e($tour->description)) !!}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +1,55 @@
|
||||
<div>
|
||||
<!-- Act only according to that maxim whereby you can, at the same time, will that it should become a universal law. - Immanuel Kant -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'ثبت نوع سفر جدید')
|
||||
|
||||
@section('content')
|
||||
<div class="card" style="max-width: 600px;">
|
||||
<div class="card-header"><h5 class="mb-0">ثبت نوع سفر جدید</h5></div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.travelTypes.store') }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">عنوان<span class="text-danger">*</span></label>
|
||||
<input type="text" name="title" class="form-control @error('title') is-invalid @enderror"
|
||||
value="{{ old('title') }}">
|
||||
@error('title')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">اسلاگ<span class="text-danger">*</span></label>
|
||||
<input type="text" name="slug" class="form-control @error('slug') is-invalid @enderror"
|
||||
value="{{ old('slug') }}" placeholder="مثلاً domestic / foreign / charter">
|
||||
@error('slug')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
{{-- <div class="mb-3 form-check">--}}
|
||||
{{-- <input type="checkbox" name="status" value="1" class="form-check-input"--}}
|
||||
{{-- id="status" @checked(old('status', true))>--}}
|
||||
{{-- <label class="form-check-label" for="status">فعال باشد</label>--}}
|
||||
{{-- </div>--}}
|
||||
<input type="hidden" name="status" value="0">
|
||||
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="status"
|
||||
value="1"
|
||||
id="status"
|
||||
{{ old('status', $travelType->status ?? 1) == 1 ? 'checked' : '' }}
|
||||
>
|
||||
<label class="form-check-label" for="status">
|
||||
فعال
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn btn-primary">ذخیره</button>
|
||||
<a href="{{ route('admin.travelTypes.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -1,3 +1,57 @@
|
||||
<div>
|
||||
<!-- Well begun is half done. - Aristotle -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'ویرایش نوع سفر')
|
||||
|
||||
@section('content')
|
||||
<div class="card" style="max-width: 600px;">
|
||||
<div class="card-header"><h5 class="mb-0">ویرایش: {{ $travelType->title }}</h5></div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.travelTypes.update', $travelType) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">عنوان<span class="text-danger">*</span></label>
|
||||
<input type="text" name="title" class="form-control @error('title') is-invalid @enderror"
|
||||
value="{{ old('title', $travelType->title) }}">
|
||||
@error('title')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">اسلاگ<span class="text-danger">*</span></label>
|
||||
<input type="text" name="slug" class="form-control @error('slug') is-invalid @enderror"
|
||||
value="{{ old('slug', $travelType->slug) }}">
|
||||
@error('slug')
|
||||
<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
{{-- <div class="mb-3 form-check">--}}
|
||||
{{-- <input type="checkbox" name="status" value="1" class="form-check-input"--}}
|
||||
{{-- id="status" @checked($travelType->status)>--}}
|
||||
{{-- <label class="form-check-label" for="status">فعال باشد</label>--}}
|
||||
{{-- </div>--}}
|
||||
<input type="hidden" name="status" value="0">
|
||||
|
||||
<div class="form-check">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
name="status"
|
||||
value="1"
|
||||
id="status"
|
||||
{{ old('status', $travelType->status ?? 1) == 1 ? 'checked' : '' }}
|
||||
>
|
||||
<label class="form-check-label" for="status">
|
||||
فعال
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn btn-primary">بهروزرسانی</button>
|
||||
<a href="{{ route('admin.travelTypes.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,3 +1,83 @@
|
||||
<div>
|
||||
<!-- Act only according to that maxim whereby you can, at the same time, will that it should become a universal law. - Immanuel Kant -->
|
||||
</div>
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', 'انواع سفر')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">انواع سفر</h5>
|
||||
<a href="{{ route('admin.travelTypes.create') }}" class="btn btn-primary btn-sm">+ نوع سفر جدید</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{-- جستجو --}}
|
||||
<form method="GET" action="{{ route('admin.travelTypes.index') }}" class="row g-2 mb-3">
|
||||
<div class="col-md-4">
|
||||
<input type="text" name="search" class="form-control"
|
||||
placeholder="جستجوی عنوان یا اسلاگ..." value="{{ request('search') }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<select name="status" class="form-control">
|
||||
<option value="">همه وضعیتها</option>
|
||||
<option value="1" @selected(request('status') == '1')>فعال</option>
|
||||
<option value="0" @selected(request('status') === '0')>غیرفعال</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<button class="btn btn-secondary" type="submit">جستجو</button>
|
||||
<a href="{{ route('admin.travelTypes.index') }}" class="btn btn-outline-secondary">پاککردن</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>عنوان</th>
|
||||
<th>اسلاگ</th>
|
||||
<th>وضعیت</th>
|
||||
<th>تاریخ ثبت</th>
|
||||
<th>عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($travelTypes as $type)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $type->title }}</td>
|
||||
<td><span class="badge bg-info">{{ $type->slug }}</span></td>
|
||||
<td>
|
||||
@if($type->status)
|
||||
<span class="badge bg-success">فعال</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">غیرفعال</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>{{ $type->created_at ? $type->created_at->toJalali()->format('Y/m/d H:i') : '-' }}</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.travelTypes.edit', $type) }}" class="btn btn-warning btn-sm">ویرایش</a>
|
||||
<form action="{{ route('admin.travelTypes.destroy', $type) }}" method="POST"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('آیا مطمئن هستید؟')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger btn-sm">حذف</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-muted">موردی یافت نشد.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{{ $travelTypes->links() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<div>
|
||||
<!-- Very little is needed to make a happy life. - Marcus Aurelius -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user