git commit "fix user panel pages hero layout and add profile dropdown improvements"

This commit is contained in:
2026-08-17 16:34:14 +03:30
parent ea1a0cc0c4
commit 523c9d0396
21 changed files with 583 additions and 1356 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ class CityController extends Controller
{
public function byProvince(int $province)
{
$cities = City::where('provinces', $province)
$cities = City::where('provinces_id', $province)
->orderBy('name')
->get(['id', 'name']);
->get();
return response()->json($cities);
}
+4 -2
View File
@@ -16,8 +16,10 @@ class CommentController extends Controller
->latest()
->paginate(4);
return view('account.users.comments.index',compact('comments'));
return view('account.users.comments.index', [
'comments' => $comments,
'withoutHero' => true
]);
}
public function store(CommentStoreRequest $request)
+5 -4
View File
@@ -14,10 +14,11 @@ class FavoriteController extends Controller
->latest()
->get();
return view('account.users.favorite.index', compact('favorites'));
}
public function store(Request $request)
return view('account.users.favorite.index', [
'favorites' => $favorites,
'withoutHero' => true
]);
} public function store(Request $request)
{
Favorite::firstOrCreate([
'user_id' => auth()->id(),
+25 -9
View File
@@ -3,23 +3,39 @@
namespace App\Http\Controllers;
use App\Models\Flight;
use App\Models\Tour;
use Illuminate\Http\Request;
class FlightController extends Controller
{
public function index()
public function index(Request $request)
{
$newestFlight = Flight::
latest()
->applySearch()
->take(10)
$flights = Flight::latest()
->applySearch($request->all())
->paginate(10);
$newestFlight = Flight::latest()
->take(3)
->get();
$flights = Flight::latest()->
paginate(9);
return view('home.index', compact('newestFlight', 'flights'));
$newestTour = Tour::latest()
->take(3)
->get();
$tours = Tour::latest()
->paginate(10);
return view('flights.index', compact(
'flights',
'newestFlight',
'newestTour',
'tours'
));
}
public function show(Flight $flight)
{
$flight->increment('views');
+5 -6
View File
@@ -11,13 +11,12 @@ class HomeController extends Controller
public function index()
{
$newestFlight = Flight::
where('departure_date', '>=', now())
->orderBy('departure_date', 'asc')
->take(3)
->get();
orderBy('created_at', 'desc')
->paginate(1);
$newestTour = Tour::latest()
->take(10)
->get();
->paginate(2);
$flights = Flight::latest()
->paginate(5);
+1 -1
View File
@@ -53,7 +53,7 @@ class ProfileController extends Controller
$user->update($inputs);
return back()->with([
'success','اطلاعات کاربر با موفقیت ویرایش شد.'
'success'=>'اطلاعات کاربر با موفقیت ویرایش شد.'
]);
}
+2 -3
View File
@@ -10,12 +10,11 @@ class TourController extends Controller
{
$newestTour = Tour::with('travelType')
->latest()
->take(10)
->get();
->paginate(3);
$tours = Tour::with('travelType')
->latest()
->paginate(5);
->paginate(2);
return view('tours.index', compact('newestTour', 'tours'));
}
+2 -2
View File
@@ -104,12 +104,12 @@ class ProfileUpdateRequest extends FormRequest
'password' => [
'required',
'nullable',
'confirmed',
'min:8'
],
'current_password' => [
'required_with:new_password',
'nullable:new_password',
'current_password:web',
],
+1 -1
View File
@@ -43,6 +43,6 @@ class City extends Model
}
public function province()
{
return $this->hasMany(Province::class);
return $this->belongsTo(Province::class);
}
}
+1 -6
View File
@@ -84,14 +84,9 @@ class Flight extends Model
->when($filters['origin'] ?? null, function($query,$origin){
$query->where('origin',$origin);
})
->when($filters['destination'] ?? null, function($query,$destination){
$query->where('destination',$destination);
})
->when($filters['departure_date'] ?? null, function ($query, $date) {
$query->whereDate('departure_date', $date);
})
->when($filters['passengers'] ?? null, function ($query, $passengers) {
$query->where('capacity', '>=', $passengers);
});
}
}
+5
View File
@@ -3,6 +3,7 @@
namespace App\Providers;
use App\Models\Province;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@@ -26,6 +27,10 @@ class AppServiceProvider extends ServiceProvider
$view->with('provinces', $provinces);
Paginator::useTailwind();
Paginator::useBootstrapFive();
});
}
View File
@@ -1,105 +1,65 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading">
پنل کاربری
</div>
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
<li>
<a href="{{ route('users.dashboard') }}">
داشبورد
</a>
</li>
<li>
<a href="{{route('users.profile.edit')}}">
ویرایش پروفایل
</a>
</li>
<li>
<a href="{{route('users.favorite.index')}}">
علاقه‌مندی‌ها
</a>
</li>
<li>
<a href="#">
نظرات من
</a>
</li>
<li>
<a href="{{ route('auth.logout.index') }}">
خروج
</a>
</li>
</ul>
</div>
</div>
</div>
@extends('account.layout.app')
<div class="col-md-9">
@section('account-content')
<div class="panel panel-default">
<div class="panel-heading">
داشبورد
</div>
<div class="profile-box">
<div class="panel-body">
<h3>
سلام {{ $user->first_name }} {{ $user->last_name }} 👋
<h3 class="fw-bold">
سلام {{auth()->user()->name}} 👋
</h3>
<p>
به پنل کاربری خود خوش آمدید.
<p class="text-muted">
از اینجا می‌توانید تورها، پروازها و نظرات خود را مدیریت کنید.
</p>
<hr>
<p>
<strong>نام کاربری:</strong>
{{ $user->username }}
</p>
<div class="row mt-4">
<p>
<strong>ایمیل:</strong>
{{ $user->email }}
</p>
<p>
<strong>موبایل:</strong>
{{ $user->mobile }}
</p>
<div class="col-md-4">
<div class="card border-0 shadow-sm rounded-4 p-3">
<h5>
❤️ علاقه مندی
</h5>
<strong>
{{ auth()->user()->favorites()->count() }}
</strong>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card border-0 shadow-sm rounded-4 p-3">
<h5>
💬 نظرات
</h5>
<strong>
{{ auth()->user()->comments()->count() }}
</strong>
</div>
</div>
</div>
</div>
@endsection
@@ -716,7 +716,7 @@
.append('<option value="">در حال دریافت شهرها...</option>');
$.ajax({
url: "{{ route('users.cities.by.province', ':province') }}"
url: "{{ route('users.cities.province', ':province') }}"
.replace(':province', provinceId),
type: 'GET',
@@ -1,5 +1,21 @@
<div class="col-md-4">
<div class="card border-0 shadow-sm rounded-4 overflow-hidden h-100">
<form action="{{ route('users.favorite.store') }}" method="POST">
@csrf
<input type="hidden" name="id" value="{{ $flight->id }}">
<input type="hidden"
name="type"
value="App\Models\Flight">
<button class="btn btn-outline-danger">
❤️ افزودن به علاقه‌مندی
</button>
</form>
<div class="flight-image">
+62
View File
@@ -0,0 +1,62 @@
@extends('layouts.app')
@section('content')
<div class="container py-5">
<h2 class="mb-4">
آرشیو پروازها
</h2>
<div class="row">
@foreach($flights as $flight)
<div class="col-md-4 mb-4">
<div class="card shadow-sm">
<img src="{{ asset($flight->image) }}"
class="card-img-top"
height="200">
<div class="card-body">
<h5>
{{ $flight->airline }}
</h5>
<p>
{{ $flight->origin }}
-
{{ $flight->destination }}
</p>
<strong>
{{ number_format($flight->price) }}
تومان
</strong>
</div>
</div>
</div>
@endforeach
</div>
<br>
<br>
<div class="mt-4">
{{ $flights->links() }}
</div>
</div>
@endsection
+13 -2
View File
@@ -17,8 +17,20 @@
</div>
</div>
</section>
<a href="{{ route('flights') }}"
class="btn btn-primary">
مشاهده همه پروازها
</a>
<a href="{{ route('tours.index') }}"
class="btn btn-primary">
مشاهده همه تورها
</a>
</section>
<br><br><br>
<section class="container my-5">
<h3 class="fw-bold mb-4">همه پروازها و تورها</h3>
@@ -34,7 +46,6 @@
@endforeach
</div>
<div class="mt-4">
{{ $flights->links() }}
</div>
File diff suppressed because it is too large Load Diff
+14 -110
View File
@@ -62,133 +62,37 @@
</div>
<form action="{{ route('users.favorite.index') }}" method="GET">
<form action="{{ route('flights') }}" method="GET">
<select name="origin">
<option value="">مبدا</option>
<div class="flight-fields">
{{-- مبدا --}}
<div class="flight-field">
<label for="origin">
مبدا
</label>
<select id="origin_province">
<option value="">استان مبدا</option>
@foreach($provinces as $province)
<option value="{{ $province->id }}">
{{ $province->name }}
@foreach($flights as $flight)
<option value="{{ $flight->origin }}">
{{ $flight->origin }}
</option>
@endforeach
</select>
<select name="origin" id="origin_city">
<option value="">شهر مبدا</option>
</select>
</div>
<select name="destination">
<option value="">مقصد</option>
{{-- مقصد --}}
<div class="flight-field">
<label for="destination">
مقصد
</label>
<select id="destination_province">
<option value="">استان مقصد</option>
@foreach($provinces as $province)
<option value="{{ $province->id }}">
{{ $province->name }}
@foreach($flights as $flight)
<option value="{{ $flight->destination }}">
{{ $flight->destination }}
</option>
@endforeach
</select>
<select name="destination" id="destination_city">
<option value="">شهر مقصد</option>
</select>
</div>
{{-- تاریخ رفت --}}
<div class="flight-field">
<label for="departure_date">
تاریخ رفت
</label>
<input
type="date"
name="departure_date"
id="departure_date"
>
</div>
{{-- تاریخ برگشت --}}
<div class="flight-field">
<label for="return_date">
تاریخ برگشت
</label>
<input
type="date"
name="return_date"
id="return_date"
>
</div>
{{-- تعداد مسافر --}}
<div class="flight-field">
<label for="passengers">
تعداد مسافر
</label>
<select
name="passengers"
id="passengers"
>
@for($i = 1; $i <= 9; $i++)
<option value="{{ $i }}">
{{ $i }} مسافر
</option>
@endfor
</select>
</div>
{{-- جستجو --}}
<div class="flight-button-wrapper">
<button
type="submit"
class="flight-search-button"
>
🔍
جستجوی پرواز
<button type="submit">
جستجو
</button>
</div>
</div>
</form>
</div>
</div>
+43 -45
View File
@@ -1,67 +1,65 @@
@extends('layouts.app')
@section('content')
<div class="container py-5">
<h2 class="mb-4">
آرشیو تورها
</h2>
<div class="row">
@foreach($tours as $tour)
<div class="swiper-slide tour-card group">
<div class="col-md-4 mb-4">
<a href="{{ route('tours.show', $tour->id) }}" class="tour-card_image-link">
<img
class="tour-card_img"
src="{{ asset($tour->image) }}" alt="{{ $tour->title }}" >
</a>
<div class="card shadow-sm">
<img src="{{ asset($tour->image) }}"
class="card-img-top"
height="200">
<div class="tour-card_content">
<div class="card-body">
<a href="{{ route('tours.show', $tour->id) }}"
class="tour-card_title">
<h5>
{{ $tour->title }}
</a>
</h5>
<div class="tour-card_destination">
<span>📍</span>
{{ Str::limit($tour->summary, 60) }}
</div>
<p>
{{ $tour->summary }}
</p>
<div class="tour-card_details">
<div class="tour-detail-item">
<span>تاریخ حرکت</span>
<strong>
{{ \Carbon\Carbon::parse($tour->departure_date)->format('Y/m/d') }}
</strong>
</div>
<div class="tour-detail-item">
<span>نوع سفر</span>
<strong>
{{ $tour->travelType->name ?? '---' }}
</strong>
</div>
</div>
<div class="tour-card_price">
<span>شروع قیمت از</span>
<strong>
{{ number_format($tour->price) }}
<small>تومان</small>
تومان
</strong>
</div>
<a href="{{ route('tours.show', $tour->id) }}"
class="tour-card_btn">
مشاهده تور
</a>
</div>
</div>
@endforeach
</div>
<br>
<br>
<div class="mt-4">
{{ $tours->links() }}
</div>
</div>
@endsection