<?php
use yii\widgets\DetailView;
use common\models\Ticket;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
?>

<div class="ticket-form">
		
			<?php if ( $model->status != Ticket::STATUS_DELETED){?>
		
		    <?php
				
				$form = ActiveForm::begin ( [ ] )
				// 'id' => 'ticket_form',
				;
				?>
		    
		    <?php
				
				$options = Ticket::statuses ();
				unset ( $options [Ticket::STATUS_DELETED] );
				echo $form->field ( $model, 'status' )->dropDownList ( $options );
				
				?>
		    
   			<div class="form-group">
	        	<?= Html::submitButton( "Módosítás", ['class' =>   'btn btn-success'  ]) ?>
		    </div>
    		<?php ActiveForm::end(); ?>
    		
		
			<?php } else{ echo "Törölt bérlet";	 }?>
</div>

<?php

$attributes = [ 
		'id_ticket',
		[ 
				'attribute' => 'id_user',
				'value' => $model->user->username 
		]
		,
		[ 
				'attribute' => 'id_ticket_type',
				'value' => $model->ticketTypeName 
		]
		,
		[ 
				'attribute' => 'id_account',
				'value' => $model->accountName 
		]
		,
		[ 
				'attribute' => 'id_discount',
				'value' => $model->discountName 
		]
		,
		'start:datetime',
		'end:datetime',
		'max_usage_count',
		'usage_count',
		// [
		// 'attribute' => 'status',
		// 'value' => $model->statusName
		// ],
		'price_brutto',
		'comment:raw',
		'created_at',
		'updated_at' 
];


if ( $model->status == Ticket::STATUS_DELETED ){
	$attributes[] = [
			'attribute' => 'status',
			'value' => $model->statusName
	];
}

?>

 <?=DetailView::widget ( [ 'model' => $model,'attributes' => $attributes ] )?>
