<?php 
use yii\helpers\Html;
use yii\widgets\Pjax;

use common\widgets\GridView;
use common\widgets\ActionColumn;
use yii\data\ArrayDataProvider;

$timeProvider = new ArrayDataProvider([
	'allModels' => $model->times
])
?>
<?php Pjax::begin(['id' => 'travel']) ?>

<div class="time-grid">
<?= GridView::Widget([
    'new' => '&nbsp;',
    'dataProvider' => $timeProvider,
    'columns' => [
        'operativename',
        'vehicle.reg',
        'direct:boolean',
        'postcodefrom',
        'postcodeto',
        'distance',
        [
            'attribute' => 'traveltime',
            'value' => function($model) {
                $t = $model->traveltime;
                return sprintf('%02d:%02d:%02d', ($t/3600),($t/60%60), $t%60);
            }
        ],
        'shifttime',
        [
            'attribute' => 'totaltime',
            'value' => function($model) {
                $t = $model->totaltime;
                return sprintf('%02d:%02d:%02d', ($t/3600),($t/60%60), $t%60);
            }
        ],
      
    ],
]);
?>
</div>
<?php Pjax::end() ?>
