<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\base\Widget;
use common\components\Helper;
use common\components\RoleDefinition;

/* @var $this yii\web\View */
/* @var $model common\models\Card */

$this->title = Yii::t ( 'common/card', 'Bérletkártya módosítása' );
$this->params ['breadcrumbs'] [] = [ 
		'label' => Yii::t ( 'common/card', 'Cards' ),
		'url' => [ 
				'index' 
		] 
];
$this->params ['breadcrumbs'] [] = [ 
		'label' => $model->number,
		'url' => [ 
				'view',
				'id' => $model->id_card 
		] 
];
$this->params ['breadcrumbs'] [] = Yii::t ( 'common/card', 'Update' );
?>
<div class="card-update">

	<h1><?= Html::encode($this->title) ?></h1>
    
    <?php
				$customer = $model->customer;
				
				if (isset ( $customer )) {
					echo DetailView::widget ( [ 
							'model' => $model,
							'attributes' => [ 
									[ 
											'label' => 'Vendég',
											'value' => $model->customer->name 
									] 
							] 
					] );
					if ( RoleDefinition::isAdmin() ){
						echo Html::a ( "Vendég törlése a kártyáról!", ['card/clear','id' =>$model->id_card], [ 
								'class' => 'btn btn-danger' ,
								'data-confirm' => "Figyelem, a kártyához tartozó összes bérlet el fog veszni!",
								'data-method' => 'post',
						] );
					}
				}
				?>

    <?=$this->render ( '_form', [ 'model' => $model ] )?>

</div>
