feat: add a list for flights in admin panel and add edit and delete for flights in admin panel
This commit is contained in:
@@ -0,0 +1,269 @@
|
||||
@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">
|
||||
|
||||
<h4 class="user-profile-card-title">
|
||||
ویرایش پرواز
|
||||
</h4>
|
||||
|
||||
<div class="user-profile-form">
|
||||
|
||||
<form action="{{ route('admin.flights.update', $flight->id) }}" method="POST">
|
||||
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>شماره پرواز</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="flight_number"
|
||||
class="form-control"
|
||||
value="{{ old('flight_number', $flight->flight_number) }}"
|
||||
placeholder="شماره پرواز"
|
||||
>
|
||||
|
||||
@error('flight_number')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>ایرلاین</label>
|
||||
|
||||
<select name="airline_id" class="form-control">
|
||||
|
||||
<option value="">
|
||||
انتخاب ایرلاین
|
||||
</option>
|
||||
|
||||
@foreach($airlines as $airline)
|
||||
|
||||
<option
|
||||
value="{{ $airline->id }}"
|
||||
{{ old('airline_id', $flight->airline_id) == $airline->id ? 'selected' : '' }}
|
||||
>
|
||||
{{ $airline->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@error('airline_id')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>مبدأ</label>
|
||||
|
||||
<select name="origin_airports_id" class="form-control">
|
||||
|
||||
<option value="">
|
||||
انتخاب مبدأ
|
||||
</option>
|
||||
|
||||
@foreach($airports as $airport)
|
||||
|
||||
<option
|
||||
value="{{ $airport->id }}"
|
||||
{{ old('origin_airports_id', $flight->origin_airports_id) == $airport->id ? 'selected' : '' }}
|
||||
>
|
||||
{{ $airport->city }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@error('origin_airports_id')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>مقصد</label>
|
||||
|
||||
<select name="destination_airports_id" class="form-control">
|
||||
|
||||
<option value="">
|
||||
انتخاب مقصد
|
||||
</option>
|
||||
|
||||
@foreach($airports as $airport)
|
||||
|
||||
<option
|
||||
value="{{ $airport->id }}"
|
||||
{{ old('destination_airports_id', $flight->destination_airports_id) == $airport->id ? 'selected' : '' }}
|
||||
>
|
||||
{{ $airport->city }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@error('destination_airports_id')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>تاریخ و ساعت حرکت</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="start_time"
|
||||
id="start_time"
|
||||
class="form-control"
|
||||
value="{{ old('start_time', verta($flight->start_time)->format('Y/m/d H:i')) }}"
|
||||
placeholder="تاریخ و ساعت حرکت"
|
||||
>
|
||||
|
||||
@error('start_time')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>تاریخ و ساعت رسیدن</label>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name="end_time"
|
||||
id="end_time"
|
||||
class="form-control"
|
||||
value="{{ old('end_time', verta($flight->end_time)->format('Y/m/d H:i')) }}"
|
||||
placeholder="تاریخ و ساعت رسیدن"
|
||||
>
|
||||
|
||||
@error('end_time')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>قیمت</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
name="price"
|
||||
class="form-control"
|
||||
value="{{ old('price', $flight->price) }}"
|
||||
placeholder="قیمت"
|
||||
>
|
||||
|
||||
@error('price')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
|
||||
<label>ظرفیت</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
name="capacity"
|
||||
class="form-control"
|
||||
value="{{ old('capacity', $flight->capacity) }}"
|
||||
placeholder="ظرفیت"
|
||||
>
|
||||
|
||||
@error('capacity')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" class="theme-btn mt-4">
|
||||
بروزرسانی پرواز
|
||||
<i class="far fa-edit"></i>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#start_time').persianDatepicker({
|
||||
format: 'YYYY/MM/DD HH:mm',
|
||||
autoClose: true,
|
||||
timePicker: {
|
||||
enabled: true
|
||||
}
|
||||
});
|
||||
|
||||
$('#end_time').persianDatepicker({
|
||||
format: 'YYYY/MM/DD HH:mm',
|
||||
autoClose: true,
|
||||
timePicker: {
|
||||
enabled: true
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@@ -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
|
||||
@@ -77,7 +77,6 @@
|
||||
<div class="price-info">
|
||||
<span class="price-amount">{{ number_format($flight->price) }} تومان</span>
|
||||
</div>
|
||||
<a href="#" class="theme-btn">اکنون ثبت کن<i class="far fa-arrow-left"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flight-booking-detail">
|
||||
|
||||
Reference in New Issue
Block a user