feat: complete flights in admin side
This commit is contained in:
@@ -1,5 +1,317 @@
|
||||
@extends('admin.layouts.app')
|
||||
@section('breadcrumb')<div><h1 class="page-title fw-medium fs-18 mb-1">مدیریت پروازها</h1><span class="text-muted fs-12">درج، ویرایش، حذف و جستجوی پروازهای داخلی، خارجی و چارتر</span></div>@endsection
|
||||
@section('content')<div class="container-fluid pt-4">@include('admin.partials.errors')
|
||||
<div class="card custom-card"><div class="card-body"><form method="GET"><div class="row g-2"><div class="col-md-4"><input class="form-control" name="search" value="{{ request('search') }}" placeholder="عنوان یا مسیر پرواز"></div><div class="col-md-2"><select class="form-control" name="flight_type"><option value="">همه انواع</option><option value="1" @selected(request('flight_type')==='1')>داخلی</option><option value="2" @selected(request('flight_type')==='2')>خارجی</option><option value="3" @selected(request('flight_type')==='3')>چارتر</option></select></div><div class="col-md-2"><select class="form-control" name="status"><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-2"><button class="btn btn-light w-100">جستجو</button></div><div class="col-md-2"><a href="{{ route('admin.flights.create') }}" class="btn btn-primary w-100"><i class="ri-add-line"></i> پرواز جدید</a></div></div></form></div></div>
|
||||
<div class="card custom-card mt-3"><div class="table-responsive"><table class="table text-nowrap table-hover mb-0"><thead><tr><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><div class="fw-semibold">{{ $flight->title }}</div><small class="text-muted">#{{ $flight->id }}</small></td><td>@switch((int)$flight->flight_type) @case(1) داخلی @break @case(2) خارجی @break @case(3) چارتر @break @default - @endswitch</td><td>{{ isset($flight->departure_time) ? $flight->departure_time->toJalali()->format('Y/m/d H:i') : '-' }}</td><td>{{ number_format($flight->price) }} تومان</td><td>{{ number_format($flight->capacity) }}</td><td>{{ number_format($flight->views ?? 0) }}</td><td>@if($flight->status)<span class="badge bg-success-transparent">فعال</span>@else<span class="badge bg-danger-transparent">غیرفعال</span>@endif</td><td><div class="hstack gap-2"><a href="{{ route('admin.flights.show',$flight) }}" class="btn btn-primary-light btn-icon btn-sm"><i class="ri-eye-line"></i></a><a href="{{ route('admin.flights.edit',$flight) }}" class="btn btn-secondary-light btn-icon btn-sm"><i class="ri-edit-line"></i></a><form method="POST" action="{{ route('admin.flights.destroy',$flight) }}" onsubmit="return confirm('حذف این پرواز؟')">@csrf @method('DELETE')<button class="btn btn-danger-light btn-icon btn-sm"><i class="ri-delete-bin-line"></i></button></form></div></td></tr>@empty<tr><td colspan="8" class="text-center py-5 text-muted">پروازی ثبت نشده است.</td></tr>@endforelse</tbody></table></div></div>{{ ($flights ?? collect())->links() }}</div>@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
<div>
|
||||
<h1 class="page-title fw-medium fs-18 mb-2">لیست پروازها</h1>
|
||||
<div>
|
||||
<nav>
|
||||
<ol class="breadcrumb mb-0">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="javascript:void(0)">مدیریت پروازها</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
لیست پروازها
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="main-content app-content">
|
||||
<div class="container-fluid pt-4">
|
||||
@error('success')
|
||||
<span class="text-success">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
@error('$errors')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card custom-card">
|
||||
|
||||
<div class="card-body p-3">
|
||||
|
||||
<form method="GET">
|
||||
<div class="d-flex align-items-center justify-content-between flex-wrap gap-3">
|
||||
|
||||
<div class="d-flex flex-wrap gap-1 project-list-main align-items-center">
|
||||
|
||||
<div class="d-flex me-2">
|
||||
<input
|
||||
class="form-control me-2"
|
||||
type="search"
|
||||
name="search"
|
||||
placeholder="جستجو پرواز"
|
||||
value="{{ request()->input('search') }}"
|
||||
aria-label="جستجو"
|
||||
>
|
||||
|
||||
<button class="btn btn-light" type="submit">
|
||||
جستجو
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<select
|
||||
id="choices-single-default"
|
||||
class="form-control"
|
||||
name="sort"
|
||||
>
|
||||
<option value="" selected>
|
||||
مرتبسازی بر اساس
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="created_at"
|
||||
@selected(request()->input('sort') == 'created_at')
|
||||
>
|
||||
جدیدترین
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="price_asc"
|
||||
@selected(request()->input('sort') == 'price_asc')
|
||||
>
|
||||
قیمت (کم به زیاد)
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="price_desc"
|
||||
@selected(request()->input('sort') == 'price_desc')
|
||||
>
|
||||
قیمت (زیاد به کم)
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="departure_time_asc"
|
||||
@selected(request()->input('sort') == 'departure_time_asc')
|
||||
>
|
||||
زمان حرکت (زودترین)
|
||||
</option>
|
||||
|
||||
<option
|
||||
value="departure_time_desc"
|
||||
@selected(request()->input('sort') == 'departure_time_desc')
|
||||
>
|
||||
زمان حرکت (دیرترین)
|
||||
</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
@if(auth('admin')->user()->permission?->flight_create)
|
||||
<div class="d-flex">
|
||||
<a
|
||||
href="{{ route('admin.flights.create') }}"
|
||||
class="btn btn-primary me-2"
|
||||
>
|
||||
<i class="ri-add-line me-1 fw-medium align-middle"></i>
|
||||
ایجاد پرواز
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Flights Table -->
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
|
||||
<div class="card custom-card">
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table text-nowrap table-bordered">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>عکس</th>
|
||||
<th>عنوان</th>
|
||||
<th>ایرلاین</th>
|
||||
<th>نوع پرواز</th>
|
||||
<th>زمان حرکت</th>
|
||||
<th>مبدا</th>
|
||||
<th>مقصد</th>
|
||||
<th>قیمت</th>
|
||||
<th>ظرفیت</th>
|
||||
<th>وضعیت</th>
|
||||
<th>تاریخ ثبت</th>
|
||||
<th>عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
@foreach($flights as $flight)
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td>
|
||||
<span class="avatar avatar-md avatar-square bg-light">
|
||||
|
||||
@if($flight->file?->id)
|
||||
<img
|
||||
src="{{ getFileUrl($flight->file->id) }}"
|
||||
class="w-100 h-100"
|
||||
alt="{{ $flight->title }}"
|
||||
>
|
||||
@else
|
||||
<img
|
||||
src="{{ asset('images/no-image.png') }}"
|
||||
class="w-100 h-100"
|
||||
alt="{{ $flight->title }}"
|
||||
>
|
||||
@endif
|
||||
|
||||
</span>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<span class="fw-semibold">
|
||||
{{ $flight->title }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $flight->airline?->name}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@switch($flight->flight_type)
|
||||
|
||||
@case(0)
|
||||
<span class="badge bg-primary-transparent">
|
||||
رفت
|
||||
</span>
|
||||
@break
|
||||
|
||||
@case(1)
|
||||
<span class="badge bg-warning-transparent">
|
||||
برگشت
|
||||
</span>
|
||||
@break
|
||||
|
||||
@case(2)
|
||||
<span class="badge bg-success-transparent">
|
||||
رفت و برگشت
|
||||
</span>
|
||||
@break
|
||||
|
||||
@default
|
||||
-
|
||||
@endswitch
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $flight->departure_time->toJalali()->format('H:i Y-m-d') }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $flight->departureAirport?->city?->name }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $flight->arrivalAirport?->city?->name }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ number_format($flight->price) }}
|
||||
تومان
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $flight->capacity }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@if(\App\Enums\FlightStatus::ENABLE)
|
||||
<span class="badge bg-primary-transparent">
|
||||
فعال
|
||||
</span>
|
||||
@elseif(\App\Enums\FlightStatus::DISABLE)
|
||||
<span class="badge bg-warning-transparent">
|
||||
غیرفعال
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $flight->created_at->toJalali()->format('H:i Y-m-d') }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="hstack gap-2 fs-15">
|
||||
|
||||
@if(auth('admin')->user()->permission?->flight_edit)
|
||||
|
||||
<a
|
||||
href="{{ route('admin.flights.edit', $flight->id) }}"
|
||||
class="btn btn-secondary-light btn-icon btn-sm"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="ویرایش"
|
||||
>
|
||||
<i class="ti ti-pencil"></i>
|
||||
</a>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
@if(auth('admin')->user()->permission?->flight_delete)
|
||||
|
||||
<form
|
||||
action="{{ route('admin.flights.destroy', $flight->id) }}"
|
||||
method="POST"
|
||||
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>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{ $flights->links() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user