{extends file=$smarty.const.SMARTY_LAYOUT_DASHBOARD_WIDGET_DEFAULT}

{block name="content"}
	{if $widget['data']['hasData']}
		{$weather=$widget['data']['weather']}
		<table class="weatherContainer">
			<tr>
				<td>
					<div class="icon">
						<div class="temp">{$weather->temp|round}&deg;</div>
						<img src="{$smarty.const.SMARTY_BLANKGIF}" alt="" class="imgIcon icon-weather_{$weather->icon}-64" />
					</div>
				</td>
				<td>
					<div class="text">
						{$_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\Weather']['weatherConditions'][$weather->description_short]|default:$weather->description_short}
					</div>
					
					{if $weather->wind_speed}
						<div class="wind">
							{$_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\Weather']['labels']['wind']}:
							{$weather->wind_speed} m/s
						</div>
					{/if}
					
					{if $weather->visibility}
						<div class="visibility">
							{$_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\Weather']['labels']['visibility']}:
							{$weather->visibility} m
						</div>
					{/if}
					
					{if $weather->pressure}
						<div class="pressure">
							{$_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\Weather']['labels']['pressure']}:
							{$weather->pressure} hPa
						</div>
					{/if}
					
					{if $weather->humidity}
						<div class="humidity">
							{$_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\Weather']['labels']['humidity']}:
							{$weather->humidity} %
						</div>
					{/if}
				</td>
			</tr>
		</table>
	{elseif $widget['data']['hasLocation']}
		{if $widget['data']['message']['error']}
			<div class="messageDivContainer layout-inline">
				{message type="error" message=$widget['data']['message']['error']}
			</div>
		{else}
			<div class="messageDivContainer layout-inline">
				{message type="info" message=$_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\Weather']['messages']['noData']}
			</div>
		{/if}
	{else}
		<div class="messageDivContainer layout-inline">
			{message type="warning" message=$_LANG['dashboard']['widgetsList']['App\Dashboard\Widget\Weather']['messages']['noLocation']}
		</div>
	{/if}
{/block}
