667 lines
26 KiB
PHP
667 lines
26 KiB
PHP
@extends('admin.layouts.app')
|
|
|
|
@section('breadcrumb')
|
|
|
|
<div>
|
|
|
|
<h1 class="page-title fw-medium fs-18 mb-2">
|
|
ویرایش تور
|
|
</h1>
|
|
|
|
<nav>
|
|
|
|
<ol class="breadcrumb mb-0">
|
|
|
|
<li class="breadcrumb-item">
|
|
<a href="{{ route('admin.tours.index') }}">
|
|
مدیریت تورها
|
|
</a>
|
|
</li>
|
|
|
|
<li class="breadcrumb-item active" aria-current="page">
|
|
ویرایش تور
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
|
|
@section('content')
|
|
|
|
<div class="container-fluid pt-4">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-xl-12">
|
|
|
|
<form
|
|
action="{{ route('admin.tours.update', $tour) }}"
|
|
method="POST"
|
|
enctype="multipart/form-data"
|
|
>
|
|
|
|
@csrf
|
|
@method('PUT')
|
|
|
|
|
|
@error('general')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
|
|
@php
|
|
$tourDate = $tour->tourDates->first();
|
|
@endphp
|
|
|
|
|
|
<div class="card custom-card">
|
|
|
|
<div class="card-header">
|
|
|
|
<div class="card-title">
|
|
ویرایش تور
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="card-body pt-0">
|
|
|
|
<div class="row gy-3">
|
|
|
|
|
|
{{-- عنوان تور --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
عنوان تور
|
|
</label>
|
|
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="title"
|
|
placeholder="عنوان تور را وارد کنید"
|
|
value="{{ old('title', $tour->title) }}"
|
|
>
|
|
|
|
@error('title')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- مبدأ --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
مبدأ
|
|
</label>
|
|
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="origin"
|
|
placeholder="مبدأ را وارد کنید"
|
|
value="{{ old('origin', $tour->origin) }}"
|
|
>
|
|
|
|
@error('origin')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- مقصد --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
مقصد
|
|
</label>
|
|
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="destination"
|
|
placeholder="مقصد را وارد کنید"
|
|
value="{{ old('destination', $tour->destination) }}"
|
|
>
|
|
|
|
@error('destination')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- مدت تور --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
مدت تور
|
|
</label>
|
|
|
|
<input
|
|
type="number"
|
|
class="form-control"
|
|
name="duration"
|
|
placeholder="مدت تور را وارد کنید"
|
|
value="{{ old('duration', $tour->duration) }}"
|
|
>
|
|
|
|
@error('duration')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- وضعیت تور --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
وضعیت تور
|
|
</label>
|
|
|
|
<select
|
|
class="form-control"
|
|
name="status"
|
|
>
|
|
|
|
<option value="">
|
|
وضعیت تور را انتخاب کنید
|
|
</option>
|
|
|
|
<option
|
|
value="{{ \App\Enums\TourStatus::ENABLE->value }}"
|
|
@selected(
|
|
old(
|
|
'status',
|
|
$tour->status
|
|
) == \App\Enums\TourStatus::ENABLE->value
|
|
)
|
|
>
|
|
فعال
|
|
</option>
|
|
|
|
<option
|
|
value="{{ \App\Enums\TourStatus::DISABLE->value }}"
|
|
@selected(
|
|
old(
|
|
'status',
|
|
$tour->status
|
|
) == \App\Enums\TourStatus::DISABLE->value
|
|
)
|
|
>
|
|
غیرفعال
|
|
</option>
|
|
|
|
</select>
|
|
|
|
@error('status')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- قیمت تور --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
قیمت
|
|
</label>
|
|
|
|
<input
|
|
type="number"
|
|
class="form-control"
|
|
name="price"
|
|
placeholder="قیمت تور را وارد کنید"
|
|
value="{{ old('price', $tour->price) }}"
|
|
>
|
|
|
|
@error('price')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- توضیحات کوتاه --}}
|
|
<div class="col-xl-12">
|
|
|
|
<label class="form-label">
|
|
خلاصه تور
|
|
</label>
|
|
|
|
<textarea
|
|
class="form-control"
|
|
name="summary"
|
|
rows="4"
|
|
placeholder="خلاصه تور را وارد کنید"
|
|
>{{ old('summary', $tour->summary) }}</textarea>
|
|
|
|
@error('summary')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- توضیحات کامل --}}
|
|
<div class="col-xl-12">
|
|
|
|
<label class="form-label">
|
|
توضیحات تور
|
|
</label>
|
|
|
|
<textarea
|
|
class="form-control"
|
|
name="descriptions"
|
|
rows="5"
|
|
placeholder="توضیحات تور را وارد کنید"
|
|
>{{ old('descriptions', $tour->descriptions) }}</textarea>
|
|
|
|
@error('descriptions')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- تاریخ شروع --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
تاریخ شروع تور
|
|
</label>
|
|
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="start_date_jalali"
|
|
id="start_date_jalali"
|
|
data-jdp
|
|
data-jdp-target-value-input="#start_date_gregorian"
|
|
data-jdp-target-value-type="gregorian"
|
|
autocomplete="off"
|
|
placeholder="مثلاً 1405/06/01"
|
|
value="{{ old(
|
|
'start_date_jalali',
|
|
$tourDate?->start_date
|
|
? verta($tourDate->start_date)->format('Y/m/d')
|
|
: ''
|
|
) }}"
|
|
>
|
|
|
|
<input
|
|
type="hidden"
|
|
name="start_date"
|
|
id="start_date_gregorian"
|
|
value="{{ old(
|
|
'start_date',
|
|
$tourDate?->start_date
|
|
? $tourDate->start_date->format('Y-m-d')
|
|
: ''
|
|
) }}"
|
|
>
|
|
|
|
@error('start_date')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- تاریخ پایان --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
تاریخ پایان تور
|
|
</label>
|
|
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
name="end_date_jalali"
|
|
id="end_date_jalali"
|
|
data-jdp
|
|
data-jdp-target-value-input="#end_date_gregorian"
|
|
data-jdp-target-value-type="gregorian"
|
|
autocomplete="off"
|
|
placeholder="مثلاً 1405/06/10"
|
|
value="{{ old(
|
|
'end_date_jalali',
|
|
$tourDate?->end_date
|
|
? verta($tourDate->end_date)->format('Y/m/d')
|
|
: ''
|
|
) }}"
|
|
>
|
|
|
|
<input
|
|
type="hidden"
|
|
name="end_date"
|
|
id="end_date_gregorian"
|
|
value="{{ old(
|
|
'end_date',
|
|
$tourDate?->end_date
|
|
? $tourDate->end_date->format('Y-m-d')
|
|
: ''
|
|
) }}"
|
|
>
|
|
|
|
@error('end_date')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- قیمت تاریخ تور --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
قیمت تاریخ تور
|
|
</label>
|
|
|
|
<input
|
|
type="number"
|
|
class="form-control"
|
|
name="tour_date_price"
|
|
placeholder="قیمت را وارد کنید"
|
|
value="{{ old(
|
|
'tour_date_price',
|
|
$tourDate?->price
|
|
) }}"
|
|
>
|
|
|
|
@error('tour_date_price')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- ظرفیت --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
ظرفیت
|
|
</label>
|
|
|
|
<input
|
|
type="number"
|
|
class="form-control"
|
|
name="capacity"
|
|
placeholder="ظرفیت را وارد کنید"
|
|
value="{{ old(
|
|
'capacity',
|
|
$tourDate?->capacity
|
|
) }}"
|
|
>
|
|
|
|
@error('capacity')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- وضعیت تاریخ تور --}}
|
|
<div class="col-xl-6">
|
|
|
|
<label class="form-label">
|
|
وضعیت تاریخ تور
|
|
</label>
|
|
|
|
<select
|
|
class="form-control"
|
|
name="tour_date_status"
|
|
>
|
|
|
|
<option value="">
|
|
وضعیت تاریخ تور را انتخاب کنید
|
|
</option>
|
|
|
|
<option
|
|
value="{{ \App\Enums\TourDateStatus::ENABLE->value }}"
|
|
@selected(
|
|
old(
|
|
'tour_date_status',
|
|
$tourDate?->status?->value
|
|
) == \App\Enums\TourDateStatus::ENABLE->value
|
|
)
|
|
>
|
|
فعال
|
|
</option>
|
|
|
|
<option
|
|
value="{{ \App\Enums\TourDateStatus::DISABLE->value }}"
|
|
@selected(
|
|
old(
|
|
'tour_date_status',
|
|
$tourDate?->status?->value
|
|
) == \App\Enums\TourDateStatus::DISABLE->value
|
|
)
|
|
>
|
|
غیرفعال
|
|
</option>
|
|
|
|
</select>
|
|
|
|
@error('tour_date_status')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
{{-- تصویر تور --}}
|
|
<div class="col-xl-12">
|
|
|
|
<label class="form-label">
|
|
تصویر تور
|
|
</label>
|
|
|
|
<div class="d-flex align-items-center gap-3">
|
|
|
|
|
|
{{-- تصویر فعلی --}}
|
|
<div
|
|
style="
|
|
width:150px;
|
|
height:150px;
|
|
"
|
|
>
|
|
|
|
<img
|
|
id="tourImagePreview"
|
|
src="{{ $tour->file?->path
|
|
? asset('storage/' . $tour->file->path)
|
|
: asset('assets/img/flight/01.jpg')
|
|
}}"
|
|
alt="{{ $tour->title }}"
|
|
class="w-100 h-100 rounded"
|
|
style="object-fit:cover;"
|
|
>
|
|
|
|
</div>
|
|
|
|
|
|
{{-- انتخاب عکس جدید --}}
|
|
<label
|
|
for="imageInput"
|
|
style="
|
|
cursor:pointer;
|
|
width:150px;
|
|
height:150px;
|
|
display:flex;
|
|
justify-content:center;
|
|
align-items:center;
|
|
border:2px dashed #ccc;
|
|
border-radius:8px;
|
|
text-align:center;
|
|
"
|
|
>
|
|
|
|
<div>
|
|
|
|
📷
|
|
<br>
|
|
|
|
<strong>
|
|
تغییر تصویر
|
|
</strong>
|
|
|
|
<br>
|
|
|
|
<small style="color:#999;">
|
|
JPG / PNG / JPEG / WEBP
|
|
</small>
|
|
|
|
</div>
|
|
|
|
</label>
|
|
|
|
|
|
<input
|
|
id="imageInput"
|
|
name="image"
|
|
type="file"
|
|
accept=".jpg,.jpeg,.png,.webp"
|
|
style="display:none;"
|
|
>
|
|
|
|
</div>
|
|
|
|
@error('image')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="card-footer text-end">
|
|
|
|
<button
|
|
type="submit"
|
|
class="btn btn-primary"
|
|
>
|
|
ذخیره تغییرات
|
|
</button>
|
|
|
|
<a
|
|
href="{{ route('admin.tours.index') }}"
|
|
class="btn btn-light"
|
|
>
|
|
انصراف
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
@push('js')
|
|
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.css"
|
|
>
|
|
|
|
<script
|
|
src="https://unpkg.com/@majidh1/jalalidatepicker/dist/jalalidatepicker.min.js">
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
|
jalaliDatepicker.startWatch({
|
|
date: true,
|
|
time: false,
|
|
hasSecond: false,
|
|
targetValueInput: 'attr',
|
|
targetValueType: 'attr'
|
|
});
|
|
|
|
|
|
// پیشنمایش عکس جدید
|
|
document
|
|
.getElementById('imageInput')
|
|
.addEventListener('change', function (event) {
|
|
|
|
const file = event.target.files[0];
|
|
|
|
if (!file) {
|
|
return;
|
|
}
|
|
|
|
const preview =
|
|
document.getElementById('tourImagePreview');
|
|
|
|
const reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
preview.src = e.target.result;
|
|
};
|
|
|
|
reader.readAsDataURL(file);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endpush
|
|
|
|
@endsection
|