diff --git a/app/Http/Livewire/Administration/DatalinkAuthoritiesTable.php b/app/Http/Livewire/Administration/DatalinkAuthoritiesTable.php new file mode 100644 index 0000000..39389f1 --- /dev/null +++ b/app/Http/Livewire/Administration/DatalinkAuthoritiesTable.php @@ -0,0 +1,61 @@ +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(); + } +} diff --git a/app/Http/Livewire/Controllers/NotifyNewEtaForPilot.php b/app/Http/Livewire/Controllers/NotifyNewEtaForPilot.php index 7b39226..452d6d9 100644 --- a/app/Http/Livewire/Controllers/NotifyNewEtaForPilot.php +++ b/app/Http/Livewire/Controllers/NotifyNewEtaForPilot.php @@ -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() diff --git a/app/Services/VatsimDataService.php b/app/Services/VatsimDataService.php index 579c418..9d65759 100644 --- a/app/Services/VatsimDataService.php +++ b/app/Services/VatsimDataService.php @@ -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; @@ -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))) { @@ -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; diff --git a/public/favicon.ico b/public/favicon.ico index e69de29..7252f44 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/resources/views/_layouts/main.blade.php b/resources/views/_layouts/main.blade.php index f71e23b..7fe0474 100644 --- a/resources/views/_layouts/main.blade.php +++ b/resources/views/_layouts/main.blade.php @@ -6,6 +6,7 @@ @vite(['resources/scss/bootstrap.scss', 'resources/scss/site.scss', 'resources/js/app.js', 'resources/css/datatables.css']) @livewireStyles @if(isset($_pageTitle)) {{ $_pageTitle }} :: @endif natTrak :: VATSIM +