fix: update public tour functionality

This commit is contained in:
2026-08-20 08:20:29 +03:30
parent 99e7d4ee95
commit 854324813e
3 changed files with 617 additions and 33 deletions
+77 -1
View File
@@ -3,11 +3,65 @@
@section('title', 'لیست تورها')
@section('content')
{{-- استایل دکمه علاقهمندی (مناسب برای کارتها) --}}
<style>
.travel-favorite-form {
position: absolute;
top: 10px;
left: 10px;
z-index: 3;
margin: 0;
}
.travel-favorite-btn {
width: 42px;
height: 42px;
border-radius: 50%;
border: 1px solid #e0245e;
background: rgba(255, 255, 255, .95);
color: #e0245e;
display: inline-flex;
align-items: center;
justify-content: center;
text-decoration: none;
transition: all .2s ease;
}
.travel-favorite-btn:hover,
.travel-favorite-btn.active {
background: #e0245e;
color: #fff;
}
</style>
<h1>تورهای ما</h1>
<div class="row">
@forelse($tours as $tour)
<div class="col-md-4">
@php
$isFavTour = in_array($tour->id, $favoriteTourIds ?? []);
@endphp
<div class="col-md-4 position-relative">
<x-tour :tour="$tour"/>
{{-- دکمه علاقهمندی --}}
@auth
<form action="{{ route('favorites.toggle') }}" method="POST" class="travel-favorite-form">
@csrf
<input type="hidden" name="favoritable_type" value="{{ \App\Models\Tour::class }}">
<input type="hidden" name="favoritable_id" value="{{ $tour->id }}">
<button type="submit" class="travel-favorite-btn {{ $isFavTour ? 'active' : '' }}">
<i class="fa {{ $isFavTour ? 'fa-heart' : 'far fa-heart' }}"></i>
</button>
</form>
@else
<a href="{{ route('login') }}" class="travel-favorite-btn">
<i class="far fa-heart"></i>
</a>
@endauth
</div>
@empty
<p>تور فعالی یافت نشد.</p>
@@ -15,4 +69,26 @@
</div>
{{ $tours->links() }}
@endsection
{{--@extends('layouts.app')--}}
{{--@section('title', 'لیست تورها')--}}
{{--@section('content')--}}
{{-- <h1>تورهای ما</h1>--}}
{{-- <div class="row">--}}
{{-- @forelse($tours as $tour)--}}
{{-- <div class="col-md-4">--}}
{{-- <x-tour :tour="$tour"/>--}}
{{-- </div>--}}
{{-- @empty--}}
{{-- <p>تور فعالی یافت نشد.</p>--}}
{{-- @endforelse--}}
{{-- </div>--}}
{{-- {{ $tours->links() }}--}}
{{--@endsection--}}