Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit bde8a07

Browse files
committed
Add GPS maps
1 parent d7d0b75 commit bde8a07

File tree

8 files changed

+174
-29
lines changed

8 files changed

+174
-29
lines changed

Diff for: app/Http/Controllers/Admin/WEIController.php

+21
Original file line numberDiff line numberDiff line change
@@ -562,4 +562,25 @@ public function list($filter = '')
562562

563563
return View::make('dashboard.wei.list', ['users' => $students, 'filter' => $filter]);
564564
}
565+
566+
/**
567+
* Display bus GPS Map
568+
*/
569+
570+
public function displayMap()
571+
{
572+
$buses = User::where('wei', 1)->whereNotNull('latitude')->whereNotNull('longitude')->orderBy('updated_at')->groupBy('bus_id')->get();
573+
574+
$pts = [];
575+
foreach ($buses as $bus) {
576+
$pts [] = [
577+
'title' => 'Bus '.$bus->bus_id,
578+
'lat' => $bus->latitude,
579+
'lng' => $bus->longitude,
580+
];
581+
}
582+
583+
return view('dashboard.maps.index', compact('pts'));
584+
585+
}
565586
}

Diff for: composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"chrisd-autume/db-config": "2.*",
1313
"doctrine/dbal": "^2.9",
1414
"fideloper/proxy": "^4.0",
15+
"gonoware/laravel-maps": "^1.0",
1516
"guzzlehttp/guzzle": "6.*",
1617
"intervention/image": "^2.5",
1718
"laravel/framework": "5.8.*",

Diff for: composer.lock

+102-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: public/vendor/maps/css/index.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: public/vendor/maps/js/index.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: public/vendor/maps/mix-manifest.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"/js/index.js": "/js/index.js?id=fdadfceebf455b33ea99",
3+
"/css/index.css": "/css/index.css?id=81569dd7736e102f4342"
4+
}

Diff for: resources/views/dashboard/maps/index.blade.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@extends('layouts.dashboard')
2+
3+
@section('title')
4+
Carte
5+
@endsection
6+
7+
@section('css')
8+
@mapstyles
9+
<style>
10+
.gnw-map-service {
11+
height: 750px;
12+
}
13+
</style>
14+
@endsection
15+
16+
@section('content')
17+
18+
<div class="box box-yellow">
19+
<div class="box-header with-border">
20+
<h3 class="box-title">Position des bus</h3>
21+
</div>
22+
<div class="box-body">
23+
@map([
24+
'lat' => '47.8463',
25+
'lng' => '3.5815',
26+
'zoom' => '9',
27+
'markers' => $pts,
28+
])
29+
30+
</div>
31+
<!-- /.box-body -->
32+
</div>
33+
34+
@endsection
35+
36+
@section('js')
37+
@mapscripts
38+
@endsection

Diff for: routes/web.php

+6
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@
466466
'uses' => 'Admin\WEIController@adminGraph'
467467
]);
468468

469+
Route::get('/map', [
470+
'as' => 'dashboard.wei.map',
471+
'middleware' => 'authorize:admin',
472+
'uses' => 'Admin\WEIController@displayMap'
473+
]);
474+
469475
Route::get('/search', [
470476
'as' => 'dashboard.wei.search',
471477
'middleware' => 'authorize:moderator',

0 commit comments

Comments
 (0)