<?php
namespace JetStudioModule\ApplicationModuleWizard\BasicCRUD;

use Jet\MVC_View;
use Jet\Tr;
use Jet\UI;
use Jet\UI_button;

/**
 * @var MVC_View $this
 * @var Main $wizard
 */
$wizard = $this->getRaw( 'wizard' );

$select_data_form = $wizard->getSelectDataModelForm();

$setup_form = $wizard->getSetupForm();

$select_data_form->field( 'data_model' )->input()->addJsAction( 'onchange', 'this.form.submit()' );

?>
<div class="section-title"><?= Tr::_( 'DataModel' ) ?></div>
<?= $select_data_form->start() ?>
<div class="form-fields" style="grid-template-columns: 0.3fr 1fr;">
	<?= $select_data_form->field( 'data_model' ) ?>
</div>
<?= $select_data_form->end() ?>


<?php if( $wizard->getDataModelClassName() ): ?>
	<?= $setup_form->start() ?>
	<div class="section-title"><?= Tr::_( 'Main module parameters' ) ?></div>

	<div class="form-fields" style="grid-template-columns: 0.3fr 1fr;">
	<?= $setup_form->field( 'NAME' ) ?>

	<?= $setup_form->field( 'LABEL' ) ?>
	<?= $setup_form->field( 'DESCRIPTION' ) ?>
	<?= $setup_form->field( 'AUTHOR' ) ?>
	<?= $setup_form->field( 'LICENSE' ) ?>
	<?= $setup_form->field( 'COPYRIGHT' ) ?>


	<div class="section-title" style="grid-column: span 2"><?= Tr::_( 'DataModel parameters' ) ?></div>
	<?= $setup_form->field( 'DATA_MODEL_CLASS_NAME' ) ?>
	<?= $setup_form->field( 'DATA_MODEL_CLASS_ALIAS' ) ?>

	<?= $setup_form->field( 'ITEM_VAR_NAME' ) ?>

	<?= $setup_form->field( 'ID_PROPERTY' ) ?>
	<?= $setup_form->field( 'ITEM_ID_GETTER' ) ?>

	<?= $setup_form->field( 'NAME_PROPERTY' ) ?>
	<?= $setup_form->field( 'ITEM_NAME_GETTER' ) ?>

	<div class="section-title" style="grid-column: span 2"><?= Tr::_( 'Menu item' ) ?></div>
	<?= $setup_form->field( 'TARGET_MENU' ) ?>
	<?= $setup_form->field( 'MENU_ITEM_ID' ) ?>

	<div class="section-title" style="grid-column: span 2"><?= Tr::_( 'Page' ) ?></div>
	<?= $setup_form->field( 'PAGE_BASE_ID' ) ?>
	<?= $setup_form->field( 'PAGE_ID' ) ?>
	<?= $setup_form->field( 'PAGE_TITLE' ) ?>
	<?= $setup_form->field( 'PAGE_ICON' ) ?>
	<?= $setup_form->field( 'PAGE_PATH_FRAGMENT' ) ?>

	<div class="section-title" style="grid-column: span 2"><?= Tr::_( 'Texts' ) ?></div>
	<?= $setup_form->field( 'TXT_MSG_CREATED' ) ?>
	<?= $setup_form->field( 'TXT_MSG_UPDATED' ) ?>
	<?= $setup_form->field( 'TXT_MSG_DELETED' ) ?>
	<?= $setup_form->field( 'TXT_BN_DETAIL' ) ?>
	<?= $setup_form->field( 'TXT_BN_EDIT' ) ?>
	<?= $setup_form->field( 'TXT_BN_DELETE' ) ?>
	<?= $setup_form->field( 'TXT_LISTING_TITLE_ID' ) ?>
	<?= $setup_form->field( 'TXT_LISTING_TITLE_NAME' ) ?>
	<?= $setup_form->field( 'TXT_DELETE_CONFIRM_QUESTION' ) ?>
	<?= $setup_form->field( 'TXT_BTN_NEW' ) ?>

	<div class="section-title" style="grid-column: span 2"><?= Tr::_( 'Logger' ) ?></div>
	<?= $setup_form->field( 'LOG_EVENT_CREATED' ) ?>
	<?= $setup_form->field( 'LOG_EVENT_CREATED_MESSAGE' ) ?>
	<?= $setup_form->field( 'LOG_EVENT_UPDATED' ) ?>
	<?= $setup_form->field( 'LOG_EVENT_UPDATED_MESSAGE' ) ?>
	<?= $setup_form->field( 'LOG_EVENT_DELETED' ) ?>
	<?= $setup_form->field( 'LOG_EVENT_DELETED_MESSAGE' ) ?>

	<div class="section-title" style="grid-column: span 2"><?= Tr::_( 'ACL' ) ?></div>
	<?= $setup_form->field( 'ACL_ENTITY_NAME' ) ?>
	</div>

	<div style="text-align: right">
		<?= UI::button_save( Tr::_( 'Create' ) )->setClass( UI_button::CLASS_PRIMARY )->setIcon( 'magic' ) ?>
	</div>
	<?= $setup_form->end() ?>
<?php endif; ?>
<br/><br/>

