feat: finish tours in admin panel and add edit show list and create a new tour from admin panel
This commit is contained in:
@@ -3,46 +3,90 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Tours\TourUpdatePostRequest;
|
||||
use App\Http\Requests\Admins\TourStorePostRequest;
|
||||
use App\Models\Airport;
|
||||
use App\Models\Tour;
|
||||
use Hekmatinasser\Verta\Verta;
|
||||
use Illuminate\Http\Request;
|
||||
use Hekmatinasser\Verta\Facades\Verta;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class TourController extends Controller
|
||||
{
|
||||
public function index()
|
||||
public function index(): View
|
||||
{
|
||||
|
||||
$tours = Tour::with([
|
||||
'file',
|
||||
'originAirport',
|
||||
'destinationAirport',
|
||||
'tour_details'
|
||||
])
|
||||
->latest()
|
||||
->paginate(10);
|
||||
])->latest()->paginate(10);
|
||||
|
||||
return view('admin.tours.index', compact('tours'));
|
||||
}
|
||||
public function edit(Tour $tour)
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
$airports = Airport::all();
|
||||
|
||||
return view('admin.tours.create', compact('airports'));
|
||||
}
|
||||
|
||||
public function store(TourStorePostRequest $request): RedirectResponse
|
||||
{
|
||||
$tour = Tour::create([
|
||||
'title' => $request->title,
|
||||
'tour_type' => $request->tour_type,
|
||||
'summary' => $request->summary,
|
||||
'description' => $request->description,
|
||||
'origin_airports_id' => $request->origin_airports_id,
|
||||
'destination_airports_id' => $request->destination_airports_id,
|
||||
]);
|
||||
|
||||
$startDate = Verta::parse($request->start_date)->datetime();
|
||||
$endDate = Verta::parse($request->end_date)->datetime();
|
||||
|
||||
$tour->tour_details()->create([
|
||||
'start_date' => $startDate,
|
||||
'end_date' => $endDate,
|
||||
'price' => $request->price,
|
||||
'capacity' => $request->capacity,
|
||||
'status' => 1,
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
->route('admin.tours.index')
|
||||
->with('success', 'تور با موفقیت ایجاد شد.');
|
||||
}
|
||||
|
||||
public function edit(Tour $tour): View
|
||||
{
|
||||
$tour->load([
|
||||
'tour_details',
|
||||
'originAirport',
|
||||
'destinationAirport',
|
||||
'file',
|
||||
'destinationAirport'
|
||||
]);
|
||||
|
||||
return view('admin.tours.edit', compact('tour' , 'airports'));
|
||||
$airports = Airport::all();
|
||||
|
||||
$detail = $tour->tour_details->first();
|
||||
|
||||
$startDate = null;
|
||||
$endDate = null;
|
||||
|
||||
if ($detail) {
|
||||
$startDate = verta($detail->start_date)->format('Y/m/d H:i');
|
||||
$endDate = verta($detail->end_date)->format('Y/m/d H:i');
|
||||
}
|
||||
|
||||
return view('admin.tours.edit', compact(
|
||||
'tour',
|
||||
'airports',
|
||||
'detail',
|
||||
'startDate',
|
||||
'endDate'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function update(TourUpdatePostRequest $request, Tour $tour)
|
||||
public function update(TourStorePostRequest $request, Tour $tour): RedirectResponse
|
||||
{
|
||||
$tour->update([
|
||||
'title' => $request->title,
|
||||
@@ -53,28 +97,30 @@ class TourController extends Controller
|
||||
'destination_airports_id' => $request->destination_airports_id,
|
||||
]);
|
||||
|
||||
$tourDetail = $tour->tour_details()->first();
|
||||
$startDate = Verta::parse($request->start_date)->datetime();
|
||||
$endDate = Verta::parse($request->end_date)->datetime();
|
||||
|
||||
if ($tourDetail) {
|
||||
|
||||
$startDate = Verta::parseFormat('Y/m/d', $request->start_date)->datetime();
|
||||
|
||||
$endDate = Verta::parseFormat('Y/m/d', $request->end_date)->datetime();
|
||||
|
||||
$tourDetail->update([
|
||||
$tour->tour_details()->updateOrCreate(
|
||||
[
|
||||
'tour_id' => $tour->id
|
||||
],
|
||||
[
|
||||
'start_date' => $startDate,
|
||||
'end_date' => $endDate,
|
||||
]);
|
||||
}
|
||||
'price' => $request->price,
|
||||
'capacity' => $request->capacity,
|
||||
'status' => 1,
|
||||
]
|
||||
);
|
||||
|
||||
return redirect()
|
||||
->route('admin.tours.index')
|
||||
->with('success', 'تور با موفقیت بروزرسانی شد.');
|
||||
->with('success', 'تور با موفقیت ویرایش شد.');
|
||||
}
|
||||
public function destroy(Tour $tour)
|
||||
|
||||
public function destroy(Tour $tour): RedirectResponse
|
||||
{
|
||||
$tour->tour_details()->delete();
|
||||
|
||||
$tour->delete();
|
||||
|
||||
return redirect()
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admins;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class TourStorePostRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
'tour_type' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
],
|
||||
'origin_airports_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
'exists:airports,id',
|
||||
],
|
||||
'destination_airports_id' => [
|
||||
'required',
|
||||
'integer',
|
||||
'exists:airports,id',
|
||||
'different:origin_airports_id',
|
||||
],
|
||||
'start_date' => [
|
||||
'required',
|
||||
],
|
||||
'end_date' => [
|
||||
'required',
|
||||
],
|
||||
'price' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:0',
|
||||
],
|
||||
'capacity' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1',
|
||||
],
|
||||
'status' => [
|
||||
'nullable',
|
||||
'integer',
|
||||
],
|
||||
'summary' => [
|
||||
'required',
|
||||
'string',
|
||||
],
|
||||
'description' => [
|
||||
'required',
|
||||
'string',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -47,14 +47,20 @@ class Tour extends Model
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'file_id',
|
||||
'tour_type',
|
||||
'summary',
|
||||
'description',
|
||||
'origin_airports_id',
|
||||
'destination_airports_id'
|
||||
];
|
||||
'title',
|
||||
'file_id',
|
||||
'tour_type',
|
||||
'summary',
|
||||
'description',
|
||||
'origin_airports_id',
|
||||
'destination_airports_id',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'price',
|
||||
'capacity',
|
||||
'status',
|
||||
'tour_id'
|
||||
];
|
||||
|
||||
public function originAirport()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
@extends('dashboard.layouts.app')
|
||||
|
||||
@section('title', 'ساخت تور')
|
||||
|
||||
@section('account-content')
|
||||
|
||||
<div class="user-profile-wrapper">
|
||||
|
||||
<div class="col-lg-12 mb-4">
|
||||
|
||||
<div class="user-profile-card">
|
||||
|
||||
<h4 class="user-profile-card-title">
|
||||
ساخت تور
|
||||
</h4>
|
||||
|
||||
<div class="user-profile-form">
|
||||
|
||||
<form action="{{ route('admin.tours.store') }}" method="POST">
|
||||
|
||||
@csrf
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>عنوان تور</label>
|
||||
|
||||
<input type="text"
|
||||
name="title"
|
||||
class="form-control"
|
||||
value="{{ old('title') }}"
|
||||
placeholder="عنوان تور">
|
||||
|
||||
@error('title')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>نوع تور</label>
|
||||
|
||||
<input type="text"
|
||||
name="tour_type"
|
||||
class="form-control"
|
||||
value="{{ old('tour_type') }}"
|
||||
placeholder="نوع تور">
|
||||
|
||||
@error('tour_type')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<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') == $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">
|
||||
<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') == $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">
|
||||
<div class="form-group">
|
||||
|
||||
<label>تاریخ حرکت</label>
|
||||
|
||||
<input type="text"
|
||||
name="start_date"
|
||||
id="start_date"
|
||||
class="form-control"
|
||||
value="{{ old('start_date') }}"
|
||||
placeholder="تاریخ حرکت">
|
||||
|
||||
@error('start_date')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
|
||||
<label>تاریخ برگشت</label>
|
||||
|
||||
<input type="text"
|
||||
name="end_date"
|
||||
id="end_date"
|
||||
class="form-control"
|
||||
value="{{ old('end_date') }}"
|
||||
placeholder="تاریخ برگشت">
|
||||
|
||||
@error('end_date')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>قیمت</label>
|
||||
<input type="number" name="price" class="form-control" value="{{old('price')}}" placeholder="قیمت">
|
||||
@error('price')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>ظرفیت</label>
|
||||
<input type="number" name="capacity" class="form-control" value="{{old('capacity')}}" placeholder="ظرفیت">
|
||||
@error('capacity')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
|
||||
<label>خلاصه تور</label>
|
||||
|
||||
<textarea name="summary"
|
||||
class="form-control"
|
||||
rows="4"
|
||||
placeholder="خلاصه تور">{{ old('summary') }}</textarea>
|
||||
|
||||
@error('summary')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
|
||||
<label>توضیحات تور</label>
|
||||
|
||||
<textarea name="description"
|
||||
class="form-control"
|
||||
rows="6"
|
||||
placeholder="توضیحات تور">{{ old('description') }}</textarea>
|
||||
|
||||
@error('description')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" class="theme-btn mt-4">
|
||||
ساخت تور
|
||||
<i class="far fa-plus"></i>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#start_date').persianDatepicker({
|
||||
format: 'YYYY/MM/DD',
|
||||
autoClose: true
|
||||
});
|
||||
|
||||
$('#end_date').persianDatepicker({
|
||||
format: 'YYYY/MM/DD',
|
||||
autoClose: true
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@@ -1,243 +1,194 @@
|
||||
@extends('dashboard.layouts.app')
|
||||
|
||||
@section('title','ویرایش تور')
|
||||
@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 mb-4">
|
||||
<div class="col-lg-12">
|
||||
<div class="user-profile-card">
|
||||
|
||||
<h4 class="user-profile-card-title">
|
||||
ویرایش تور
|
||||
</h4>
|
||||
<h4 class="user-profile-card-title">ویرایش تور</h4>
|
||||
|
||||
<div class="user-profile-form">
|
||||
|
||||
<form action="{{route('admin.tours.update',$tour->id)}}" method="POST">
|
||||
@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->id) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
@php
|
||||
$detail = $tour->tour_details->first();
|
||||
|
||||
$startDate = $detail && $detail->start_date
|
||||
? verta($detail->start_date)->format('Y/m/d')
|
||||
: '';
|
||||
|
||||
$endDate = $detail && $detail->end_date
|
||||
? verta($detail->end_date)->format('Y/m/d')
|
||||
: '';
|
||||
@endphp
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>عنوان تور</label>
|
||||
|
||||
<input type="text"
|
||||
name="title"
|
||||
class="form-control"
|
||||
value="{{old('title',$tour->title)}}"
|
||||
placeholder="عنوان تور">
|
||||
|
||||
@error('title')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">عنوان تور</label>
|
||||
<input type="text"
|
||||
name="title"
|
||||
class="form-control"
|
||||
value="{{ old('title', $tour->title) }}"
|
||||
required>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>نوع تور</label>
|
||||
|
||||
<input type="text"
|
||||
name="tour_type"
|
||||
class="form-control"
|
||||
value="{{old('tour_type',$tour->tour_type)}}"
|
||||
placeholder="نوع تور">
|
||||
|
||||
@error('tour_type')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">نوع تور</label>
|
||||
<input type="text"
|
||||
name="tour_type"
|
||||
class="form-control"
|
||||
value="{{ old('tour_type', $tour->tour_type) }}"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">مبدأ</label>
|
||||
<select name="origin_airports_id"
|
||||
class="form-control"
|
||||
required>
|
||||
<option value="">انتخاب مبدأ</option>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>مبدأ</label>
|
||||
|
||||
<select name="origin_airports_id" class="form-control">
|
||||
|
||||
<option value="">
|
||||
انتخاب مبدأ
|
||||
@foreach($airports as $airport)
|
||||
<option value="{{ $airport->id }}"
|
||||
{{ old('origin_airports_id', $tour->origin_airports_id) == $airport->id ? 'selected' : '' }}>
|
||||
{{ $airport->city }}
|
||||
</option>
|
||||
|
||||
@foreach($airports as $airport)
|
||||
|
||||
<option value="{{$airport->id}}"
|
||||
{{old('origin_airports_id',$tour->origin_airports_id)==$airport->id?'selected':''}}>
|
||||
|
||||
{{$airport->city}}
|
||||
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@error('origin_airports_id')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">مقصد</label>
|
||||
<select name="destination_airports_id"
|
||||
class="form-control"
|
||||
required>
|
||||
<option value="">انتخاب مقصد</option>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>مقصد</label>
|
||||
|
||||
<select name="destination_airports_id" class="form-control">
|
||||
|
||||
<option value="">
|
||||
انتخاب مقصد
|
||||
@foreach($airports as $airport)
|
||||
<option value="{{ $airport->id }}"
|
||||
{{ old('destination_airports_id', $tour->destination_airports_id) == $airport->id ? 'selected' : '' }}>
|
||||
{{ $airport->city }}
|
||||
</option>
|
||||
|
||||
@foreach($airports as $airport)
|
||||
|
||||
<option value="{{$airport->id}}"
|
||||
{{old('destination_airports_id',$tour->destination_airports_id)==$airport->id?'selected':''}}>
|
||||
|
||||
{{$airport->city}}
|
||||
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@error('destination_airports_id')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
|
||||
<label>تاریخ حرکت</label>
|
||||
|
||||
<input type="text"
|
||||
name="start_date"
|
||||
id="start_date"
|
||||
class="form-control"
|
||||
value="{{old('start_date',$tour->tour_details->first()?verta($tour->tour_details->first()->start_date)->format('Y/m/d'):'')}}"
|
||||
placeholder="تاریخ حرکت">
|
||||
|
||||
@error('start_date')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">تاریخ حرکت</label>
|
||||
<input type="text"
|
||||
id="start_date"
|
||||
name="start_date"
|
||||
class="form-control"
|
||||
value="{{ old('start_date', $startDate) }}"
|
||||
placeholder="1405/06/01"
|
||||
autocomplete="off"
|
||||
required>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
|
||||
<label>تاریخ برگشت</label>
|
||||
|
||||
<input type="text"
|
||||
name="end_date"
|
||||
id="end_date"
|
||||
class="form-control"
|
||||
value="{{old('end_date',$tour->tour_details->first()?verta($tour->tour_details->first()->end_date)->format('Y/m/d'):'')}}"
|
||||
placeholder="تاریخ برگشت">
|
||||
|
||||
@error('end_date')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">تاریخ برگشت</label>
|
||||
<input type="text"
|
||||
id="end_date"
|
||||
name="end_date"
|
||||
class="form-control"
|
||||
value="{{ old('end_date', $endDate) }}"
|
||||
placeholder="1405/06/05"
|
||||
autocomplete="off"
|
||||
required>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
|
||||
<label>خلاصه تور</label>
|
||||
|
||||
<textarea name="summary"
|
||||
class="form-control"
|
||||
rows="4"
|
||||
placeholder="خلاصه تور">{{old('summary',$tour->summary)}}</textarea>
|
||||
|
||||
@error('summary')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">قیمت</label>
|
||||
<input type="number"
|
||||
name="price"
|
||||
class="form-control"
|
||||
value="{{ old('price', $detail?->price) }}"
|
||||
min="0"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 mb-3">
|
||||
<label class="form-label">ظرفیت</label>
|
||||
<input type="number"
|
||||
name="capacity"
|
||||
class="form-control"
|
||||
value="{{ old('capacity', $detail?->capacity) }}"
|
||||
min="1"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12 mb-3">
|
||||
<label class="form-label">خلاصه تور</label>
|
||||
<textarea name="summary"
|
||||
class="form-control"
|
||||
rows="4"
|
||||
required>{{ old('summary', $tour->summary) }}</textarea>
|
||||
</div>
|
||||
|
||||
<label>توضیحات تور</label>
|
||||
<div class="col-lg-12 mb-3">
|
||||
<label class="form-label">توضیحات تور</label>
|
||||
<textarea name="description"
|
||||
class="form-control"
|
||||
rows="7"
|
||||
required>{{ old('description', $tour->description) }}</textarea>
|
||||
</div>
|
||||
|
||||
<textarea name="description"
|
||||
class="form-control"
|
||||
rows="6"
|
||||
placeholder="توضیحات تور">{{old('description',$tour->description)}}</textarea>
|
||||
<div class="col-lg-12">
|
||||
<button type="submit" class="theme-btn">
|
||||
ذخیره تغییرات
|
||||
<i class="far fa-check"></i>
|
||||
</button>
|
||||
|
||||
@error('description')
|
||||
<span class="text-danger">{{$message}}</span>
|
||||
@enderror
|
||||
|
||||
</div>
|
||||
<a href="{{ route('admin.tours.index') }}" class="theme-btn">
|
||||
بازگشت
|
||||
</a>
|
||||
</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(){
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
$('#start_date').persianDatepicker({
|
||||
format:'YYYY/MM/DD',
|
||||
autoClose:true
|
||||
});
|
||||
const startDate = document.getElementById('start_date');
|
||||
const endDate = document.getElementById('end_date');
|
||||
|
||||
$('#end_date').persianDatepicker({
|
||||
format:'YYYY/MM/DD',
|
||||
autoClose:true
|
||||
});
|
||||
if (typeof $ !== 'undefined' && typeof $.fn.persianDatepicker !== 'undefined') {
|
||||
|
||||
$(startDate).persianDatepicker({
|
||||
format: 'YYYY/MM/DD',
|
||||
autoClose: true,
|
||||
initialValue: false
|
||||
});
|
||||
|
||||
$(endDate).persianDatepicker({
|
||||
format: 'YYYY/MM/DD',
|
||||
autoClose: true,
|
||||
initialValue: false
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
لیست تورها
|
||||
</h4>
|
||||
|
||||
<div class="d-flex justify-content-end mb-4">
|
||||
<a href="{{ route('admin.tours.create') }}" class="theme-btn">
|
||||
ساخت تور
|
||||
<i class="far fa-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="user-profile-form">
|
||||
|
||||
<div class="table-responsive">
|
||||
@@ -67,37 +74,59 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ verta($tour->tour_details->first()->start_date)->format('Y/m/d') }}
|
||||
@if($detail && $detail->start_date)
|
||||
{{ verta($detail->start_date)->format('Y/m/d') }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ verta($tour->tour_details->first()->end_date)->format('Y/m/d') }} </td>
|
||||
@if($detail && $detail->end_date)
|
||||
{{ verta($detail->end_date)->format('Y/m/d') }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{ $tour->tour_type }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<a href="{{ route('tour.show', $tour->id) }}" title="مشاهده"
|
||||
|
||||
<a href="{{ route('tour.show', $tour->id) }}"
|
||||
title="مشاهده"
|
||||
class="btn btn-outline-secondary btn-sm">
|
||||
<i class="far fa-eye"></i>
|
||||
</a>
|
||||
<a href="{{ route('admin.tours.edit', $tour->id) }}" title="ویرایش"
|
||||
class="btn btn-outline-secondary btn-sm">
|
||||
|
||||
<a href="{{ route('admin.tours.edit', $tour->id) }}"
|
||||
title="ویرایش"
|
||||
class="btn btn-outline-secondary btn-sm">
|
||||
<i class="far fa-pen"></i>
|
||||
</a>
|
||||
<form action="{{ route('admin.tours.destroy', $tour->id) }}" method="POST"
|
||||
|
||||
<form action="{{ route('admin.tours.destroy', $tour->id) }}"
|
||||
method="POST"
|
||||
style="display: inline-block;">
|
||||
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
||||
<button type="submit" title="حذف"
|
||||
<button type="submit"
|
||||
title="حذف"
|
||||
onclick="return confirm('آیا از حذف این تور مطمئن هستید؟')"
|
||||
|
||||
class="btn btn-outline-secondary btn-sm"><i class="far fa-trash-can"></i> </button>
|
||||
class="btn btn-outline-secondary btn-sm">
|
||||
<i class="far fa-trash-can"></i>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@@ -270,9 +270,7 @@
|
||||
|
||||
</div>
|
||||
<div class="listing-side-btn">
|
||||
<button type="submit" class="theme-btn"><span
|
||||
class="far fa-shopping-bag"></span>اکنون ثبت کن
|
||||
</button>
|
||||
|
||||
@if($isFavorite)
|
||||
<a href="{{ route('favorites.toggle', ['type' => 'tour', 'id' => $tour->id]) }}"
|
||||
class="border-btn">
|
||||
|
||||
Reference in New Issue
Block a user