Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8.8 #172

Merged
merged 12 commits into from
Dec 18, 2024
61 changes: 61 additions & 0 deletions app/Http/Livewire/Administration/DatalinkAuthoritiesTable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace App\Http\Livewire\Administration;

use App\Models\DatalinkAuthority;
use Rappasoft\LaravelLivewireTables\DataTableComponent;
use Rappasoft\LaravelLivewireTables\Views\Column;
use Rappasoft\LaravelLivewireTables\Views\Columns\BooleanColumn;

class DatalinkAuthoritiesTable extends DataTableComponent
{
protected $model = DatalinkAuthority::class;

public function configure(): void
{
$this->setPrimaryKey('id');
}

public function columns(): array
{
return [
Column::make("Id", "id")
->sortable(),
Column::make("Name", "name")
->sortable(),
Column::make("Prefix", "prefix")
->sortable(),
BooleanColumn::make("Auto acknowledge participant", "auto_acknowledge_participant")
->sortable()->toggleable('changeAutoAcknowledge'),
BooleanColumn::make("Valid rcl target", "valid_rcl_target")
->sortable()->toggleable('changeValidRclTarget'),
BooleanColumn::make("System", "system")
->sortable()->toggleable('changeSystem'),
Column::make("Created at", "created_at")
->sortable(),
Column::make("Updated at", "updated_at")
->sortable(),
];
}

public function changeAutoAcknowledge(string $id)
{
$authority = $this->model::find($id);
$authority->auto_acknowledge_participant = !$authority->auto_acknowledge_participant;
$authority->save();
}

public function changeValidRclTarget(string $id)
{
$authority = $this->model::find($id);
$authority->valid_rcl_target = !$authority->valid_rcl_target;
$authority->save();
}

public function changeSystem(string $id)
{
$authority = $this->model::find($id);
$authority->system = !$authority->system;
$authority->save();
}
}
2 changes: 1 addition & 1 deletion app/Http/Livewire/Controllers/NotifyNewEtaForPilot.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function mount()
{
$this->domesticAuthorities = DomesticAuthorities::cases();
$dataService = new VatsimDataService();
$this->activeDomesticAuthority = $dataService->getActiveDomesticControllerAuthorirty(Auth::user())->value ?? DomesticAuthorities::UNKN->value;
$this->activeDomesticAuthority = $dataService->getActiveDomesticControllerAuthority(Auth::user())->value ?? DomesticAuthorities::UNKN->value;
}

public function render()
Expand Down
12 changes: 7 additions & 5 deletions app/Services/VatsimDataService.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public function isActiveOceanicController(VatsimAccount $vatsimAccount)

if ($online) {
$authorities = [];
foreach (DatalinkAuthorities::cases() as $authority) {
$authorities[] = $authority->value;
foreach (DatalinkAuthority::all() as $authority) {
$authorities[] = $authority->prefix;
}

$callsign = $this->getActiveControllerData($vatsimAccount)->callsign;
Expand All @@ -107,8 +107,10 @@ public function isActiveBoundaryDomesticController(VatsimAccount $vatsimAccount)

if ($online) {
$authorities = [];
foreach (DomesticAuthorities::cases() as $authority) {
$authorities[] = $authority->value;
foreach (DatalinkAuthority::all() as $authority) {
if (! $authority->valid_rcl_target) {
$authorities[] = $authority->prefix;
}
}
$callsign = $this->getActiveControllerData($vatsimAccount)->callsign;
if ((in_array(strtok($callsign, '_'), $authorities)) || (in_array(strtok($callsign, '-'), $authorities))) {
Expand Down Expand Up @@ -136,7 +138,7 @@ public function getActiveControllerAuthority(VatsimAccount $vatsimAccount)
return null;
}

public function getActiveDomesticControllerAuthorirty(VatsimAccount $vatsimAccount)
public function getActiveDomesticControllerAuthority(VatsimAccount $vatsimAccount)
{
if (! $this->isActiveBoundaryDomesticController($vatsimAccount) || $this->getActiveControllerData($vatsimAccount) == null) {
return null;
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions resources/views/_layouts/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@vite(['resources/scss/bootstrap.scss', 'resources/scss/site.scss', 'resources/js/app.js', 'resources/css/datatables.css'])
@livewireStyles
<title>@if(isset($_pageTitle)) {{ $_pageTitle }} :: @endif natTrak :: VATSIM</title>
<link rel="shortcut icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
</head>
<body>
<header id="header">
Expand Down Expand Up @@ -44,6 +45,10 @@
<li>
<a href="{{ route('administration.utility') }}" class="dropdown-item">Utility</a>
</li>
<li>
<a href="{{ route('administration.datalink-authorities') }}"
class="dropdown-item">Datalink Authorities</a>
</li>
</ul>
</li>
@endcan
Expand Down
7 changes: 7 additions & 0 deletions resources/views/administration/datalink-authorities.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@extends('_layouts.main')
@section('page')
<div class="container">
<h2 class="fs-2 font-display text-primary-emphasis">Datalink authorities</h2>
<livewire:administration.datalink-authorities-table />
</div>
@endsection
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</a>
</p>
<p class="mb-4">
<a class="icon-link icon-link-hover" href="{{ route('controllers.clx.processed') }}">
<a class="icon-link icon-link-hover" href="{{ route('controllers.clx.pending') }}">
<i class="fa-solid fa-chevron-left"></i>
Processed
</a>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/controllers/nav.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
@can('activeBoundaryController')
Domestic
@else
{{ current_dl_authority() ?? 'Offline' }}
{{ current_dl_authority()->prefix ?? 'Offline' }}
@endcan
</span>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#controller-nav" aria-controls="controller-nav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="controller-nav">
<ul class="navbar-nav gap-2">
@can('activeController')
@canany('activeController')
<li class="nav-item">
<a class="nav-link {{ Request::is('controllers/clx/pending') ? 'active' : '' }}" href="{{ route('controllers.clx.pending') }}">Pending Messages</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</a>
</p>
<p class="mb-4">
<a class="icon-link icon-link-hover" href="{{ route('controllers.clx.pending') }}">
<a class="icon-link icon-link-hover" href="{{ route('controllers.clx.processed') }}">
<i class="fa-solid fa-chevron-left"></i>
Processed
</a>
Expand Down Expand Up @@ -93,7 +93,7 @@
<div class="fst-italic">or...</div>
</div>
</div>
<div class="col-auto">
<div class="col-lg">
<div class="form-floating">
<input wire:model.blur="randomRouteing" value="{{ old('random_routeing') }}" type="text" class="form-control" name="random_routeing" id="random_routeing" placeholder="e.g. GOMUP 59/20 59/30 58/40 56/50 JANJO" onblur="this.value = this.value.toUpperCase()">
<label for="random_routeing">Random routeing</label>
Expand Down
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

Route::get('/utility', [AdministrationController::class, 'utility'])->name('.utility');
Route::post('/utility/clear', [AdministrationController::class, 'clearDb'])->name('.clear-db');

Route::view('/datalink-authorities', 'administration.datalink-authorities')->name('.datalink-authorities');
});

Route::prefix('pilots')->name('pilots')->middleware('can:activePilot')->group(function () {
Expand Down