277 lines
8.0 KiB
Vue
277 lines
8.0 KiB
Vue
<script setup lang="ts">
|
|
import { Flight } from "@/Types/types";
|
|
import AirlineLogo from "@/Components/FlightsGoneBy/AirlineLogo.vue";
|
|
import AirportToolTip from "@/Components/FlightsGoneBy/AirportToolTip.vue";
|
|
import AircraftToolTip from "@/Components/FlightsGoneBy/AircraftToolTip.vue";
|
|
|
|
defineProps<{
|
|
flight: Flight
|
|
}>()
|
|
|
|
function classKey(flight: Flight): string {
|
|
const n = flight.flight_class?.name?.toLowerCase() ?? ''
|
|
if (n.includes('private')) return 'private'
|
|
if (n.includes('first')) return 'first'
|
|
if (n.includes('business')) return 'business'
|
|
if (n.includes('premium')) return 'premium'
|
|
return 'economy'
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="boarding-pass">
|
|
<div class="pass-header" :class="`class-${classKey(flight)}-global`">
|
|
<span v-if="flight.flight_class?.name !== 'Unspecified'" class="pass-header-class">
|
|
{{ flight.flight_class?.name }}
|
|
</span>
|
|
</div>
|
|
|
|
<div class="pass-body">
|
|
<div class="pass-route">
|
|
<div class="pass-endpoint">
|
|
<AirportToolTip :airport="flight.departure_airport">
|
|
<div class="pass-iata">{{ flight.departure_airport.display_code}}</div>
|
|
</AirportToolTip>
|
|
<div class="pass-endpoint-city">{{ flight.departure_airport.municipality }}</div>
|
|
<div class="pass-endpoint-date">{{ flight.departure_date_display }}</div>
|
|
<div class="pass-endpoint-time">{{ flight.departure_time_display }}</div>
|
|
</div>
|
|
|
|
<div class="pass-centre">
|
|
<div class="pass-plane-icon">✈</div>
|
|
<AirlineLogo :airline="flight.airline" size="44" class="pass-logo" />
|
|
<div class="pass-flight-number">{{ flight.flight_number }}</div>
|
|
<div class="pass-airline-name">{{ flight.airline?.name }}</div>
|
|
<AircraftToolTip v-if="flight.aircraft?.designator" :aircraft="flight.aircraft">
|
|
<div v-if="flight.aircraft?.designator" class="pass-aircraft">{{ flight.aircraft.manufacturer_code}} {{flight.aircraft.model_full_name}}</div>
|
|
</AircraftToolTip>
|
|
</div>
|
|
|
|
<div class="pass-endpoint pass-endpoint--right">
|
|
<AirportToolTip :airport="flight.arrival_airport">
|
|
<div class="pass-iata">{{ flight.arrival_airport.display_code}}</div>
|
|
</AirportToolTip>
|
|
<div class="pass-endpoint-city">{{ flight.arrival_airport.municipality }}</div>
|
|
<div class="pass-endpoint-date">{{ flight.arrival_date_display ?? flight.departure_date_display }}</div>
|
|
<div class="pass-endpoint-time">
|
|
{{ flight.arrival_time_display }}
|
|
<span v-if="flight.arrival_day_difference" class="pass-daydiff">+{{ flight.arrival_day_difference }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div v-if="flight.duration_display || flight.distance || flight.seat_number" class="pass-tear">
|
|
<div class="pass-tear-notch pass-tear-notch--left" />
|
|
<div class="pass-tear-notch pass-tear-notch--right" />
|
|
<div v-if="flight.duration_display || flight.distance " class="pass-stats-row">
|
|
<span v-if="flight.seat_number" class="pass-stat">
|
|
<span class="pass-stat-label">SEAT</span>
|
|
<span class="pass-stat-value">{{ flight.seat_number }}</span>
|
|
</span>
|
|
<span class="pass-stat-divider" v-if="flight.duration_display && flight.distance">·</span>
|
|
<span v-if="flight.duration_display" class="pass-stat">
|
|
<span class="pass-stat-label">DURATION</span>
|
|
<span class="pass-stat-value">{{ flight.duration_display }}</span>
|
|
</span>
|
|
<span class="pass-stat-divider" v-if="flight.duration_display && flight.distance">·</span>
|
|
<span v-if="flight.distance" class="pass-stat">
|
|
<span class="pass-stat-label">DISTANCE</span>
|
|
<span class="pass-stat-value">{{ Math.round(flight.distance).toLocaleString() }} km</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.pass-stats-row {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.75rem;
|
|
margin-top: 1rem;
|
|
padding-top: 0.75rem;
|
|
background-image: repeating-linear-gradient(
|
|
to right,
|
|
rgba(255,255,255,0.08) 0px,
|
|
rgba(255,255,255,0.08) 6px,
|
|
transparent 6px,
|
|
transparent 12px
|
|
);
|
|
background-size: 100% 1px;
|
|
background-repeat: no-repeat;
|
|
background-position: top center;
|
|
}
|
|
|
|
.pass-tear {
|
|
position: relative;
|
|
margin-top: 1rem;
|
|
}
|
|
|
|
.pass-tear-notch {
|
|
position: absolute;
|
|
top: 0;
|
|
width: 15px;
|
|
height: 15px;
|
|
background: #0e1018; /* match your page background */
|
|
border-radius: 50%;
|
|
transform: translateY(-50%);
|
|
z-index: 1;
|
|
}
|
|
|
|
.pass-tear-notch--left { left: -1.6rem; } /* bleeds into the padding */
|
|
.pass-tear-notch--right { right: -1.6rem; }
|
|
|
|
.pass-stat {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 0.15rem;
|
|
}
|
|
|
|
.pass-stat-label {
|
|
font-family: 'Share Tech Mono', monospace;
|
|
font-size: 0.55rem;
|
|
letter-spacing: 0.18em;
|
|
color: #445566;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.pass-stat-value {
|
|
font-family: 'Share Tech Mono', monospace;
|
|
font-size: 0.82rem;
|
|
color: #9aa;
|
|
letter-spacing: 0.06em;
|
|
}
|
|
|
|
.pass-stat-divider {
|
|
color: #334;
|
|
font-size: 1rem;
|
|
line-height: 1;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.boarding-pass {
|
|
background: #181b24;
|
|
border-radius: 10px;
|
|
overflow: hidden;
|
|
border: 1px solid rgba(255,255,255,0.06);
|
|
box-shadow: 0 8px 32px rgba(0,0,0,0.5);
|
|
}
|
|
|
|
.pass-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
padding: 0.5rem 0.85rem;
|
|
min-height: 2rem;
|
|
border-bottom: 1px solid rgba(255,255,255,0.06);
|
|
}
|
|
|
|
.pass-header-class {
|
|
font-family: 'Share Tech Mono', monospace;
|
|
font-size: 0.62rem;
|
|
letter-spacing: 0.18em;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.pass-body {
|
|
padding: 1.25rem 1.25rem 1rem;
|
|
}
|
|
|
|
.pass-route {
|
|
display: grid;
|
|
grid-template-columns: 1fr auto 1fr;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.pass-endpoint {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.2rem;
|
|
}
|
|
|
|
.pass-endpoint--right {
|
|
text-align: right;
|
|
align-items: flex-end;
|
|
}
|
|
|
|
.pass-iata {
|
|
font-family: 'Barlow Condensed', sans-serif;
|
|
font-size: 3rem;
|
|
font-weight: 700;
|
|
color: #f0f2f5;
|
|
letter-spacing: 0.02em;
|
|
line-height: 1;
|
|
}
|
|
|
|
.pass-endpoint-city {
|
|
font-family: 'Barlow', sans-serif;
|
|
font-size: 0.8rem;
|
|
color: #778899;
|
|
font-weight: 500;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.pass-endpoint-date {
|
|
font-family: 'Share Tech Mono', monospace;
|
|
font-size: 0.7rem;
|
|
color: #445566;
|
|
letter-spacing: 0.04em;
|
|
}
|
|
|
|
.pass-endpoint-time {
|
|
font-family: 'Share Tech Mono', monospace;
|
|
font-size: 1rem;
|
|
color: #c8cdd8;
|
|
letter-spacing: 0.06em;
|
|
}
|
|
|
|
.pass-centre {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 0.3rem;
|
|
padding: 0 0.5rem;
|
|
}
|
|
|
|
.pass-plane-icon {
|
|
font-size: 0.9rem;
|
|
color: #445566;
|
|
margin-bottom: 0.1rem;
|
|
}
|
|
|
|
.pass-logo { opacity: 0.9; }
|
|
|
|
.pass-flight-number {
|
|
font-family: 'Share Tech Mono', monospace;
|
|
font-size: 0.85rem;
|
|
font-weight: 700;
|
|
color: #e8eaf0;
|
|
letter-spacing: 0.08em;
|
|
}
|
|
|
|
.pass-airline-name {
|
|
font-family: 'Barlow', sans-serif;
|
|
font-size: 0.72rem;
|
|
color: #778899;
|
|
text-align: center;
|
|
}
|
|
|
|
.pass-aircraft {
|
|
font-size: 0.65rem;
|
|
color: #445566;
|
|
letter-spacing: 0.06em;
|
|
white-space: nowrap
|
|
}
|
|
|
|
.pass-daydiff {
|
|
font-size: 0.65rem;
|
|
color: #ffc107;
|
|
margin-left: 0.15rem;
|
|
vertical-align: super;
|
|
}
|
|
</style>
|