saved jobs

This commit is contained in:
Doar Mihai
2026-05-01 02:58:06 +03:00
parent 75388cfb95
commit 17097c3bb1
7 changed files with 133 additions and 14 deletions
+36
View File
@@ -0,0 +1,36 @@
@extends('layouts.app')
@section('title', 'My Bookmarks - JobifyGarden')
@section('description', 'Your saved job listings on JobifyGarden.')
@section('canonical', route('bookmarks'))
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900">My Bookmarks</h1>
<p class="text-gray-600 mt-1">{{ $jobs->total() }} saved {{ Str::plural('job', $jobs->total()) }}</p>
</div>
@if($jobs->isEmpty())
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-12 text-center">
<svg class="w-12 h-12 text-gray-300 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-4.5L5 21V5z"/>
</svg>
<p class="text-gray-500 text-lg mb-4">No bookmarks yet.</p>
<a href="{{ route('jobs.index') }}" class="inline-flex items-center px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-white text-sm font-medium rounded-md">
Browse Jobs
</a>
</div>
@else
<div class="grid grid-cols-1 gap-4">
@foreach($jobs as $job)
<x-job-card :job="$job" />
@endforeach
</div>
<div class="mt-8">
{{ $jobs->links() }}
</div>
@endif
</div>
@endsection
+21
View File
@@ -181,6 +181,27 @@
</svg>
</a>
<p class="text-xs text-gray-500 text-center mt-3">You will be redirected to the company's application page</p>
@auth
<form method="POST" action="{{ route('jobs.bookmark', $job) }}" class="mt-3"
x-data="{ saved: {{ auth()->user()->savedJobs()->where('job_id', $job->id)->exists() ? 'true' : 'false' }} }">
@csrf
<button type="submit" @click="saved = !saved"
class="flex items-center justify-center w-full px-6 py-3 border rounded-lg font-semibold transition-colors duration-200"
:class="saved ? 'border-emerald-600 text-emerald-600 bg-emerald-50 hover:bg-emerald-100' : 'border-gray-300 text-gray-700 hover:border-emerald-400 hover:text-emerald-600'">
<svg class="w-5 h-5 mr-2" :fill="saved ? 'currentColor' : 'none'" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-4.5L5 21V5z"/>
</svg>
<span x-text="saved ? 'Bookmarked' : 'Bookmark'"></span>
</button>
</form>
@else
<a href="{{ route('login') }}" class="flex items-center justify-center w-full mt-3 px-6 py-3 border border-gray-300 text-gray-500 rounded-lg text-sm hover:border-emerald-400 hover:text-emerald-600 transition-colors duration-200">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-4.5L5 21V5z"/>
</svg>
Log in to bookmark
</a>
@endauth
</div>
<!-- Share -->