Files
airline-agency/resources/views/account/favorite-list.blade.php
T

160 lines
9.5 KiB
PHP

@extends('account.layouts.app')
@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
@if (session('error'))
<div class="col-lg-12 mb-3">
<div class="alert alert-danger">
{{ session('error') }}
</div>
</div>
@endif
<div class="col-lg-12">
<div class="user-profile-card">
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="user-profile-card-title mb-0">
<i class="far fa-heart text-danger me-1"></i>
علاقه‌مندی‌های من
</h4>
<span class="badge bg-primary">
{{ method_exists($favorites, 'total') ? $favorites->total() : $favorites->count() }} مورد
</span>
</div>
<div class="row mt-30">
@forelse($favorites as $favorite)
@if($favorite->tour)
<div class="col-md-6 col-lg-4 mb-4">
<div class="hotel-item h-100 d-flex flex-column justify-content-between">
<div class="hotel-img position-relative">
<span class="badge bg-info position-absolute top-0 start-0 m-2">تور</span>
<img src="{{ $favorite->tour->file ? asset($favorite->tour->file->path) : asset('assets/img/tour/default.jpg') }}"
alt="{{ $favorite->tour->title }}"
style="height: 200px; width: 100%; object-fit: cover;">
<form method="POST" action="{{ route('accounts.favorites.tour.toggle', $favorite->tour->id) }}" class="d-inline">
@csrf
<button type="submit" class="add-wishlist border-0 bg-transparent" title="حذف از علاقه‌مندی">
<i class="fas fa-heart text-danger"></i>
</button>
</form>
</div>
<div class="hotel-content d-flex flex-column flex-grow-1 justify-content-between">
<div>
<h4 class="hotel-title">
<a href="{{ route('tours.show', $favorite->tour->id) }}">
{{ $favorite->tour->title }}
</a>
</h4>
<p><i class="far fa-location-dot"></i>
{{ $favorite->tour->originCity->name ?? 'مبدأ' }}
<i class="fas fa-arrow-right-long"></i>
{{ $favorite->tour->city?->name ?? 'مقصد' }}
</p>
</div>
<div class="hotel-bottom mt-3">
<div class="hotel-price">
<span class="hotel-price-amount">
{{ number_format(optional($favorite->tour->tourDepartures->first())->price ?? 0) }} تومان
</span>
</div>
<div class="hotel-text-btn">
<a href="{{ route('tours.show', $favorite->tour->id) }}">
نمایش جزئیات <i class="fas fa-arrow-left"></i>
</a>
</div>
</div>
</div>
</div>
</div>
@elseif($favorite->flight)
<div class="col-md-6 col-lg-4 mb-4">
<div class="hotel-item h-100 d-flex flex-column justify-content-between">
<div class="hotel-img position-relative">
<span class="badge bg-primary position-absolute top-0 start-0 m-2">پرواز</span>
<img src="{{ $favorite->flight->file ? asset($favorite->flight->file->path) : asset('assets/img/flight/default.jpg') }}"
alt="{{ $favorite->flight->flight_number }}"
style="height: 200px; width: 100%; object-fit: cover;">
<form method="POST" action="{{ route('accounts.favorites.flight.toggle', $favorite->flight->id) }}" class="d-inline">
@csrf
<button type="submit" class="add-wishlist border-0 bg-transparent" title="حذف از علاقه‌مندی">
<i class="fas fa-heart text-danger"></i>
</button>
</form>
</div>
<div class="hotel-content d-flex flex-column flex-grow-1 justify-content-between">
<div>
<h4 class="hotel-title">
<a href="{{ route('flights.show', $favorite->flight->id) }}">
{{ $favorite->flight->origin_airport?->city?->name ?? 'مبدأ' }} به {{ $favorite->flight->airport?->city?->name ?? 'مقصد' }}
</a>
</h4>
<p class="text-muted mb-1">
<i class="far fa-plane"></i>
{{ $favorite->flight->airline?->name }} (شماره: {{ $favorite->flight->flight_number }})
</p>
@if($favorite->flight->departure_time)
<p class="small text-muted mb-0">
<i class="far fa-calendar-alt"></i>
{{ \Hekmatinasser\Verta\Verta::instance($favorite->flight->departure_time)->format('Y/m/d - H:i') }}
</p>
@endif
</div>
<div class="hotel-bottom mt-3">
<div class="hotel-price">
<span class="hotel-price-amount">
{{ number_format($favorite->flight->price) }}
<span class="hotel-price-type">تومان</span>
</span>
</div>
<div class="hotel-text-btn">
<a href="{{ route('flights.show', $favorite->flight->id) }}">
نمایش جزئیات <i class="fas fa-arrow-left"></i>
</a>
</div>
</div>
</div>
</div>
</div>
@endif
@empty
<div class="col-12 text-center py-5">
<i class="far fa-heart-broken fa-3x text-muted mb-3"></i>
<h5>هنوز موردی به علاقه‌مندی‌هایتان اضافه نکرده‌اید.</h5>
<p class="text-muted mb-0">
تورها و پروازهای مورد علاقه خود را ذخیره کنید تا در هر زمان به راحتی به آن‌ها دسترسی داشته باشید.
</p>
</div>
@endforelse
</div>
@if (method_exists($favorites, 'hasPages') && $favorites->hasPages())
<div class="pagination-area my-4">
<div class="d-flex justify-content-center">
{{ $favorites->links() }}
</div>
</div>
@endif
</div>
</div>
</div>
@endsection