diff --git a/Makefile b/Makefile
index 89e6e5e0..ccef10db 100644
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,10 @@ update: build
.PHONY: reset
reset: clean
@php composer.phar dump-autoload
+ @make reload-db
+
+.PHONY: reload-db
+reload-db:
@php artisan database:create --reset
@php artisan migrate:refresh --seed
diff --git a/app/Database/seeds/dev.yml b/app/Database/seeds/dev.yml
index 13de353a..bb449a4b 100644
--- a/app/Database/seeds/dev.yml
+++ b/app/Database/seeds/dev.yml
@@ -335,8 +335,9 @@ pireps:
aircraft_id: 1
dpt_airport_id: KAUS
arr_airport_id: KJFK
- flight_time: 21600 # 6 hours
+ flight_time: 180 # 6 hours
status: 0
+ route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
notes: just a pilot report
- id: pirepid_2
user_id: 1
@@ -345,8 +346,9 @@ pireps:
aircraft_id: 1
dpt_airport_id: KJFK
arr_airport_id: KAUS
- flight_time: 21600 # 6 hours
+ flight_time: 180 # 6 hours
status: 0
+ route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
notes: just a pilot report
- id: pirepid_3
user_id: 1
@@ -355,8 +357,9 @@ pireps:
aircraft_id: 1
dpt_airport_id: KJFK
arr_airport_id: KAUS
- flight_time: 21600 # 6 hours
+ flight_time: 180 # 6 hours
status: 0
+ route: PLMMR2 SPA Q22 BEARI FAK PHLBO3
notes: just a pilot report
pirep_fields:
diff --git a/app/Http/Controllers/Frontend/PirepController.php b/app/Http/Controllers/Frontend/PirepController.php
index 4492ad37..d303577b 100644
--- a/app/Http/Controllers/Frontend/PirepController.php
+++ b/app/Http/Controllers/Frontend/PirepController.php
@@ -107,7 +107,8 @@ class PirepController extends Controller
public function show($id)
{
- $pirep = Pirep::where('id', $id);
+ #$pirep = Pirep::where('id', $id);
+ $pirep = $this->pirepRepo->find($id);
return $this->view('pireps.show', [
'pirep' => $pirep,
]);
diff --git a/config/app.php b/config/app.php
index a3692c44..dfcf3f91 100755
--- a/config/app.php
+++ b/config/app.php
@@ -2,7 +2,7 @@
return [
- 'name' => 'phpvms',
+ 'name' => env('PHPVMS_VA_NAME', 'phpvms'),
'env' => env('APP_ENV', 'dev'),
'debug' => env('APP_DEBUG', true),
'url' => env('APP_URL', 'http://localhost'),
diff --git a/modules/Installer/Resources/views/stubs/env.blade.php b/modules/Installer/Resources/views/stubs/env.blade.php
index 6779730c..830e7cbb 100644
--- a/modules/Installer/Resources/views/stubs/env.blade.php
+++ b/modules/Installer/Resources/views/stubs/env.blade.php
@@ -11,6 +11,7 @@ APP_DEBUG=true
APP_LOCALE=en
PHPVMS_INSTALLED=true
+PHPVMS_VA_NAME="phpvms"
VACENTRAL_API_KEY=
APP_LOG=daily
diff --git a/modules/Installer/Services/EnvironmentService.php b/modules/Installer/Services/EnvironmentService.php
index 849182e6..645449ab 100644
--- a/modules/Installer/Services/EnvironmentService.php
+++ b/modules/Installer/Services/EnvironmentService.php
@@ -80,6 +80,30 @@ class EnvironmentService
return $opts;
}
+ /**
+ * Update a key/value pair in the env file
+ * @param $key
+ * @param $value
+ */
+ public static function changeEnvironmentVariable($key, $value, $quoted=false)
+ {
+ $env_file = \App::environmentFilePath();
+
+ if (\is_bool(env($key))) {
+ $old = env($key) ? 'true' : 'false';
+ }
+
+ if($quoted) {
+ $value = '"'.$value.'"';
+ }
+
+ if (file_exists($env_file)) {
+ file_put_contents($env_file, str_replace(
+ "$key=" . $old, "$key=" . $value, file_get_contents($env_file)
+ ));
+ }
+ }
+
/**
* Get the template file name and write it out
* @param $opts
diff --git a/public/assets/admin/js/admin.js b/public/assets/admin/js/admin.js
index 1f4c26b4..e7f004da 100644
--- a/public/assets/admin/js/admin.js
+++ b/public/assets/admin/js/admin.js
@@ -11,81 +11,3 @@ function phpvms_vacentral_airport_lookup(icao, callback) {
});
}
-function phpvms_render_airspace_map(opts) {
- opts = __parse_opts(opts);
- var map = __draw_base_map(opts);
- if (opts.set_marker == true) {
- L.marker(coords).addTo(map);
- }
- return map;
-}
-
-function __parse_opts(opts) {
- _.defaults(opts, {
- render_elem: 'map',
- overlay_elem: '',
- lat: 0,
- lon: 0,
- zoom: 12,
- layers: [],
- set_marker: false,
- });
-
- return opts;
-}
-
-function __draw_base_map(opts) {
-
- var coords = [opts.lat, opts.lon];
-
- /*var openaip_airspace_labels = new L.TileLayer.WMS(
- "http://{s}.tile.maps.openaip.net/geowebcache/service/wms", {
- maxZoom: 14,
- minZoom: 12,
- layers: 'openaip_approved_airspaces_labels',
- tileSize: 1024,
- detectRetina: true,
- subdomains: '12',
- format: 'image/png',
- transparent: true
- });
-
- openaip_airspace_labels.addTo(map);*/
-
- var opencyclemap_phys_osm = new L.TileLayer(
- 'http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=f09a38fa87514de4890fc96e7fe8ecb1', {
- maxZoom: 14,
- minZoom: 4,
- format: 'image/png',
- transparent: true
- });
-
- var openaip_cached_basemap = new L.TileLayer("http://{s}.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{y}.png", {
- maxZoom: 14,
- minZoom: 4,
- tms: true,
- detectRetina: false,
- subdomains: '12',
- format: 'image/png',
- transparent: true
- });
-
- var openaip_basemap_phys_osm = L.featureGroup([opencyclemap_phys_osm, openaip_cached_basemap]);
-
- var map = L.map('map', {
- layers: [openaip_basemap_phys_osm],
- center: coords,
- zoom: opts.zoom,
- scrollWheelZoom: false,
- }).setView(coords, opts.zoom);
-
- var attrib = L.control.attribution({position: 'bottomleft'});
- attrib.addAttribution("Thunderforest");
- attrib.addAttribution("openAIP");
- attrib.addAttribution("OpenStreetMap contributors");
- attrib.addAttribution("OpenWeatherMap");
-
- attrib.addTo(map);
-
- return map;
-}
diff --git a/public/assets/system/js/system.js b/public/assets/system/js/system.js
new file mode 100644
index 00000000..09be73b0
--- /dev/null
+++ b/public/assets/system/js/system.js
@@ -0,0 +1,78 @@
+function phpvms_render_airspace_map(opts) {
+ opts = __parse_opts(opts);
+ var map = __draw_base_map(opts);
+ if (opts.set_marker == true) {
+ L.marker(coords).addTo(map);
+ }
+ return map;
+}
+
+function __parse_opts(opts) {
+ _.defaults(opts, {
+ render_elem: 'map',
+ overlay_elem: '',
+ lat: 0,
+ lon: 0,
+ zoom: 12,
+ layers: [],
+ set_marker: false,
+ });
+
+ return opts;
+}
+
+function __draw_base_map(opts) {
+
+ var coords = [opts.lat, opts.lon];
+
+ /*var openaip_airspace_labels = new L.TileLayer.WMS(
+ "http://{s}.tile.maps.openaip.net/geowebcache/service/wms", {
+ maxZoom: 14,
+ minZoom: 12,
+ layers: 'openaip_approved_airspaces_labels',
+ tileSize: 1024,
+ detectRetina: true,
+ subdomains: '12',
+ format: 'image/png',
+ transparent: true
+ });
+
+ openaip_airspace_labels.addTo(map);*/
+
+ var opencyclemap_phys_osm = new L.TileLayer(
+ 'http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=f09a38fa87514de4890fc96e7fe8ecb1', {
+ maxZoom: 14,
+ minZoom: 4,
+ format: 'image/png',
+ transparent: true
+ });
+
+ var openaip_cached_basemap = new L.TileLayer("http://{s}.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{y}.png", {
+ maxZoom: 14,
+ minZoom: 4,
+ tms: true,
+ detectRetina: false,
+ subdomains: '12',
+ format: 'image/png',
+ transparent: true
+ });
+
+ var openaip_basemap_phys_osm = L.featureGroup([opencyclemap_phys_osm, openaip_cached_basemap]);
+
+ var map = L.map('map', {
+ layers: [openaip_basemap_phys_osm],
+ center: coords,
+ zoom: opts.zoom,
+ scrollWheelZoom: false,
+ }).setView(coords, opts.zoom);
+
+ var attrib = L.control.attribution({position: 'bottomleft'});
+ attrib.addAttribution("Thunderforest");
+ attrib.addAttribution("openAIP");
+ attrib.addAttribution("OpenStreetMap contributors");
+ attrib.addAttribution("OpenWeatherMap");
+
+ attrib.addTo(map);
+
+ return map;
+}
diff --git a/resources/views/admin/app.blade.php b/resources/views/admin/app.blade.php
index 6508559d..de05fa3c 100644
--- a/resources/views/admin/app.blade.php
+++ b/resources/views/admin/app.blade.php
@@ -1,7 +1,7 @@
- @yield('title') - phpvms admin
+ @yield('title') - {!! config('app.name') !!} admin
@@ -88,6 +88,7 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-{{-- --}}
-
-
-
-@yield('scripts')
-
-
diff --git a/resources/views/layouts/default/app.blade.php b/resources/views/layouts/default/app.blade.php
index 989e4af9..d2a0b9a4 100644
--- a/resources/views/layouts/default/app.blade.php
+++ b/resources/views/layouts/default/app.blade.php
@@ -7,7 +7,7 @@
- phpvms
+ @yield('title') - {!! config('app.name') !!}
@@ -18,8 +18,19 @@
+
+
+
@yield('css')
@@ -137,6 +148,7 @@
+
@@ -145,6 +157,10 @@
+
+
+
+
+@endsection
diff --git a/resources/views/layouts/default/pireps/show.blade.php b/resources/views/layouts/default/pireps/show.blade.php
new file mode 100644
index 00000000..93e424e8
--- /dev/null
+++ b/resources/views/layouts/default/pireps/show.blade.php
@@ -0,0 +1,97 @@
+@extends('layouts.default.app')
+
+@section('title', 'PIREP '.$pirep->getFlightId())
+@section('content')
+
+
+
{!! $pirep->getFlightId() !!}
+
+
+ @if($pirep->status == config('enums.pirep_status.PENDING'))
+
Pending
+ @elseif($pirep->status === config('enums.pirep_status.ACCEPTED'))
+
Accepted
+ @else
+
Rejected
+ @endif
+
+
+
+
+
+
+
+ | Departure/Arrival |
+
+ {!! $pirep->dpt_airport->icao !!} - {!! $pirep->dpt_airport->name !!}
+ to
+ {!! $pirep->arr_airport->icao !!} - {!! $pirep->arr_airport->name !!}
+ |
+
+
+
+ | Flight Time |
+
+ {!! Utils::minutesToTimeString($pirep->flight_time) !!}
+ |
+
+
+
+ | Route |
+
+ {!! $pirep->route !!}
+ |
+
+
+
+ | Notes |
+
+ {!! $pirep->notes !!}
+ |
+
+
+
+
+
+
+
+
+
fields
+
+
+ | Name |
+ Value |
+ Source |
+
+
+ @foreach($pirep->fields as $field)
+
+ | {!! $field->name !!} |
+ {!! $field->value !!} |
+ {!! $field->source !!} |
+
+ @endforeach
+
+
+
+
+
+
+@endsection
+@section('scripts')
+
+@endsection