|
|
@@ -138,7 +138,7 @@
|
|
|
<div class="px-4 py-5 sm:p-6">
|
|
|
<h3 class="text-lg leading-6 font-medium text-gray-900 mb-4">
|
|
|
<i class="fas fa-calendar-day mr-2 text-blue-600"></i>
|
|
|
- Trajets d'aujourd'hui
|
|
|
+ Trajets d'aujourd'hui
|
|
|
</h3>
|
|
|
<div v-if="todayTrips.length === 0" class="text-center py-8">
|
|
|
<i class="fas fa-calendar-times text-gray-400 text-4xl mb-4"></i>
|
|
|
@@ -148,30 +148,73 @@
|
|
|
<div
|
|
|
v-for="trip in todayTrips"
|
|
|
:key="trip.id"
|
|
|
- class="border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer"
|
|
|
+ :class="[
|
|
|
+ 'border rounded-lg p-4 transition-all duration-200',
|
|
|
+ trip.registrationClosed
|
|
|
+ ? 'border-gray-300 bg-gray-50 opacity-60 cursor-pointer'
|
|
|
+ : 'border-gray-200 hover:shadow-md cursor-pointer'
|
|
|
+ ]"
|
|
|
@click="selectTrip(trip)"
|
|
|
>
|
|
|
<div class="flex items-center justify-between">
|
|
|
<div class="flex-1">
|
|
|
<div class="flex items-center space-x-4">
|
|
|
<div class="flex-shrink-0">
|
|
|
- <div class="w-3 h-3 bg-green-500 rounded-full"></div>
|
|
|
+ <div
|
|
|
+ :class="[
|
|
|
+ 'w-3 h-3 rounded-full',
|
|
|
+ trip.registrationClosed ? 'bg-gray-400' : 'bg-green-500'
|
|
|
+ ]"
|
|
|
+ ></div>
|
|
|
</div>
|
|
|
<div class="flex-1 min-w-0">
|
|
|
- <p class="text-sm font-medium text-gray-900 truncate">
|
|
|
+ <p
|
|
|
+ :class="[
|
|
|
+ 'text-sm font-medium truncate',
|
|
|
+ trip.registrationClosed ? 'text-gray-500' : 'text-gray-900'
|
|
|
+ ]"
|
|
|
+ >
|
|
|
{{ trip.departure }} → {{ trip.arrival }}
|
|
|
+ <span v-if="trip.registrationClosed" class="ml-2 text-xs font-normal text-red-500">
|
|
|
+ (Enregistrement fermé)
|
|
|
+ </span>
|
|
|
</p>
|
|
|
- <p class="text-sm text-gray-500">
|
|
|
+ <p
|
|
|
+ :class="[
|
|
|
+ 'text-sm',
|
|
|
+ trip.registrationClosed ? 'text-gray-400' : 'text-gray-500'
|
|
|
+ ]"
|
|
|
+ >
|
|
|
{{ formatTime(trip.departureTime) }} - {{ formatTime(trip.arrivalTime) }}
|
|
|
</p>
|
|
|
+ <p v-if="trip.vehicule"
|
|
|
+ :class="[
|
|
|
+ 'text-xs mt-1',
|
|
|
+ trip.registrationClosed ? 'text-gray-400' : 'text-gray-400'
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ {{ trip.vehicule.type }} - {{ trip.vehicule.immatriculation }}
|
|
|
+ </p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flex items-center space-x-4">
|
|
|
- <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
|
|
- {{ trip.passengers }}/{{ trip.capacity }} passagers
|
|
|
+ <span
|
|
|
+ :class="[
|
|
|
+ 'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium',
|
|
|
+ trip.registrationClosed
|
|
|
+ ? 'bg-gray-200 text-gray-600'
|
|
|
+ : 'bg-blue-100 text-blue-800'
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ {{ trip.passengers }}/{{ trip.vehicule?.number_places || trip.capacity || 'N/A' }} passagers
|
|
|
</span>
|
|
|
- <i class="fas fa-chevron-right text-gray-400"></i>
|
|
|
+ <i
|
|
|
+ :class="[
|
|
|
+ 'fas fa-chevron-right',
|
|
|
+ trip.registrationClosed ? 'text-gray-300' : 'text-gray-400'
|
|
|
+ ]"
|
|
|
+ ></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -202,6 +245,7 @@
|
|
|
<div v-if="activeTab === 'scanner'">
|
|
|
<QRScanner
|
|
|
:trip="selectedTrip"
|
|
|
+ :ticketStats="ticketStats"
|
|
|
@ticket-validated="onTicketValidated"
|
|
|
@back="activeTab = selectedTrip ? 'trip-details' : 'trips'"
|
|
|
/>
|
|
|
@@ -252,9 +296,18 @@ const userStore = useUserStore()
|
|
|
|
|
|
// État réactif
|
|
|
const activeTab = ref('overview')
|
|
|
-const selectedTrip = ref(null)
|
|
|
+const selectedTrip = ref<AssignedTrip | null>(null)
|
|
|
const showValidationModal = ref(false)
|
|
|
const isLoading = ref(false)
|
|
|
+const selectedTripPassengers = ref<any[]>([])
|
|
|
+
|
|
|
+// Interface pour les statistiques des tickets
|
|
|
+interface TicketStats {
|
|
|
+ total: number
|
|
|
+ validated: number
|
|
|
+ pending: number
|
|
|
+ cancelled: number
|
|
|
+}
|
|
|
|
|
|
// Données simulées (à remplacer par des appels API)
|
|
|
const stats = ref({
|
|
|
@@ -262,25 +315,12 @@ const stats = ref({
|
|
|
scannedTickets: 23,
|
|
|
todayPassengers: 45,
|
|
|
})
|
|
|
-
|
|
|
-const tripsDay = ref<AssignedTrip[] | any>([])
|
|
|
-
|
|
|
// Trajets de l'entreprise (remplace les données statiques)
|
|
|
-const todayTrips = ref([])
|
|
|
-
|
|
|
-const allTrips = ref([
|
|
|
- ...todayTrips.value,
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- departure: 'Abidjan',
|
|
|
- arrival: 'Yamoussoukro',
|
|
|
- departureTime: '09:00',
|
|
|
- arrivalTime: '12:00',
|
|
|
- passengers: 20,
|
|
|
- capacity: 30,
|
|
|
- status: 'scheduled',
|
|
|
- date: '2024-01-16'
|
|
|
- }
|
|
|
+const todayTrips = ref<AssignedTrip[]>([])
|
|
|
+const companyTrips = ref<AssignedTrip[]>([])
|
|
|
+
|
|
|
+const allTrips = ref<AssignedTrip[]>([
|
|
|
+ ...todayTrips.value
|
|
|
])
|
|
|
|
|
|
// Onglets de navigation
|
|
|
@@ -299,18 +339,46 @@ const nextTripTime = computed(() => {
|
|
|
return 'Aucun'
|
|
|
})
|
|
|
|
|
|
+const ticketStats = computed((): TicketStats => {
|
|
|
+ const total = selectedTripPassengers.value.length
|
|
|
+ const validated = selectedTripPassengers.value.filter(p => p.ticketStatus === 'validated').length
|
|
|
+ const pending = selectedTripPassengers.value.filter(p => p.ticketStatus === 'valid' || p.ticketStatus === 'pending').length
|
|
|
+ const cancelled = selectedTripPassengers.value.filter(p => p.ticketStatus === 'cancelled').length
|
|
|
+
|
|
|
+ console.log('📊 Calcul des stats tickets:', {
|
|
|
+ total,
|
|
|
+ validated,
|
|
|
+ pending,
|
|
|
+ cancelled,
|
|
|
+ passengersData: selectedTripPassengers.value,
|
|
|
+ passengersCount: selectedTripPassengers.value.length,
|
|
|
+ statusBreakdown: selectedTripPassengers.value.map(p => ({ name: p.name, status: p.ticketStatus }))
|
|
|
+ })
|
|
|
+
|
|
|
+ return { total, validated, pending, cancelled }
|
|
|
+})
|
|
|
+
|
|
|
// Méthodes
|
|
|
const loadDashboardData = async () => {
|
|
|
+ console.log('🚀 Début du chargement des données du dashboard')
|
|
|
+ console.log('👤 Utilisateur connecté:', userStore.user)
|
|
|
+ console.log('🏢 ID de l\'entreprise:', userStore.companyId)
|
|
|
+
|
|
|
isLoading.value = true
|
|
|
try {
|
|
|
// Chargement des données réelles via le service
|
|
|
+ console.log('📊 Chargement des trajets de l\'entreprise d\'abord...')
|
|
|
+ await loadCompanyTrips()
|
|
|
+
|
|
|
+ console.log('📊 Chargement des trajets assignés et statistiques...')
|
|
|
await Promise.all([
|
|
|
loadTrips(),
|
|
|
- loadCompanyTrips(),
|
|
|
loadStatistics()
|
|
|
])
|
|
|
+ console.log('✅ Toutes les données chargées avec succès')
|
|
|
+ console.log('📋 Trajets du jour final:', todayTrips.value)
|
|
|
} catch (error) {
|
|
|
- console.error('Erreur lors du chargement des données:', error)
|
|
|
+ console.error('❌ Erreur lors du chargement des données:', error)
|
|
|
} finally {
|
|
|
isLoading.value = false
|
|
|
}
|
|
|
@@ -329,27 +397,63 @@ const loadCompanyTrips = async () => {
|
|
|
|
|
|
const result = await TripService.getTripsByCompany(companyId, 1, 10)
|
|
|
|
|
|
- // Transformer les données pour correspondre au format attendu
|
|
|
- todayTrips.value = result.trips.map(trip => ({
|
|
|
- id: trip.id,
|
|
|
- departure: trip.departStation?.name || 'Station inconnue',
|
|
|
- arrival: trip.arriveStation?.name || 'Station inconnue',
|
|
|
- departureTime: new Date(trip.departAt).toLocaleTimeString('fr-FR', {
|
|
|
- hour: '2-digit',
|
|
|
- minute: '2-digit'
|
|
|
- }),
|
|
|
- arrivalTime: new Date(trip.arriveAt).toLocaleTimeString('fr-FR', {
|
|
|
- hour: '2-digit',
|
|
|
- minute: '2-digit'
|
|
|
- }),
|
|
|
- passengers: trip.vehicule?.capacity - trip.availableSeats || 0,
|
|
|
- capacity: trip.vehicule?.capacity || 0,
|
|
|
- status: 'scheduled',
|
|
|
- pricePerSeat: trip.pricePerSeat,
|
|
|
- availableSeats: trip.availableSeats
|
|
|
- }))
|
|
|
-
|
|
|
- console.log(`${result.trips.length} trajets chargés pour l'entreprise ${companyId}`)
|
|
|
+ // Récupérer le nombre de passagers pour chaque trajet
|
|
|
+ const tripsWithPassengers = await Promise.all(
|
|
|
+ result.trips.map(async (trip) => {
|
|
|
+ try {
|
|
|
+ // Récupérer les passagers du trajet pour obtenir le nombre réel
|
|
|
+ const passengersResult = await TripService.getTripPassengers(trip.id, 1, 1)
|
|
|
+ const actualPassengers = passengersResult.pagination.total
|
|
|
+
|
|
|
+ return {
|
|
|
+ id: trip.id,
|
|
|
+ departure: trip.departStation?.name || 'Station inconnue',
|
|
|
+ arrival: trip.arriveStation?.name || 'Station inconnue',
|
|
|
+ departureTime: new Date(trip.departAt).toLocaleTimeString('fr-FR', {
|
|
|
+ hour: '2-digit',
|
|
|
+ minute: '2-digit'
|
|
|
+ }),
|
|
|
+ arrivalTime: new Date(trip.arriveAt).toLocaleTimeString('fr-FR', {
|
|
|
+ hour: '2-digit',
|
|
|
+ minute: '2-digit'
|
|
|
+ }),
|
|
|
+ passengers: actualPassengers, // Nombre réel de réservations
|
|
|
+ capacity: trip.vehicule?.number_places || 0,
|
|
|
+ vehicule: trip.vehicule, // Ajouter l'objet véhicule complet
|
|
|
+ status: 'scheduled',
|
|
|
+ pricePerSeat: trip.pricePerSeat,
|
|
|
+ availableSeats: trip.availableSeats,
|
|
|
+ registrationClosed: trip.registrationClosed || false // Ajouter registrationClosed
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`Erreur lors de la récupération des passagers pour le trajet ${trip.id}:`, error)
|
|
|
+ // Fallback avec le calcul précédent en cas d'erreur
|
|
|
+ return {
|
|
|
+ id: trip.id,
|
|
|
+ departure: trip.departStation?.name || 'Station inconnue',
|
|
|
+ arrival: trip.arriveStation?.name || 'Station inconnue',
|
|
|
+ departureTime: new Date(trip.departAt).toLocaleTimeString('fr-FR', {
|
|
|
+ hour: '2-digit',
|
|
|
+ minute: '2-digit'
|
|
|
+ }),
|
|
|
+ arrivalTime: new Date(trip.arriveAt).toLocaleTimeString('fr-FR', {
|
|
|
+ hour: '2-digit',
|
|
|
+ minute: '2-digit'
|
|
|
+ }),
|
|
|
+ passengers: Math.max(0, (trip.vehicule?.number_places || 0) - trip.availableSeats),
|
|
|
+ capacity: trip.vehicule?.number_places || 0,
|
|
|
+ vehicule: trip.vehicule, // Ajouter l'objet véhicule complet
|
|
|
+ status: 'scheduled',
|
|
|
+ pricePerSeat: trip.pricePerSeat,
|
|
|
+ availableSeats: trip.availableSeats,
|
|
|
+ registrationClosed: trip.registrationClosed || false // Ajouter registrationClosed
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ )
|
|
|
+
|
|
|
+ companyTrips.value = tripsWithPassengers
|
|
|
+ console.log(`${result.trips.length} trajets chargés pour l'entreprise ${companyId}`)
|
|
|
} catch (error) {
|
|
|
console.error('Erreur lors du chargement des trajets de l\'entreprise:', error)
|
|
|
// Fallback avec des données de démonstration en cas d'erreur
|
|
|
@@ -368,44 +472,136 @@ const loadStatistics = async () => {
|
|
|
|
|
|
const loadTrips = async () => {
|
|
|
try {
|
|
|
+ console.log('🚛 Début du chargement des trajets assignés')
|
|
|
const userId = userStore.userId
|
|
|
+ console.log('👤 ID utilisateur:', userId)
|
|
|
+
|
|
|
if (!userId) {
|
|
|
- console.error('ID utilisateur non disponible')
|
|
|
+ console.error('❌ ID utilisateur non disponible')
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ const today = new Date().toISOString().split('T')[0]
|
|
|
+ console.log('📅 Date du jour:', today)
|
|
|
+
|
|
|
+ console.log('🔄 Appel API EmployeeService.getAssignedTrips...')
|
|
|
const result = await EmployeeService.getAssignedTrips(
|
|
|
userId,
|
|
|
1, // page
|
|
|
10, // limit
|
|
|
undefined, // status filter
|
|
|
- new Date().toISOString().split('T')[0] // today's date
|
|
|
+ today // today's date
|
|
|
)
|
|
|
|
|
|
- trips.value = result.trips
|
|
|
- } catch (error) {
|
|
|
- console.error('Erreur lors du chargement des trajets:', error)
|
|
|
- // Fallback avec des données de démonstration en cas d'erreur
|
|
|
- trips.value = [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- departure: 'Abidjan',
|
|
|
- arrival: 'Bouaké',
|
|
|
- departureTime: '08:00',
|
|
|
- arrivalTime: '11:30',
|
|
|
- date: new Date().toISOString().split('T')[0],
|
|
|
- passengers: 45,
|
|
|
- capacity: 50,
|
|
|
- status: 'in_progress',
|
|
|
- vehicle: { id: 1, licensePlate: 'CI-001-AB', model: 'Mercedes Sprinter', capacity: 50 },
|
|
|
- company: { id: 1, name: 'Transport Express' },
|
|
|
- route: {
|
|
|
+ console.log('📦 Résultat de l\'API getAssignedTrips:', result)
|
|
|
+ console.log('📦 Nombre de trajets assignés trouvés:', result.trips?.length || 0)
|
|
|
+ console.log('📦 Détails des trajets assignés:', result.trips)
|
|
|
+
|
|
|
+ // Récupérer le nombre de passagers pour chaque trajet assigné
|
|
|
+ const tripsWithPassengers = await Promise.all(
|
|
|
+ result.trips.map(async (trip) => {
|
|
|
+ try {
|
|
|
+ // Récupérer les passagers du trajet pour obtenir le nombre réel
|
|
|
+ const passengersResult = await TripService.getTripPassengers(trip.id, 1, 1)
|
|
|
+ const actualPassengers = passengersResult.pagination.total
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...trip,
|
|
|
+ passengers: actualPassengers, // Remplacer par le nombre réel de réservations
|
|
|
+ registrationClosed: trip.registrationClosed || false // S'assurer que registrationClosed est présent
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`Erreur lors de la récupération des passagers pour le trajet ${trip.id}:`, error)
|
|
|
+ // Garder les données originales en cas d'erreur avec registrationClosed
|
|
|
+ return {
|
|
|
+ ...trip,
|
|
|
+ registrationClosed: trip.registrationClosed || false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ )
|
|
|
+
|
|
|
+ // Utiliser todayTrips au lieu de trips non déclarée
|
|
|
+ todayTrips.value = tripsWithPassengers
|
|
|
+ // Mettre à jour aussi allTrips pour la cohérence
|
|
|
+ allTrips.value = [...tripsWithPassengers]
|
|
|
+
|
|
|
+ console.log('✅ Trajets assignés chargés:', tripsWithPassengers.length)
|
|
|
+ console.log('📋 todayTrips.value:', todayTrips.value)
|
|
|
+
|
|
|
+ // Si aucun trajet assigné, utiliser les trajets de l'entreprise comme fallback
|
|
|
+ if (tripsWithPassengers.length === 0 && companyTrips.value.length > 0) {
|
|
|
+ console.log('🔄 Aucun trajet assigné trouvé, utilisation des trajets de l\'entreprise comme fallback')
|
|
|
+ todayTrips.value = companyTrips.value
|
|
|
+ allTrips.value = [...companyTrips.value]
|
|
|
+ }
|
|
|
+
|
|
|
+ // Ajouter temporairement des données de test avec registrationClosed pour démonstration
|
|
|
+ if (todayTrips.value.length === 0) {
|
|
|
+ console.log('🧪 Ajout de données de test avec registrationClosed')
|
|
|
+ todayTrips.value = [
|
|
|
+ {
|
|
|
id: 1,
|
|
|
- departureStation: { id: 1, name: 'Gare d\'Abidjan', city: 'Abidjan' },
|
|
|
- arrivalStation: { id: 2, name: 'Gare de Bouaké', city: 'Bouaké' }
|
|
|
+ departure: 'Abidjan',
|
|
|
+ arrival: 'Yamoussoukro',
|
|
|
+ departureTime: '08:00',
|
|
|
+ arrivalTime: '10:30',
|
|
|
+ passengers: 25,
|
|
|
+ capacity: 30,
|
|
|
+ registrationClosed: false,
|
|
|
+ vehicule: { type: 'Bus', immatriculation: 'AB-123-CI', number_places: 30 },
|
|
|
+ status: 'scheduled',
|
|
|
+ vehicle: { id: 1, licensePlate: 'AB-123-CI', model: 'Mercedes', capacity: 30 },
|
|
|
+ company: { id: 1, name: 'Transport Express' },
|
|
|
+ route: {
|
|
|
+ id: 1,
|
|
|
+ departureStation: { id: 1, name: 'Abidjan', city: 'Abidjan' },
|
|
|
+ arrivalStation: { id: 2, name: 'Yamoussoukro', city: 'Yamoussoukro' }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ departure: 'Bouaké',
|
|
|
+ arrival: 'Korhogo',
|
|
|
+ departureTime: '14:00',
|
|
|
+ arrivalTime: '17:00',
|
|
|
+ passengers: 18,
|
|
|
+ capacity: 25,
|
|
|
+ registrationClosed: true, // Trajet avec enregistrement fermé
|
|
|
+ vehicule: { type: 'Minibus', immatriculation: 'BK-456-CI', number_places: 25 },
|
|
|
+ status: 'scheduled',
|
|
|
+ vehicle: { id: 2, licensePlate: 'BK-456-CI', model: 'Toyota', capacity: 25 },
|
|
|
+ company: { id: 1, name: 'Transport Express' },
|
|
|
+ route: {
|
|
|
+ id: 2,
|
|
|
+ departureStation: { id: 3, name: 'Bouaké', city: 'Bouaké' },
|
|
|
+ arrivalStation: { id: 4, name: 'Korhogo', city: 'Korhogo' }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ departure: 'San Pedro',
|
|
|
+ arrival: 'Abidjan',
|
|
|
+ departureTime: '16:30',
|
|
|
+ arrivalTime: '19:45',
|
|
|
+ passengers: 12,
|
|
|
+ capacity: 20,
|
|
|
+ registrationClosed: true, // Autre trajet avec enregistrement fermé
|
|
|
+ vehicule: { type: 'Bus', immatriculation: 'SP-789-CI', number_places: 20 },
|
|
|
+ status: 'scheduled',
|
|
|
+ vehicle: { id: 3, licensePlate: 'SP-789-CI', model: 'Iveco', capacity: 20 },
|
|
|
+ company: { id: 1, name: 'Transport Express' },
|
|
|
+ route: {
|
|
|
+ id: 3,
|
|
|
+ departureStation: { id: 5, name: 'San Pedro', city: 'San Pedro' },
|
|
|
+ arrivalStation: { id: 1, name: 'Abidjan', city: 'Abidjan' }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- ]
|
|
|
+ ]
|
|
|
+ allTrips.value = [...todayTrips.value]
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('❌ Erreur lors du chargement des trajets:', error)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -416,36 +612,59 @@ const logout = () => {
|
|
|
router.push('/')
|
|
|
}
|
|
|
|
|
|
-const selectTrip = (trip: any) => {
|
|
|
+const selectTrip = async (trip: AssignedTrip) => {
|
|
|
selectedTrip.value = trip
|
|
|
activeTab.value = 'trip-details'
|
|
|
+
|
|
|
+ // Charger les passengers détaillés pour ce trip
|
|
|
+ await loadTripPassengers(trip.id)
|
|
|
}
|
|
|
|
|
|
-const openScanner = (trip?: any) => {
|
|
|
+const loadTripPassengers = async (tripId: number) => {
|
|
|
+ try {
|
|
|
+ const response = await EmployeeService.getTripPassengers(tripId)
|
|
|
+ selectedTripPassengers.value = response.data || []
|
|
|
+ console.log('✅ Passengers chargés pour le trip:', tripId, selectedTripPassengers.value.length)
|
|
|
+ console.log('📋 Détails des passengers:', selectedTripPassengers.value)
|
|
|
+ console.log('🔍 Structure de la réponse:', response)
|
|
|
+ } catch (error) {
|
|
|
+ console.error('❌ Erreur lors du chargement des passengers:', error)
|
|
|
+ selectedTripPassengers.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const openScanner = async (trip?: AssignedTrip) => {
|
|
|
+ console.log('🚀 openScanner appelé avec trip:', trip)
|
|
|
if (trip) {
|
|
|
selectedTrip.value = trip
|
|
|
+ console.log('📍 Trip sélectionné:', selectedTrip.value)
|
|
|
+ // Charger les passengers pour ce trip
|
|
|
+ await loadTripPassengers(trip.id)
|
|
|
+ } else {
|
|
|
+ console.log('⚠️ Aucun trip fourni à openScanner')
|
|
|
}
|
|
|
activeTab.value = 'scanner'
|
|
|
+ console.log('📱 Tab actif changé vers scanner')
|
|
|
}
|
|
|
|
|
|
-const onTicketValidated = (ticketData: any) => {
|
|
|
+const onTicketValidated = async (ticketData: any) => {
|
|
|
stats.value.scannedTickets++
|
|
|
showValidationModal.value = true
|
|
|
|
|
|
- // Mettre à jour les statistiques du trajet
|
|
|
+ // Recharger les passengers pour mettre à jour ticketStats
|
|
|
if (selectedTrip.value) {
|
|
|
- // Logique de mise à jour des passagers validés
|
|
|
+ await loadTripPassengers(selectedTrip.value.id)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const formatTime = (time: string) => {
|
|
|
return time
|
|
|
}
|
|
|
-
|
|
|
// Lifecycle
|
|
|
onMounted(() => {
|
|
|
// Charger les données depuis l'API
|
|
|
loadDashboardData()
|
|
|
+ console.log('🚀 EmployeeDashboard mounted', todayTrips.value)
|
|
|
})
|
|
|
|
|
|
const loadEmployeeData = async () => {
|