<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Customer;
use common\components\CityNameTypeahead;
use common\components\CityZipTypeahead;
use common\components\CardNumberTypeahead;
use kartik\widgets\DatePicker;

/* @var $this yii\web\View */
/* @var $model common\models\Customer */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="customer-form">

    <?php $form = ActiveForm::begin(); ?>


	<div class='row'>
		<div class='col-md-3'>
		     <?php echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
		</div>
	</div>


	<div class='row'>
		<div class='col-md-6'>
		    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
		</div>
	</div>
	<div class='row'>
		<div class='col-md-6'>
		    <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
		</div>
	</div>

	<div class='row'>
		<div class='col-md-3'>
		    <?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
		</div>
		<div class='col-md-3'>
		    <?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
    			 'pluginOptions' => [
				        'autoclose'=>true,
				        'format' => 'yyyy.mm.dd'
				    ]
				])  ?>
		</div>
	</div>

	<div class='row'>
		<div class='col-md-3'>
		    <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
		</div>
		<div class='col-md-3'>
		    <?= $form->field($model, 'date_stundent_card_expire')->widget(DatePicker::classname(), [
    			 'pluginOptions' => [
				        'autoclose'=>true,
				        'format' => 'yyyy.mm.dd'
				    ]
				])  ?>
		</div>
	</div>

	<div class='row'>
		<div class='col-md-6'>
		    <?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
		</div>
	</div>

	<div class='row'>
		<div class='col-md-6'>
		    <?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
		</div>
	</div>
	<div class='row'>
		<div class='col-md-6'>
		    <?= $form->field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?>
		</div>
	</div>
	<div class='row'>
		<div class='col-md-6'>
		    <?= $form->field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?>
		</div>
	</div>
	<div class='row'>
		<div class='col-md-6'>
		    <?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
		</div>
	</div>
	<div class='row'>
		<div class='col-md-2'>
		    <?= $form->field($model, 'zip')->widget(CityZipTypeahead::className(),[
		    		'pluginEvents' =>[
		    				"typeahead:select" => "function(a,b) {
		    			$('#customercreate-city').typeahead( 'val', b.name );
				}",]
		    ])?>
		</div>
		<div class='col-md-4'>
		    <?php echo $form->field($model, 'city')->widget(CityNameTypeahead::className(),[
		    	'pluginEvents' =>[	
		    	"typeahead:select" => "function(a,b) {  
		    			$('#customercreate-zip').typeahead( 'val', b.zip );
				}",]
		    		
		    ])?>
		</div>
	</div>




    <?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('common/customer', 'Create') : Yii::t('common/customer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
