<?php
use yii\grid\GridView;
use common\components\Helper;
use common\models\Transfer;
?>
 <?php 
 ?>
 
 <style>
 
 .table td,.table th{
 	padding: 2px;
 }
 
 .table th{
 	text-align: center;
 }
 
 
 .table td.transfer_id_transfer{
 	width: 70px;
 }
 
 .table td.transfer_created_at{
 	width: 120px;
 }
 .table td.ticket_comment{
 	width: 150px;
 }
 .table td.customer_name{
 	/*width: 150px;*/
 }
 
 .table td.transfer_status{
 	width: 120px;
 }
 
 .table td.transfer_money{
 	width: 70px;
 	text-align: right;
 }
 </style>
 <h2>Fizetendő tételek</h2>
 <?= GridView::widget([
	    	'tableOptions' => ['class' => 'table table-striped table-bordered table-transfer'],	
	        'dataProvider' => $dataProvider,
	        'columns' => [
	        		[
	        			'attribute' => 'transfer_id_transfer',
	        			'label' => 'T.',
	        			'enableSorting' => false,
	        			'contentOptions' => ['class' => 'transfer_id_transfer'],
	        		],
	        		[
	        			'attribute' => 'transfer_created_at',
	        			'label' => 'Kiadva',
	        			'format' => 'datetime',
	        			'enableSorting' => false,
	        			'contentOptions' => ['class' => 'transfer_created_at'],
	        		],
	        		/*
					[
						'attribute' => 'user_username',
						'label' => 'Felhasználó',
						'enableSorting' => false,
						'contentOptions' => ['class' => 'user_username'],
				    ],
				    */
	        		[
	        			'attribute' => 'customer_name',
	        			'label' => 'Vendég',
	        			'enableSorting' => false,
	        				'contentOptions' => ['class' => 'customer_name'],
	        		],
	        		[
		        		'attribute' => 'ticket_start',
		        		'label' => 'Bérlet',
// 		        		'format' => 'date',
	        			'enableSorting' => false,
	        			'contentOptions' => ['class' => 'ticket_start'],
	        			'value' => function ($model, $key, $index, $column){
	        				$type = $model['ticket_type_name'];
	        				$start = \Yii::$app->formatter->asDate($model['ticket_start']);
	        				$end = \Yii::$app->formatter->asDate($model['ticket_end']);
	        				return $type. " (" .$start . " - " .$end . ")";
	        				//return Helper::getArrayValue(Transfer::statuses(), $model['transfer_status'],'');
	        			},
	        		],
	        		[
	        			'attribute' => 'transfer_money',
	        			'label' => 'Összeg',
	        			'enableSorting' => false,
	        			'contentOptions' => ['class' => 'transfer_money'],
			        ],
	        		/*[
		        		'attribute' => 'transfer_status',
	        			'enableSorting' => false,
		        		'label' => 'Státusz',
	        			'contentOptions' => ['class' => 'transfer_status'],
		        		'value' => function ($model, $key, $index, $column){
		        					return Helper::getArrayValue(Transfer::statuses(), $model['transfer_status'],'');
		    				},
			        ],
			        */
	        			[
	        			'attribute' => 'customer_description',
	        			'label' => 'Megjegyzés',
	        			'enableSorting' => false,
	        			'contentOptions' => ['class' => 'customer_description'],
	        			],
	        		[
	        			'attribute' => 'ticket_comment',
	        			'label' => 'Megj',
	        			'enableSorting' => false,
	        			'contentOptions' => ['class' => 'ticket_comment'],
			        ],
			     ],
	    ]); ?>