<?php

namespace JetApplication\Installer;

use Jet\MVC_View;
use Jet\Tr;
use Jet\Application_Module_Manifest;

/**
 * @var MVC_View $this
 * @var Application_Module_Manifest[] $modules
 */

$modules = $this->getRaw( 'modules' );
$result = $this->getRaw( 'result' );

$OK = $this->getBool( 'OK' );
?>

	<table class="table table-striped">
		<thead>
		<tr>
			<th><?= Tr::_( 'Module' ); ?></th>
			<th style="width:150px"><?= Tr::_( 'Result' ); ?></th>
		</tr>
		</thead>
		<?php foreach( $modules as $name => $info ):
			if( !isset( $result[$name] ) ) {
				continue;
			}

			$state = $result[$name];
			?>
			<tr>
				<td>
					<label for="module_<?= $info->getName(); ?>"><?= $info->getLabel(); ?></label>
					<br/>
					<div style="font-size: 11px;"><?= $info->getName(); ?></div>

				</td>
				<td>
					<?php if( $state === true ): ?>
						<div class="OK">OK</div>
					<?php else: ?>
						<div class="error"><?= $state; ?></div>
					<?php endif; ?>

				</td>

			</tr>
		<?php endforeach; ?>
	</table>

	<?php if( $OK ):
	echo Installer::buttonNext();
else:
	echo Installer::buttonBack();
endif;
