feat: implement flights index and blade view for panel admin
This commit is contained in:
@@ -0,0 +1,264 @@
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@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="javascript:void(0);">پروازها</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
لیست پروازها
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid pt-4">
|
||||
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(session('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card custom-card">
|
||||
<div class="card-body p-3">
|
||||
<form method="GET" action="{{ route('admin.flights.index') }}">
|
||||
<div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
|
||||
|
||||
<div class="d-flex flex-wrap gap-2 project-list-main align-items-center">
|
||||
<div class="d-flex">
|
||||
<input class="form-control me-2"
|
||||
type="search"
|
||||
name="search"
|
||||
placeholder="جستوجوی شماره پرواز"
|
||||
value="{{ request('search') }}"
|
||||
aria-label="جستوجو">
|
||||
|
||||
<button class="btn btn-light" type="submit">
|
||||
جستوجو
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<select class="form-control"
|
||||
name="sort"
|
||||
onchange="this.form.submit()">
|
||||
<option value="">مرتبسازی بر اساس</option>
|
||||
|
||||
<option value="newest"
|
||||
@selected(request()->missing('sort') || request('sort') === 'newest')>
|
||||
جدیدترین
|
||||
</option>
|
||||
|
||||
<option value="lowest"
|
||||
@selected(request('sort') === 'lowest')>
|
||||
کمترین قیمت
|
||||
</option>
|
||||
|
||||
<option value="highest"
|
||||
@selected(request('sort') === 'highest')>
|
||||
بیشترین قیمت
|
||||
</option>
|
||||
|
||||
<option value="popularity"
|
||||
@selected(request('sort') === 'popularity')>
|
||||
پر بازدیدترین
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<a href="{{ route('admin.flights.trash.index') }}"
|
||||
class="btn btn-danger-light d-flex align-items-center">
|
||||
<i class="ri-delete-bin-3-line me-1 fw-medium align-middle"></i>
|
||||
سطل زباله
|
||||
</a>
|
||||
|
||||
<a href="{{ route('admin.flights.create') }}"
|
||||
class="btn btn-primary">
|
||||
<i class="ri-add-line me-1 fw-medium align-middle"></i>
|
||||
ایجاد پرواز
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</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 align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>تصویر</th>
|
||||
<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>
|
||||
@forelse($flights as $flight)
|
||||
<tr>
|
||||
<td>
|
||||
<span class="avatar avatar-md avatar-square bg-light">
|
||||
@if($flight->coverImage?->file_id)
|
||||
<img src="{{ getFileUrl($flight->coverImage->file_id) }}"
|
||||
class="w-100 h-100"
|
||||
alt="{{ $flight->flight_number }}">
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="fw-medium">
|
||||
{{ $flight->flight_number }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $flight->airline?->name ?? '-' }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="fw-medium">
|
||||
{{ $flight->origin_airport?->city?->name ?? '-' }}
|
||||
</div>
|
||||
|
||||
@if($flight->origin_airport?->name)
|
||||
<small class="text-muted">
|
||||
{{ $flight->origin_airport->name }}
|
||||
</small>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="fw-medium">
|
||||
{{ $flight->airport?->city?->name ?? '-' }}
|
||||
</div>
|
||||
|
||||
@if($flight->airport?->name)
|
||||
<small class="text-muted">
|
||||
{{ $flight->airport->name }}
|
||||
</small>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@if($flight->departure_time)
|
||||
{{ \Hekmatinasser\Verta\Verta::instance($flight->departure_time)->format('d F Y - H:i') }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ number_format($flight->price) }} تومان
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="badge bg-info-transparent">
|
||||
{{ $flight->capacity }} نفر
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@if($flight->status)
|
||||
<span class="badge bg-success-transparent">
|
||||
{{ $flight->status->label() }}
|
||||
</span>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ number_format($flight->views_count ?? 0) }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@if($flight->created_at)
|
||||
{{ \Hekmatinasser\Verta\Verta::instance($flight->created_at)->format('d F Y - H:i') }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<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) }}"
|
||||
class="btn btn-secondary-light btn-icon btn-sm"
|
||||
title="ویرایش">
|
||||
<i class="ti ti-pencil"></i>
|
||||
</a>
|
||||
|
||||
<form action="{{ route('admin.flights.destroy', $flight->id) }}"
|
||||
method="POST"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('از حذف این پرواز مطمئن هستید؟')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
||||
<button type="submit"
|
||||
class="btn btn-icon btn-sm btn-danger-light"
|
||||
title="حذف">
|
||||
<i class="ri-delete-bin-line"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="12" class="text-center text-muted py-4">
|
||||
هیچ پروازی یافت نشد.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end mt-3">
|
||||
{{ $flights->links() }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user