<?php

use Jet\Form;
use Jet\Form_Renderer;
use Jet\Tr;
use Jet\MVC_View;

/**
 * @var MVC_View $this
 * @var Form $form
 */

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

$form->renderer()->setDefaultLabelWidth([
	Form_Renderer::LJ_SIZE_MEDIUM => 3
] );
$form->renderer()->setDefaultFieldWidth([
	Form_Renderer::LJ_SIZE_MEDIUM => 9
]);
//$form->setIsReadonly();
?>
<?= $form->start() ?>

<?php foreach( $form->getFields() as $field ):
	echo $field;
endforeach;
?>

<?php if( !$form->getIsReadonly() ): ?>
	<div class="row">
		<div class="offset-md-3">
			<input type="submit" class="btn btn-light" value="<?= Tr::_( 'Submit' ) ?>"/>

			<input type="button" class="btn btn-light" value="<?= Tr::_( 'Submit (AJAX)' ) ?>"
			       onclick="testSendForm.submit('<?= $form->getId() ?>')"/>
		</div>
	</div>
<?php endif; ?>

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