first commit

This commit is contained in:
Doar Mihai
2026-04-28 16:10:27 +03:00
commit b73f568d90
107 changed files with 18067 additions and 0 deletions
+129
View File
@@ -0,0 +1,129 @@
@extends('layouts.app')
@section('title', 'Login')
@section('content')
<div class="min-h-screen bg-gradient-to-br from-indigo-100 via-purple-50 to-pink-100 flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full">
<div class="bg-white rounded-2xl shadow-2xl overflow-hidden">
<!-- Header -->
<div class="bg-gradient-to-r from-indigo-600 to-purple-600 px-8 py-6">
<h2 class="text-3xl font-bold text-white text-center">Welcome Back</h2>
<p class="mt-2 text-center text-indigo-100">Sign in to your account</p>
</div>
<!-- Form -->
<div class="px-8 py-8">
<form method="POST" action="{{ route('login') }}" class="space-y-6">
@csrf
<!-- Email -->
<div>
<label for="email" class="block text-sm font-semibold text-gray-700 mb-2">Email Address</label>
<input
id="email"
name="email"
type="email"
autocomplete="email"
required
value="{{ old('email') }}"
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 @error('email') border-red-500 @enderror"
placeholder="you@example.com"
>
@error('email')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Password -->
<div>
<label for="password" class="block text-sm font-semibold text-gray-700 mb-2">Password</label>
<input
id="password"
name="password"
type="password"
autocomplete="current-password"
required
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 @error('password') border-red-500 @enderror"
placeholder="Enter your password"
>
@error('password')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Remember Me & Forgot Password -->
<div class="flex items-center justify-between">
<div class="flex items-center">
<input
id="remember"
name="remember"
type="checkbox"
class="h-4 w-4 text-purple-600 focus:ring-purple-500 border-gray-300 rounded"
{{ old('remember') ? 'checked' : '' }}
>
<label for="remember" class="ml-2 block text-sm text-gray-700">
Remember me
</label>
</div>
<div class="text-sm">
<a href="#" class="font-medium text-purple-600 hover:text-purple-500 transition-colors duration-200">
Forgot password?
</a>
</div>
</div>
<!-- Error Messages -->
@if ($errors->any())
<div class="bg-red-50 border-l-4 border-red-500 rounded-lg p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<p class="text-sm text-red-700 font-medium">{{ $errors->first() }}</p>
</div>
</div>
</div>
@endif
<!-- Submit Button -->
<div>
<button
type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-xl shadow-lg text-sm font-semibold text-white bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-700 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition-all duration-200 transform hover:-translate-y-0.5"
>
Sign In
</button>
</div>
</form>
<!-- Divider -->
<div class="mt-6">
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-white text-gray-500">Don't have an account?</span>
</div>
</div>
</div>
<!-- Register Link -->
<div class="mt-6 text-center">
<a
href="{{ route('register') }}"
class="inline-flex items-center px-6 py-3 border-2 border-purple-200 rounded-xl text-sm font-semibold text-purple-600 hover:bg-purple-50 hover:border-purple-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition-all duration-200"
>
Create New Account
</a>
</div>
</div>
</div>
</div>
</div>
@endsection
+157
View File
@@ -0,0 +1,157 @@
@extends('layouts.app')
@section('title', 'Register')
@section('content')
<div class="min-h-screen bg-gradient-to-br from-indigo-100 via-purple-50 to-pink-100 flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full">
<div class="bg-white rounded-2xl shadow-2xl overflow-hidden">
<!-- Header -->
<div class="bg-gradient-to-r from-purple-600 to-pink-600 px-8 py-6">
<h2 class="text-3xl font-bold text-white text-center">Create Account</h2>
<p class="mt-2 text-center text-purple-100">Join Wiki Travel today</p>
</div>
<!-- Form -->
<div class="px-8 py-8">
<form method="POST" action="{{ route('register') }}" class="space-y-6">
@csrf
<!-- Name -->
<div>
<label for="name" class="block text-sm font-semibold text-gray-700 mb-2">Full Name</label>
<input
id="name"
name="name"
type="text"
autocomplete="name"
required
value="{{ old('name') }}"
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 @error('name') border-red-500 @enderror"
placeholder="John Doe"
>
@error('name')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Email -->
<div>
<label for="email" class="block text-sm font-semibold text-gray-700 mb-2">Email Address</label>
<input
id="email"
name="email"
type="email"
autocomplete="email"
required
value="{{ old('email') }}"
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 @error('email') border-red-500 @enderror"
placeholder="you@example.com"
>
@error('email')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Password -->
<div>
<label for="password" class="block text-sm font-semibold text-gray-700 mb-2">Password</label>
<input
id="password"
name="password"
type="password"
autocomplete="new-password"
required
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 @error('password') border-red-500 @enderror"
placeholder="Min. 8 characters"
>
@error('password')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Confirm Password -->
<div>
<label for="password_confirmation" class="block text-sm font-semibold text-gray-700 mb-2">Confirm Password</label>
<input
id="password_confirmation"
name="password_confirmation"
type="password"
autocomplete="new-password"
required
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200"
placeholder="Re-enter your password"
>
</div>
<!-- Terms & Conditions -->
<div class="flex items-start">
<div class="flex items-center h-5">
<input
id="terms"
name="terms"
type="checkbox"
required
class="h-4 w-4 text-purple-600 focus:ring-purple-500 border-gray-300 rounded"
>
</div>
<div class="ml-3 text-sm">
<label for="terms" class="text-gray-700">
I agree to the <a href="#" class="font-medium text-purple-600 hover:text-purple-500">Terms and Conditions</a> and <a href="#" class="font-medium text-purple-600 hover:text-purple-500">Privacy Policy</a>
</label>
</div>
</div>
<!-- Error Messages -->
@if ($errors->any())
<div class="bg-red-50 border-l-4 border-red-500 rounded-lg p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<p class="text-sm text-red-700 font-medium">{{ $errors->first() }}</p>
</div>
</div>
</div>
@endif
<!-- Submit Button -->
<div>
<button
type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-xl shadow-lg text-sm font-semibold text-white bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition-all duration-200 transform hover:-translate-y-0.5"
>
Create Account
</button>
</div>
</form>
<!-- Divider -->
<div class="mt-6">
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-white text-gray-500">Already have an account?</span>
</div>
</div>
</div>
<!-- Login Link -->
<div class="mt-6 text-center">
<a
href="{{ route('login') }}"
class="inline-flex items-center px-6 py-3 border-2 border-purple-200 rounded-xl text-sm font-semibold text-purple-600 hover:bg-purple-50 hover:border-purple-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition-all duration-200"
>
Sign In Instead
</a>
</div>
</div>
</div>
</div>
</div>
@endsection
+397
View File
@@ -0,0 +1,397 @@
@extends('layouts.app')
@section('title', $city->name . ', ' . $city->country)
@section('content')
<!-- Hero Header -->
<div class="relative bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 text-white overflow-hidden">
@if($city->image_url)
<img src="{{ $city->image_url }}" alt="{{ $city->name }}" class="absolute inset-0 w-full h-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-40"></div>
@elseif($city->thumbnail_url)
<img src="{{ $city->thumbnail_url }}" alt="{{ $city->name }}" class="absolute inset-0 w-full h-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-40"></div>
@else
<div class="absolute inset-0 opacity-10">
<div class="absolute top-0 right-1/4 w-96 h-96 bg-white rounded-full mix-blend-overlay filter blur-3xl"></div>
</div>
@endif
<div class="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16">
<div class="flex items-center justify-between">
<div>
<h1 class="text-5xl md:text-6xl font-bold mb-3 drop-shadow-lg">{{ $city->name }}</h1>
<p class="text-2xl text-purple-100 mb-4 drop-shadow-md">{{ $city->country }}</p>
@if($city->wikipedia_url)
<a href="{{ $city->wikipedia_url }}" target="_blank" class="inline-flex items-center px-6 py-3 bg-white text-purple-600 rounded-lg font-semibold hover:bg-purple-50 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5">
<span>View on Wikipedia</span>
<svg class="w-5 h-5 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
</svg>
</a>
@endif
</div>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<!-- City Summary -->
@if($city->wikipedia_summary)
<div class="bg-gradient-to-br from-white to-gray-50 rounded-2xl shadow-xl p-8 mb-12 border border-gray-100">
<div class="flex items-center mb-6">
<div class="w-1 h-8 bg-gradient-to-b from-purple-500 to-pink-500 rounded-full mr-4"></div>
<h2 class="text-3xl font-bold text-gray-900">About {{ $city->name }}</h2>
</div>
<p class="text-gray-700 text-lg leading-relaxed">{{ $city->wikipedia_summary }}</p>
</div>
@endif
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Map -->
<div class="lg:col-span-2">
<div class="bg-white rounded-2xl shadow-xl overflow-hidden border border-gray-100">
<div class="px-6 py-5 bg-gradient-to-r from-purple-50 to-pink-50 border-b border-gray-200">
<div class="flex items-center">
<div class="w-1 h-6 bg-gradient-to-b from-purple-500 to-pink-500 rounded-full mr-3"></div>
<h2 class="text-2xl font-bold text-gray-900">Map & Attractions</h2>
</div>
</div>
<div
x-data="cityMap({{ $city->latitude }}, {{ $city->longitude }}, '{{ $city->slug }}')"
x-init="initMap()"
id="map"
class="h-[500px]"
></div>
</div>
</div>
<!-- Attractions List -->
<div class="lg:col-span-1">
<div class="bg-white rounded-2xl shadow-xl overflow-hidden border border-gray-100">
<div class="px-6 py-5 bg-gradient-to-r from-indigo-50 to-purple-50 border-b border-gray-200">
<div class="flex items-center justify-between">
<div class="flex items-center">
<div class="w-1 h-6 bg-gradient-to-b from-indigo-500 to-purple-500 rounded-full mr-3"></div>
<h2 class="text-2xl font-bold text-gray-900">Attractions</h2>
</div>
<span class="px-3 py-1 bg-purple-100 text-purple-700 rounded-full text-sm font-semibold">{{ $city->attractions->count() }}</span>
</div>
</div>
<div x-data="attractionsList('{{ $city->slug }}')" x-init="loadAttractions()">
<!-- Category Filter -->
<div class="p-5 border-b border-gray-200 bg-gray-50">
<label class="block text-sm font-semibold text-gray-700 mb-2">Filter by Category</label>
<select
x-model="selectedCategory"
@change="filterAttractions()"
:disabled="loading"
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed transition-all duration-200"
>
<option value="">All Categories</option>
<option value="museum">Museums</option>
<option value="restaurant">Restaurants</option>
<option value="historic">Historic</option>
<option value="park">Parks</option>
<option value="cultural">Cultural</option>
<option value="entertainment">Entertainment</option>
</select>
</div>
<!-- Attractions List -->
<div class="divide-y divide-gray-100 max-h-[500px] overflow-y-auto">
<template x-for="attraction in filteredAttractions" :key="attraction.id">
<div class="p-5 hover:bg-gradient-to-r hover:from-purple-50 hover:to-pink-50 cursor-pointer transition-all duration-200 group" @click="highlightAttraction(attraction)">
<h3 class="font-bold text-gray-900 group-hover:text-purple-600 transition-colors duration-200" x-text="attraction.name"></h3>
<div class="flex items-center gap-2 mt-2">
<span class="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold bg-gray-100 text-gray-700 capitalize" x-text="attraction.category"></span>
<template x-if="attraction.rating">
<span class="inline-flex items-center text-sm font-semibold text-yellow-600">
★ <span x-text="attraction.rating" class="ml-0.5"></span>
</span>
</template>
</div>
</div>
</template>
<!-- Loading State -->
<div x-show="loading" class="p-12 text-center">
<div class="inline-flex flex-col items-center gap-3">
<svg class="animate-spin h-8 w-8 text-purple-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span class="text-gray-600 font-medium">Loading attractions...</span>
</div>
</div>
<!-- Empty State -->
<div x-show="!loading && filteredAttractions.length === 0" class="p-12 text-center text-gray-500">
<div class="inline-flex items-center justify-center w-16 h-16 bg-gray-100 rounded-full mb-4">
<svg class="h-8 w-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path>
</svg>
</div>
<p class="font-semibold text-gray-700 mb-1">No attractions found</p>
<p class="text-sm">Try selecting a different category</p>
</div>
<!-- Pagination Controls -->
<div x-show="!loading && pagination.last_page > 1" class="p-5 border-t border-gray-200 bg-gradient-to-r from-gray-50 to-purple-50">
<div class="flex items-center justify-between">
<button
@click="loadPage(pagination.current_page - 1)"
:disabled="pagination.current_page === 1"
class="px-4 py-2 text-sm font-semibold border-2 border-purple-200 text-purple-600 rounded-lg hover:bg-purple-50 hover:border-purple-300 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200"
>
Previous
</button>
<span class="text-sm font-semibold text-gray-700">
Page <span x-text="pagination.current_page" class="text-purple-600"></span> of <span x-text="pagination.last_page" class="text-purple-600"></span>
</span>
<button
@click="loadPage(pagination.current_page + 1)"
:disabled="pagination.current_page === pagination.last_page"
class="px-4 py-2 text-sm font-semibold border-2 border-purple-200 text-purple-600 rounded-lg hover:bg-purple-50 hover:border-purple-300 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200"
>
Next
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
function cityMap(lat, lon, citySlug) {
return {
map: null,
markers: [],
allAttractions: [],
selectedCategory: '',
// Define colors and icons for each category
categoryColors: {
museum: '#8B4513', // Brown
restaurant: '#FF6347', // Tomato
historic: '#4169E1', // Royal Blue
park: '#228B22', // Forest Green
cultural: '#9370DB', // Medium Purple
entertainment: '#FF1493', // Deep Pink
other: '#808080' // Gray
},
categoryIcons: {
museum: '🏛️', // Museum emoji
restaurant: '🍽️', // Restaurant emoji
historic: '🏰', // Castle emoji
park: '🌳', // Tree emoji
cultural: '🎭', // Theater emoji
entertainment: '🎪', // Circus tent emoji
other: '📍' // Pin emoji
},
initMap() {
// Initialize Leaflet map
this.map = L.map('map').setView([lat, lon], 13);
// Add OpenStreetMap tiles
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(this.map);
// Add city marker (star icon for the city)
const cityIcon = L.divIcon({
html: '<div style="font-size: 24px;">⭐</div>',
className: 'city-marker',
iconSize: [24, 24],
iconAnchor: [12, 12]
});
L.marker([lat, lon], { icon: cityIcon })
.addTo(this.map)
.bindPopup('<b>{{ $city->name }}</b>')
.openPopup();
// Load and display attractions
this.loadAttractions();
// Listen for category filter events
window.addEventListener('filter-category', (e) => {
this.filterAttractions(e.detail.category);
});
// Listen for highlight attraction events from the list
window.addEventListener('highlight-attraction', (e) => {
const attraction = e.detail.attraction;
// Find the corresponding marker
const marker = this.markers.find(m =>
Math.abs(m.getLatLng().lat - attraction.latitude) < 0.0001 &&
Math.abs(m.getLatLng().lng - attraction.longitude) < 0.0001
);
if (marker) {
this.map.setView([attraction.latitude, attraction.longitude], 16);
marker.openPopup();
}
});
},
createMarkerIcon(category) {
const icon = this.categoryIcons[category] || this.categoryIcons.other;
const color = this.categoryColors[category] || this.categoryColors.other;
return L.divIcon({
html: `<div style="font-size: 20px; background-color: white; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 2px solid ${color}; box-shadow: 0 2px 6px rgba(0,0,0,0.3);">${icon}</div>`,
className: '',
iconSize: [28, 28],
iconAnchor: [14, 14],
popupAnchor: [0, -14]
});
},
async loadAttractions() {
try {
const response = await fetch(`/api/cities/${citySlug}/attractions?limit=100`);
const data = await response.json();
// Handle both paginated and non-paginated responses
this.allAttractions = data.data || data;
// Display all attractions on map
this.displayAttractions(this.allAttractions);
} catch (error) {
console.error('Error loading attractions:', error);
}
},
displayAttractions(attractions) {
// Clear existing markers
this.markers.forEach(marker => this.map.removeLayer(marker));
this.markers = [];
// Add new markers
attractions.forEach(attraction => {
const icon = this.createMarkerIcon(attraction.category);
const marker = L.marker([attraction.latitude, attraction.longitude], { icon })
.addTo(this.map)
.bindPopup(`
<div class="p-2">
<b>${attraction.name}</b><br>
<span class="text-sm capitalize" style="color: ${this.categoryColors[attraction.category] || this.categoryColors.other}">${attraction.category}</span>
${attraction.rating ? `<br><span class="text-yellow-600">★ ${attraction.rating}</span>` : ''}
</div>
`);
// Store category with marker for filtering
marker.category = attraction.category;
this.markers.push(marker);
});
},
filterAttractions(category) {
this.selectedCategory = category;
if (!category) {
// Show all markers
this.markers.forEach(marker => {
if (!this.map.hasLayer(marker)) {
marker.addTo(this.map);
}
});
} else {
// Show only markers matching the category
this.markers.forEach(marker => {
if (marker.category === category) {
if (!this.map.hasLayer(marker)) {
marker.addTo(this.map);
}
} else {
if (this.map.hasLayer(marker)) {
this.map.removeLayer(marker);
}
}
});
}
}
}
}
function attractionsList(citySlug) {
return {
attractions: [],
filteredAttractions: [],
selectedCategory: '',
loading: false,
currentPage: 1,
pagination: {
current_page: 1,
last_page: 1,
per_page: 20,
total: 0
},
async loadAttractions(page = 1) {
this.loading = true;
try {
let url = `/api/cities/${citySlug}/attractions?page=${page}`;
if (this.selectedCategory) {
url += `&category=${this.selectedCategory}`;
}
const response = await fetch(url);
const data = await response.json();
// Handle paginated response
if (data.data) {
this.filteredAttractions = data.data;
this.pagination = {
current_page: data.current_page || 1,
last_page: data.last_page || 1,
per_page: data.per_page || 20,
total: data.total || 0
};
} else {
// Handle non-paginated response (fallback)
this.filteredAttractions = data;
}
} catch (error) {
console.error('Error loading attractions:', error);
this.filteredAttractions = [];
} finally {
this.loading = false;
}
},
async filterAttractions() {
await this.loadAttractions(1);
// Notify the map to filter attractions
window.dispatchEvent(new CustomEvent('filter-category', {
detail: { category: this.selectedCategory }
}));
},
async loadPage(page) {
if (page >= 1 && page <= this.pagination.last_page) {
await this.loadAttractions(page);
}
},
highlightAttraction(attraction) {
// Dispatch event to highlight marker on map
window.dispatchEvent(new CustomEvent('highlight-attraction', {
detail: { attraction }
}));
}
}
}
</script>
@endpush
@endsection
+160
View File
@@ -0,0 +1,160 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Wiki Travel Site') }} - @yield('title', 'Explore Cities')</title>
<!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=instrument-sans:400,500,600,700" rel="stylesheet" />
<!-- Styles -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="font-sans antialiased bg-gray-50">
<!-- Navigation -->
<nav class="bg-white shadow-lg border-b border-gray-100 sticky top-0 z-50 backdrop-blur-sm bg-white/95">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-20">
<div class="flex items-center">
<!-- Logo -->
<div class="flex-shrink-0 flex items-center">
<a href="/" class="flex items-center group">
<div class="w-10 h-10 bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 rounded-xl flex items-center justify-center mr-3 group-hover:scale-110 transition-transform duration-200">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<span class="text-2xl font-bold bg-gradient-to-r from-indigo-600 via-purple-600 to-pink-500 bg-clip-text text-transparent">
Wiki Travel
</span>
</a>
</div>
<!-- Navigation Links -->
<div class="hidden sm:ml-10 sm:flex sm:space-x-8">
<a href="/" class="inline-flex items-center px-4 py-2 rounded-lg text-base font-semibold text-gray-700 hover:text-purple-600 hover:bg-purple-50 transition-all 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="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
</svg>
Home
</a>
</div>
</div>
<!-- Auth Links -->
<div class="flex items-center space-x-4">
@auth
<span class="text-sm text-gray-700 font-medium">Hello, {{ Auth::user()->name }}!</span>
<form method="POST" action="{{ route('logout') }}" class="inline">
@csrf
<button type="submit" class="inline-flex items-center px-4 py-2 border-2 border-red-200 rounded-lg text-sm font-semibold text-red-600 hover:bg-red-50 hover:border-red-300 transition-all duration-200">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path>
</svg>
Logout
</button>
</form>
@else
<a href="{{ route('login') }}" class="inline-flex items-center px-4 py-2 border-2 border-purple-200 rounded-lg text-sm font-semibold text-purple-600 hover:bg-purple-50 hover:border-purple-300 transition-all duration-200">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"></path>
</svg>
Login
</a>
<a href="{{ route('register') }}" class="inline-flex items-center px-4 py-2 bg-gradient-to-r from-purple-600 to-pink-600 rounded-lg text-sm font-semibold text-white hover:from-purple-700 hover:to-pink-700 shadow-lg hover:shadow-xl transition-all duration-200 transform hover:-translate-y-0.5">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"></path>
</svg>
Register
</a>
@endauth
</div>
</div>
</div>
</nav>
<!-- Page Content -->
<main>
@yield('content')
</main>
<!-- Footer -->
<footer class="bg-gradient-to-br from-gray-900 via-purple-900 to-indigo-900 text-white mt-20">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="grid grid-cols-1 md:grid-cols-3 gap-8 mb-8">
<!-- Brand Section -->
<div>
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-gradient-to-br from-pink-500 to-purple-500 rounded-xl flex items-center justify-center mr-3">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<span class="text-xl font-bold">Wiki Travel</span>
</div>
<p class="text-purple-200 text-sm leading-relaxed">
Explore cities around the world with comprehensive travel information, attractions, and interactive maps.
</p>
</div>
<!-- Quick Links -->
<div>
<h3 class="font-bold text-lg mb-4">Quick Links</h3>
<ul class="space-y-2">
<li>
<a href="/" class="text-purple-200 hover:text-white transition-colors duration-200 text-sm">Home</a>
</li>
<li>
<a href="/" class="text-purple-200 hover:text-white transition-colors duration-200 text-sm">Explore Cities</a>
</li>
</ul>
</div>
<!-- Data Sources -->
<div>
<h3 class="font-bold text-lg mb-4">Powered By</h3>
<div class="space-y-2 text-sm">
<div class="flex items-center text-purple-200">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
Wikipedia
</div>
<div class="flex items-center text-purple-200">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
OpenTripMap
</div>
<div class="flex items-center text-purple-200">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
OpenStreetMap
</div>
</div>
</div>
</div>
<!-- Bottom Bar -->
<div class="border-t border-purple-700 pt-8 mt-8">
<p class="text-center text-sm text-purple-300">
&copy; {{ date('Y') }} Wiki Travel Site. All rights reserved.
</p>
</div>
</div>
</footer>
<!-- Leaflet JS -->
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
@stack('scripts')
</body>
</html>
+209
View File
@@ -0,0 +1,209 @@
@extends('layouts.app')
@section('title', 'Explore Cities Around the World')
@section('content')
<div class="relative">
<!-- Hero Section -->
<div class="relative bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 text-white overflow-hidden">
<!-- Animated background shapes -->
<div class="absolute inset-0 opacity-20">
<div class="absolute top-0 left-1/4 w-96 h-96 bg-white rounded-full mix-blend-overlay filter blur-3xl animate-pulse"></div>
<div class="absolute bottom-0 right-1/4 w-96 h-96 bg-yellow-300 rounded-full mix-blend-overlay filter blur-3xl animate-pulse" style="animation-delay: 1s;"></div>
</div>
<div class="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-32">
<div class="text-center">
<h1 class="text-5xl md:text-7xl font-bold mb-6 animate-fade-in-up">
Explore Cities Around the World
</h1>
<p class="text-xl md:text-2xl mb-12 text-purple-100 max-w-3xl mx-auto animate-fade-in-up" style="animation-delay: 0.2s;">
Discover hidden gems, plan unforgettable trips, and explore destinations like never before
</p>
<!-- City Search Component -->
<div x-data="citySearch()" class="max-w-2xl mx-auto animate-fade-in-up" style="animation-delay: 0.4s;">
<div class="relative group">
<div class="absolute -inset-1 bg-gradient-to-r from-pink-400 via-purple-400 to-indigo-400 rounded-2xl blur opacity-75 group-hover:opacity-100 transition duration-1000 group-hover:duration-200"></div>
<input
type="text"
x-model="query"
@input.debounce.300ms="search()"
@focus="showResults = true"
placeholder="Search for a city..."
class="relative w-full px-8 py-5 text-lg text-gray-900 bg-white rounded-xl shadow-2xl focus:outline-none focus:ring-4 focus:ring-purple-300 transition-all duration-200"
>
<!-- Search Results Dropdown -->
<div
x-show="showResults && (results.local.length > 0 || results.wikipedia.length > 0)"
@click.away="showResults = false"
class="absolute z-10 w-full mt-2 bg-white rounded-lg shadow-xl max-h-96 overflow-y-auto"
>
<!-- Local Results -->
<template x-if="results.local.length > 0">
<div class="border-b border-gray-200">
<div class="px-4 py-2 bg-gray-50 text-xs font-semibold text-gray-600 uppercase">
Saved Cities
</div>
<template x-for="city in results.local" :key="city.id">
<a
:href="`/cities/${city.slug}`"
class="block px-4 py-3 hover:bg-blue-50 cursor-pointer border-b border-gray-100"
>
<div class="font-semibold text-gray-900" x-text="city.name"></div>
<div class="text-sm text-gray-600" x-text="city.country"></div>
</a>
</template>
</div>
</template>
<!-- Wikipedia Results -->
<template x-if="results.wikipedia.length > 0">
<div>
<div class="px-4 py-2 bg-gray-50 text-xs font-semibold text-gray-600 uppercase">
Wikipedia Results
</div>
<template x-for="city in results.wikipedia" :key="city.title">
<div class="px-4 py-3 hover:bg-blue-50 cursor-pointer border-b border-gray-100">
<div class="font-semibold text-gray-900" x-text="city.title"></div>
<div class="text-sm text-gray-600" x-text="city.description"></div>
</div>
</template>
</div>
</template>
<!-- Loading State -->
<div x-show="loading" class="px-4 py-3 text-center text-gray-500">
<svg class="animate-spin h-5 w-5 mx-auto" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Popular Destinations Section -->
<div class="bg-gray-50 py-20">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center mb-12">
<h2 class="text-4xl font-bold text-gray-900 mb-4">Popular Destinations</h2>
<p class="text-xl text-gray-600">Start exploring these trending cities</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
@forelse($popularCities as $city)
<a href="{{ route('cities.show', $city->slug) }}" class="group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2">
<div class="relative h-64 overflow-hidden @if(!$city->thumbnail_url) bg-gradient-to-br from-blue-400 to-blue-600 @endif">
@if($city->thumbnail_url)
<img
src="{{ $city->thumbnail_url }}"
alt="{{ $city->name }}"
class="w-full h-full object-cover"
loading="lazy"
>
@endif
<div class="absolute inset-0 bg-black bg-opacity-30 group-hover:bg-opacity-50 transition-all duration-300"></div>
<div class="absolute inset-0 flex flex-col justify-end p-6 text-white">
<h3 class="text-2xl font-bold mb-1 drop-shadow-lg">{{ $city->name }}</h3>
<p class="text-sm text-gray-200 drop-shadow-md">{{ $city->country }}</p>
</div>
</div>
</a>
@empty
<!-- Fallback if no cities are available -->
<a href="#" class="group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2">
<div class="aspect-w-16 aspect-h-12 bg-gradient-to-br from-blue-400 to-blue-600 h-64">
<div class="absolute inset-0 bg-black bg-opacity-20 group-hover:bg-opacity-40 transition-all duration-300"></div>
<div class="absolute inset-0 flex flex-col justify-end p-6 text-white">
<h3 class="text-2xl font-bold mb-1">Start Exploring</h3>
<p class="text-sm text-gray-200">Search for cities above</p>
</div>
</div>
</a>
@endforelse
</div>
</div>
</div>
<!-- Features Section -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20">
<div class="text-center mb-12">
<h2 class="text-4xl font-bold text-gray-900 mb-4">Why Choose Wiki Travel</h2>
<p class="text-xl text-gray-600">Everything you need to plan your perfect journey</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<div class="group text-center p-8 bg-white rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2">
<div class="inline-flex items-center justify-center w-20 h-20 bg-gradient-to-br from-blue-400 to-blue-600 text-white rounded-2xl mb-6 group-hover:scale-110 transition-transform duration-300">
<svg class="w-10 h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
</div>
<h3 class="text-2xl font-bold mb-3 text-gray-900">Discover Cities</h3>
<p class="text-gray-600 leading-relaxed">Search and explore cities worldwide with comprehensive Wikipedia data and local insights</p>
</div>
<div class="group text-center p-8 bg-white rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2">
<div class="inline-flex items-center justify-center w-20 h-20 bg-gradient-to-br from-purple-400 to-pink-600 text-white rounded-2xl mb-6 group-hover:scale-110 transition-transform duration-300">
<svg class="w-10 h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path>
</svg>
</div>
<h3 class="text-2xl font-bold mb-3 text-gray-900">Find Attractions</h3>
<p class="text-gray-600 leading-relaxed">Explore museums, restaurants, historic sites, and countless points of interest around the globe</p>
</div>
<div class="group text-center p-8 bg-white rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2">
<div class="inline-flex items-center justify-center w-20 h-20 bg-gradient-to-br from-green-400 to-teal-600 text-white rounded-2xl mb-6 group-hover:scale-110 transition-transform duration-300">
<svg class="w-10 h-10" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
</svg>
</div>
<h3 class="text-2xl font-bold mb-3 text-gray-900">Plan Trips</h3>
<p class="text-gray-600 leading-relaxed">Create detailed itineraries, save your favorite destinations, and organize the perfect journey</p>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
function citySearch() {
return {
query: '',
results: { local: [], wikipedia: [] },
showResults: false,
loading: false,
async search() {
if (this.query.length < 2) {
this.results = { local: [], wikipedia: [] };
return;
}
this.loading = true;
try {
const response = await fetch(`/api/cities/search?q=${encodeURIComponent(this.query)}`);
const data = await response.json();
this.results = {
local: data.local || [],
wikipedia: data.wikipedia || []
};
this.showResults = true;
} catch (error) {
console.error('Search error:', error);
} finally {
this.loading = false;
}
}
}
}
</script>
@endpush
@endsection