<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\Introduction */
/* @var $form yii\widgets\ActiveForm */
// $js = "$('.datepicker').datepicker({autoclose: true, format: '".Yii::$app->params["dateFormat"]."'});";
$js = "$('.datepicker').datepicker({autoclose: true, endDate: '0d', format: '".strtolower(Yii::$app->formatter->dateFormat)."'});";
$this->registerJs($js);
?>

<div class="introduction-form">
	<div class="panel panel-default">
		<div class="panel-heading">
			Form Elements
		</div>
		<div class="panel-body">
			<div class="row">
				<div class="col-lg-12">
					<?php
						$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal']]);
						$template = [
							'labelOptions' => ['class' => 'control-label col-sm-5'],
							'template' => '{label} <div class="col-sm-4">{input}{error}{hint}</div>',
						];
						$htemplate = [
							'options' => ['tag' => false],
							'template' => '{input}'
						];
					?>
					<?= $form->errorSummary($model); ?>
					<?= $form->field($model, 'mem_intr_survey', $template)->textInput(['maxlength' => true]) ?>
					<?= $form->field($model, 'mem_intr_doi', $template)->textInput(['class' => 'form-control datepicker']) ?>
					<?= $form->field($model, 'mem_intr_initial', $template)->textInput(['maxlength' => true]) ?>
					<?= $form->field($model, 'mem_intr_location', $template)->textInput(['maxlength' => true]) ?>
					<?= $form->field($model, 'mem_intr_part_type', $template)->textInput(['maxlength' => true]) ?>
					<?= $form->field($model, 'mem_intr_part_id', $template)->textInput(['maxlength' => true]) ?>
					<?= $form->field($model, 'status', $htemplate)->hiddenInput(['value' => 1])->label("") ?>
					<?= $form->field($model, $model->isNewRecord ? 'create_user' : 'update_user', $htemplate)->hiddenInput(['value' => yii::$app->user->identity->id])->label("") ?>
					<div class="form-group">
						<div class="col-sm-offset-5 col-sm-7">
							<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
							<?= Html::a('Cancel', ['/'.Yii::$app->controller->id], ['class' => 'btn btn-default']) ?>
						</div>
					</div>
					<?php ActiveForm::end(); ?>
				</div>
				<!-- /.col-lg-6 (nested) -->
			</div>
			<!-- /.row (nested) -->
		</div>
		<!-- /.panel-body -->
	</div>
	<!-- /.panel -->
</div>