diff --git a/app/Http/Controllers/whazzupController.php b/app/Http/Controllers/whazzupController.php index 198849b..bc406db 100644 --- a/app/Http/Controllers/whazzupController.php +++ b/app/Http/Controllers/whazzupController.php @@ -211,10 +211,9 @@ public function API_Delect_session($path = null, $method = 'GET', $data = null, if (session("ivao_tokens")) { $json = session("ivao_tokens"); - $json = json_decode($json); - $json = $json->access_token; + $access_token = $json["access_token"]; $headers = [ - 'Authorization' => 'Bearer ' . $json, + 'Authorization' => 'Bearer ' . $access_token, 'Accept' => 'application/json', ]; } else { @@ -258,14 +257,14 @@ public function refresh_token_api_ivao(Request $request) public function API_POST($path = null, $method = 'POST', $data = null, $headers = null) { $json = session("ivao_tokens"); - $json = json_decode($json); - $json = $json->access_token; + $access_token = $json["access_token"]; $url = 'https://api.ivao.aero/' . $path; $headers = [ - 'Authorization' => 'Bearer ' . $json, + 'Authorization' => 'Bearer ' . $access_token, 'Accept' => 'application/json', ]; $response = Http::withHeaders($headers)->post($url, $data); + dd($response); return $response; } @@ -291,7 +290,7 @@ public function Get_Position($vid) if ($pilot["userId"] == $vid) { $data = $pilot; return $data; - } + } } } @@ -310,9 +309,8 @@ public function Get_Position_pilote($vid) if ($pilot["userId"] == $vid) { $data = $pilot; return $data; - } + } } - } public function track_session_id($idsession = null) @@ -358,7 +356,7 @@ public function user_me() $pilot = $pilot1->diffInMinutes($heure) / 60; /** Rounded heure Pilot */ $pilot = round($pilot, 2); - + /** Staff */ $staff = Carbon::createFromTimestamp($users_me["hours"][2]["hours"])->format('Y-m-d H:i'); $staff1 = Carbon::parse($staff); @@ -457,7 +455,7 @@ public function get_friends_online() $whazzup = $whazzup->json(); return $whazzup; } - public function post_friends($vid) + public function post_friends($myvid, $vid) { $whazzup = $this->API_POST("v2/webeye/friends/" . $vid); $whazzup = $whazzup->json(); @@ -577,10 +575,10 @@ public function get_bookings_for_event($airport = "LFBL") { $bookings = $this->API_request("/v2/atc/bookings/daily"); $bookings = $bookings->json(); - $pattern = '/'.$airport.'(.*)/'; + $pattern = '/' . $airport . '(.*)/'; $book = []; for ($i = 0; $i < count($bookings); $i++) { - if(preg_match($pattern, $bookings[$i]["atcPosition"])){ + if (preg_match($pattern, $bookings[$i]["atcPosition"])) { $book[$i]["id"] = $bookings[$i]["id"]; $book[$i]["Start_time"] = Carbon::parse($bookings[$i]["startDate"])->format('H:i') . " Z"; $book[$i]["End_time"] = Carbon::parse($bookings[$i]["endDate"])->format('H:i') . " Z"; @@ -591,7 +589,6 @@ public function get_bookings_for_event($airport = "LFBL") "vid" => $bookings[$i]["user"]["id"], ]; } - } return $book; } @@ -607,7 +604,6 @@ public function get_fp_me() public function get_fp($id) { $fp = $this->API_request("/v2/users/me/flightPlans/" . $id); - $fp = $fp->json(); return $fp; } @@ -640,14 +636,13 @@ public function get_center($icao) $airport = $airport->json(); return $airport; } - + public function get_aircrafts($icao_code) { $aircrafts = $this->API_request("/v2/aircrafts/" . $icao_code); $aircrafts = $aircrafts->json(); return $aircrafts; - } public function event_ivao() @@ -656,5 +651,4 @@ public function event_ivao() $event = $event->json(); return $event; } - } diff --git a/database/changelog.json b/database/changelog.json index 0f04db4..2705905 100644 --- a/database/changelog.json +++ b/database/changelog.json @@ -176,7 +176,6 @@ ] }, "7": { - "id": 8, "name": "2023 / 33", "date": "2023-11-02", @@ -247,5 +246,25 @@ "description": "change welcome page" } ] + }, + "10": { + "id": 11, + "name": "2023 / 36", + "date": "2023-11-26", + "version": "26.2.7", + "option": [ + { + "id": 0, + "type": "Bug Fix", + "btn": "danger", + "description": "Change information POST and Delete for API IVAO" + }, + { + "id": 1, + "type": "Feature", + "btn": "success", + "description": "View FPL" + } + ] } } diff --git a/resources/views/friends/add.blade.php b/resources/views/friends/add.blade.php index c6cabe3..efa7704 100644 --- a/resources/views/friends/add.blade.php +++ b/resources/views/friends/add.blade.php @@ -20,6 +20,7 @@
+
diff --git a/resources/views/pirep/index.blade.php b/resources/views/pirep/index.blade.php index 27e6468..b509881 100644 --- a/resources/views/pirep/index.blade.php +++ b/resources/views/pirep/index.blade.php @@ -17,11 +17,6 @@
-
-
- -
-

