352 lines
17 KiB
PHP
352 lines
17 KiB
PHP
@extends('admin.layouts.app')
|
|
|
|
@section('content')
|
|
<div class="main-content app-content">
|
|
<div class="container-fluid pt-4">
|
|
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
|
|
@error('error')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
|
|
|
|
<form action="{{ route('admin.flights.update', $flight) }}" method="POST" enctype="multipart/form-data">
|
|
@csrf
|
|
@method('put')
|
|
|
|
<div class="card custom-card">
|
|
|
|
<div class="card-header">
|
|
<div class="card-title">
|
|
ویرایش پرواز
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card-body pt-0">
|
|
|
|
<div class="row gy-3">
|
|
|
|
<!-- Title -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">عنوان پرواز</label>
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="title"
|
|
placeholder="عنوان پرواز را وارد کنید"
|
|
value="{{ old('title', $flight->title) }}"
|
|
>
|
|
|
|
@error('title')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Airline -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">شرکت هواپیمایی</label>
|
|
|
|
<select class="form-control" name="airline_id">
|
|
<option value="">یک شرکت هواپیمایی انتخاب کنید</option>
|
|
|
|
@foreach($airlines as $airline)
|
|
<option
|
|
value="{{ $airline->id }}"
|
|
@selected(old('airline_id', $flight->airline_id) == $airline->id)
|
|
>
|
|
{{ $airline->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
|
|
@error('airline_id')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Flight Type -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">نوع پرواز</label>
|
|
|
|
<select class="form-control" name="flight_type">
|
|
|
|
<option
|
|
value="0"
|
|
@selected(old('flight_type', $flight->flight_type) == 0)
|
|
>
|
|
رفت
|
|
</option>
|
|
|
|
<option
|
|
value="1"
|
|
@selected(old('flight_type', $flight->flight_type) == 1)
|
|
>
|
|
برگشت
|
|
</option>
|
|
|
|
<option
|
|
value="2"
|
|
@selected(old('flight_type', $flight->flight_type) == 2)
|
|
>
|
|
رفت و برگشت
|
|
</option>
|
|
|
|
</select>
|
|
|
|
@error('flight_type')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Departure Airport -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">فرودگاه مبدأ</label>
|
|
|
|
<select class="form-control" name="departure_airport_id">
|
|
|
|
<option value="">فرودگاه مبدأ را انتخاب کنید</option>
|
|
|
|
@foreach($airports as $airport)
|
|
<option
|
|
value="{{ $airport->id }}"
|
|
@selected(old('departure_airport_id', $flight->departure_airport_id) == $airport->id)
|
|
>
|
|
{{ $airport->name }}
|
|
@if($airport->city)
|
|
- {{ $airport->city->name }}
|
|
@endif
|
|
</option>
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
@error('departure_airport_id')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Arrival Airport -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">فرودگاه مقصد</label>
|
|
|
|
<select class="form-control" name="arrival_airport_id">
|
|
|
|
<option value="">فرودگاه مقصد را انتخاب کنید</option>
|
|
|
|
@foreach($airports as $airport)
|
|
<option
|
|
value="{{ $airport->id }}"
|
|
@selected(old('arrival_airport_id', $flight->arrival_airport_id) == $airport->id)
|
|
>
|
|
{{ $airport->name }}
|
|
@if($airport->city)
|
|
- {{ $airport->city->name }}
|
|
@endif
|
|
</option>
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
@error('arrival_airport_id')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Departure Time -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">زمان حرکت</label>
|
|
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="departure_time_jalali"
|
|
id="departure_time_jalali"
|
|
data-jdp
|
|
data-jdp-target-value-input="#departure_time_gregorian"
|
|
data-jdp-target-value-type="gregorian"
|
|
autocomplete="off"
|
|
placeholder="مثلاً 1403/05/29 14:30"
|
|
value="{{ old('departure_time_jalali', $flight->departure_time ? verta($flight->departure_time)->format('Y/m/d H:i') : '') }}"
|
|
>
|
|
|
|
<input
|
|
type="hidden"
|
|
name="departure_time"
|
|
id="departure_time_gregorian"
|
|
value="{{ old('departure_time', optional($flight->departure_time)->format('Y-m-d H:i:s')) }}"
|
|
>
|
|
|
|
@error('departure_time')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Price -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">قیمت</label>
|
|
|
|
<input
|
|
type="number"
|
|
class="form-control"
|
|
name="price"
|
|
placeholder="قیمت پرواز را وارد کنید"
|
|
value="{{ old('price', $flight->price) }}"
|
|
>
|
|
|
|
@error('price')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Capacity -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">ظرفیت</label>
|
|
|
|
<input
|
|
type="number"
|
|
class="form-control"
|
|
name="capacity"
|
|
placeholder="ظرفیت پرواز را وارد کنید"
|
|
value="{{ old('capacity', $flight->capacity) }}"
|
|
>
|
|
|
|
@error('capacity')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Status -->
|
|
<div class="col-xl-6">
|
|
<label class="form-label">وضعیت</label>
|
|
|
|
<select class="form-control" name="status">
|
|
|
|
<option
|
|
value="0"
|
|
@selected(old('status', $flight->status) == 0)
|
|
>
|
|
غیرفعال
|
|
</option>
|
|
|
|
<option
|
|
value="1"
|
|
@selected(old('status', $flight->status) == 1)
|
|
>
|
|
فعال
|
|
</option>
|
|
|
|
</select>
|
|
|
|
@error('status')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Summary -->
|
|
<div class="col-xl-12">
|
|
<label class="form-label">خلاصه</label>
|
|
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="summary"
|
|
placeholder="خلاصهای از پرواز"
|
|
value="{{ old('summary', $flight->summary) }}"
|
|
>
|
|
|
|
@error('summary')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Description -->
|
|
<div class="col-xl-12">
|
|
<label class="form-label">توضیحات</label>
|
|
|
|
<textarea
|
|
class="form-control"
|
|
name="description"
|
|
rows="4"
|
|
placeholder="توضیحات پرواز را وارد کنید"
|
|
>{{ old('description', $flight->description) }}</textarea>
|
|
|
|
@error('description')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
|
|
|
|
<!-- Image -->
|
|
<div class="col-xl-12">
|
|
<label class="form-label">تصویر پرواز</label>
|
|
|
|
<input
|
|
type="file"
|
|
class="form-control"
|
|
name="image"
|
|
accept=".jpg,.jpeg,.png,.webp"
|
|
>
|
|
|
|
@error('image')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
|
|
@if($flight->file)
|
|
<div class="mt-3">
|
|
<img
|
|
src="{{ getFileUrl($flight->file->id) }}"
|
|
alt="{{ $flight->title }}"
|
|
style="width:150px;height:150px;object-fit:cover;border-radius:8px;"
|
|
>
|
|
</div>
|
|
@endif
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="card-footer text-end">
|
|
|
|
<button type="submit" class="btn btn-primary">
|
|
ذخیره تغییرات
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<link rel="stylesheet" href="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.css">
|
|
<script src="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.js"></script>
|
|
|
|
<script>
|
|
jalaliDatepicker.startWatch({
|
|
date: true,
|
|
time: true,
|
|
hasSecond: false,
|
|
targetValueInput: 'attr',
|
|
targetValueType: 'attr'
|
|
});
|
|
</script>
|
|
@endsection
|