<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\widgets\Alert;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;


$items = [];
if (!Yii::$app->user->isGuest){
    $items[] = ['label' => Yii::t('app', 'Main Categories'), 'url' => ['/main-categories/index'] ];
    $items[] = ['label' => Yii::t('app', 'Items'), 'url' => ['/items/index'] ];
    $items[] = ['label' => Yii::t('app', 'Branches'), 'url' => ['/branches/index'] ];
    $items[] = ['label' => Yii::t('app', 'System Configurations'), 'url' => ['/system-configurations/configure-options'] ];
}
    $items[] = Yii::$app->user->isGuest ?

                ['label' => Yii::t('app', 'Login'), 'url' => ['/admins/login'] ]
    
                :

                ['label' => Yii::t('app', 'Logout') . ' (' . ucfirst(Yii::$app->user->identity->username) . ')',
                    'url' => ['/admins/logout'],
                ];
    $items[] = Yii::$app->language == 'en' ?
                ['label' => 'عربي', 'url' => ['site/change-language', 'lang' => 'ar', 'current_url' => Yii::$app->request->url]]
                :
                ['label' => 'English', 'url' => ['site/change-language', 'lang' => 'en', 'current_url' => Yii::$app->request->url]];

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>" dir="<?= Yii::$app->language == 'en' ? 'ltr': 'rtl' ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php $this->registerCsrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
    <link rel="stylesheet" href="<?=Url::base(true)?>/css/main.css" />
    <?php if (Yii::$app->controller->id == 'menu'){
         echo '<link rel="stylesheet" href="'.Url::base(true).'/css/user.css" />';
    }
    ?>
    
    <?php if(Yii::$app->language == 'ar'){
        echo '<link rel="stylesheet" href="'.Url::base(true).'/css/bootstrap-ar.min.css" />';
        echo '<link rel="stylesheet" href="'.Url::base(true).'/css/main-ar.css" />';
        if (Yii::$app->controller->id == 'menu'){
            echo '<link rel="stylesheet" href="'.Url::base(true).'/css/user-ar.css" />';
        }
        
    }?>
</head>
<body>

<?php $this->beginBody() ?>

<div class="wrap">
    
<?php
    if (Yii::$app->controller->id != 'menu') {
        NavBar::begin([
            'brandLabel' => Yii::t('app','Home Page' ),
            'brandUrl' => Yii::$app->homeUrl,
            'options' => [
                'class' => 'navbar-inverse special-navbar navbar-fixed-top',
            ],
        ]);
        echo Nav::widget([
            'options' => ['class' => 'navbar-nav navbar-right'],
            'items' =>  $items ,
        ]);
        NavBar::end();
    }
    
    ?>


    
        <div class="container-fluid content menu-user" >
            
           
            <?= Alert::widget() ?>
            
            <?= $content ?>

        </div>
   
    
</div>


<footer class="container-fluid footer footer-user">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 custom-footer">
                            <p class="text-footer"><?= Yii::t('app','Developed By:')?> &nbsp;</p>
                            <a target="_blank" href="https://www.flexsolution.biz/"> <?= Yii::t('app','Flex Solutions')?></a>
                        </div>
                    </div>
                
                </div>

            </footer>

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
