Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

fix: Bug: Add friend for page #134 #136

Merged
merged 2 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions app/Http/Controllers/whazzupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

Expand All @@ -291,7 +290,7 @@ public function Get_Position($vid)
if ($pilot["userId"] == $vid) {
$data = $pilot;
return $data;
}
}
}
}

Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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";
Expand All @@ -591,7 +589,6 @@ public function get_bookings_for_event($airport = "LFBL")
"vid" => $bookings[$i]["user"]["id"],
];
}

}
return $book;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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()
Expand All @@ -656,5 +651,4 @@ public function event_ivao()
$event = $event->json();
return $event;
}

}
21 changes: 20 additions & 1 deletion database/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@
]
},
"7": {

"id": 8,
"name": "2023 / 33",
"date": "2023-11-02",
Expand Down Expand Up @@ -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"
}
]
}
}
1 change: 1 addition & 0 deletions resources/views/friends/add.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<div class="mb-3">
<label for="vid_friend" class="form-label">VID <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="vid" name="vid">
<input type="hidden" name="myvid" value="{{Auth::user()->vid}}">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Expand Down
7 changes: 1 addition & 6 deletions resources/views/pirep/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@

<div class="container">
<div class="row">
<div class="col-12 d-flex mt-5">
<form action="{{ Route("pirep.create") }}" method="get">
<button type="submit" class="btn btn-success">CREATE THE FPL</button>
</form>
</div>
<hr>
<div class="col-12">
<table class="table table-striped table-inverse table-responsive mt-5">
Expand All @@ -40,7 +35,7 @@
<td>{{$pireps[$i]["departureId"]}} / {{$pireps[$i]["arrivalId"]}}</td>
<td>{{$pireps[$i]["callsign"]}}</td>
<td>
<form action="{{Route("pirep.show",[$pireps[$i]["id"]])}}" method="get">
<form action="{{Route("pirep.show", ["id" => $pireps[$i]["id"]])}}" method="get">
<button class="btn btn-dark btn-sm" type="submit">View</button>
</form>
</td>
Expand Down
99 changes: 48 additions & 51 deletions resources/views/pirep/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<?php

use Illuminate\Support\Carbon;
?>
@extends("metar-base")

@section("title", "Flight Plan System")
Expand All @@ -13,117 +17,110 @@

<div class="container px-4 text-center mt-5">
<h4 class="text-primary">INTERNATIONAL FLIGHT PLAN</h4>
<p class=" d-flex justify-content-start text-muted">Fligt Plan id: {{$json["id"]}}</p>
<hr>
<div class="form-group">
<div class="row">
<div class="col">
<label for="number" class="text-primary d-flex justify-content-start">Identification :</label>
{{$json->identification ?? ''}}
<label for="number" class="text-primary d-flex justify-content-start">Identification : <p class="text-dark ms-2"> {{$json["callsign"]?? ''}}</p></label>

</div>
<div class="col">
<label for="flightRules" class="text-primary d-flex justify-content-start">Flight Rules :</label>
{{$json->flightRules}}
<label for="flightRules" class="text-primary d-flex justify-content-start">Flight Rules :<p class="text-dark ms-2">{{$json["flightRules"]}}</p></label>

</div>
<div class="col">
<label for="typeOfFlight" class="text-primary d-flex justify-content-start">Type of Flight :</label>
{{$json->typeOfFlight}}
<label for="typeOfFlight" class="text-primary d-flex justify-content-start">Type of Flight :<p class="text-dark ms-2">{{$json["flightType"]}}</p></label>

</div>
</div>
<hr>
<div class="row">
<div class="col">
<label for="aircraftType" class="text-primary d-flex justify-content-start">Aircraft Type :</label>
{{$json->aircraftType}}
<label for="aircraftType" class="text-primary d-flex justify-content-start">Aircraft Type :<p class="text-dark ms-2">{{$json["aircraftId"]}}</p></label>

</div>
<div class="col">
<label for="wakeTurbulence" class="text-primary d-flex justify-content-start">Wake Turbulence :</label>
{{$json->wakeTurbulence}}
<label for="wakeTurbulence" class="text-primary d-flex justify-content-start">Wake Turbulence :<p class="text-dark ms-2">{{$json["aircraftWakeTurbulence"]}}</p></label>

</div>
<div class="col">
<label for="equipment" class="text-primary d-flex justify-content-start">Equipment :</label>
@if($oo->upload == 1)
{{$json->equipment}}
@else
@foreach ($json->equipment as $item)
{{$item}}
@endforeach
@endif
@foreach ($json["aircraftEquipments"] as $item)
{{$item}}
@endforeach

</div>
</div>
<hr>
<div class="row">
<div class="col">
<label for="departureAerodrome" class="text-primary d-flex justify-content-start">Departure Aerodrome :</label>
{{$json->departureAerodrome}}
<label for="departureAerodrome" class="text-primary d-flex justify-content-start">Departure Aerodrome :<p class="text-dark ms-2">{{$json["departureId"]}}</p></label>

</div>
<div class="col">
<label for="departureTime" class="text-primary d-flex justify-content-start">Departure Time :</label>
{{$json->departureTime }}
<label for="departureTime" class="text-primary d-flex justify-content-start">Departure Time :<p class="text-dark ms-2"> {{Carbon::parse($json["departureTime"])->format('H:i') }}</p></label>

