feat: finish tours in admin panel and add edit show list and create a new tour from admin panel
This commit is contained in:
@@ -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