<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\models\Vehicle */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Vehicles'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="vehicle-view">

    <div class="row">
        <div class="col-md-7">
            <h1 class="text-center">Daily Rate <br/><?= $model->daily_rate;?></h1>
            <?php
            if($model->image_name!=null) {
                echo Html::img('uploads/' . $model->image_name,
                    ['width' => '700px', 'height' => '500px', 'class' => 'img-square']);
            }
            else{
                echo Html::img('uploads/avatar.jpg',
                    ['width' => '700px', 'height' => '600px', 'class' => 'img-square']);
            }
            ?>

        </div>
        <div class="col-md-5">
            <h1><?= $model->name;?></h1>
            <p><?= $model->description?></p>
            <h2>Specifications</h2>
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            [
                'attribute' => 'body_type_id',
                'value' => function ($model) {
                    return $model->bodyType->name;
                }
            ],
            'daily_rate',
            'seat',
            'door',
            'luggage',
            'fuel_type',
            'engine',
            'year',
            'mileage',
            'transmission',
            'drive',
            'fuel_economy',
            'external_color',
            'internal_color',
        ],
    ]) ?>
            <div class="text-right" style="margin-top: 10px">
                <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
                <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [
                    'class' => 'btn btn-danger',
                    'data' => [
                        'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
                        'method' => 'post',
                    ],
                ]) ?>
            </div>

        </div>
    </div>


</div>
