From 2b28589848315d2aaf21b59907cb25a1013b216a Mon Sep 17 00:00:00 2001 From: alexcaussades Date: Tue, 23 Jul 2024 10:48:19 +0200 Subject: [PATCH] Feature/sid star (#159) * change sid and star * remove sid star from * change atc * set arr and dep airport * data recherche des atc en ligne sur une plateforme * update last version * en attente de changement * final concept atc page --- app/Http/Controllers/eventController.php | 77 ++++++++- .../Controllers/myOnlineServeurController.php | 10 +- app/Http/Controllers/whazzupController.php | 15 ++ resources/views/myoline/atc.blade.php | 38 ----- resources/views/myoline/pilot.blade.php | 33 +--- resources/views/plateforme/atc.blade.php | 150 ++++++++++++++++++ routes/web.php | 23 ++- 7 files changed, 267 insertions(+), 79 deletions(-) create mode 100644 resources/views/plateforme/atc.blade.php diff --git a/app/Http/Controllers/eventController.php b/app/Http/Controllers/eventController.php index b2ffaa8..4359a56 100644 --- a/app/Http/Controllers/eventController.php +++ b/app/Http/Controllers/eventController.php @@ -46,10 +46,15 @@ public function get_last_arrival($route) public function aircrafts($icao_code){ $whazzup = new whazzupController(); $aircrafts = $whazzup->get_aircrafts($icao_code); - //dd($aircrafts); return $aircrafts["wakeTurbulence"]; } + public function aircrafts_model($icao_code){ + $whazzup = new whazzupController(); + $aircrafts = $whazzup->get_aircrafts($icao_code); + return $aircrafts["model"]; + } + public function ETA($distance_arrival, $speed) { $distance_arrival = explode(".", $distance_arrival); @@ -130,4 +135,74 @@ public function Star($route){ break; } } + + public function Departure(){ + $q = $this->get_arrival(); + $r = $q["outbound"]; + $sr = []; + // filter la liste avec les parametres dans la liste [lastTrack][altitude] avec [lastTrack][onGround] + for ($i = 0; $i < count($r); $i++) { + if ($r[$i]["lastTrack"]["onGround"] == true) { + $sr[$i]["callsign"] = $r[$i]["callsign"]; + $sr[$i]["model"] = $this->aircrafts_model($r[$i]["flightPlan"]["aircraftId"]); + $sr[$i]["wakeTurbulence"] = $this->aircrafts($r[$i]["flightPlan"]["aircraftId"]); + $sr[$i]["arrival"] = $r[$i]["flightPlan"]["arrivalId"]; + $sr[$i]["fp"] = $this->get_fp($r[$i]["id"]); + $sr[$i]["departureTime"] = $this->get_fp($r[$i]["id"])[0]["departureTime"]; + $sr[$i]["departureTime"] = Carbon::parse($sr[$i]["departureTime"])->format('H:i'); + $sr[$i]["peopleOnBoard"] = $this->get_fp($r[$i]["id"])[0]["peopleOnBoard"]; + $sr[$i]["rule"] = $this->get_fp($r[$i]["id"])[0]["flightRules"]; + $sr[$i]["fp"] = null; + } + } + $sr = array_values($sr); + $query = [ + "count" => count($sr), + "data" => $sr + ]; + return $query; + } + + public function get_atc_online(){ + $whazzup = new whazzupController(); + $atc = $whazzup->position_search($this->icao); + $sy = []; + for ($i = 0; $i < count($atc); $i++) { + $sy[$i] = $atc[$i]; + } + $sy = collect($sy)->toArray(); + $r = new whazzupController(); + $r = $r->atc_tracking(); + $sr = []; + for ($i = 0; $i < count($r); $i++) { + if ($r[$i]["callsign"]) { + $sr[$i]["callsign"] = $r[$i]["callsign"]; + $sr[$i]["time"] = Carbon::parse($r[$i]["time"])->format('H:i'); + $sr[$i]["frequency"] = $r[$i]["atcSession"]["frequency"]; + $sr[$i]["id"] = $r[$i]["id"]; + } + } + $sr = collect($sr)->toArray(); + // rechercher dans la liste sr les callsigns qui sont dans la liste sy et les mettre dans une liste + $online = []; + foreach ($sr as $key => $value) { + if (in_array($value["callsign"], $sy)) { + array_push($online, $value); + } + } + return $online; + } + + public function get_arrival_departure(){ + + $arrival = $this->get_general(); + $departure = $this->Departure(); + $atc = $this->get_atc_online(); + $query = [ + "arrival" => $arrival, + "departure" => $departure, + "atc" => $atc + ]; + return $query; + } } diff --git a/app/Http/Controllers/myOnlineServeurController.php b/app/Http/Controllers/myOnlineServeurController.php index 51c0651..2d8ed58 100644 --- a/app/Http/Controllers/myOnlineServeurController.php +++ b/app/Http/Controllers/myOnlineServeurController.php @@ -157,8 +157,8 @@ public function getVerrifOnlineServeur() $metar_arr = $whazzupp->Get_metar($fp_session["arrivalId"]); $taf_dep = $whazzupp->Get_taf($fp_session["departureId"]); $taf_arr = $whazzupp->Get_taf($fp_session["arrivalId"]); - $airac_ARR = $airac->get_approach($fp_session["arrivalId"]); - $airac_DEP = $airac->get_departure($fp_session["departureId"]); + //$airac_ARR = $airac->get_approach($fp_session["arrivalId"]); + //$airac_DEP = $airac->get_departure($fp_session["departureId"]); $airac_ils = $airac->get_ils_information($fp_session["arrivalId"]); if ($speed <= 0) { $speed = 1; @@ -222,15 +222,15 @@ public function getVerrifOnlineServeur() "IFR" => $chartController->chartIFR($p["flightPlan"]["departureId"]), "VFR" => $chartController->chartVFR($p["flightPlan"]["departureId"]), "airac" => [ - "departure" => $airac_DEP, + "departure" => $airac_DEP ?? null, ], ], "arrival" => [ "IFR" => $chartController->chartIFR($p["flightPlan"]["arrivalId"]), "VFR" => $chartController->chartVFR($p["flightPlan"]["arrivalId"]), "airac" => [ - "arrival" => $airac_ARR, - "ils" => $airac_ils + "arrival" => $airac_ARR ?? null, + "ils" => $airac_ils ?? null, ], ] ]; diff --git a/app/Http/Controllers/whazzupController.php b/app/Http/Controllers/whazzupController.php index ca1d458..ee3c7b2 100644 --- a/app/Http/Controllers/whazzupController.php +++ b/app/Http/Controllers/whazzupController.php @@ -654,4 +654,19 @@ public function event_ivao() $event = $event->json(); return $event; } + + public function atc_tracking() + { + $atc = $this->API_request("v2/tracker/now/atc"); + $atc = $atc->json(); + return $atc; + } + + public function session_atc($id_session) + { + $atc = $this->API_request("v2/tracker/sessions/" . $id_session . "/atc"); + $atc = $atc->json(); + return $atc; + } + } diff --git a/resources/views/myoline/atc.blade.php b/resources/views/myoline/atc.blade.php index 6418f7b..a61b4bf 100644 --- a/resources/views/myoline/atc.blade.php +++ b/resources/views/myoline/atc.blade.php @@ -70,44 +70,6 @@ @endif @endforeach
-
-
- - - - - - - - - @foreach ($atc["airac_airport"]["departure"] as $airrac_departure) - - - - @endforeach - - -
SID
{{ $airrac_departure }}
-
-
- - - - - - - - - @foreach ($atc["airac_airport"]["approch"] as $approch) - - - - @endforeach - - -
STAR
{{ $approch }}
-
-
@endif diff --git a/resources/views/myoline/pilot.blade.php b/resources/views/myoline/pilot.blade.php index a86b0dc..c2fc663 100644 --- a/resources/views/myoline/pilot.blade.php +++ b/resources/views/myoline/pilot.blade.php @@ -83,22 +83,7 @@ Departure :
- - - - - - - - - @foreach ($chart["departure"]["airac"]["departure"] as $airrac_departure) - - - - @endforeach - - -
SID
{{ $airrac_departure }}
+
@@ -106,22 +91,6 @@ Arrival :
- - - - - - - - - @foreach ($chart["arrival"]["airac"]["arrival"] as $airrac_departure) - - - - @endforeach - - -
SID
{{ $airrac_departure }}
diff --git a/resources/views/plateforme/atc.blade.php b/resources/views/plateforme/atc.blade.php new file mode 100644 index 0000000..d28e553 --- /dev/null +++ b/resources/views/plateforme/atc.blade.php @@ -0,0 +1,150 @@ +@extends("metar-base") + +@section("title", "Information Air Traffic Control Ivao") + +@include("navbar-metar") + +@section('content') + +
+

+

{{$icao}} Information
+

+
+ + +
+
+
+
+
+
Metar
+
+
+

+

{{$metar["metar"]}}
+

+
+
+
+
+
+
+
{{ $atc["departure"]["count"] < 1 ? "Departure" : "Departures" }}
+
+
+

+

{{$atc["departure"]["count"]}}
+

+
+
+
+
+
+
+
{{ $atc["arrival"]["count"] < 1 ? "Arrival" : "Arrivals" }}
+
+
+

+

{{ $atc["arrival"]["count"]}}
+

+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
ATC online
+
+
+ @foreach ( $atc["atc"] as $atcs ) +
+
+
+

{{$atcs["callsign"]}}

+

+

{{$atcs["frequency"]}} Mhz
+

+
+
+
+ @endforeach +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
Plane
+
+
+
+
+ + + + + + + + + + + + + @foreach ($atc["departure"]["data"] as $departures) + + + + + + + + @endforeach + + +
Flight numberTime of departure :Arrivals Type AircraftRules
{{$departures["callsign"]}}{{$departures["departureTime"]}}{{$departures["arrival"]}}{{$departures["model"]}}{{$departures["rule"]}}
+
+
+ + + + + + + + + + @foreach ($atc["arrival"]["data"] as $arrivals) + + + + + + @endforeach + +
Flight numberTime of arrival :Type Aircraft
{{$arrivals["callsign"]}}{{$arrivals["eta"]}}{{$arrivals["wakeTurbulence"]}}
+
+
+
+
+
+
\ No newline at end of file diff --git a/routes/web.php b/routes/web.php index fb7e085..4ea3f0b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -622,8 +622,8 @@ Route::get("/ils", function (Request $request) { $airac = new airac_info(); - $airport = "LFMT"; - $Rwy = "30R"; + $airport = "LFBL"; + $Rwy = "21"; $airac2 = $airac->get_approach($airport); $airac1 = $airac->get_departure($airport); $ils = $airac->get_ils_information($airport, $Rwy); @@ -677,7 +677,24 @@ $encrypted = Crypt::encryptString('la vie de devs est cool.'); $decrypted = Crypt::decryptString($encrypted); dd($encrypted, $decrypted); - })->name("crypto"); + })->name("crypto"); + + Route::get("atc/{icao}", function (Request $request) { + $request->merge([ + "icao" => $request->icao + ]); + $request->validate([ + "icao" => "required|size:4" + ]); + $atconline = new eventController($request->icao); + $atc = $atconline->get_arrival_departure(); + $metar = new metarController(); + $metar = $metar->metar($request->icao); + $info_atc = null; + return view("plateforme.atc", ["icao" => $request->icao, "atc" => $atc, "metar" => $metar, "info_atc" => $info_atc]); + + + })->name("devs.atc"); });