<script type="text/javascript">
	$( document ).ready(function(){
		var banners = {{$aInfo.sBannersJSON}};
		var counter = 0;
		$(banners).each(function(){
			counter++;
			$('#sellsmart-banners-container ul#sellsmart-banners').append('<li id="banner' + counter + '"><a href="' + this.url + '"><img src="http://sellsmart.pl/sellsmart_banners/' + this.img + '" /></a></li>');
			$('#sellsmart-banners-container #sellsmart-banners-pages').append('<a class="page" href="#banner' + counter + '"></a>');
		});
		/* obsługa cycle - bannery ręczne */
		$('#sellsmart-banners-container').each(function(){
			$(this).find('.pages a.page').click(function(e){
				e.preventDefault();
				$(this).closest('#sellsmart-banners-container').find('.pages a.page').removeClass('activeSlide');
				$(this).addClass('activeSlide');
				$(this).closest('#sellsmart-banners-container').find('li').removeClass('activeSlide');
				$($(this).attr('href')).addClass('activeSlide');
			}).first().trigger('click');
		});
		setInterval(function(){
			$('#sellsmart-banners-container').each(function(){
				if( $(this).find('.pages a.activeSlide.page').next().length > 0 ){
					$(this).find('.pages a.activeSlide.page').next().trigger('click');
				} else{
					$(this).find('.pages a.page').first().trigger('click');
				}
			});
		}, 6000);
});
</script>
{{if count( $aOrders.aList ) > 0}}
	<div class="temp">
		<div class="full-home home">
			<h2 class="right-h2">{{$lang.Last_orders}}</h2>
			<table class="list" id="orders" style="margin-bottom: 5px;">
				<thead>
					<tr class="order">
						<th class="id">{{$lang.Id}}</th>
						<th class="name">{{$lang.First_and_last_name}}</th>
						<th class="email">{{$lang.Email}}</th>
						<th class="phone">{{$lang.Telephone}}</th>
						<th class="company">{{$lang.Company}}</th>
						<th class="date" colspan="2">{{$lang.Date}}</th>
						<th class="status">{{$lang.Status}}</th>
						<th class="actions" colspan="2">{{$lang.Actions}}</th>
					</tr>
					<tr class="header">
						<th></th>
						<th colspan="4">{{$lang.Name}}</th>
						<th colspan="2">{{$lang.Price}}</th>
						<th>{{$lang.Quantity}}</th>
						<th colspan="2"><strong>{{$lang.Summary}}</strong></th>
					</tr>
				</thead>
				<tbody>
					<tr class="space"><td colspan="10"></td></tr>
					{{foreach from=$aOrders.aList item=aOrder}}
						<tr class="order {{if preg_match( '/allegro:/i', $aOrder.sComment )}}allegro{{/if}}">
							<td class="id">{{$aOrder.iOrder}} {{if !empty( $aOrder.aVCOrders )}} <img class="tTip" style="vertical-align: middle; display: inline-block;" src="templates/images/ff0000/discount.png"  title="{{$lang.help_orders_vc_prefix}}{{implode( ', ', $aOrder.aVCOrders )}}{{$lang.help_orders_vc_suffix}}" />{{/if}} {{if !empty( $aOrder.aVCOrdersOK )}} <img class="tTip" style="vertical-align: middle; display: inline-block;" src="templates/images/008000/discount.png"  title="{{$lang.help_orders_vc_prefix}}{{implode( ', ', $aOrder.aVCOrdersOK )}}{{$lang.help_orders_vc_suffix_ok}}" />{{/if}}</td>
							<td class="name">{{$aOrder.sFirstName}} {{$aOrder.sLastName}}</td>
							<td class="email">{{$aOrder.sEmail}}</td>
							<td class="phone">{{$aOrder.sPhone}}</td>
							<td class="company">{{$aOrder.sCompanyName}}</td>
							<td class="date" colspan="2">
								{{$aOrder.sDate}}
								{{if isset( $aOrder.sComment ) || isset( $aOrder.sCommentAdmin )}}&nbsp;{{/if}}
								{{if isset( $aOrder.sComment )}}<img class="tTip" src="templates/admin/images/ico/comment-new.png" title="{{$aOrder.sComment}}" />{{/if}}
								{{if isset( $aOrder.sComment ) && isset( $aOrder.sCommentAdmin )}}&nbsp;{{/if}}
								{{if isset( $aOrder.sCommentAdmin )}}<img class="tTip" src="templates/admin/images/ico/comment.png" title="{{$aOrder.sCommentAdmin}}" />{{/if}}
							</td>
							<td class="status {{if $aOrder.iStatus==8 or $aOrder.iStatus==51 or $aOrder.iStatus==52 or $aOrder.iStatus==53}}done
								{{elseif $aOrder.iStatus == 1 && $aOrder.iTime < ( time() - 24 * 3600 * 3 ) }}adminerror
								{{elseif $aOrder.iStatus == 1}}new
								{{elseif ($aOrder.iStatus == 3 or $aOrder.iStatus == 17 or $aOrder.iStatus == 23)}}waitforpay
								{{elseif ($aOrder.iStatus == 4 or $aOrder.iStatus == 5 or $aOrder.iStatus == 6 or $aOrder.iStatus == 24)}}inprogress
								{{elseif ($aOrder.iStatus == 21 )}}readytosendlong
								{{elseif ($aOrder.iStatus == 14 or $aOrder.iStatus == 7)}}readytosend
								{{elseif ($aOrder.iStatus == 22)}}inprogresslongtime
								{{elseif ($aOrder.iStatus == 2 or $aOrder.iStatus == 18 or $aOrder.iStatus == 19 or $aOrder.iStatus == 20)}}send
								{{elseif ($aOrder.iStatus == 9 or $aOrder.iStatus == 10 or $aOrder.iStatus == 11 or $aOrder.iStatus == 13)}}change
								{{elseif $aOrder.iStatus == 54 or $aOrder.iStatus == 12}}donedifferent
								{{elseif $aOrder.iStatus == 15 or $aOrder.iStatus == 16}}waitforuser
								{{/if}}">
								<a href="?p=orders-form&amp;iOrder={{$aOrder.iOrder}}">{{$aOrder.sStatus}}</a>
							</td>
							<td class="action" colspan="2">
								<a href="?p=orders-form&amp;iOrder={{$aOrder.iOrder}}"><img src="{{$config.dir_templates}}admin/images/ico/edit.png" alt="{{$lang.Edit}}" title="{{$lang.Edit}}" /></a>
							</td>
						</tr>
						{{foreach from=$aOrder.aProducts.aProducts item=aProduct}}
							<tr class="product">
								<td></td>
								<td colspan="4">
									{{if !empty( $aProduct.sLinkName )}}
										<a href="{{$aProduct.sLinkName}}" target="_blank">{{$aProduct.sName}}</a>
									{{else}}
										{{$aProduct.sName}}
									{{/if}}
									&nbsp;
									{{if is_array( $aProduct.aStores )}}
										<a href="admin.php?p=products-variants_ajax&iProduct={{$aProduct.iProduct}}" class="colorbox_stores">({{foreach from=$aProduct.aStores item=aStore}}{{if !$aStore@first}}, {{/if}}{{$aStore.sName}}: {{$aStore.iQuantity}}{{/foreach}})</a>
									{{/if}}
									&nbsp;
									{{if isset( $aProduct.aDataImage )}}
										<a href="{{$config.dir_files}}{{$aProduct.aDataImage.sFileName}}" class="photo"><img src="{{$config.dir_templates}}admin/images/ico_photo.png" alt="(f)" style="display: inline;" /></a>
									{{else}}
										<img src="{{$config.dir_templates}}admin/images/ico_nophoto.png" alt="(f)" style="display: inline;" />
									{{/if}}
				<a href="admin.php?p=products-form&amp;iProduct={{$aProduct.iProduct}}"><img src="{{$config.dir_templates}}admin/images/ico/edit.png" style="width: 15px; height: 15px;" /></a>
								</td>
			<td class="netto">{{number_format( $aProduct.fPrice / ( 1 + $aProduct.fVat ), 2, '.', '' )}}</td>
			<td class="gross">{{$aProduct.fPrice}}</td>
								<td>{{$aProduct.iQuantity}}</td>
			<td class="netto">{{number_format( $aProduct.fSummary / ( 1 + $aProduct.fVat ), 2, '.', '' )}}</td>
			<td class="gross">{{$aProduct.fSummary}} {{if isset( $aProduct.bDiscount )}}<img class="tTip discount_{{if $aProduct.bDiscount}}true{{else}}false{{/if}}" title="{{if $aProduct.bDiscount}}{{$lang.Discount_affected}}{{else}}{{$lang.Discount_not_affected}}{{/if}}" src="{{$config.dir_templates}}images/discount.png" />{{/if}}</td>
							</tr>
						{{/foreach}}
						<tr class="product summary"><td colspan="6">{{$lang.Summary}}</td><td><strong>{{$aOrder.aProducts.sOrderSummary}}</strong></td></tr>
						{{if !$aOrder@last}}<tr class="space"><td colspan="10"></td></tr>{{/if}}
					{{/foreach}}
				</tbody>
			</table>
		</div>
	</div>
{{/if}}
<div class="clear"></div>
<div id="sellsmart-banners-container" class="temp">
	<h2 class="right-h2">{{$lang.Advertisement}}</h2>
	<ul id="sellsmart-banners" style="padding-bottom: 280px"></ul>
	<div id="sellsmart-banners-pages" class="pages"><a class="sellsmart_ad" href="mailto:kontakt@sellsmart.pl?subject={{$lang.Sellsmart_ad_subject}}">{{$lang.Sellsmart_ad}}?</a></div>
