fix(admin): nav issues and blank screens fix

This commit is contained in:
2026-02-26 16:20:59 -05:00
parent 10cb37c866
commit 34a73f0f94
8 changed files with 57 additions and 15 deletions

View File

@ -65,7 +65,8 @@ onMounted(loadStops)
async function loadStops() {
isLoading.value = true
try {
stops.value = await busStopsService.getAllBusStops()
const data = await busStopsService.getAllBusStops()
stops.value = data || []
} catch (e) {
error.value = 'Error al cargar las paradas'
} finally {

View File

@ -399,14 +399,16 @@ async function loadData() {
isLoading.value = true
try {
// Load drivers from Supabase
const { data: drivers } = await supabase.from('users').select('*, driver_profiles(*)').eq('role', 'DRIVER')
const { data: drivers, error: errorDrivers } = await supabase.from('users').select('*, driver_profiles(*)').eq('role', 'DRIVER')
if (errorDrivers) throw errorDrivers
activeDrivers.value = drivers || []
// Load taxis from Supabase
const { data: taxisData } = await supabase.from('taxis').select('*').order('owner_name')
const { data: taxisData, error: errorTaxis } = await supabase.from('taxis').select('*').order('owner_name')
if (errorTaxis) throw errorTaxis
taxis.value = taxisData || []
} catch (e) {
console.error(e)
console.error('Error cargando datos:', e)
} finally {
isLoading.value = false
}

View File

@ -90,7 +90,8 @@ onMounted(async () => {
async function fetchReports() {
isLoading.value = true
try {
reports.value = await reportsService.getReports()
const data = await reportsService.getReports()
reports.value = data || []
} catch (e) {
console.error('Error fetching reports:', e)
} finally {

View File

@ -206,12 +206,18 @@ onMounted(async () => {
})
async function loadInitialData() {
const [routesData, stopsData] = await Promise.all([
routesService.getAllRoutes(),
busStopsService.getAllBusStops()
])
routes.value = routesData || []
allStops.value = stopsData || []
try {
const [routesData, stopsData] = await Promise.all([
routesService.getAllRoutes(),
busStopsService.getAllBusStops()
])
routes.value = routesData || []
allStops.value = stopsData || []
} catch (e) {
console.error('Error loading initial data:', e)
routes.value = []
allStops.value = []
}
}
const availableStops = computed(() => {

View File

@ -159,7 +159,8 @@ const form = ref({
onMounted(async () => {
try {
routes.value = await routesService.getAllRoutes()
const data = await routesService.getAllRoutes()
routes.value = data || []
} catch (e) {
console.error('Error loading routes', e)
}
@ -177,7 +178,8 @@ async function loadSchedules() {
isLoadingSchedules.value = true
try {
// Get all schedules including drafts (false for onlyPublished)
schedules.value = await schedulesService.getRouteSchedules(selectedRouteId.value, false)
const data = await schedulesService.getRouteSchedules(selectedRouteId.value, false)
schedules.value = data || []
} catch (e) {
console.error('Error loading schedules', e)
} finally {
@ -347,6 +349,11 @@ async function handleDelete(id: string) {
cursor: pointer;
}
.premium-select option {
background: var(--bg-primary, #1e1e2d);
color: var(--text-primary, #ffffff);
}
.actions-header {
display: flex;
justify-content: space-between;

View File

@ -200,9 +200,10 @@ async function loadTaxis() {
try {
const { data, error } = await supabase.from('taxis').select('*').order('owner_name')
if (error) throw error
taxis.value = data
taxis.value = data || []
} catch (e) {
console.error('Error loading taxis:', e)
console.error('Error cargando taxis:', e)
error.value = 'Failed to load taxis'
} finally {
isLoading.value = false
}