feat: add created_by field handling for flights

This commit is contained in:
2026-08-19 13:31:25 +03:30
parent 700bd38c20
commit 7cf68cc02f
103 changed files with 29226 additions and 18 deletions
+189 -3
View File
@@ -1,3 +1,189 @@
<div>
<!-- Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi -->
</div>
@extends('admin.layouts.app')
@section('content')
<div class="container">
<h4 class="mb-4">
ثبت تور جدید
</h4>
@if($errors->any())
<div class="alert alert-danger">
<ul class="mb-0">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('admin.tours.store') }}"
method="POST"
enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-md-6 mb-3">
<label>
عنوان تور
</label>
<input type="text"
name="title"
class="form-control"
value="{{ old('title') }}">
</div>
<div class="col-md-6 mb-3">
<label>
نوع سفر
</label>
<select name="travel_type_id"
class="form-control">
<option value="1">
داخلی
</option>
<option value="2">
خارجی
</option>
<option value="3">
چارتر
</option>
</select>
</div>
<div class="col-md-12 mb-3">
<label>
خلاصه
</label>
<textarea name="summary"
class="form-control"
rows="3">{{ old('summary') }}</textarea>
</div>
<div class="col-md-12 mb-3">
<label>
توضیحات کامل
</label>
<textarea name="description"
class="form-control"
rows="6">{{ old('description') }}</textarea>
</div>
<div class="col-md-4 mb-3">
<label>
قیمت
</label>
<input type="number"
name="price"
class="form-control"
value="{{ old('price') }}">
</div>
<div class="col-md-4 mb-3">
<label>
تاریخ حرکت
</label>
<input type="text"
name="departure_date"
id="departure_date"
class="form-control"
autocomplete="off"
value="{{ old('departure_date') }}">
</div>
<div class="col-md-4 mb-3">
<label>
تصویر
</label>
<input type="file"
name="image"
class="form-control">
</div>
<div class="col-md-4 mb-3">
<label>
وضعیت
</label>
<select name="status"
class="form-control">
<option value="0">
پیش نویس
</option>
<option value="1">
فعال
</option>
<option value="2">
غیرفعال
</option>
</select>
</div>
</div>
<button class="btn btn-primary">
ذخیره
</button>
</form>
</div>
@endsection
+192 -3
View File
@@ -1,3 +1,192 @@
<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>
@if($errors->any())
<div class="alert alert-danger">
<ul class="mb-0">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('admin.tours.update',$tour) }}"
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="title"
class="form-control"
value="{{ old('title',$tour->title) }}">
</div>
<div class="col-md-6 mb-3">
<label>
نوع سفر
</label>
<select name="travel_type_id"
class="form-control">
<option value="1">
داخلی
</option>
<option value="2">
خارجی
</option>
<option value="3">
چارتر
</option>
</select>
</div>
<div class="col-md-12 mb-3">
<label>خلاصه</label>
<textarea name="summary"
class="form-control"
rows="3">{{ old('summary',$tour->summary) }}</textarea>
</div>
<div class="col-md-12 mb-3">
<label>توضیحات</label>
<textarea name="description"
class="form-control"
rows="5">{{ old('description',$tour->description) }}</textarea>
</div>
<div class="col-md-4 mb-3">
<label>قیمت</label>
<input type="number"
name="price"
class="form-control"
value="{{ old('price',$tour->price) }}">
</div>
<div class="col-md-4 mb-3">
<label>تاریخ حرکت</label>
<input type="text"
name="departure_date"
id="departure_date"
class="form-control"
value="{{ old('departure_date',$tour->departure_date) }}">
</div>
<div class="col-md-4 mb-3">
<label>وضعیت</label>
<select name="status"
class="form-control">
<option value="0"
{{ old('status',$tour->status)==0?'selected':'' }}>
پیش نویس
</option>
<option value="1"
{{ old('status',$tour->status)==1?'selected':'' }}>
فعال
</option>
<option value="2"
{{ old('status',$tour->status)==2?'selected':'' }}>
غیرفعال
</option>
</select>
</div>
<div class="col-md-6 mb-3">
<label>تصویر</label>
<input type="file"
name="image"
class="form-control">
@if($tour->image)
<img src="{{ getImageUrl($tour->image) }}"
width="150"
class="mt-2">
@endif
</div>
</div>
<button class="btn btn-primary">
ذخیره تغییرات
</button>
<a href="{{ route('admin.tours.index') }}"
class="btn btn-secondary">
بازگشت
</a>
</form>
</div>
@endsection
+289 -3
View File
@@ -1,3 +1,289 @@
<div>
<!-- Simplicity is the essence of happiness. - Cedric Bledsoe -->
</div>
@extends('admin.layouts.app')
@section('content')
<div class="container">
<div class="d-flex justify-content-between mb-4">
<h4>
مدیریت تورها
</h4>
<a href="{{ route('admin.tours.create') }}"
class="btn btn-primary">
ثبت تور جدید
</a>
</div>
<form method="GET"
action="{{ route('admin.tours.index') }}"
class="mb-3">
<div class="row">
<div class="col-md-4">
<input type="text"
name="search"
class="form-control"
placeholder="جستجو..."
value="{{ request('search') }}">
</div>
<div class="col-md-3">
<select name="type" class="form-control">
<option value="">
همه انواع
</option>
<option value="0"
@selected(request('type')=='0')>
داخلی
</option>
<option value="2"
@selected(request('type')=='2')>
خارجی
</option>
<option value="3"
@selected(request('type')=='3')>
چارتر
</option>
</select>
</div>
<div class="col-md-3">
<select name="sort"
class="form-control">
<option value="newest">
جدیدترین
</option>
<option value="price_asc">
ارزان‌ترین
</option>
<option value="price_desc">
گران‌ترین
</option>
</select>
</div>
<div class="col-md-2">
<button class="btn btn-dark w-100">
اعمال
</button>
</div>
</div>
</form>
<table class="table table-bordered text-center">
<thead>
<tr>
<th>
شناسه
</th>
<th>
عنوان تور
</th>
<th>
تصویر
</th>
<th>
نوع سفر
</th>
<th>
تاریخ حرکت
</th>
<th>
قیمت
</th>
<th>
بازدید
</th>
<th>
وضعیت
</th>
<th>
عملیات
</th>
</tr>
</thead>
<tbody>
@forelse($tours as $tour)
<tr>
<td>
{{ $loop->iteration }}
</td>
<td>
{{ $tour->title }}
</td>
<td>
@if($tour->image)
<img src="{{ getImageUrl($tour->image) }}"
width="120">
@endif
</td>
<td>
{{ $tour->travelType->name ?? '-' }}
</td>
<td>
{{ verta($tour->departure_date)->format('Y/m/d') }}
</td>
<td>
{{ number_format($tour->price) }}
</td>
<td>
{{ $tour->views }}
</td>
<td>
@switch($tour->status)
@case(0)
پیش نویس
@break
@case(1)
فعال
@break
@case(2)
غیرفعال
@break
@case(3)
تمام شده
@break
@case(4)
لغو شده
@break
@endswitch
</td>
<td>
<a href="{{ route('admin.tours.edit',$tour) }}"
class="btn btn-warning btn-sm">
ویرایش
</a>
<form action="{{ route('admin.tours.destroy',$tour) }}"
method="POST"
class="d-inline">
@csrf
@method('DELETE')
<button class="btn btn-danger btn-sm"
onclick="return confirm('حذف شود؟')">
حذف
</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="9">
موردی یافت نشد
</td>
</tr>
@endforelse
</tbody>
</table>
{{ $tours->links() }}
</div>
@endsection