Weather widget additions/fixes (#981)

Fixed the problem where values are not displayed when the reported wind,temp and dewpoint are 0 (zero).
Fixed the hPa number formatting, there is no need to add 2 more digits to it, it is a plain 4 digit value always (like 1013 or 1024, it is never reported nor used as 1013,58 or 1024,35 etc).
Corrected the display order, as it should be read (or say decoded).
Also added decoded Current and Recent Weather Situations, RVR and Runway Condition reports.

RVR report needs improvement in the Support / Metar.php too, it only reports nmi as the distance as far as i saw but it should be able to report meters too.
pull/907/merge
B.Fatih KOZ 4 years ago committed by GitHub
parent a037597a21
commit 319a9fc8e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,71 +10,87 @@ https://api.checkwx.com/#metar-decoded
<table class="table table-striped">
<tr>
<td>@lang('widgets.weather.conditions')</td>
<td>
{{ $metar['category'] }}
{{ $metar['temperature'][$unit_temp] }}
°{{strtoupper($unit_temp)}}
@if($metar['visibility'])
, @lang('widgets.weather.visibility') {{ $metar['visibility'][$unit_dist] }} {{$unit_dist}}
@endif
@if($metar['humidity'])
, {{ $metar['humidity'] }}% @lang('widgets.weather.humidity')
@endif
@if($metar['dew_point'])
, @lang('widgets.weather.dewpoint')
{{ $metar['dew_point'][$unit_temp] }}
°{{strtoupper($unit_temp)}}
@endif
</td>
<td>{{ $metar['category'] }}</td>
</tr>
<tr>
<td>@lang('widgets.weather.barometer')</td>
<td>@lang('widgets.weather.wind')</td>
<td>
{{ number_format($metar['barometer']['hPa'], 2) }} hPa
/ {{ number_format($metar['barometer']['inHg'], 2) }} inHg
@if($metar['wind_speed'] < '1') Calm @else {{ $metar['wind_speed'] }} kts @lang('common.from') {{ $metar['wind_direction_label'] }} ({{ $metar['wind_direction']}}°) @endif
@if($metar['wind_gust_speed']) @lang('widgets.weather.guststo') {{ $metar['wind_gust_speed'] }} @endif
</td>
</tr>
@if($metar['clouds'])
<tr>
<td>@lang('widgets.weather.clouds')</td>
<td>
@if($unit_alt === 'ft')
{{$metar['clouds_report_ft']}}
@else
{{ $metar['clouds_report'] }}
@endif
</td>
</tr>
@endif
@if($metar['visibility'])
<tr>
<td>@lang('widgets.weather.wind')</td>
<td>
{{$metar['wind_speed']}} kts @lang('common.from') {{$metar['wind_direction_label']}}
({{$metar['wind_direction']}}°)
@if($metar['wind_gust_speed'])
@lang('widgets.weather.guststo') {{ $metar['wind_gust_speed'] }}
@endif
</td>
<td>Visibility</td>
<td>{{ $metar['visibility'][$unit_dist] }} {{$unit_dist}}</td>
</tr>
@endif
@if($metar['runways_visual_range'])
<tr>
<td>Runway Visual Range</td>
<td>
@foreach($metar['runways_visual_range'] as $rvr)
<b>RWY{{ $rvr['runway'] }}</b>; {{ $rvr['report'] }}<br>
@endforeach
</td>
</tr>
@endif
@if($metar['present_weather_report'] <> 'Dry')
<tr>
<td>Phenomena</td>
<td>{{ $metar['present_weather_report'] }}</td>
</tr>
@endif
@if($metar['clouds'] || $metar['cavok'])
<tr>
<td>@lang('widgets.weather.clouds')</td>
<td>
@if($unit_alt === 'ft') {{ $metar['clouds_report_ft'] }} @else {{ $metar['clouds_report'] }} @endif
@if($metar['cavok'] == 1) Ceiling and Visibility OK @endif
</td>
</tr>
@endif
<tr>
<td>@lang('common.metar')</td>
<td>
<div style="line-height:1.5em;min-height: 3em;">
{{ $metar['raw'] }}
</div>
</td>
<td>Temperature</td>
<td>
@if($metar['temperature'][$unit_temp]) {{ $metar['temperature'][$unit_temp] }} @else 0 @endif °{{strtoupper($unit_temp)}}
@if($metar['dew_point']), @lang('widgets.weather.dewpoint') @if($metar['dew_point'][$unit_temp]) {{ $metar['dew_point'][$unit_temp] }} @else 0 @endif °{{strtoupper($unit_temp)}} @endif
@if($metar['humidity']), @lang('widgets.weather.humidity') {{ $metar['humidity'] }}% @endif
</td>
</tr>
<tr>
<td>@lang('widgets.weather.barometer')</td>
<td>{{ number_format($metar['barometer']['hPa']) }} hPa / {{ number_format($metar['barometer']['inHg'], 2) }} inHg</td>
</tr>
@if($metar['recent_weather_report'])
<tr>
<td>Recent Phenomena</td>
<td>{{ $metar['recent_weather_report'] }}</td>
</tr>
@endif
@if($metar['runways_report'])
<tr>
<td>Runway Condition</td>
<td>
@foreach($metar['runways_report'] as $runway)
<b>RWY{{ $runway['runway'] }}</b>; {{ $runway['report'] }}<br>
@endforeach
</td>
</tr>
@endif
@if($metar['remarks'])
<tr>
<td>@lang('widgets.weather.remarks')</td>
<td>
{{ $metar['remarks'] }}
</td>
<td>{{ $metar['remarks'] }}</td>
</tr>
@endif
<tr>
<td>@lang('widgets.weather.updated')</td>
<td>{{$metar['observed_time']}} ({{$metar['observed_age']}})</td>
</tr>
<tr>
<td>@lang('common.metar')</td>
<td>{{ $metar['raw'] }}</td>
</tr>
</table>
@endif

Loading…
Cancel
Save