Added Notifications
@@ -7,6 +7,7 @@ use App\Models\UserFlight;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
#[Signature('app:flight-feed-update')]
|
||||
#[Description('Command description')]
|
||||
@@ -14,24 +15,26 @@ class FlightFeedUpdate extends Command
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
$time = now('UTC');
|
||||
$time = now('UTC')->startOfMinute();
|
||||
|
||||
$this->logFlightActions('flight_departing', UserFlight::where('departure_date', $time)->get()->toArray());
|
||||
$this->logFlightActions('flight_arriving', UserFlight::where('arrival_date', $time)->get()->toArray());
|
||||
$this->logFlightActions('flight_departing', UserFlight::where('departure_date', $time)->get());
|
||||
$this->logFlightActions('flight_arriving', UserFlight::where('arrival_date', $time)->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param UserFlight[] $flights
|
||||
* @param Collection<UserFlight> $flights
|
||||
* @return void
|
||||
*/
|
||||
private function logFlightActions(string $type, array $flights): void
|
||||
private function logFlightActions(string $type, Collection $flights): void
|
||||
{
|
||||
foreach ($flights as $flight) {
|
||||
UserAction::create([
|
||||
'user_id' => $flight->user_id,
|
||||
'type' => $type,
|
||||
'data' => $flight->snapshot($flight->id),
|
||||
'data' => [
|
||||
'flight' => $flight->snapshot($flight->id),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ class UpdateDepartedFlights extends Command
|
||||
public function handle(): void
|
||||
{
|
||||
$now = now()->utc();
|
||||
$oneHourAgo = $now->copy()->subHours(1);
|
||||
|
||||
$userFlights = UserFlight::where('arrival_date', '<=', $now->copy()->subHour()->toDateTimeString())
|
||||
->where('auto_update', true)
|
||||
|
||||
@@ -13,7 +13,7 @@ class AdminToolsController extends Controller
|
||||
->map(fn ($path) => pathinfo($path, PATHINFO_FILENAME))
|
||||
->toArray();*/
|
||||
|
||||
$existingFiles = collect(glob('C:\\Users\\josh\\WebstormProjects\\Watermark-Remover\\images\\liveries_processed\\*'))
|
||||
$existingFiles = collect(glob(public_path('img/liveries/generated/*')))
|
||||
->map(fn ($path) => pathinfo($path, PATHINFO_FILENAME))
|
||||
->toArray();
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ class UserAction extends Model
|
||||
'flight_imported' => 'Flight Imported from FR24',
|
||||
'flight_logged' => 'Flight Logged',
|
||||
'flight_deleted' => 'Flight Deleted',
|
||||
'flight_departing' => 'Flight Departed',
|
||||
'flight_arriving' => 'Flight Landed',
|
||||
default => 'Unknown Action'
|
||||
}
|
||||
);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Aircraft;
|
||||
use App\Models\Airline;
|
||||
use App\Models\Country;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Airline::create([
|
||||
'name' => 'Scoot',
|
||||
'IATA_code' => 'TR',
|
||||
'ICAO_code' => 'TGW',
|
||||
'internal_name' => 'scoot-new',
|
||||
'logo' => 'TR.png',
|
||||
'active' => true,
|
||||
'country_id' => Country::whereCode('SG')->first()->id,
|
||||
]);
|
||||
|
||||
Aircraft::where('manufacturer_code', 'ATR')
|
||||
->each(function ($aircraft) {
|
||||
$aircraft->update([
|
||||
'model_full_name' => str_replace('ATR-', '', $aircraft->model_full_name),
|
||||
]);
|
||||
});
|
||||
|
||||
Aircraft::where('manufacturer_code', 'AIRBUS')
|
||||
->each(function ($aircraft) {
|
||||
$aircraft->update([
|
||||
'model_full_name' => str_replace('A-', 'A', $aircraft->model_full_name),
|
||||
]);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
|
After Width: | Height: | Size: 234 KiB |
|
After Width: | Height: | Size: 471 KiB |
|
After Width: | Height: | Size: 514 KiB |
|
After Width: | Height: | Size: 405 KiB |
|
After Width: | Height: | Size: 519 KiB |
|
After Width: | Height: | Size: 436 KiB |
|
After Width: | Height: | Size: 483 KiB |
|
After Width: | Height: | Size: 470 KiB |
|
After Width: | Height: | Size: 507 KiB |
|
After Width: | Height: | Size: 521 KiB |
|
After Width: | Height: | Size: 538 KiB |
|
After Width: | Height: | Size: 216 KiB |
|
After Width: | Height: | Size: 459 KiB |
|
After Width: | Height: | Size: 751 KiB |
|
After Width: | Height: | Size: 500 KiB |
|
After Width: | Height: | Size: 586 KiB |
|
After Width: | Height: | Size: 546 KiB |
|
After Width: | Height: | Size: 542 KiB |
|
After Width: | Height: | Size: 356 KiB |
|
After Width: | Height: | Size: 478 KiB |
|
After Width: | Height: | Size: 561 KiB |
@@ -13,13 +13,14 @@ import FlightUpdatedFeedItem from "@/Components/FlightsGoneBy/Feed/FlightUpdated
|
||||
import FlightCancelledFeedItem from "@/Components/FlightsGoneBy/Feed/FlightCancelledFeedItem.vue";
|
||||
import FlightImportedFeedItem from "@/Components/FlightsGoneBy/Feed/FlightImportedFeedItem.vue";
|
||||
import FlightMovedFeedItem from "@/Components/FlightsGoneBy/Feed/FlightMovedFeedItem.vue";
|
||||
import ButtonLink from "@/Components/FlightsGoneBy/ButtonLink.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
action: UserAction
|
||||
}>()
|
||||
|
||||
const flight = computed(() =>{
|
||||
if (props.action.type === 'flight_booked' || props.action.type === 'flight_logged'){
|
||||
if (props.action.type === 'flight_booked' || props.action.type === 'flight_logged' || props.action.type === 'flight_departing' || props.action.type === 'flight_arriving' || props.action.type === 'flight_imported'){
|
||||
return (props.action.data as UserActionFlightBookedData).flight
|
||||
} else if (props.action.type === 'flight_updated'){
|
||||
return (props.action.data as UserActionFlightUpdatedData).updated
|
||||
@@ -77,15 +78,10 @@ function timeAgo(dateStr: string): string {
|
||||
<FlightImportedFeedItem v-if="action.type == 'flight_imported'" :flight="(action.data as UserActionFlightBookedData).flight" ></FlightImportedFeedItem>
|
||||
<FlightUpdatedFeedItem v-if="action.type == 'flight_updated'" :data="(action.data as UserActionFlightUpdatedData)" ></FlightUpdatedFeedItem>
|
||||
<FlightCancelledFeedItem v-if="action.type == 'flight_cancelled'" :data="(action.data as UserActionFlightCancelledData)" flight=""></FlightCancelledFeedItem>
|
||||
<FlightMovedFeedItem v-if="action.type == 'flight_departing' || action.type== 'flight_arriving'" :flight="(action.data as UserActionFlightBookedData).flight" ></FlightMovedFeedItem>/
|
||||
<FlightMovedFeedItem v-if="action.type == 'flight_departing' || action.type== 'flight_arriving'" :action="action.type" :flight="(action.data as UserActionFlightBookedData).flight" ></FlightMovedFeedItem>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<Link v-if="flight" :href="`/u/${action.user?.name}/departure-board/${flight?.id}`" class="view-flight-link">
|
||||
View Flight
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M5 12h14M13 6l6 6-6 6"/>
|
||||
</svg>
|
||||
</Link>
|
||||
<ButtonLink v-if="flight" :href="route('profile.flight', { user: action.user?.name, userFlight: flight?.id })" label="View Flight" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -146,13 +142,6 @@ function timeAgo(dateStr: string): string {
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.changes {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.3rem 1rem;
|
||||
margin: 0;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.changes dt {
|
||||
color: #9ca3af;
|
||||
@@ -166,24 +155,6 @@ function timeAgo(dateStr: string): string {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.view-flight-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
color: #818cf8;
|
||||
text-decoration: none;
|
||||
padding: 0.35rem 0.75rem;
|
||||
border: 1px solid rgba(99, 102, 241, 0.25);
|
||||
background: rgba(99, 102, 241, 0.08);
|
||||
transition: background 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.view-flight-link:hover {
|
||||
background: rgba(99, 102, 241, 0.18);
|
||||
border-color: rgba(99, 102, 241, 0.45);
|
||||
}
|
||||
|
||||
.view-flight-link svg {
|
||||
width: 0.85rem;
|
||||
|
||||
@@ -15,9 +15,22 @@ const actionText = computed(() => props.action === 'flight_departing' ? 'departe
|
||||
|
||||
<template>
|
||||
<div class="flight-booked">
|
||||
Flight <FlightBadge :flight="flight" /> from {{flight.departure_airport.municipality}} to {{flight.arrival_airport.municipality}} has {{actionText}}.
|
||||
<span class="flight-summary">
|
||||
Flight <FlightBadge :flight="flight" /> from {{flight.departure_airport.municipality}} to {{flight.arrival_airport.municipality}} has {{actionText}}.
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.flight-booked {
|
||||
padding: 0.75rem 1.25rem;
|
||||
}
|
||||
|
||||
.flight-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
color: #9ca3af;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -112,37 +112,6 @@ header {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* Notification button */
|
||||
.notif-btn {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
color: var(--text);
|
||||
border-radius: 4px;
|
||||
transition: color 0.15s ease, background 0.15s ease;
|
||||
}
|
||||
|
||||
.notif-btn:hover {
|
||||
color: var(--accent);
|
||||
background: rgba(56, 189, 248, 0.07);
|
||||
}
|
||||
|
||||
.notif-dot {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
background: var(--accent);
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid var(--bg);
|
||||
}
|
||||
|
||||
/* Shared nav link base */
|
||||
.nav-link {
|
||||
|
||||
@@ -21,6 +21,10 @@ const markAllRead = async (notifications: Notification[]) => {
|
||||
unread.forEach(n => n.read_at = new Date().toISOString())
|
||||
}
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:unreadCount', value: number): void
|
||||
}>()
|
||||
|
||||
watch(open, async (isOpen) => {
|
||||
if (!isOpen || notifications.value.length) return
|
||||
loading.value = true
|
||||
@@ -28,6 +32,7 @@ watch(open, async (isOpen) => {
|
||||
notifications.value = data
|
||||
loading.value = false
|
||||
await markAllRead(notifications.value)
|
||||
emit('update:unreadCount', 0) // <-- add this
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -84,7 +89,8 @@ watch(open, async (isOpen) => {
|
||||
.notif-menu {
|
||||
position: absolute;
|
||||
top: calc(100% + 0.4rem);
|
||||
right: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 320px;
|
||||
background: var(--bg);
|
||||
border: 1px solid rgba(56, 189, 248, 0.12);
|
||||
|
||||