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

Commit

Permalink
maj update
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcaussades committed Nov 22, 2023
1 parent abb4a3e commit 5332b73
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 18 deletions.
12 changes: 10 additions & 2 deletions app/Http/Controllers/changelogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

namespace App\Http\Controllers;



use Carbon\Carbon;

class changelogController extends Controller
{
Expand All @@ -15,4 +14,13 @@ public function localadress()
return $data;

}

public function info_update()
{
$data = $this->localadress();
$data = $data[0];
$date = Carbon::parse($data["date"])->format("d M Y");
$data["date"] = $date;
return $data;
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/metarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function clouds($metar)

public function temp_qnh($metar)
{
$regexTemparature = "/[0-9]{2}\/[0-9]{2}/";
$regexTemparature = "/M?[0-9]{2}\/M?[0-9]{2}/";
$regexQNH = "/[Q][0-9]{4}/";
preg_match($regexTemparature, $metar, $temparature);
preg_match($regexQNH, $metar, $QNH);
Expand Down
50 changes: 50 additions & 0 deletions app/Http/Controllers/my_fav_plateController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace App\Http\Controllers;

use App\Models\metar_favModel;
use Illuminate\Http\Request;

class my_fav_plateController extends Controller
{
public function save(Request $request)
{
$icao = $request->icao;
$vid = $request->vid;
$id_user = auth()->user()->id;
$fav = metar_favModel::where("vid", $vid);
if ($fav == null) {
$fav = new \App\Models\metar_favModel();
$fav->icao = $icao;
$fav->vid = $vid;
$fav->id_user = $id_user;
$fav->save();
return response()->json(["status" => "success", "message" => "Saved"]);
} else {
$fav->delete();
return response()->json(["status" => "success", "message" => "Deleted"]);
}
}

public function get()
{
$id_user = auth()->user()->id;
$fav = metar_favModel::where("id_user", $id_user)->get();
$plateforme = [];
foreach ($fav as $key => $value) {
$plateforme[] = $value->icao;
}
return $plateforme;
}

public function update(Request $request)
{
$icao = $request->icao;
$vid = $request->vid;
$id_user = auth()->user()->id;
$fav = metar_favModel::where("vid", $vid)->where("id_user", $id_user)->first();
$fav->icao = $icao;
$fav->save();
return response()->json(["status" => "success", "message" => "Updated"]);
}
}
15 changes: 15 additions & 0 deletions app/Models/metar_favModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class metar_favModel extends Model
{
protected $table = "metar_fav";
protected $fillable = [
"id_user",
"vid",
"icao"
];
}
20 changes: 20 additions & 0 deletions public/asset/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,24 @@
.areoport_font{
font-family: "airport";
font-size: 3.0vw;
}

.update_font{
height: 10px;
}

.update_txt{
font-size: 0.8vw;
margin-top: -0.5vw;
padding-left: 1vw;
color: #070707;

}

.metar_font{
font-size: 0.7vw;
}

.departures_font{
font-size: 0.7vw;
}
1 change: 0 additions & 1 deletion resources/views/nav-wellcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,5 @@

</ul>
</div>
<button class="btn btn-success my-2 my-lg-0 rounded">AIRAC 2310</button>
</div>
</nav>
41 changes: 29 additions & 12 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
@include('nav-wellcome')
<div class="row mt-2">
<div class="col-12">
<div class="alert alert-info text-center" role="alert">
<strong> 12 Nov 2023 - Update 2023.75 </strong> view the full <a href="{{route("changelog")}}" class="text-reset">Changelog</a>.
<div class="alert alert-info update_font" role="alert">
<p class="update_txt"><strong> {{$update["date"]}} - Update {{$update["name"]}} </strong> view the full <a href="{{route("changelog")}}" class="text-reset">Changelog</a>.</p>
</div>
</div>
<div class="col-6">
Expand Down Expand Up @@ -117,24 +117,41 @@
</div>

@auth()
<hr>
<!-- <hr>
<div class="container">
<h5>Last Metar</h5>
<h5>My Favorites</h5>
<div class="row">
<div class="col">
<div class="col-4 mt-2">
<div class="card text-white bg-dark">
<div class="card-body">
<h4 class="card-title text-center text-info">Pilot</h4>
<p class="card-text text-center text-info">{{ $whazzup["pilot"] }}</p>
</div>
<div class="col-4 mt-2">
<div class="card text-white bg-dark">
<div class="card-body">
<h4 class="card-title text-center fs-5">LFBL</h4>
<p class="card-text text-center text-info metar_font">LFBL 201930Z AUTO 25006KT 220V280 CAVOK 07/07 Q1017 TEMPO 3000 SHRA BKN004 BKN020TCU</p>
<p class="card-text text-center departures_font"> DEP: 15 / ARR: 10 </p>
</div>
</div>
</div>
<div class="col-4 mt-2">
<div class="card text-white bg-dark">
<div class="card-body">
<h4 class="card-title text-center fs-5">LFBL</h4>
<p class="card-text text-center text-info metar_font">LFBL 201930Z AUTO 25006KT 220V280 CAVOK 07/07 Q1017 TEMPO 3000 SHRA BKN004 BKN020TCU</p>
<p class="card-text text-center departures_font"> DEP: 15 / ARR: 10 </p>
</div>
</div>
</div>
<div class="col-4 mt-2">
<div class="card text-white bg-dark">
<div class="card-body">
<h4 class="card-title text-center fs-5">LFBL</h4>
<p class="card-text text-center text-info metar_font">LFBL 201930Z AUTO 25006KT 220V280 CAVOK 07/07 Q1017 TEMPO 3000 SHRA BKN004 BKN020TCU</p>
<p class="card-text text-center departures_font"> DEP: 15 / ARR: 10 </p>
</div>
</div>
</div>
</div>
</div>

-->



Expand Down
13 changes: 11 additions & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use App\Http\Controllers\myOnlineServeurController;
use App\Http\Controllers\CreatAuhUniqueUsersController;
use Symfony\Component\HttpKernel\Controller\ErrorController;
use App\Http\Controllers\my_fav_plateController;

/*
|--------------------------------------------------------------------------
Expand All @@ -69,6 +70,8 @@
/** creation d'un cookie sur laravel */
$whazzup = new whazzupController();
$whazzup = $whazzup->connexion();
$w = new changelogController();
$u = $w->info_update();
if (Session::get("ivao_tokens") != null) {
$date = new DateTime();
$date->setTimezone(new DateTimeZone('UTC'));
Expand All @@ -82,13 +85,13 @@
$users_me = $whaz->user_me();
//dd($online->json(), $users_me);
$online = json_decode($online, true);
return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online]);
return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u ]);
}
if (env("maintenance_mode") == true) {
return view('maintenance');
}
$online = null;
return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online]);
return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u]);
})->where('client', '[0-9]+')->name("home");

Route::get('/logout', function (Request $request) {
Expand Down Expand Up @@ -646,3 +649,9 @@
$g = json_decode($u);
return $g;
});

Route::get("test3", function (Request $request) {
$fav = new my_fav_plateController();
$fav = $fav->get();
return $fav;
});

0 comments on commit 5332b73

Please sign in to comment.