refactor: hide old promotions tab and rename business tab to include activities

This commit is contained in:
2026-03-18 20:46:46 -05:00
parent fd61cb7f87
commit bf5b3266dc

View File

@ -1,4 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, watch, computed } from 'vue' import { ref, onMounted, watch, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { businessService } from '@/services/businessService' import { businessService } from '@/services/businessService'
@ -12,7 +12,7 @@ const route = useRoute()
const authStore = useAuthStore() const authStore = useAuthStore()
// State // State
const activeTab = ref<'promotions' | 'businesses' | 'shuttles'>('promotions') const activeTab = ref<'promotions' | 'businesses' | 'shuttles'>('businesses')
const coupons = ref<Coupon[]>([]) const coupons = ref<Coupon[]>([])
const businesses = ref<Business[]>([]) const businesses = ref<Business[]>([])
const shuttles = ref<Shuttle[]>([]) const shuttles = ref<Shuttle[]>([])
@ -185,27 +185,7 @@ async function deleteBusiness(id: string) {
} }
} }
// Coupon Methods
function openCreateModal() {
isEditing.value = false
couponImageFile.value = null
couponImagePreview.value = null
currentCoupon.value = {
title: '',
business_id: null,
description: '',
image_url: '',
social_media: '',
terms: '',
discount_percentage: null,
discount_amount: null,
category: 'Restaurante',
valid_from: '',
valid_until: '',
is_active: true
}
showModal.value = true
}
function handleBusinessChange() { function handleBusinessChange() {
const selectedBiz = businesses.value.find(b => b.id === currentCoupon.value.business_id) const selectedBiz = businesses.value.find(b => b.id === currentCoupon.value.business_id)
@ -311,11 +291,9 @@ async function toggleCouponStatus(coupon: Coupon) {
<!-- Tabs --> <!-- Tabs -->
<div class="tabs-container"> <div class="tabs-container">
<div class="tabs-buttons"> <div class="tabs-buttons">
<button :class="['tab-btn', { active: activeTab === 'promotions' }]" @click="activeTab = 'promotions'">
Promociones
</button>
<button :class="['tab-btn', { active: activeTab === 'businesses' }]" @click="activeTab = 'businesses'"> <button :class="['tab-btn', { active: activeTab === 'businesses' }]" @click="activeTab = 'businesses'">
Mis Negocios Negocios y Actividades
</button> </button>
<button :class="['tab-btn', { active: activeTab === 'shuttles' }]" @click="activeTab = 'shuttles'"> <button :class="['tab-btn', { active: activeTab === 'shuttles' }]" @click="activeTab = 'shuttles'">
Viajes Turísticos Viajes Turísticos
@ -346,13 +324,10 @@ async function toggleCouponStatus(coupon: Coupon) {
</div> </div>
</div> </div>
<button v-if="activeTab === 'promotions'" class="primary-btn" @click="openCreateModal">
<span class="material-icons">add</span>
Nuevo Cupón
</button>
<button v-if="activeTab === 'businesses'" class="primary-btn" @click="openCreateBusinessModal"> <button v-if="activeTab === 'businesses'" class="primary-btn" @click="openCreateBusinessModal">
<span class="material-icons">add</span> <span class="material-icons">add</span>
Nuevo Negocio Crear Actividad / Negocio
</button> </button>
<button v-if="activeTab === 'shuttles'" class="primary-btn" @click="$router.push('/admin/shuttles')"> <button v-if="activeTab === 'shuttles'" class="primary-btn" @click="$router.push('/admin/shuttles')">
<span class="material-icons">rocket_launch</span> <span class="material-icons">rocket_launch</span>
@ -365,7 +340,7 @@ async function toggleCouponStatus(coupon: Coupon) {
<div class="search-filter-bar"> <div class="search-filter-bar">
<div class="search-box"> <div class="search-box">
<span class="material-icons">search</span> <span class="material-icons">search</span>
<input v-model="searchQuery" type="text" :placeholder="activeTab === 'promotions' ? 'Buscar promoción...' : (activeTab === 'businesses' ? 'Buscar negocio...' : 'Buscar shuttle...')"> <input v-model="searchQuery" type="text" :placeholder="activeTab === 'businesses' ? 'Buscar negocio o actividad...' : 'Buscar shuttle...'">
</div> </div>
<div class="filter-box"> <div class="filter-box">
<span class="material-icons">filter_alt</span> <span class="material-icons">filter_alt</span>
@ -449,13 +424,13 @@ async function toggleCouponStatus(coupon: Coupon) {
<div v-if="activeTab === 'businesses'"> <div v-if="activeTab === 'businesses'">
<div v-if="businesses.length === 0" class="empty-state"> <div v-if="businesses.length === 0" class="empty-state">
<span class="material-icons">store_front</span> <span class="material-icons">store_front</span>
<p>Aún no has registrado ningún negocio o local.</p> <p>Aún no has registrado ningún negocio local o actividad.</p>
</div> </div>
<div v-else class="table-card"> <div v-else class="table-card">
<table class="coupons-table"> <table class="coupons-table">
<thead> <thead>
<tr> <tr>
<th>Negocio / Local</th> <th>Negocio / Actividad Turística</th>
<th class="text-center">Categoría</th> <th class="text-center">Categoría</th>
<th class="text-center">Área</th> <th class="text-center">Área</th>
<th class="text-center">Contacto</th> <th class="text-center">Contacto</th>