git commit "add flight image upload and update support"

This commit is contained in:
2026-08-18 17:58:02 +03:30
parent 0722cf3120
commit 62a95c411b
15 changed files with 896 additions and 26 deletions
+241 -3
View File
@@ -1,3 +1,241 @@
<div>
<!-- Let all your things have their places; let each part of your business have its time. - Benjamin Franklin -->
</div>
@extends('admin.layouts.app')
@section('content')
<div class="container">
<h4 class="mb-4">
ویرایش پرواز
</h4>
<form action="{{ route('admin.flights.update', $flight->id) }}"
method="POST"
enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="row">
<div class="col-md-6 mb-3">
<label>نام ایرلاین</label>
<input type="text"
name="airline"
class="form-control"
value="{{ old('airline', $flight->airline) }}">
@error('airline')
<small class="text-danger">
{{ $message }}
</small>
@enderror
</div>
<div class="col-md-6 mb-3">
<label>شماره پرواز</label>
<input type="text"
name="flight_number"
class="form-control"
value="{{ old('flight_number', $flight->flight_number) }}">
</div>
<div class="col-md-6 mb-3">
<label>مبدا</label>
<input type="text"
name="origin"
class="form-control"
value="{{ old('origin', $flight->origin) }}">
</div>
<div class="col-md-6 mb-3">
<label>مقصد</label>
<input type="text"
name="destination"
class="form-control"
value="{{ old('destination', $flight->destination) }}">
</div>
<div class="col-md-4 mb-3">
<label>تاریخ حرکت</label>
<input type="date"
name="departure_date"
class="form-control"
value="{{ old('departure_date', $flight->departure_date) }}">
</div>
<div class="col-md-4 mb-3">
<label>ساعت حرکت</label>
<input type="time"
name="departure_time"
class="form-control"
value="{{ old('departure_time', $flight->departure_time) }}">
</div>
<div class="col-md-4 mb-3">
<label>ساعت رسیدن</label>
<input type="time"
name="arrival_time"
class="form-control"
value="{{ old('arrival_time', $flight->arrival_time) }}">
</div>
<div class="col-md-4 mb-3">
<label>کلاس پرواز</label>
<input type="text"
name="flight_class"
class="form-control"
value="{{ old('flight_class', $flight->flight_class) }}">
</div>
<div class="col-md-4 mb-3">
<label>ظرفیت</label>
<input type="number"
name="capacity"
class="form-control"
value="{{ old('capacity', $flight->capacity) }}">
</div>
<div class="col-md-4 mb-3">
<label>قیمت</label>
<input type="number"
name="price"
class="form-control"
value="{{ old('price', $flight->price) }}">
</div>
<div class="col-md-6 mb-3">
<label>وضعیت</label>
<select name="status" class="form-control">
<option value="0"
{{ $flight->status == 0 ? 'selected':'' }}>
پیش نویس
</option>
<option value="1"
{{ $flight->status == 1 ? 'selected':'' }}>
فعال
</option>
<option value="2"
{{ $flight->status == 2 ? 'selected':'' }}>
غیرفعال
</option>
<option value="3"
{{ $flight->status == 3 ? 'selected':'' }}>
تمام شده
</option>
<option value="4"
{{ $flight->status == 4 ? 'selected':'' }}>
لغو شده
</option>
</select>
</div>
<div class="col-md-6 mb-3">
<label>تصویر</label>
<input type="file"
name="image"
class="form-control">
@if($flight->image)
<img src="{{ asset('storage/'.$flight->image) }}"
width="120"
class="mt-2">
@endif
</div>
</div>
<button class="btn btn-primary">
ذخیره تغییرات
</button>
<a href="{{ route('admin.flights.index') }}"
class="btn btn-secondary">
بازگشت
</a>
</form>
</div>
@endsection