git commit "implement flight management with search filter and sorting"

This commit is contained in:
2026-08-19 09:07:34 +03:30
parent 40dbf3b575
commit 700bd38c20
11 changed files with 903 additions and 237 deletions
+42 -27
View File
@@ -8,6 +8,15 @@
ثبت پرواز جدید
</h4>
@if($errors->any())
<div class="alert alert-danger">
<ul class="mb-0">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('admin.flights.store') }}"
method="POST"
@@ -83,7 +92,30 @@
</div>
<div class="col-md-4 mb-3">
<label>
ساعت حرکت
</label>
<input type="time"
name="departure_time"
class="form-control">
</div>
<div class="col-md-4 mb-3">
<label>
ساعت رسیدن
</label>
<input type="time"
name="arrival_time"
class="form-control">
</div>
<div class="col-md-4 mb-3">
@@ -91,9 +123,11 @@
نوع پرواز
</label>
<option value="0">داخلی</option>
<option value="2">خارجی</option>
<option value="3">چارتر</option>
<select name="type" class="form-control"> <option value="0">داخلی</option>
<option value="2">خارجی</option>
<option value="3">چارتر</option>
</select>
</div>
@@ -176,31 +210,12 @@
وضعیت
</label>
<select name="status"
class="form-control">
<option value="1">
فعال
</option>
<option value="0">
پیش نویس
</option>
<option value="2">
غیرفعال
</option>
<option value="3">
تمام شده
</option>
<option value="4">
لغو شده
</option>
<select name="status" class="form-control"> <option value="0">پیش‌نویس</option>
<option value="1">فعال</option>
<option value="2">غیرفعال</option>
<option value="3">تمام شده</option>
<option value="4">لغو شده</option>
</select>
</div>
+121 -126
View File
@@ -8,213 +8,216 @@
ویرایش پرواز
</h4>
@if($errors->any())
<div class="alert alert-danger">
<ul class="mb-0">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('admin.flights.update', $flight->id) }}"
<form action="{{ route('admin.flights.update',$flight->id) }}"
method="POST"
enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="row">
<div class="col-md-6 mb-3">
<label>نام ایرلاین</label>
<label>
ایرلاین
</label>
<input type="text"
name="airline"
class="form-control"
value="{{ old('airline', $flight->airline) }}">
value="{{ old('airline') }}">
@error('airline')
<small class="text-danger">
{{ $message }}
</small>
@enderror
</div>
<div class="col-md-6 mb-3">
<label>شماره پرواز</label>
<label>
شماره پرواز
</label>
<input type="text"
name="flight_number"
class="form-control"
value="{{ old('flight_number', $flight->flight_number) }}">
value="{{ old('flight_number') }}">
@error('flight_number')
<small class="text-danger">
{{ $message }}
</small>
@enderror
</div>
<div class="col-md-6 mb-3">
<label>مبدا</label>
<label>
مبدا
</label>
<input type="text"
name="origin"
class="form-control"
value="{{ old('origin', $flight->origin) }}">
value="{{ old('origin') }}">
</div>
<div class="col-md-6 mb-3">
<label>مقصد</label>
<label>
مقصد
</label>
<input type="text"
name="destination"
class="form-control"
value="{{ old('destination', $flight->destination) }}">
value="{{ old('destination') }}">
</div>
<div class="col-md-4 mb-3">
<label>تاریخ حرکت</label>
<input type="date"
name="departure_date"
class="form-control"
value="{{ old('departure_date', $flight->departure_date) }}">
</div>
<div class="col-md-4 mb-3">
<label>ساعت حرکت</label>
<label>
ساعت حرکت
</label>
<input type="time"
name="departure_time"
class="form-control"
value="{{ old('departure_time', $flight->departure_time) }}">
class="form-control">
</div>
<div class="col-md-4 mb-3">
<label>ساعت رسیدن</label>
<label>
ساعت رسیدن
</label>
<input type="time"
name="arrival_time"
class="form-control"
value="{{ old('arrival_time', $flight->arrival_time) }}">
class="form-control">
</div>
<div class="col-md-4 mb-3">
<label>کلاس پرواز</label>
<input type="text"
name="flight_class"
class="form-control"
value="{{ old('flight_class', $flight->flight_class) }}">
</div>
<div class="col-md-4 mb-3">
<label>ظرفیت</label>
<input type="number"
name="capacity"
class="form-control"
value="{{ old('capacity', $flight->capacity) }}">
</div>
<div class="col-md-4 mb-3">
<label>قیمت</label>
<input type="number"
name="price"
class="form-control"
value="{{ old('price', $flight->price) }}">
</div>
<div class="col-md-6 mb-3">
<label>وضعیت</label>
<select name="status" class="form-control">
<option value="0"
{{ $flight->status == 0 ? 'selected':'' }}>
پیش نویس
</option>
<option value="1"
{{ $flight->status == 1 ? 'selected':'' }}>
فعال
</option>
<option value="2"
{{ $flight->status == 2 ? 'selected':'' }}>
غیرفعال
</option>
<option value="3"
{{ $flight->status == 3 ? 'selected':'' }}>
تمام شده
</option>
<option value="4"
{{ $flight->status == 4 ? 'selected':'' }}>
لغو شده
</option>
<label>
نوع پرواز
</label>
<select name="type" class="form-control">
<option value="0">داخلی</option>
<option value="2">خارجی</option>
<option value="3">چارتر</option>
</select>
</div>
<div class="col-md-4 mb-3">
<div class="col-md-6 mb-3">
<label>
تاریخ حرکت
</label>
<label>تصویر</label>
<input type="text"
name="departure_date"
id="departure_date"
class="form-control"
autocomplete="off">
</div>
<div class="col-md-4 mb-3">
<label>
کلاس پرواز
</label>
<input type="text"
name="flight_class"
class="form-control">
</div>
<div class="col-md-4 mb-3">
<label>
ظرفیت
</label>
<input type="number"
name="capacity"
class="form-control">
</div>
<div class="col-md-4 mb-3">
<label>
قیمت
</label>
<input type="number"
name="price"
class="form-control">
</div>
<div class="col-md-4 mb-3">
<label>
عکس
</label>
<input type="file"
name="image"
class="form-control">
</div>
@if($flight->image)
<img src="{{ asset('storage/'.$flight->image) }}"
width="120"
class="mt-2">
@endif
<div class="col-md-4 mb-3">
<label>
وضعیت
</label>
<select name="status" class="form-control">
<option value="0">پیش‌نویس</option>
<option value="1">فعال</option>
<option value="2">غیرفعال</option>
<option value="3">تمام شده</option>
<option value="4">لغو شده</option>
</select>
</div>
@@ -222,20 +225,12 @@
<button class="btn btn-primary">
ذخیره تغییرات
ذخیره
</button>
<a href="{{ route('admin.flights.index') }}"
class="btn btn-secondary">
بازگشت
</a>
</form>
</div>
@endsection
+12 -1
View File
@@ -111,13 +111,17 @@
<tr>
<th>
#
شناسه
</th>
<th>
ایرلاین
</th>
<th>
تصویر
</th>
<th>
شماره پرواز
</th>
@@ -163,6 +167,13 @@
{{ $flight->airline }}
</td>
<td>
@if($flight->image)
<img src="{{ getImageUrl($flight->image) }}"
width="120">
@endif
</td>
<td>
{{ $flight->flight_number }}
+113 -43
View File
@@ -4,59 +4,129 @@
<div class="container py-5">
<h2 class="mb-4">
آرشیو پروازها
</h2>
<div class="d-flex justify-content-between align-items-center mb-4">
<div class="row">
@foreach($flights as $flight)
<div class="col-md-4 mb-4">
<div class="card shadow-sm">
<img src="{{ asset($flight->image) }}"
class="card-img-top"
height="200">
<div class="card-body">
<h5>
{{ $flight->airline }}
</h5>
<p>
{{ $flight->origin }}
-
{{ $flight->destination }}
</p>
<strong>
{{ number_format($flight->price) }}
تومان
</strong>
</div>
</div>
</div>
@endforeach
<h2 class="fw-bold">
آرشیو پروازها ✈️
</h2>
</div>
<br>
<br>
<div class="mt-4">
<div class="row g-4">
@foreach($flights as $flight)
<div class="col-lg-4 col-md-6">
<div class="card h-100 shadow-sm border-0 rounded-4 overflow-hidden">
<div class="position-relative">
<img src="{{ getImageUrl($flight->image) }}"
class="card-img-top"
style="height:220px; object-fit:cover;"
alt="{{ $flight->airline }}">
<span class="position-absolute top-0 end-0 m-3 badge bg-primary">
{{ $flight->flight_class ?? 'Economy' }}
</span>
</div>
<div class="card-body">
<h5 class="fw-bold mb-3">
{{ $flight->airline }}
</h5>
<div class="text-muted mb-2">
<i class="bi bi-geo-alt"></i>
{{ $flight->origin }}
→
{{ $flight->destination }}
</div>
<div class="mb-2">
📅
{{ verta($flight->departure_date)->format('Y/m/d') }}
</div>
<div class="d-flex justify-content-between align-items-center mt-4">
<strong class="text-primary fs-5">
{{ number_format($flight->price) }}
تومان
</strong>
<a href="#"
class="btn btn-outline-primary rounded-pill">
مشاهده
</a>
</div>
</div>
</div>
</div>
@endforeach
</div>
<div class="mt-5 d-flex justify-content-center">
{{ $flights->links() }}
</div>
</div>
@endsection