<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use app\models\Branches;

/* @var $this yii\web\View */
/* @var $model app\models\Branches */

$this->title = Yii::$app->language == 'en' ? $model->english_name : $model->arabic_name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Branches'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="branches-view">

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

    <p>
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?php  
            $count = count(Branches::find()->all());
            if($count != 1)  : 
        ?>     

        <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [
                'class' => 'btn btn-danger',
                'data' => [
                    'confirm' => 'Are you sure you want to delete this item?',
                    'method' => 'post',
                ],
            ]) ?>

        <?php endif; ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'arabic_name',
            'english_name',
            'arabic_address',
            'english_address',
            'location',
            'phone_num',
        ],
    ]) ?>

</div>