</div>
</div>
<hr>
<div class="row">
<div class="col">
<label for="departureTime" class="text-primary d-flex justify-content-start">Speed :</label>
<div class="input-group mb-3">
{{$json->speed }}
{{$json->speednumber }}
</div>
<label for="departureTime" class="text-primary d-flex justify-content-start">Speed
<div class="input-group mb-3">
<p class="text-dark ms-2">{{$json["cruisingSpeedType"] }} {{$json["cruisingSpeed"] }}</p>
</div>
</label>
</div>
<div class="col">
<label for="departureTime" class="text-primary d-flex justify-content-start">Level :</label>
<div class="input-group mb-3">
{{$json->LevelFL}}
{{$json->level}}
</div>
<label for="departureTime" class="text-primary d-flex justify-content-start">Level
<div class="input-group mb-3">
<p class="text-dark ms-2"> {{$json["altitudeType"]}} {{$json["cruisingSpeed"]}} </p>
</div>
</label>
</div>
</div>
<hr>
<div class="row">
<div class="col">
<label for="Route" class="text-primary d-flex justify-content-start">Route :</label>
{{$json->route}}
<label for="Route" class="text-primary d-flex justify-content-start">Route :<p class="text-dark ms-2">{{$json["route"]}}</p></label>

</div>
</div>
<hr>
<div class="row">
<div class="col">
<label for="destinationAerodrome" class="text-primary d-flex justify-content-start">Destination Aerodrome :</label>
{{$json->destinationAerodrome}}
<label for="destinationAerodrome" class="text-primary d-flex justify-content-start">Destination Aerodrome :<p class="text-dark ms-2"> {{$json["arrivalId"]}}</p></label>

</div>
<div class="col">
<label for="destinationTime" class="text-primary d-flex justify-content-start">Total EET :</label>
{{$json->eet}}
<label for="destinationTime" class="text-primary d-flex justify-content-start">Total EET :<p class="text-dark ms-2">{{Carbon::parse($json["eet"])->format('H:i')}}</p></label>

</div>
<div class="col">
<label for="destinationTime" class="text-primary d-flex justify-content-start">Alternate Aerodrome :</label>
{{$json->Alternate}}
<label for="destinationTime" class="text-primary d-flex justify-content-start">Alternate Aerodrome :<p class="text-dark ms-2">{{$json["alternativeId"]}}</p></label>

</div>
<div class="col">
<label for="destinationTime" class="text-primary d-flex justify-content-start">2nd Alternate Aerodrome :</label>
{{$json->Alternate2}}
<label for="destinationTime" class="text-primary d-flex justify-content-start">2nd Alternate Aerodrome :<p class="text-dark ms-2">{{$json["alternative2Id"]}}</p></label>

</div>
</div>
<hr>
<div class="row">
<div class="col">
<label for="Route" class="text-primary d-flex justify-content-start">Other Information :</label>
{{$json->Other}}
<label for="Route" class="text-primary d-flex justify-content-start">Other Information :<p class="text-dark ms-2">{{$json["remarks"]}}</p</label>
</div>
</div>
<hr>
<div class="row">
<div class="col">
<label for="Route" class="text-primary d-flex justify-content-start">Endurance :</label>
{{$json->endurance}}
</div>
<div class="col">
<label for="Route" class="text-primary d-flex justify-content-start">Persons on Board :</label>
{{$json->pob}}
<label for="Route" class="text-primary d-flex justify-content-start">Endurance :<p class="text-dark ms-2">{{Carbon::parse($json["endurance"])->format('H:i')}}</p></label>

</div>
<div class="col">
<label for="Route" class="text-primary d-flex justify-content-start">Fuel on Board :</label>
{{$json->fuel ?? ""}} Kg
<label for="Route" class="text-primary d-flex justify-content-start">Persons on Board :<p class="text-dark ms-2"> {{$json["pob"]}}</p></label>

</div>
</div>
<hr>
Expand Down
9 changes: 4 additions & 5 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
</div>
</div>
<div class="container">

@auth
<h4 class="mt-3"> Welcome {{ auth()->user()->name }} ({{auth()->user()->vid}})</h4>
@endauth
Expand All @@ -27,7 +26,7 @@
<div class="col-6">
<div class="card text-white bg-dark">
<div class="card-body bg-dark border-dark text-white text-opacity-75">
<h4 class="card-title text-center text-info">Request</h4>
<h4 class="card-title text-center text-info">Request information</h4>
<p class="card-text d-flex align-items-center"><span class="material-symbols-outlined ms-2">air</span> <span class="ms-2"> Search for metars or users </span></p>
<p class="card-footer text-center"><a href="{{ Route("metars.index")}}" class="btn btn-success">Search IVAO</a></p>
</div>
Expand All @@ -36,10 +35,10 @@
<div class="col-6">
<div class="card text-white bg-dark">
<div class="card-body bg-dark border-dark text-white text-opacity-75">
<h4 class="card-title text-center text-info">FPL</h4>
<p class="card-text d-flex align-items-center"><span class="material-symbols-outlined ms-2">description</span> <span class="ms-2"> Register and store the FPL</span></p>
<h4 class="card-title text-center text-info">Fligth Plan</h4>
<p class="card-text d-flex align-items-center"><span class="material-symbols-outlined ms-2">description</span> <span class="ms-2"> View the FPL submit on IVAO</span></p>
@auth
<p class="card-footer text-center"><a href="#" class="btn btn-success">Comming soon</a></p>
<p class="card-footer text-center"><a href="{{ Route("pirep.index")}}" class="btn btn-success">See My Fligth Plan</a></p>
@endauth
@guest
<p class="card-footer text-center"><a href="{{ Route("auth.login")}}" title="register on the platform only" class="btn btn-secondary">Register Only</a></p>
Expand Down
Loading
Loading