{extends file=$smarty.const.SMARTY_LAYOUT_DASHBOARD_WIDGET_DEFAULT}

{block name="content"}
	{if $widget['data']['errorMessage']}
		<div class="messageDivContainer layout-inline">
			{message type='warning' message=$widget['data']['errorMessage']}
		</div>
	{else}
		{$financialData = $widget['data']['financialData']}
		<table class="simpleList entityData w100p">
			<tbody>
				<tr>
					<td>
						{***************** INCOME *********************}
						<table class="tableBox w100p">
							<thead>
								<tr>
									<th colspan="3" class="generalInfo">{$widgetLang['columnsList']['profit']}</th>
								</tr>
							</thead>

							<tbody>
								{***************** ESTIMATED PROFIT *************************************}
								<tr>
									<td class="label">{$widgetLang['columnsList']['estimatedProfit']}</td>
									<td class="label bold">
										{$currency=sprintf("%s (%s)", $financialData['defaultCurrency'], $widgetLang['columnsList']['equivalent'])}
										&raquo; {$currency}
									</td>
									<td class="value bold">{$financialData['estimatedProfitDefCurr']|priceFormat:$financialData['defaultCurrency']:true}</td>
								</tr>
								{foreach $financialData['estimatedProfit'] as $currency => $value}
									<tr>
										<td class="label">&nbsp;</td>
										<td class="label bold"><b>&raquo; {$currency}:</b></td>
										<td class="value">{$value|priceFormat:$currency:1}</td>
									</tr>
								{/foreach}

								{***************** REAL PROFIT *************************************}
								<tr>
									<td class="label">{$widgetLang['columnsList']['realProfit']}</td>
									<td class="label bold">
										{$currency=sprintf("%s (%s)", $financialData['defaultCurrency'], $widgetLang['columnsList']['equivalent'])}
										&raquo; {$currency}
									</td>
									<td class="value bold">{$financialData['realProfitDefCurr']|priceFormat:$financialData['defaultCurrency']:true}</td>
								</tr>
								
								{***************** ORDER PROFIT PERCENT *************************************}
								<tr>
									<td class="label">{$widgetLang['columnsList']['orderProfitPercent']}</td>
									<td class="label bold">
										{$numberOfservices = sprintf($widgetLang['columnsList']['numberOfBalancedServices'], $financialData['numberOfBalancedServices'], $financialData['numberOfServices'])}
										{$numberOfservices}
									</td>
									<td class="value bold">
										{round($financialData['currentProfitPercent']*100, 1)}%
									</td>
								</tr>								
							</tbody>
						</table>
					</td>
				</tr>
			</tbody>
		</table>
	{/if}
{/block}