@@ -40,7 +35,7 @@ diff --git a/resources/views/pirep/show.blade.php b/resources/views/pirep/show.blade.php index 516fe70..abaccf5 100644 --- a/resources/views/pirep/show.blade.php +++ b/resources/views/pirep/show.blade.php @@ -1,3 +1,7 @@ + @extends("metar-base") @section("title", "Flight Plan System") @@ -13,117 +17,110 @@

INTERNATIONAL FLIGHT PLAN

+

Fligt Plan id: {{$json["id"]}}


- - {{$json->identification ?? ''}} + +
- - {{$json->flightRules}} + +
- - {{$json->typeOfFlight}} + +

- - {{$json->aircraftType}} + +
- - {{$json->wakeTurbulence}} + +
- @if($oo->upload == 1) - {{$json->equipment}} - @else - @foreach ($json->equipment as $item) - {{$item}} - @endforeach - @endif + @foreach ($json["aircraftEquipments"] as $item) + {{$item}} + @endforeach +

- - {{$json->departureAerodrome}} + +
- - {{$json->departureTime }} + +

- -
- {{$json->speed }} - {{$json->speednumber }} -
+
- -
- {{$json->LevelFL}} - {{$json->level}} -
+

- - {{$json->route}} + +

- - {{$json->destinationAerodrome}} + +
- - {{$json->eet}} + +
- - {{$json->Alternate}} + +
- - {{$json->Alternate2}} + +

- - {{$json->Other}} +

- - {{$json->endurance}} -
-
- - {{$json->pob}} + +
- - {{$json->fuel ?? ""}} Kg + +

diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 4caf4b9..b26fe27 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -13,7 +13,6 @@
- @auth

Welcome {{ auth()->user()->name }} ({{auth()->user()->vid}})

@endauth @@ -27,7 +26,7 @@
-

Request

+

Request information

air Search for metars or users

@@ -36,10 +35,10 @@
-

FPL

-

description Register and store the FPL

+

Fligth Plan

+

description View the FPL submit on IVAO

@auth - + @endauth @guest diff --git a/routes/web.php b/routes/web.php index 05adfa2..797bc72 100644 --- a/routes/web.php +++ b/routes/web.php @@ -85,7 +85,7 @@ $users_me = $whaz->user_me(); //dd($online->json(), $users_me); $online = json_decode($online, true); - return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u ]); + return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u]); } if (env("maintenance_mode") == true) { return view('maintenance'); @@ -303,7 +303,7 @@ $request->merge([ "icao" => $request->icao ]); - + $regex_for_vid = "/^[0-9]{1,6}$/"; if (preg_match($regex_for_vid, $request->icao)) { return redirect()->route("vid", ["vid" => $request->icao]); @@ -451,16 +451,18 @@ } })->name("pirep.upload"); - Route::get("/show", function (Request $request) { + Route::get("/show/{id}", function (Request $request) { + $request->merge([ + "id" => $request->id + ]); if (!Auth::user()) { return redirect()->route("auth.login"); } else { - $pirep = new PirepController(); - $oo = $pirep->show_fpl_id(4); - $json = json_decode($oo->fpl); - //dd($oo); - return view("pirep.show", ["json" => $json, "oo" => $oo]); + $pirep_ivao = new whazzupController(); + $pirep = new PirepController(); + $oo = $pirep_ivao->get_fp($request->id); + return view("pirep.show", ["json" => $oo]); } })->name("pirep.show"); @@ -526,12 +528,13 @@ Route::get("post-webeye", function (Request $request) { $request->merge([ - "vid" => $request->vid + "vid" => $request->vid, + "myvid" => $request->myvid ]); $authivao = new AuthIVAOController(); $authivao->sso($request, "home"); $whazzup = new whazzupController(); - $whazzup->post_friends($request->vid); + $whazzup->post_friends($request->myvid, $request->vid); return to_route("friends.all")->with("success", "Amis ajouté dans la liste"); })->name("friends.add.post.webeye")->middleware(["auth:web"]); @@ -654,4 +657,4 @@ $fav = new my_fav_plateController(); $fav = $fav->get(); return $fav; -}); \ No newline at end of file +});
{{$pireps[$i]["departureId"]}} / {{$pireps[$i]["arrivalId"]}} {{$pireps[$i]["callsign"]}} -
+ $pireps[$i]["id"]])}}" method="get">