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