feat: add a list for flights in admin panel and add edit and delete for flights in admin panel

This commit is contained in:
2026-08-20 13:22:35 +03:30
parent ab9a459c48
commit 67f9379e86
8 changed files with 729 additions and 3 deletions
@@ -0,0 +1,161 @@
@extends('dashboard.layouts.app')
@section('title', 'لیست پروازها')
@section('account-content')
<div class="user-profile-wrapper">
@if(session('success'))
<div class="col-lg-12 mb-3">
<div class="alert alert-success">
{{ session('success') }}
</div>
</div>
@endif
<div class="col-lg-12">
<div class="user-profile-card">
<div class="d-flex align-items-center justify-content-between mb-4">
<h4 class="user-profile-card-title mb-0">
لیست پروازها
</h4>
<a href="{{ route('admin.flights.create') }}" class="theme-btn">
ساخت پرواز
<i class="far fa-plus"></i>
</a>
</div>
<div class="user-profile-form">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>#</th>
<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>
{{ $flights->firstItem() + $loop->index }}
</td>
<td>
{{ $flight->flight_number }}
</td>
<td>
{{ $flight->airline?->name ?? '-' }}
</td>
<td>
{{ $flight->airport?->city ?? '-' }}
</td>
<td>
{{ $flight->destinationAirport?->city ?? '-' }}
</td>
<td>
{{ $flight->start_date_fa ?? '-' }}
<br>
<small>{{ $flight->start_time_fa ?? '-' }}</small>
</td>
<td>
{{ $flight->end_date_fa ?? '-' }}
<br>
<small>{{ $flight->end_time_fa ?? '-' }}</small>
</td>
<td>
{{ number_format($flight->price) }} تومان
</td>
<td>
{{ $flight->capacity }}
</td>
<td>
<div class="d-flex align-items-center gap-2">
<a
href="{{ route('admin.flights.edit', $flight->id) }}"
title="ویرایش"
class="btn btn-outline-secondary btn-sm"
>
<i class="far fa-pen"></i>
</a>
<form
action="{{ route('admin.flights.destroy', $flight->id) }}"
method="POST"
style="display: inline-block;"
>
@csrf
@method('DELETE')
<button
type="submit"
title="حذف"
onclick="return confirm('آیا از حذف این پرواز مطمئن هستید؟')"
class="btn btn-outline-secondary btn-sm"
>
<i class="far fa-trash-can"></i>
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="10" class="text-center">
هیچ پروازی ثبت نشده است.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4">
{{ $flights->links() }}
</div>
</div>
</div>
</div>
</div>
@endsection