</div>
<div class="clear"></div>
<div class="temp">
	<div class="block50 temp">
		<h2 class="right-h2">{{$lang.Stats}}</h2>
		<p>{{$lang.Orders_currentmonth}} - {{$lang.Orders_count}}: <span class="blue">{{$aInfo.sOrdersCountCurrentMonth}}</span></p>
		<p>{{$lang.Orders_currentmonth}} - {{$lang.Orders_summary}}: <span class="blue">{{number_format( $aInfo.sOrdersSummaryCurrentMonth, 2, '.', '' )}} {{$config.currency_symbol}}</span></p>
		<p>{{$lang.Orders_lastmonth}} - {{$lang.Orders_count}}: <span class="blue">{{$aInfo.sOrdersCountLastMonth}}</span></p>
		<p>{{$lang.Orders_lastmonth}} - {{$lang.Orders_summary}}: <span class="blue">{{number_format( $aInfo.sOrdersSummaryLastMonth, 2, '.', '' )}} {{$config.currency_symbol}}</span></p>
		<p>{{$lang.Orders_currentyear}} - {{$lang.Orders_count}}: <span class="blue">{{$aInfo.sOrdersCountCurrentYear}}</span></p>
		<p>{{$lang.Orders_currentyear}} - {{$lang.Orders_summary}}: <span class="blue">{{number_format( $aInfo.sOrdersSummaryCurrentYear, 2, '.', '' )}} {{$config.currency_symbol}}</span></p>
		<p>{{$lang.Orders_lastyear}} - {{$lang.Orders_count}}: <span class="blue">{{$aInfo.sOrdersCountLastYear}}</span></p>
		<p>{{$lang.Orders_lastyear}} - {{$lang.Orders_summary}}: <span class="blue">{{number_format( $aInfo.sOrdersSummaryLastYear, 2, '.', '' )}} {{$config.currency_symbol}}</span></p>
		<p>{{$lang.Orders_all}} - {{$lang.Orders_count}}: <span class="blue">{{$aInfo.sOrdersCountAll}}</span></p>
		<p>{{$lang.Orders_all}} - {{$lang.Orders_summary}}: <span class="blue">{{number_format( $aInfo.sOrdersSummaryAll, 2, '.', '' )}} {{$config.currency_symbol}}</span></p>
		<p>{{$lang.Home_finishing_products}}: <span class="blue">{{$aInfo.sFinishingProducts}}</span></p>
		<p>{{$lang.Home_clients_count}}: <span class="blue">{{$aInfo.sUsers}}</span></p>
		<p>{{$lang.Home_clients_groups}}: <span class="blue">{{$aInfo.sGroups}}</span></p>
		<p>{{$lang.Home_new_pages_comments}}: <span class="blue">{{$aInfo.sPagesComments}}</span></p>
		<p>{{$lang.Home_new_products_comments}}: <span class="blue"><a href="?p=products-list&amp;iNewComments=1">{{$aInfo.sProductsComments}}</a></span></p>
		<p>{{$lang.Home_products_count}}: <span class="blue">{{$aInfo.sProducts}}</span></p>
		<p>{{$lang.Home_products_active}}: <span class="blue">{{$aInfo.sActiveProducts}}</span></p>
		<p>{{$lang.Home_discounted}}: <span class="blue"><a href="?p=products-list&amp;iDiscounted=1">{{$aInfo.sDiscountedProducts}}</a></span></p>
	</div>
	<div class="block50 temp">	
		<h2 class="right-h2">{{$lang.News}}</h2>
		<div id="fb-root"></div>
		<script>(function(d, s, id) {
			var js, fjs = d.getElementsByTagName(s)[0];
			if (d.getElementById(id)) return;
			js = d.createElement(s); js.id = id;
			js.src = "//connect.facebook.net/pl_PL/all.js#xfbml=1";
			fjs.parentNode.insertBefore(js, fjs);
		}(document, 'script', 'facebook-jssdk'));</script>
		<div class="fb-like-box" data-href="http://www.facebook.com/sellsmartpl" data-width="1220" data-height="400" data-show-faces="false" data-stream="true" data-header="false"></div>
	</div>
</div>
<div class="clear"></div>