<?php
	/**
	 * @package     SP Soccer
	 * @author      JoomShaper http://www.joomshaper.com
	 * @copyright   Copyright (C) 2010 - 2016 JoomShaper. All rights reserved.
	 * @license     GNU General Public License version 2 or later; see LICENSE.txt
	 */

	defined('_JEXEC') or die('Restricted access');
?>
<div id="spsoccer" class="spsoccer view-spsoccer-tournament tournament-standings">
	<div class="spsoccer-tournament">

		<div class="spsoccer-container">

			<div class="spsoccer-row-fluid">
				<div class="torunament-info">
					<div class="tournament-header">
						<h2 class="soccer-title"><?php echo $this->item->title; ?></h2>
					</div>
				</div> <!-- /.spsoccer-col-lg -->
			</div> <!-- /.spsoccer-row -->

			<div id="tournament-standing">

		  		<!-- has Standings -->
				<div class="spsoccer-standings-wrapper">

					<div class="pointboard-header">
						<div class="spsoccer-col-lg-4 spsoccer-col-md-4 spsoccer-col-sm-12 header-left spsoccer-col-xs-5">
							<ul>
								<li><?php echo JText::_('COM_SPSOOCER_POSITION'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_TEAM'); ?></li>
							</ul>
						</div>
						<div class="spsoccer-col-lg-8 spsoccer-col-md-8 spsoccer-col-sm-12 header-right spsoccer-col-xs-7">
							<ul>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_P'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_W'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_D'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_L'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_GF'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_GA'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_AVG'); ?></li>
								<li><?php echo JText::_('COM_SPSOOCER_STANDINGS_PTS'); ?></li>
							</ul>
						</div>
					</div>

					<?php
					// start countig team
					foreach ($this->groups as $sgroup) {
						if(!empty($sgroup->point_tables )){

						if ($this->sgroup->uncategory == false) { ?>
						<div class="item-list-wrap text-center">
							<h3><?php echo $sgroup->title; ?></h3>
						</div>
					<?php
						} // END:: $this->sgroup->uncategory
						// has point table
						if (!empty($sgroup->point_tables)) {
						$item_no = 1;
						foreach ($sgroup->point_tables as $point_table){

						$point_table['team_logo'] = SpsoccerHelper::hasImg($point_table['team_logo']);
					?>

					<div class="item-list-wrap">

						<div class="spsoccer-col-lg-4 spsoccer-col-md-4 spsoccer-col-sm-12 spsoccer-col-xs-5 team-position">
							<div class="teamthumb">
								<div class="inline-block">
									<p><?php echo $item_no; ?></p>
								</div>
								<img class="spsoccer-img-thumbnail spsoccer-img-responsive" src="<?php echo $point_table['team_logo']; ?>" alt="<?php echo $point_table['team_name']; ?>">
								<span class="spsoccer-team-name"><?php echo $point_table['team_name']; ?></span>
							</div>
						</div> <!-- /.spsoccer-col-lg -->

						<div class="spsoccer-col-lg-8 spsoccer-col-md-8 spsoccer-col-sm-12 spsoccer-col-xs-7 team-stats">
							<div class="team-point-table">
								<ul>
									<li> <span><?php echo $point_table['plays']; ?></span> </li>
									<li> <span><?php echo $point_table['wons']; ?></span> </li>
									<li> <span><?php echo $point_table['draws']; ?></span> </li>
									<li> <span><?php echo $point_table['losts']; ?></span> </li>
									<li> <span><?php echo $point_table['gforwards']; ?></span> </li>
									<li> <span><?php echo $point_table['gagainsts']; ?></span> </li>
									<li> <span><?php echo $point_table['avgs']; ?></span> </li>
									<li> <span><?php echo $point_table['ptss']; ?></span> </li>
								</ul>
							</div> <!-- /.team-point-table -->
						</div> <!-- /.spsoccer-col-lg -->

					</div> <!-- ./spsoccer-row -->

					<?php $item_no ++; } } // END:: forech $group_teams_infos // END:: has point table  ?>
				<?php } }// END:: foreach $this->point_tables ?>

				</div> <!-- ./spsoccer-standings-wrapper -->
				<?php  // END:: !empty groups ?>
		  	</div> <!-- /.tournament-standing -->
		</div> <!-- /. spsoccer-container -->
	</div> <!-- /.spsoccer-tournament -->
</div> <!-- /#spsoccer .spsoccer -->
