User can add/edit flights
This commit is contained in:
@@ -11,6 +11,7 @@ import AircraftToolTip from "@/Components/FlightsGoneBy/AircraftToolTip.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
flights: Flight[]
|
||||
canEdit: boolean
|
||||
}>()
|
||||
|
||||
const headers = [
|
||||
@@ -25,6 +26,7 @@ const headers = [
|
||||
{ title: 'DISTANCE', key: 'distance', sortable: true },
|
||||
{ title: 'AIRCRAFT', key: 'aircraft.designator', sortable: true },
|
||||
{ title: 'CLASS', key: 'flight_class', sortable: true },
|
||||
{ title: '', key: 'actions', sortable: false },
|
||||
]
|
||||
|
||||
const CLASS_ORDER: Record<string, number> = {
|
||||
@@ -206,6 +208,30 @@ const tableItems = computed(() =>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<!-- Actions -->
|
||||
<td class="v-data-table__td actions-cell">
|
||||
<template v-if="canEdit">
|
||||
<v-menu>
|
||||
<template #activator="{ props: menuProps }">
|
||||
<v-btn
|
||||
v-bind="menuProps"
|
||||
icon="mdi-dots-horizontal"
|
||||
variant="text"
|
||||
size="small"
|
||||
density="compact"
|
||||
/>
|
||||
</template>
|
||||
<v-list density="compact" bg-color="#1a1e2e">
|
||||
<v-list-item
|
||||
prepend-icon="mdi-pencil-outline"
|
||||
title="Edit"
|
||||
:href="route('flights.edit', { flight: (item as Flight).id })"
|
||||
/>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</template>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</template>
|
||||
</template>
|
||||
@@ -462,4 +488,17 @@ const tableItems = computed(() =>
|
||||
letter-spacing: 0.2em;
|
||||
color: #445;
|
||||
}
|
||||
|
||||
.actions-cell {
|
||||
width: 40px;
|
||||
padding: 0 0.5rem !important;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
:deep(.v-list-item-title) {
|
||||
font-family: 'Share Tech Mono', monospace !important;
|
||||
font-size: 0.8rem !important;
|
||||
letter-spacing: 0.08em !important;
|
||||
color: #c8cdd8 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -18,7 +18,7 @@ const menuOpen = ref(false)
|
||||
<Link :href="route('login')" class="nav-link">Log In</Link>
|
||||
<Link :href="route('register')" class="nav-link nav-link--highlight">Register</Link>
|
||||
</template>
|
||||
<span v-else class="nav-link nav-link--greeting">Welcome, {{ props.auth.user.name }}</span>
|
||||
<span v-else class="nav-link nav-link--greeting"><Link :href="route('dashboard')">Welcome, {{ props.auth.user.name }}</Link></span>
|
||||
</nav>
|
||||
|
||||
<!-- Hamburger (mobile only) -->
|
||||
@@ -33,7 +33,7 @@ const menuOpen = ref(false)
|
||||
<Link :href="route('login')" class="nav-link">Log In</Link>
|
||||
<Link :href="route('register')" class="nav-link nav-link--highlight">Register</Link>
|
||||
</template>
|
||||
<span v-else class="nav-link nav-link--greeting">Welcome, {{ props.auth.user.name }}</span>
|
||||
<span v-else class="nav-link nav-link--greeting"><Link :href="route('dashboard')">Welcome, {{ props.auth.user.name }}</Link></span>
|
||||
</nav>
|
||||
</Transition>
|
||||
</header>
|
||||
|
||||
@@ -39,7 +39,7 @@ const isEdit = !!props.flight
|
||||
const flightNumber = ref(props.flight?.flight_number ?? '')
|
||||
const lookupLoading = ref(false)
|
||||
const lookupError = ref<string | null>(null)
|
||||
const lookupComplete = ref(isEdit)
|
||||
const lookupComplete = ref(true)
|
||||
|
||||
interface LookupResult {
|
||||
airline_options: { value: number; title: string }[]
|
||||
|
||||
@@ -19,15 +19,10 @@ const name = computed(() => page?.props?.auth?.user?.name || 'there');
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col cols="12" md="6">
|
||||
<v-btn size="large" block href="#" prepend-icon="mdi-plus">
|
||||
<v-btn size="large" @click="router.visit(route('flights.add'))" block href="#" prepend-icon="mdi-plus">
|
||||
Add a Flight
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="12" md="6">
|
||||
<v-btn size="large" block href="#" prepend-icon="mdi-pencil-outline">
|
||||
Edit Flights
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="12" md="6">
|
||||
<v-btn size="large" block @click="router.visit(route('import.fr24'))" prepend-icon="mdi-import">
|
||||
Import from FR24
|
||||
@@ -38,7 +33,7 @@ const name = computed(() => page?.props?.auth?.user?.name || 'there');
|
||||
View Profile
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-col cols="12" md="6">
|
||||
<v-btn size="large" block @click="router.post(route('logout'))" prepend-icon="mdi-logout">
|
||||
Log Out
|
||||
</v-btn>
|
||||
|
||||
@@ -18,6 +18,7 @@ defineProps<{
|
||||
email: string
|
||||
}
|
||||
flights: Flight[]
|
||||
canEdit: boolean
|
||||
}>()
|
||||
|
||||
type View = 'board' | 'passes' | 'map'
|
||||
@@ -67,7 +68,7 @@ const activeView = ref<View>('map')
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<DepartureBoard v-if="activeView === 'board'" :flights="flights" />
|
||||
<DepartureBoard v-if="activeView === 'board'" :flights="flights" :canEdit="canEdit" />
|
||||
<BoardingPasses v-else-if="activeView === 'passes'" :flights="flights" />
|
||||
<ProfileMap v-else-if="activeView === 'map'" :flights="flights" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user