<?php
namespace JetApplication\Installer;

use Jet\MVC_View;

use Jet\UI_messages;
use Jet\UI;
use Jet\Tr;

/**
 * @var MVC_View $this
 * @var Installer_CompatibilityTester $tester
 */
$tester = $this->getRaw( 'tester' );

?>

<table class="table table-striped">
	<tbody>
	<?php foreach( $tester->getTestResults() as $test_result ):
		if( $test_result->getPassed() ) {
			$icon = UI::icon( 'check' );
			$css_class = '';
		} else {
			if( $test_result->getIsWarning() ) {
				$icon = UI::icon( 'meh' );
				$css_class = 'warning';
			} else {
				$icon = UI::icon( 'frown-open' );
				$css_class = 'danger';
			}
		}
		?>
		<tr class="<?= $css_class; ?>">
			<td><?= $icon ?></td>
			<td><b><?= $test_result->getTitle(); ?></b><br/><?= $test_result->getDescription(); ?></td>
			<td><?= $test_result->getResultMessage(); ?></td>
		</tr>
	<?php
	endforeach; ?>
	</tbody>
</table>

<?php if( $tester->isCompatible() ):
	if( !$tester->hasWarnings() ):
		echo UI_messages::createSuccess( Tr::_( 'The system is fully compatible!' ) )->setCloseable( false );
	else:
		echo UI_messages::createWarning( Tr::_( 'The system is compatible. Please take care about warnings!' ) )->setCloseable( false );
	endif;

	echo Installer::buttonNext();

else:
	echo UI_messages::createDanger( Tr::_( 'Sorry, but the system is not compatible!' ) )->setCloseable( false );
endif; ?>
