<?php

use yii\helpers\Html;
use frontend\components\TransferTotalWidget;
use common\components\AccountStatisticWidget;


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

$this->title = Yii::t('frontend/collection', 'Create Collection');
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/collection', 'Collections'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-create">

    <h1><?= Html::encode($this->title) ?></h1>

	<dl class='dl-horizontal'>
		<dt><?= Yii::t('frontend/collection', "Last collection")?></dt>
		<dd><?php  echo isset($model->lastCollection) ? Yii::$app->formatter->asDatetime($model->lastCollection->end) : Yii::t('frontend/collection', "No collection found") ?></dd> 
		
		<dt><?= Yii::t('frontend/collection', "Start of interval")?></dt>
		<dd><?php  echo   Yii::$app->formatter->asDatetime($model->timestampStart,'yyyy-MM-dd HH:mm:ss')  ?> (inkluzív)</dd> 
		
		<dt><?= Yii::t('frontend/collection', "End of interval")?></dt>
		<dd><?php  echo   Yii::$app->formatter->asDatetime($model->timestampEnd,'yyyy-MM-dd HH:mm:ss')  ?> (exkluzív)</dd> 
	</dl>
	
	<p>
        <?= Html::a(Yii::t('frontend/collection', 'Refresh'), ['create', 'id_account' => $model->id_account], ['class' => 'btn btn-primary']) ?>
        <?= Html::a(Yii::t('frontend/collection', 'Select another account'), ['select-account' ], ['class' => 'btn btn-primary']) ?>
    </p>
	
	<?php 
		if ( $model->userCartTotal > 0){
			?>
			<p class="bg-danger">
				Figyelem! A recepció kassza tartalmaz még fizetetlen elemeket!
			</p>
			<?php 
		}
	?>
	
	
	<?php 
	
		echo AccountStatisticWidget::widget([
			'totals' =>  $model->totals
		]);
	?>
    <?= $this->render('_form', [
        'model' => $model,
    ]) ?>

</div>
