main.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?php
  2. /* @var $this \yii\web\View */
  3. /* @var $content string */
  4. use app\widgets\Alert;
  5. use yii\helpers\Html;
  6. use yii\bootstrap4\Nav;
  7. use yii\bootstrap4\NavBar;
  8. use rmrevin\yii\fontawesome\FAR;
  9. use rmrevin\yii\fontawesome\FAS;
  10. use yii\widgets\Breadcrumbs;
  11. use app\widgets\MainSidebarMenu;
  12. use app\assets\AdminLteAsset;
  13. //AppAsset::register($this);
  14. AdminLteAsset::register($this);
  15. $bodyClass = $this->params['body-class'] ?? null;
  16. Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed', 'layout-navbar-fixed', 'accent-dark']);
  17. ?>
  18. <?php $this->beginPage() ?>
  19. <!DOCTYPE html>
  20. <html lang="<?= Yii::$app->language ?>">
  21. <head>
  22. <meta charset="<?= Yii::$app->charset ?>">
  23. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  24. <meta name="viewport" content="width=device-width, initial-scale=1">
  25. <?php $this->registerCsrfMetaTags() ?>
  26. <title><?= Html::encode($this->title) ?></title>
  27. <?php $this->head() ?>
  28. </head>
  29. <?= Html::tag('body', '', $bodyClass); ?>
  30. <?php $this->beginBody() ?>
  31. <!-- Site wrapper -->
  32. <div class="wrapper">
  33. <!-- Navbar -->
  34. <?php
  35. NavBar::begin([
  36. 'brandUrl' => Yii::$app->homeUrl,
  37. 'togglerOptions' => ['data-widget' => 'pushmenu', 'type' => 'link', 'widget'=>'nav-link'],
  38. 'renderInnerContainer' => false,
  39. 'options' => [
  40. 'class' => 'main-header navbar navbar-expand navbar-light navbar-warning',
  41. ],
  42. ]);
  43. echo Nav::widget([
  44. 'options' => ['class' => 'navbar-nav'],
  45. 'items' => [
  46. ['label' => '<i class="fas fa-bars"></i>', 'linkOptions' => ['data-widget' => 'pushmenu'], 'encode' => false],
  47. ],
  48. ]);
  49. $menuItems = [
  50. [
  51. 'label' => FAS::icon('users', ['class' => ['nav-icon']]) . ' <span class="d-none d-sm-inline-block">Пользователи</span>',
  52. 'raw' => true,
  53. 'url' => ['/user/admin/index'],
  54. 'active' => Yii::$app->controller->module->id == 'user',
  55. 'visible' => Yii::$app->user->can('admin'),
  56. ],
  57. ];
  58. if (Yii::$app->user->isGuest) {
  59. $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
  60. } else {
  61. $menuItems[] = '<li class="nav-item">'
  62. . Html::beginForm(['/logout'], 'post')
  63. . Html::submitButton(
  64. 'Выйти (' . Yii::$app->user->identity->username . ')',
  65. ['class' => 'btn btn-link logout']
  66. )
  67. . Html::endForm()
  68. . '</li>';
  69. };
  70. $menuItems[] = ['label' => 'Home2', 'url' => ['/site/index'], 'linkOptions' => ['data-widget' => 'control-sidebar', 'class' => 'd-none']];
  71. echo Nav::widget([
  72. 'options' => ['class' => 'navbar-nav ml-auto'],
  73. 'encodeLabels' => false,
  74. 'items' => $menuItems,
  75. ]);
  76. NavBar::end();
  77. ?>
  78. <!-- /.navbar -->
  79. <!-- Main Sidebar Container -->
  80. <aside class="main-sidebar sidebar-dark-warning elevation-4">
  81. <!-- Brand Logo -->
  82. <a href="<?= Yii::$app->homeUrl; ?>" class="brand-link navbar-warning text-uppercase">
  83. <!--<img src="../dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8">-->
  84. <?= Html::img('@web/img/logo.png', ['alt' => Yii::$app->name, 'style' => '', 'class'=>'brand-image']); ?>
  85. <span class="brand-text font-weight-light"><?= Yii::$app->name; ?></span>
  86. </a>
  87. <!-- Sidebar -->
  88. <div class="sidebar">
  89. <!-- Sidebar user panel (optional) -->
  90. <div class="user-panel mt-3 pb-3 mb-3 ">
  91. <div class="image d-none">
  92. <!--<img src="../dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image">-->
  93. <?= Html::img('@web/img/logo.png', ['alt' => 'User Image', 'style' => '', 'class'=>'d-none img-circle elevation-2']); ?>
  94. </div>
  95. <div class="info text-center text-white">
  96. <p>Поточний баланс: <?= \Yii::$app->user->identity->balance ?> грн</p>
  97. <?php if (\Yii::$app->user->identity->payment_online): ?>
  98. <p style="line-height: 1">Оплачено онлайн: <?= \Yii::$app->user->identity->payment_online; ?> грн,<br>очікуємо зарахування банком</p>
  99. <?php endif; ?>
  100. <?php if((\Yii::$app->user->identity->balance - \Yii::$app->user->identity->plan_price) < 0 && (\Yii::$app->user->identity->payment_online + \Yii::$app->user->identity->balance) < \Yii::$app->user->identity->plan_price): ?>
  101. <p class="mb-0 mt-3" data-toggle="tooltip" title="Поповніть рахунок для продовження дії тарифного плану &quot;<?= \Yii::$app->user->identity->plan_title ?>&quot;">
  102. <i class="fas fa-exclamation-triangle text-danger"></i><span class="pl-2 text-danger">Недостатньо коштів</span>
  103. </p>
  104. <?php endif; ?>
  105. </div>
  106. </div>
  107. <!-- Sidebar Menu -->
  108. <nav class="mt-2">
  109. <?php
  110. echo MainSidebarMenu::widget([
  111. 'options' => [
  112. 'class' => 'nav nav-pills nav-sidebar flex-column nav-child-indent',
  113. 'data' => [
  114. 'widget' => 'treeview',
  115. 'accordion' => 'false'
  116. ],
  117. 'role' => 'menu',
  118. ],
  119. 'encodeLabels' => false,
  120. //'activateParents' => true,
  121. 'items' => [
  122. [
  123. 'icon' => FAS::icon('home', ['class' => ['nav-icon']]),
  124. 'label' => 'Головна',
  125. 'url' => Yii::$app->homeUrl,
  126. 'active' => Yii::$app->controller->id === 'site',
  127. ],
  128. /*[
  129. 'icon' => FAS::icon('hand-holding-usd', ['class' => ['nav-icon']]),
  130. 'label' => 'Пополнить счет',
  131. 'url' => ['/pay/index'],
  132. //'active' => Yii::$app->controller->id === 'site',
  133. ],
  134. [
  135. 'icon' => FAS::icon('money-check-alt', ['class' => ['nav-icon']]),
  136. 'label' => 'Тарифы',
  137. 'url' => ['/pricing/index'],
  138. 'active' => Yii::$app->controller->id === 'pricing',
  139. ],*/
  140. [
  141. 'icon' => FAS::icon('history', ['class' => ['nav-icon']]),
  142. 'label' => 'Історія платежів',
  143. 'url' => ['/history/index'],
  144. ],
  145. [
  146. 'icon' => FAS::icon('user-alt', ['class' => ['nav-icon']]),
  147. 'label' => 'Профіль',
  148. 'url' => ['/profile/index'],
  149. 'active' => Yii::$app->controller->id === 'profile',
  150. ],
  151. [
  152. 'icon' => FAS::icon('sign-out-alt', ['class' => ['nav-icon']]),
  153. 'label' => 'Вихід',
  154. 'url' => ['/logout'],
  155. 'template' => Html::beginForm(['/logout'], 'post')
  156. . '<a href="#" onclick="this.parentNode.submit();" class="nav-link">{icon}&nbsp;<p>{label}</p></a>'
  157. . Html::endForm()
  158. ]
  159. ],
  160. ]);
  161. ?>
  162. </nav>
  163. <!-- /.sidebar-menu -->
  164. </div>
  165. <!-- /.sidebar -->
  166. </aside>
  167. <!-- Content Wrapper. Contains page content -->
  168. <div class="content-wrapper">
  169. <!-- Content Header (Page header) -->
  170. <div class="content-header">
  171. <div class="container-fluid">
  172. <div class="row mb-3">
  173. <div class="col-sm-6">
  174. <h1 class="text-uppercase"><?= Html::encode($this->title); ?></h1>
  175. </div>
  176. <div class="col-sm-6 align-self-end">
  177. <?= Breadcrumbs::widget([
  178. 'homeLink' => [
  179. 'label' => FAS::icon('home', ['class' => ['nav-icon']]),
  180. 'url' => Yii::$app->homeUrl,
  181. 'class' => 'text-secondary',
  182. 'encode' => false,
  183. ],
  184. 'tag' => 'ol',
  185. 'options' => [
  186. 'class' => 'breadcrumb text-sm float-sm-right'
  187. ],
  188. 'itemTemplate' => "<li class=\"breadcrumb-item\">{link}</li>\n",
  189. 'activeItemTemplate' => "<li class=\"breadcrumb-item active\">{link}</li>\n",
  190. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  191. ]) ?>
  192. </div>
  193. </div>
  194. </div><!-- /.container-fluid -->
  195. </div>
  196. <!-- /.content-header -->
  197. <!-- Main content -->
  198. <div class="content">
  199. <div class="container-fluid">
  200. <?= Alert::widget() ?>
  201. <?= $content ?>
  202. </div>
  203. </div>
  204. <!-- /.content -->
  205. </div>
  206. <!-- /.content-wrapper -->
  207. <footer class="main-footer text-sm">
  208. <div class="float-right d-none d-sm-block">
  209. Розробка: <a href="http://reactlogic.com.ua/" target="_blank">ReactLogic</a>
  210. </div>
  211. <strong>Copyright &copy; <?= date('Y') ?> <?= Html::encode(Yii::$app->name) ?>.</strong> All rights reserved.
  212. </footer>
  213. </div>
  214. <?php $this->endBody() ?>
  215. </body>
  216. </html>
  217. <?php $this->endPage() ?>