<?php

use yii\helpers\Html;
use common\widgets\GridView;

/* @var $this yii\web\View */
/* @var $searchModel frontend\models\ContactsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Contacts';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="contacts-index">
    <?= GridView::widget([
        //'search' => $this->render('_search', ['model' => $searchModel]),
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
        	//'_Id',
            //'accountid',
            [
            'label' => 'Client',
            'attribute' => 'accountname',
            'value' => 'account.account_name',
            ],
            'firstname',
            'lastname',
            'homephone',
            'mobileno',
            'email:email',
            'contacttype',
            // 'efirstname',
            // 'elastname',
            // 'ephone',
            // 'emobile',
            // 'erelationship',
            // 'address1',
            // 'address2',
            // 'town',
            // 'county',
            // 'postcode',
            // 'drivinglno',
            // 'drivinglexpiry',
            // 'drivingcategories',
            // 'sentidno',
            // 'sentidexpiry',
            // 'Created',
            // 'eemail:email',
            // 'isengineer',

            ['class' => 'common\widgets\ActionColumn',
            'template' => '{view} {update} {delete} {undelete}',
  			'buttons' => [
  				'undelete' => function ($url, $model, $key) { return $model->deleted == true ? Html::a('<i class="fa fa-undo"></i>', $url) : null;},
  				'update' => function ($url, $model, $key) {return Html::a('<i class="fa fa-pencil-alt"></i>', $url);},
  				'view' => function ($url, $model, $key) {return Html::a('<i class="fa fa-eye"></i>', $url);},
  				'delete' => function ($url, $model, $key) {        
                    return $model->deleted !== true ? Html::a('<i class="fa fa-trash"></i>', $url, ['data-method' => 'POST']) : null;
                    },
				 ],
            ]
        ],
    ]); ?>

</div>
