<?php

namespace JetApplication\Installer;

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

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

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

$form = $this->getRaw( 'form' );

?>
<?= $form->start() ?>

	<table class="table table-striped">
		<thead>
		<tr>
			<th style="width: 30px;"></th>
			<th><?= Tr::_( 'Module' ); ?></th>
			<th style="width:150px"><?= Tr::_( 'Installed?' ); ?></th>
			<th style="width:150px"><?= Tr::_( 'Activated?' ); ?></th>
		</tr>
		</thead>
		<?php foreach( $modules as $manifest ): ?>
			<tr>
				<td>
					<?php if( !$manifest->isActivated() ):

						if( $manifest->isMandatory() ):
							?>
							<input type="checkbox" value="<?= $manifest->getName(); ?>" name="modules[]"
							       id="module_<?= $manifest->getName(); ?>" checked="checked" disabled="disabled"/>
						<?php
						else:
							?>
							<input type="checkbox" value="<?= $manifest->getName(); ?>" name="modules[]"
							       id="module_<?= $manifest->getName(); ?>" checked="checked"/>
						<?php
						endif;
					endif; ?>
				</td>
				<td>
					<label for="module_<?= $manifest->getName(); ?>"><?= $manifest->getLabel(); ?> </label>
					<br/>
					<div style="font-size: 11px;"><?= $manifest->getName(); ?></div>
					<br/>
					<?= $manifest->getDescription(); ?>
				</td>
				<td><?= Tr::_( $manifest->isInstalled() ? 'Yes' : 'NO' ); ?></td>
				<td><?= Tr::_( $manifest->isActivated() ? 'Yes' : 'NO' ); ?></td>
			</tr>
		<?php endforeach; ?>
	</table>

<?= Installer::buttonNextSubmit(); ?>
<?= $form->end() ?>