fix(admin): resolve issues on tour edit page

This commit is contained in:
2026-08-22 10:30:01 +03:30
parent 183b2d93d1
commit 16585c0de0
4 changed files with 23 additions and 23 deletions
@@ -314,7 +314,7 @@ class TourController extends Controller
->with('success', 'تور با موفقیت به سطل زباله منتقل شد.');
}
public function restore( $id)
public function restore($id)
{
$tour = Tour::onlyTrashed()->findOrFail($id);
@@ -2,9 +2,9 @@
namespace App\Http\Requests\Admin\Tour;
use App\Enums\Flight\TourType;
use App\Enums\Tour\TourMode;
use App\Enums\Tour\TourScope;
use App\Enums\Tour\TourType;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
@@ -2,9 +2,9 @@
namespace App\Http\Requests\Admin\Tour;
use App\Enums\Flight\TourType;
use App\Enums\Tour\TourMode;
use App\Enums\Tour\TourScope;
use App\Enums\Tour\TourType;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
+20 -20
View File
@@ -56,7 +56,7 @@
<option value="">یک مورد را انتخاب کنید</option>
@foreach(\App\Enums\Tour\TourScope::cases() as $scope)
<option value="{{ $scope->value }}"
{{ old('tour_scope', $tour->tour_scope?->value) == $scope->value ? 'selected' : '' }}>
{{ old('tour_scope', $tour->tour_scope?->value) == $scope->value ? 'selected' : '' }}>
{{ $scope->label() }}
</option>
@endforeach
@@ -68,12 +68,12 @@
<div class="col-xl-6">
<label class="form-label">نوع حمل و نقل / سفر <span
class="text-danger">*</span></label>
class="text-danger">*</span></label>
<select class="form-control" name="tour_mode">
<option value="">یک مورد را انتخاب کنید</option>
@foreach(\App\Enums\Tour\TourMode::cases() as $mode)
<option value="{{ $mode->value }}"
{{ old('tour_mode', $tour->tour_mode?->value) == $mode->value ? 'selected' : '' }}>
{{ old('tour_mode', $tour->tour_mode?->value) == $mode->value ? 'selected' : '' }}>
{{ $mode->label() }}
</option>
@endforeach
@@ -87,9 +87,9 @@
<label class="form-label">سبک تور <span class="text-danger">*</span></label>
<select class="form-control" name="tour_type">
<option value="">یک مورد را انتخاب کنید</option>
@foreach(\App\Enums\Flight\TourType::cases() as $type)
@foreach(\App\Enums\Tour\TourType::cases() as $type)
<option value="{{ $type->value }}"
{{ old('tour_type', $tour->tour_type?->value) == $type->value ? 'selected' : '' }}>
{{ old('tour_type', $tour->tour_type?->value) == $type->value ? 'selected' : '' }}>
{{ $type->label() }}
</option>
@endforeach
@@ -105,7 +105,7 @@
<option value="">شهر مبدا را انتخاب کنید</option>
@foreach($cities as $city)
<option value="{{ $city->id }}"
{{ old('origin_city_id', $tour->origin_city_id) == $city->id ? 'selected' : '' }}>
{{ old('origin_city_id', $tour->origin_city_id) == $city->id ? 'selected' : '' }}>
{{ $city->name }}
</option>
@endforeach
@@ -119,11 +119,11 @@
style="{{ $tour->tour_scope === \App\Enums\Tour\TourScope::INTERNATIONAL ? '' : 'display:none;' }}">
<label class="form-label">کشور مقصد</label>
<select class="form-control" id="country_id"
{{ $tour->tour_scope === \App\Enums\Tour\TourScope::INTERNATIONAL ? '' : 'disabled' }}>
{{ $tour->tour_scope === \App\Enums\Tour\TourScope::INTERNATIONAL ? '' : 'disabled' }}>
<option value="">یک مورد را انتخاب کنید</option>
@foreach($countries as $country)
<option value="{{ $country->id }}"
{{ $selectedCountryId == $country->id ? 'selected' : '' }}>
{{ $selectedCountryId == $country->id ? 'selected' : '' }}>
{{ $country->name }}
</option>
@endforeach
@@ -136,7 +136,7 @@
<option value="">شهر مقصد را انتخاب کنید</option>
@foreach($destinationCities as $city)
<option value="{{ $city->id }}"
{{ old('destination_city_id', $tour->destination_city_id) == $city->id ? 'selected' : '' }}>
{{ old('destination_city_id', $tour->destination_city_id) == $city->id ? 'selected' : '' }}>
{{ $city->name }}
</option>
@endforeach
@@ -172,11 +172,11 @@
<label class="form-label">تاریخ رفت (شروع)</label>
<input
type="text"
id="startDateInput"
class="form-control"
name="start_date"
value="{{ old(
type="text"
id="startDateInput"
class="form-control"
name="start_date"
value="{{ old(
'start_date',$departure?->start_date ? Verta::instance($departure->start_date)->format('Y/m/d H:i') : '' ) }}">
@error('start_date')
<span class="text-danger small">{{ $message }}</span>
@@ -187,11 +187,11 @@
<label class="form-label">تاریخ برگشت (پایان)</label>
<input
type="text"
id="endDateInput"
class="form-control"
name="end_date"
value="{{ old('end_date',$departure?->end_date ? Verta::instance($departure->end_date)->format('Y/m/d H:i') : '') }}">
type="text"
id="endDateInput"
class="form-control"
name="end_date"
value="{{ old('end_date',$departure?->end_date ? Verta::instance($departure->end_date)->format('Y/m/d H:i') : '') }}">
@error('end_date')
<span class="text-danger small">{{ $message }}</span>
@enderror
@@ -227,7 +227,7 @@
alt="{{ $tour->title }}">
@if($image->is_default)
<span
class="badge bg-primary position-absolute top-0 start-0 m-1">اصلی</span>
class="badge bg-primary position-absolute top-0 start-0 m-1">اصلی</span>
@endif
</div>
@empty