Integrated AuthGuard in Discover and Shuttles, updated Business types and translations
This commit is contained in:
218
frontend/src/components/common/AuthGuard.vue
Normal file
218
frontend/src/components/common/AuthGuard.vue
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
title?: string
|
||||||
|
message?: string
|
||||||
|
actionLabel?: string
|
||||||
|
showOnGuest?: boolean // If false, the guard won't trigger (standard behavior)
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
title: '¡Desbloquea contenido exclusivo!',
|
||||||
|
message: 'Regístrate para ver todos los detalles, ofertas y rutas recomendadas.',
|
||||||
|
actionLabel: 'Unirme ahora',
|
||||||
|
showOnGuest: true
|
||||||
|
})
|
||||||
|
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
const router = useRouter()
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
function goToRegister() {
|
||||||
|
router.push('/register')
|
||||||
|
}
|
||||||
|
|
||||||
|
function goToLogin() {
|
||||||
|
router.push('/login')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="auth-guard-container">
|
||||||
|
<!-- Slot for the actual content -->
|
||||||
|
<div
|
||||||
|
class="content-wrapper"
|
||||||
|
:class="{ 'content-blurred': !authStore.isAuthenticated && props.showOnGuest }"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Overlay (only visible if not authenticated) -->
|
||||||
|
<Transition name="fade-scale">
|
||||||
|
<div
|
||||||
|
v-if="!authStore.isAuthenticated && props.showOnGuest"
|
||||||
|
class="auth-overlay"
|
||||||
|
>
|
||||||
|
<div class="auth-card glass-effect">
|
||||||
|
<div class="auth-icon-circle">
|
||||||
|
<span class="material-icons">lock</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="auth-title">{{ props.title }}</h3>
|
||||||
|
<p class="auth-message">{{ props.message }}</p>
|
||||||
|
|
||||||
|
<div class="auth-actions">
|
||||||
|
<button class="primary-btn" @click="goToRegister">
|
||||||
|
<span class="material-icons">person_add</span>
|
||||||
|
{{ props.actionLabel }}
|
||||||
|
</button>
|
||||||
|
<button class="secondary-btn" @click="goToLogin">
|
||||||
|
{{ t('auth.loginLink') || 'Ya tengo cuenta' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.auth-guard-container {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-wrapper {
|
||||||
|
transition: filter 0.5s ease, opacity 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-blurred {
|
||||||
|
filter: blur(14px);
|
||||||
|
pointer-events: none;
|
||||||
|
user-select: none;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── OVERLAY ── */
|
||||||
|
.auth-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 50;
|
||||||
|
padding: 1.5rem;
|
||||||
|
background: rgba(var(--bg-primary-rgb), 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card {
|
||||||
|
max-width: 360px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 2.25rem 1.75rem;
|
||||||
|
border-radius: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1.25rem;
|
||||||
|
animation: float 6s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-icon-circle {
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
background: var(--active-color);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-icon-circle .material-icons {
|
||||||
|
font-size: 2rem;
|
||||||
|
color: #101820;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-title {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 900;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin: 0;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-message {
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.5;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── ACTIONS ── */
|
||||||
|
.auth-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 1rem;
|
||||||
|
background: var(--active-color);
|
||||||
|
color: #101820;
|
||||||
|
border: none;
|
||||||
|
border-radius: 1rem;
|
||||||
|
font-weight: 800;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-btn:hover {
|
||||||
|
transform: scale(1.03);
|
||||||
|
box-shadow: 0 10px 20px rgba(254, 231, 21, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-btn {
|
||||||
|
padding: 0.75rem;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--text-primary);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-btn:hover {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border-color: var(--active-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── ANIMATIONS ── */
|
||||||
|
.fade-scale-enter-active,
|
||||||
|
.fade-scale-leave-active {
|
||||||
|
transition: all 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-scale-enter-from,
|
||||||
|
.fade-scale-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.95) translateY(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes float {
|
||||||
|
0% { transform: translateY(0px); }
|
||||||
|
50% { transform: translateY(-10px); }
|
||||||
|
100% { transform: translateY(0px); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark mode utility */
|
||||||
|
:root {
|
||||||
|
--bg-primary-rgb: 16, 24, 32; /* SIBU Dark primary */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -242,6 +242,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"business": {
|
"business": {
|
||||||
|
"aboutUs": "Sobre Nosotros",
|
||||||
"detailsTitle": "Explora Nuestra Historia Para Una Cocina Refinada Y Un Ambiente Atemporal",
|
"detailsTitle": "Explora Nuestra Historia Para Una Cocina Refinada Y Un Ambiente Atemporal",
|
||||||
"detailsDescription": "Nuestra historia es una de crecimiento, exploración y recuerdos culinarios inflamables, donde cada capítulo se sirve con elegancia.",
|
"detailsDescription": "Nuestra historia es una de crecimiento, exploración y recuerdos culinarios inflamables, donde cada capítulo se sirve con elegancia.",
|
||||||
"timelessHeritage": "Herencia Atemporal",
|
"timelessHeritage": "Herencia Atemporal",
|
||||||
@ -257,6 +258,7 @@
|
|||||||
"socialMedia": "Redes Sociales",
|
"socialMedia": "Redes Sociales",
|
||||||
"availableOffers": "Ofertas Disponibles",
|
"availableOffers": "Ofertas Disponibles",
|
||||||
"viewBusiness": "Ver Negocio",
|
"viewBusiness": "Ver Negocio",
|
||||||
|
"getDirections": "Cómo llegar",
|
||||||
"loadingPremium": "Cargando experiencia premium..."
|
"loadingPremium": "Cargando experiencia premium..."
|
||||||
},
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
|
|||||||
@ -18,14 +18,14 @@ export const businessService = {
|
|||||||
|
|
||||||
/** Get all businesses */
|
/** Get all businesses */
|
||||||
async getAllBusinesses(): Promise<Business[]> {
|
async getAllBusinesses(): Promise<Business[]> {
|
||||||
const { data, error } = await supabase.from('businesses').select('id, name, address, phone, image_url, social_media, category, latitude, longitude, area, updated_at')
|
const { data, error } = await supabase.from('businesses').select('id, name, address, phone, image_url, social_media, category, latitude, longitude, area, description, website, updated_at')
|
||||||
if (error) throw new Error(error.message)
|
if (error) throw new Error(error.message)
|
||||||
return data as Business[]
|
return data as Business[]
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Get a single business by ID */
|
/** Get a single business by ID */
|
||||||
async getBusiness(id: string): Promise<Business> {
|
async getBusiness(id: string): Promise<Business> {
|
||||||
const { data, error } = await supabase.from('businesses').select('id, name, address, phone, image_url, social_media, category, latitude, longitude, area, updated_at').eq('id', id).single()
|
const { data, error } = await supabase.from('businesses').select('id, name, address, phone, image_url, social_media, category, latitude, longitude, area, description, website, updated_at').eq('id', id).single()
|
||||||
if (error) throw new Error(error.message)
|
if (error) throw new Error(error.message)
|
||||||
return data as Business
|
return data as Business
|
||||||
},
|
},
|
||||||
|
|||||||
@ -95,6 +95,8 @@ export interface Business {
|
|||||||
latitude?: number | null
|
latitude?: number | null
|
||||||
longitude?: number | null
|
longitude?: number | null
|
||||||
area?: string | null
|
area?: string | null
|
||||||
|
description?: string | null
|
||||||
|
website?: string | null
|
||||||
updated_at?: string
|
updated_at?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,14 @@ function getImageUrl(path: string | null | undefined) {
|
|||||||
|
|
||||||
const goBack = () => router.back()
|
const goBack = () => router.back()
|
||||||
|
|
||||||
|
function openDirections() {
|
||||||
|
if (business.value?.latitude && business.value?.longitude) {
|
||||||
|
window.open(`https://www.google.com/maps/dir/?api=1&destination=${business.value.latitude},${business.value.longitude}`, '_blank')
|
||||||
|
} else if (business.value?.address) {
|
||||||
|
window.open(`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(business.value.address + ' ' + (business.value.area || ''))}`, '_blank')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -82,8 +90,8 @@ const goBack = () => router.back()
|
|||||||
<!-- Details Content -->
|
<!-- Details Content -->
|
||||||
<div class="details-container">
|
<div class="details-container">
|
||||||
<div class="premium-story">
|
<div class="premium-story">
|
||||||
<h2 class="premium-font">{{ t('business.detailsTitle') }}</h2>
|
<h2 class="premium-font">{{ business.description ? t('business.aboutUs') : t('business.detailsTitle') }}</h2>
|
||||||
<p>"{{ t('business.detailsDescription') }}"</p>
|
<p>"{{ business.description || t('business.detailsDescription') }}"</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Highlights Grid (Inspired by the frame) -->
|
<!-- Highlights Grid (Inspired by the frame) -->
|
||||||
@ -128,6 +136,10 @@ const goBack = () => router.back()
|
|||||||
<div class="info-text">
|
<div class="info-text">
|
||||||
<h4>{{ t('business.address') }}</h4>
|
<h4>{{ t('business.address') }}</h4>
|
||||||
<p>{{ business.address }}</p>
|
<p>{{ business.address }}</p>
|
||||||
|
<button v-if="business.latitude || business.address" class="track-directions-btn" @click="openDirections">
|
||||||
|
<span class="material-icons">directions</span>
|
||||||
|
{{ t('business.getDirections') || 'Cómo llegar' }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -139,6 +151,14 @@ const goBack = () => router.back()
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="business.website" class="info-card">
|
||||||
|
<span class="material-icons">public</span>
|
||||||
|
<div class="info-text">
|
||||||
|
<h4>Página Web</h4>
|
||||||
|
<a :href="business.website" target="_blank" class="website-link">{{ business.website }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="business.social_media" class="info-card">
|
<div v-if="business.social_media" class="info-card">
|
||||||
<span class="material-icons">language</span>
|
<span class="material-icons">language</span>
|
||||||
<div class="info-text">
|
<div class="info-text">
|
||||||
@ -386,13 +406,36 @@ const goBack = () => router.back()
|
|||||||
|
|
||||||
.track-directions-btn {
|
.track-directions-btn {
|
||||||
background: var(--active-color);
|
background: var(--active-color);
|
||||||
color: white;
|
color: #101820;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 8px 16px;
|
padding: 10px 18px;
|
||||||
border-radius: 8px;
|
border-radius: 12px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-top: 4px;
|
margin-top: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.track-directions-btn:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(254, 231, 21, 0.3);
|
||||||
|
filter: brightness(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.website-link {
|
||||||
|
color: var(--active-color);
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.website-link:hover {
|
||||||
|
opacity: 0.8;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Offers Section */
|
/* Offers Section */
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import { useCouponStore } from '@/stores/coupon'
|
|||||||
import type { Coupon } from '@/types'
|
import type { Coupon } from '@/types'
|
||||||
import FavoriteButton from '@/components/FavoriteButton.vue'
|
import FavoriteButton from '@/components/FavoriteButton.vue'
|
||||||
import { getImageUrl as utilGetImageUrl } from '@/utils/imageUrl'
|
import { getImageUrl as utilGetImageUrl } from '@/utils/imageUrl'
|
||||||
|
import AuthGuard from '@/components/common/AuthGuard.vue'
|
||||||
|
import { analyticsService } from '@/services/analyticsService'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const couponStore = useCouponStore()
|
const couponStore = useCouponStore()
|
||||||
@ -42,7 +44,6 @@ function getImageUrl(path: string | null | undefined) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import { analyticsService } from '@/services/analyticsService'
|
|
||||||
|
|
||||||
function openCoupon(coupon: Coupon) {
|
function openCoupon(coupon: Coupon) {
|
||||||
selectedCoupon.value = coupon
|
selectedCoupon.value = coupon
|
||||||
@ -125,36 +126,42 @@ function getCategoryIcon(category?: string | null) {
|
|||||||
<p>{{ t('coupons.noResults') }}</p>
|
<p>{{ t('coupons.noResults') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="coupons-grid-new">
|
<AuthGuard
|
||||||
<div
|
v-else
|
||||||
v-for="coupon in filteredCoupons"
|
:title="t('coupons.auth.title') || '¡Cupones exclusivos!'"
|
||||||
:key="coupon.id"
|
:message="t('coupons.auth.message') || 'Regístrate para ver todos los descuentos y promociones en restaurantes y comercios locales.'"
|
||||||
v-memo="[coupon.id]"
|
>
|
||||||
class="offer-card-new"
|
<div class="coupons-grid-new">
|
||||||
@click="openCoupon(coupon)"
|
<div
|
||||||
>
|
v-for="coupon in filteredCoupons"
|
||||||
<div class="offer-image-wrapper">
|
:key="coupon.id"
|
||||||
<img :src="getImageUrl(coupon.image_url)" :alt="coupon.title" loading="lazy" decoding="async" class="offer-img">
|
v-memo="[coupon.id]"
|
||||||
<div class="status-badge" :class="{ 'tmr': coupon.title.toLowerCase().includes('mañana') || (coupon.description?.toLowerCase().includes('mañana') ?? false) }">
|
class="offer-card-new"
|
||||||
<span class="material-icons">schedule</span>
|
@click="openCoupon(coupon)"
|
||||||
{{ coupon.title.toLowerCase().includes('mañana') ? t('coupons.tomorrow') : t('coupons.active') }}
|
>
|
||||||
|
<div class="offer-image-wrapper">
|
||||||
|
<img :src="getImageUrl(coupon.image_url)" :alt="coupon.title" loading="lazy" decoding="async" class="offer-img">
|
||||||
|
<div class="status-badge" :class="{ 'tmr': coupon.title.toLowerCase().includes('mañana') || (coupon.description?.toLowerCase().includes('mañana') ?? false) }">
|
||||||
|
<span class="material-icons">schedule</span>
|
||||||
|
{{ coupon.title.toLowerCase().includes('mañana') ? t('coupons.tomorrow') : t('coupons.active') }}
|
||||||
|
</div>
|
||||||
|
<div class="favorite-button-wrapper">
|
||||||
|
<FavoriteButton
|
||||||
|
item-type="coupon"
|
||||||
|
:item-id="coupon.id"
|
||||||
|
:item-name="coupon.title"
|
||||||
|
:item-image="coupon.image_url || undefined"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="favorite-button-wrapper">
|
|
||||||
<FavoriteButton
|
<div class="offer-content">
|
||||||
item-type="coupon"
|
<h3 class="offer-title">{{ coupon.business?.name || t('coupons.restaurant') }}</h3>
|
||||||
:item-id="coupon.id"
|
<p class="offer-benefit">{{ coupon.title }}</p>
|
||||||
:item-name="coupon.title"
|
|
||||||
:item-image="coupon.image_url || undefined"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="offer-content">
|
|
||||||
<h3 class="offer-title">{{ coupon.business?.name || t('coupons.restaurant') }}</h3>
|
|
||||||
<p class="offer-benefit">{{ coupon.title }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</AuthGuard>
|
||||||
|
|
||||||
<!-- Category Filter Sheet -->
|
<!-- Category Filter Sheet -->
|
||||||
<div v-if="showFilterSheet" class="bottom-sheet-overlay" @click.self="showFilterSheet = false">
|
<div v-if="showFilterSheet" class="bottom-sheet-overlay" @click.self="showFilterSheet = false">
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import FavoriteButton from '@/components/FavoriteButton.vue'
|
import FavoriteButton from '@/components/FavoriteButton.vue'
|
||||||
import { analyticsService } from '@/services/analyticsService'
|
import { analyticsService } from '@/services/analyticsService'
|
||||||
import { getImageUrl } from '@/utils/imageUrl'
|
import { getImageUrl } from '@/utils/imageUrl'
|
||||||
|
import AuthGuard from '@/components/common/AuthGuard.vue'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@ -279,82 +280,87 @@ function resetFilters() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- DESTACADOS -->
|
<!-- DESTACADOS USANDO AUTHGUARD -->
|
||||||
<div v-if="featuredBusinesses.length > 0" class="featured-section">
|
<AuthGuard
|
||||||
<p class="section-label">{{ t('discover.sections.featured') }}</p>
|
:title="t('discover.auth.title') || '¡Locales exclusivos!'"
|
||||||
<div class="featured-grid">
|
:message="t('discover.auth.message') || 'Regístrate para descubrir los mejores rincones de la ciudad y ofertas directas.'"
|
||||||
<div
|
>
|
||||||
v-for="biz in featuredBusinesses"
|
<div v-if="featuredBusinesses.length > 0" class="featured-section">
|
||||||
:key="biz.id"
|
<p class="section-label">{{ t('discover.sections.featured') }}</p>
|
||||||
v-memo="[biz.id]"
|
<div class="featured-grid">
|
||||||
class="featured-card"
|
<div
|
||||||
@click="handleExplore(biz)"
|
v-for="biz in featuredBusinesses"
|
||||||
>
|
:key="biz.id"
|
||||||
<img
|
v-memo="[biz.id]"
|
||||||
:src="getImageUrl(biz.image_url, 'business')"
|
class="featured-card"
|
||||||
:alt="biz.name"
|
@click="handleExplore(biz)"
|
||||||
loading="lazy"
|
>
|
||||||
decoding="async"
|
|
||||||
class="featured-img"
|
|
||||||
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'business')"
|
|
||||||
/>
|
|
||||||
<div class="featured-gradient"></div>
|
|
||||||
<div class="featured-fav">
|
|
||||||
<FavoriteButton item-type="business" :item-id="biz.id" :item-name="biz.name" :item-image="biz.image_url || undefined" />
|
|
||||||
</div>
|
|
||||||
<div class="featured-info">
|
|
||||||
<span class="featured-cat">
|
|
||||||
<span class="material-icons" style="font-size:0.8rem">{{ catIcon(biz.category || '') }}</span>
|
|
||||||
{{ catName(biz.category || '') }}
|
|
||||||
</span>
|
|
||||||
<p class="featured-name">{{ biz.name }}</p>
|
|
||||||
<p class="featured-area">
|
|
||||||
<span class="material-icons" style="font-size:0.875rem">near_me</span>
|
|
||||||
{{ biz.area }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- TODOS LOS LUGARES -->
|
|
||||||
<div v-if="gridBusinesses.length > 0" class="all-section">
|
|
||||||
<p class="section-label">{{ t('discover.sections.allPlaces') }}</p>
|
|
||||||
<TransitionGroup name="fade" tag="div" class="biz-grid">
|
|
||||||
<div
|
|
||||||
v-for="biz in gridBusinesses"
|
|
||||||
:key="biz.id"
|
|
||||||
v-memo="[biz.id]"
|
|
||||||
class="biz-card"
|
|
||||||
@click="handleExplore(biz)"
|
|
||||||
>
|
|
||||||
<div class="biz-img-wrap">
|
|
||||||
<img
|
<img
|
||||||
:src="getImageUrl(biz.image_url, 'business')"
|
:src="getImageUrl(biz.image_url, 'business')"
|
||||||
:alt="biz.name"
|
:alt="biz.name"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
class="biz-img"
|
class="featured-img"
|
||||||
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'business')"
|
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'business')"
|
||||||
/>
|
/>
|
||||||
<div class="biz-fav">
|
<div class="featured-gradient"></div>
|
||||||
|
<div class="featured-fav">
|
||||||
<FavoriteButton item-type="business" :item-id="biz.id" :item-name="biz.name" :item-image="biz.image_url || undefined" />
|
<FavoriteButton item-type="business" :item-id="biz.id" :item-name="biz.name" :item-image="biz.image_url || undefined" />
|
||||||
</div>
|
</div>
|
||||||
<span class="biz-cat-badge">
|
<div class="featured-info">
|
||||||
<span class="material-icons" style="font-size:0.875rem">{{ catIcon(biz.category || '') }}</span>
|
<span class="featured-cat">
|
||||||
{{ catName(biz.category || '') }}
|
<span class="material-icons" style="font-size:0.8rem">{{ catIcon(biz.category || '') }}</span>
|
||||||
</span>
|
{{ catName(biz.category || '') }}
|
||||||
</div>
|
</span>
|
||||||
<div class="biz-body">
|
<p class="featured-name">{{ biz.name }}</p>
|
||||||
<p class="biz-name">{{ biz.name }}</p>
|
<p class="featured-area">
|
||||||
<p class="biz-area">
|
<span class="material-icons" style="font-size:0.875rem">near_me</span>
|
||||||
<span class="material-icons biz-area-icon">near_me</span>
|
{{ biz.area }}
|
||||||
{{ biz.area }}
|
</p>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TransitionGroup>
|
</div>
|
||||||
</div>
|
|
||||||
|
<!-- TODOS LOS LUGARES -->
|
||||||
|
<div v-if="gridBusinesses.length > 0" class="all-section">
|
||||||
|
<p class="section-label">{{ t('discover.sections.allPlaces') }}</p>
|
||||||
|
<TransitionGroup name="fade" tag="div" class="biz-grid">
|
||||||
|
<div
|
||||||
|
v-for="biz in gridBusinesses"
|
||||||
|
:key="biz.id"
|
||||||
|
v-memo="[biz.id]"
|
||||||
|
class="biz-card"
|
||||||
|
@click="handleExplore(biz)"
|
||||||
|
>
|
||||||
|
<div class="biz-img-wrap">
|
||||||
|
<img
|
||||||
|
:src="getImageUrl(biz.image_url, 'business')"
|
||||||
|
:alt="biz.name"
|
||||||
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
|
class="biz-img"
|
||||||
|
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'business')"
|
||||||
|
/>
|
||||||
|
<div class="biz-fav">
|
||||||
|
<FavoriteButton item-type="business" :item-id="biz.id" :item-name="biz.name" :item-image="biz.image_url || undefined" />
|
||||||
|
</div>
|
||||||
|
<span class="biz-cat-badge">
|
||||||
|
<span class="material-icons" style="font-size:0.875rem">{{ catIcon(biz.category || '') }}</span>
|
||||||
|
{{ catName(biz.category || '') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="biz-body">
|
||||||
|
<p class="biz-name">{{ biz.name }}</p>
|
||||||
|
<p class="biz-area">
|
||||||
|
<span class="material-icons biz-area-icon">near_me</span>
|
||||||
|
{{ biz.area }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</TransitionGroup>
|
||||||
|
</div>
|
||||||
|
</AuthGuard>
|
||||||
|
|
||||||
<div v-if="businesses.length === 0" class="empty-state">
|
<div v-if="businesses.length === 0" class="empty-state">
|
||||||
<span class="material-icons empty-icon">storefront</span>
|
<span class="material-icons empty-icon">storefront</span>
|
||||||
|
|||||||
@ -54,7 +54,9 @@ const currentBusiness = ref<Partial<Business>>({
|
|||||||
image_url: '',
|
image_url: '',
|
||||||
social_media: '',
|
social_media: '',
|
||||||
category: 'Restaurante',
|
category: 'Restaurante',
|
||||||
area: 'Boquete'
|
area: 'Boquete',
|
||||||
|
description: '',
|
||||||
|
website: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const userName = localStorage.getItem('user_name') || 'Promotor'
|
const userName = localStorage.getItem('user_name') || 'Promotor'
|
||||||
@ -175,7 +177,9 @@ function openCreateBusinessModal() {
|
|||||||
image_url: '',
|
image_url: '',
|
||||||
social_media: '',
|
social_media: '',
|
||||||
category: 'Restaurante',
|
category: 'Restaurante',
|
||||||
area: 'Boquete'
|
area: 'Boquete',
|
||||||
|
description: '',
|
||||||
|
website: ''
|
||||||
}
|
}
|
||||||
showBusinessModal.value = true
|
showBusinessModal.value = true
|
||||||
businessImageFile.value = null
|
businessImageFile.value = null
|
||||||
@ -208,6 +212,8 @@ async function saveBusiness() {
|
|||||||
formData.append('phone', currentBusiness.value.phone || '')
|
formData.append('phone', currentBusiness.value.phone || '')
|
||||||
formData.append('social_media', currentBusiness.value.social_media || '')
|
formData.append('social_media', currentBusiness.value.social_media || '')
|
||||||
formData.append('area', currentBusiness.value.area || 'Boquete')
|
formData.append('area', currentBusiness.value.area || 'Boquete')
|
||||||
|
formData.append('description', currentBusiness.value.description || '')
|
||||||
|
formData.append('website', currentBusiness.value.website || '')
|
||||||
|
|
||||||
if (businessImageFile.value) {
|
if (businessImageFile.value) {
|
||||||
formData.append('image', businessImageFile.value)
|
formData.append('image', businessImageFile.value)
|
||||||
@ -726,6 +732,14 @@ async function toggleCouponStatus(coupon: Coupon) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Descripción / Historia del Negocio</label>
|
||||||
|
<textarea v-model="currentBusiness.description" placeholder="Cuéntanos un poco sobre el negocio para darle un toque premium..." rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Página Web (Opcional)</label>
|
||||||
|
<input v-model="currentBusiness.website" type="url" placeholder="https://www.ejemplo.com">
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Redes Sociales</label>
|
<label>Redes Sociales</label>
|
||||||
<input v-model="currentBusiness.social_media" type="text" placeholder="Ej: @pizzeria_centro">
|
<input v-model="currentBusiness.social_media" type="text" placeholder="Ej: @pizzeria_centro">
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import { useShuttleStore } from '@/stores/shuttle'
|
import { useShuttleStore } from '@/stores/shuttle'
|
||||||
import { analyticsService } from '@/services/analyticsService'
|
import { analyticsService } from '@/services/analyticsService'
|
||||||
import { getImageUrl } from '@/utils/imageUrl'
|
import { getImageUrl } from '@/utils/imageUrl'
|
||||||
|
import AuthGuard from '@/components/common/AuthGuard.vue'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const shuttleStore = useShuttleStore()
|
const shuttleStore = useShuttleStore()
|
||||||
@ -91,68 +92,74 @@ onMounted(async () => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- GRID PREMIUM -->
|
<!-- GRID PREMIUM CON AUTHGUARD -->
|
||||||
<div v-else class="shuttles-grid">
|
<AuthGuard
|
||||||
<div
|
v-else
|
||||||
v-for="shuttle in filteredShuttles"
|
:title="t('shuttle.auth.title') || 'Viajes Exclusivos'"
|
||||||
:key="shuttle.id"
|
:message="t('shuttle.auth.message') || 'Regístrate para reservar tus viajes, ver horarios detallados y tarifas de grupo.'"
|
||||||
v-memo="[shuttle.id]"
|
>
|
||||||
class="shuttle-card-premium glass-effect"
|
<div class="shuttles-grid">
|
||||||
@click="verDetalle(shuttle.id)"
|
<div
|
||||||
>
|
v-for="shuttle in filteredShuttles"
|
||||||
<div class="card-image-wrap">
|
:key="shuttle.id"
|
||||||
<img
|
v-memo="[shuttle.id]"
|
||||||
:src="getImageUrl(shuttle.image_url, 'shuttle')"
|
class="shuttle-card-premium glass-effect"
|
||||||
loading="lazy"
|
@click="verDetalle(shuttle.id)"
|
||||||
decoding="async"
|
>
|
||||||
class="shuttle-img"
|
<div class="card-image-wrap">
|
||||||
alt="Shuttle"
|
<img
|
||||||
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'shuttle')"
|
:src="getImageUrl(shuttle.image_url, 'shuttle')"
|
||||||
/>
|
loading="lazy"
|
||||||
<div class="company-tag" v-if="shuttle.company_name">
|
decoding="async"
|
||||||
<span class="material-icons">business</span>
|
class="shuttle-img"
|
||||||
{{ shuttle.company_name }}
|
alt="Shuttle"
|
||||||
|
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'shuttle')"
|
||||||
|
/>
|
||||||
|
<div class="company-tag" v-if="shuttle.company_name">
|
||||||
|
<span class="material-icons">business</span>
|
||||||
|
{{ shuttle.company_name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body-premium">
|
||||||
|
<div class="route-header">
|
||||||
|
<div class="route-main">
|
||||||
|
<span class="location-name">{{ shuttle.origin }}</span>
|
||||||
|
<span class="material-icons separator-icon">east</span>
|
||||||
|
<span class="location-name">{{ shuttle.destination }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-meta">
|
||||||
|
<div class="meta-tag">
|
||||||
|
<span class="material-icons">directions_bus</span>
|
||||||
|
<span>{{ shuttle.vehicle_type }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="meta-tag" v-if="shuttle.estimated_duration">
|
||||||
|
<span class="material-icons">schedule</span>
|
||||||
|
<span>{{ shuttle.estimated_duration }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer-premium">
|
||||||
|
<div class="price-container">
|
||||||
|
<span class="price-label">{{ t('shuttle.from') || 'Desde' }}</span>
|
||||||
|
<span class="price-val">${{ shuttle.price_per_person }}</span>
|
||||||
|
</div>
|
||||||
|
<button class="view-details-btn">
|
||||||
|
<span class="material-icons">chevron_right</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body-premium">
|
<!-- EMPTY STATE -->
|
||||||
<div class="route-header">
|
<div v-if="filteredShuttles.length === 0" class="empty-state">
|
||||||
<div class="route-main">
|
<span class="material-icons">directions_bus_filled</span>
|
||||||
<span class="location-name">{{ shuttle.origin }}</span>
|
<p>{{ t('shuttle.noShuttles') }}</p>
|
||||||
<span class="material-icons separator-icon">east</span>
|
|
||||||
<span class="location-name">{{ shuttle.destination }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-meta">
|
|
||||||
<div class="meta-tag">
|
|
||||||
<span class="material-icons">directions_bus</span>
|
|
||||||
<span>{{ shuttle.vehicle_type }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="meta-tag" v-if="shuttle.estimated_duration">
|
|
||||||
<span class="material-icons">schedule</span>
|
|
||||||
<span>{{ shuttle.estimated_duration }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-footer-premium">
|
|
||||||
<div class="price-container">
|
|
||||||
<span class="price-label">{{ t('shuttle.from') || 'Desde' }}</span>
|
|
||||||
<span class="price-val">${{ shuttle.price_per_person }}</span>
|
|
||||||
</div>
|
|
||||||
<button class="view-details-btn">
|
|
||||||
<span class="material-icons">chevron_right</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</AuthGuard>
|
||||||
<!-- EMPTY STATE -->
|
|
||||||
<div v-if="filteredShuttles.length === 0" class="empty-state">
|
|
||||||
<span class="material-icons">directions_bus_filled</span>
|
|
||||||
<p>{{ t('shuttle.noShuttles') }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user