fix: update account favorites view
This commit is contained in:
@@ -1,3 +1,53 @@
|
||||
<div>
|
||||
<!-- Very little is needed to make a happy life. - Marcus Aurelius -->
|
||||
</div>
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container py-4">
|
||||
<h1 class="mb-4">علاقهمندیهای من</h1>
|
||||
|
||||
@if($favorites->count())
|
||||
<div class="row g-3">
|
||||
@foreach($favorites as $favorite)
|
||||
@php $item = $favorite->favoritable; @endphp
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
@if($favorite->favoritable_type === \App\Models\Tour::class)
|
||||
<h5 class="card-title">{{ $item?->title ?? 'تور' }}</h5>
|
||||
<p class="card-text">
|
||||
{{ $item?->summary ?? '' }}
|
||||
</p>
|
||||
@elseif($favorite->favoritable_type === \App\Models\Flight::class)
|
||||
<h5 class="card-title">
|
||||
{{ $item?->origin ?? '-' }} → {{ $item?->destination ?? '-' }}
|
||||
</h5>
|
||||
@else
|
||||
<h5 class="card-title">مورد ناشناخته</h5>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="card-footer bg-transparent border-0 d-flex justify-content-between">
|
||||
<a href="{{route('tours.index')}}" class="btn btn-sm btn-primary">مشاهده</a>
|
||||
|
||||
<form action="{{ route('favorites.toggle') }}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="favoritable_type" value="{{ $favorite->favoritable_type }}">
|
||||
<input type="hidden" name="favoritable_id" value="{{ $favorite->favoritable_id }}">
|
||||
<button class="btn btn-sm btn-danger">حذف</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
{{ $favorites->links() }}
|
||||
</div>
|
||||
@else
|
||||
<div class="alert alert-info">
|
||||
هنوز هیچ موردی به علاقهمندیها اضافه نکردهاید.
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user