Browse Source

decimal price and design

Oleg K 2 years ago
parent
commit
5089280fbd

+ 1 - 0
config/web.php

@@ -77,6 +77,7 @@ $config = [
                 'pricing/<action:[\w\-]+>' => 'pricing/<action>',
                 'profile/<action:[\w\-]+>' => 'profile/<action>',
                 'pay/<action:[\w\-]+>' => 'pay/<action>',
+                'history/<action:[\w\-]+>' => 'history/<action>',
                 //'user/admin/<action:\w+>' => 'user/admin/<action>',
                 'user/<controller:[\w\-]+>/<action:[\w\-]+>' => 'user/<controller>/<action>',
                 /*'<controller>/<action>' => '<controller>/<action>',

+ 12 - 0
controllers/HistoryController.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace app\controllers;
+
+class HistoryController extends \yii\web\Controller
+{
+    public function actionIndex()
+    {
+        return $this->render('index');
+    }
+
+}

+ 29 - 0
migrations/m210820_084938_decimal_currencies.php

@@ -0,0 +1,29 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m210820_084938_decimal_currencies
+ */
+class m210820_084938_decimal_currencies extends Migration
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->alterColumn('{{%user}}', 'balance', 'decimal(8,2)');
+        $this->alterColumn('{{%user}}', 'plan_price', 'decimal(8,2)');
+        $this->alterColumn('{{%user}}', 'payment_online', 'decimal(8,2)');
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->alterColumn('{{%user}}', 'balance', 'int(11)');
+        $this->alterColumn('{{%user}}', 'plan_price', 'int(11)');
+        $this->alterColumn('{{%user}}', 'payment_online', 'smallint(3)');
+    }
+}

+ 103 - 0
views/history/index.php

@@ -0,0 +1,103 @@
+<?php
+/* @var $this yii\web\View */
+
+$this->title = 'Історія платежів';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<div class="row">
+    <div class="col-md-6">
+        <div class="card card-gray">
+            <div class="card-header">
+                <h3 class="card-title">Рахунки</h3>
+            </div>
+            <!-- /.card-header -->
+            <div class="card-body p-0">
+                <table class="table table-striped">
+                    <thead>
+                    <tr>
+                        <th style="width: 10px">#</th>
+                        <th>Дата</th>
+                        <th></th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr>
+                        <td>1</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>2</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>3</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>4</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>5</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+            <!-- /.card-body -->
+        </div>
+    </div>
+    <div class="col-md-6">
+        <div class="card card-gray">
+            <div class="card-header">
+                <h3 class="card-title">Акти</h3>
+            </div>
+            <!-- /.card-header -->
+            <div class="card-body p-0">
+                <table class="table table-striped">
+                    <thead>
+                    <tr>
+                        <th style="width: 10px">#</th>
+                        <th>Дата</th>
+                        <th></th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr>
+                        <td>1</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>2</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>3</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>4</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    <tr>
+                        <td>5</td>
+                        <td>10.10.2021</td>
+                        <td class="w-25 text-right" width="30%"><a class="text-muted" href="#" data-toggle="tooltip" title="Завантажити"><i class="fas fa-download text-warning"></i></a></td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+            <!-- /.card-body -->
+        </div>
+    </div>
+</div>

+ 27 - 23
views/layouts/main.php

@@ -17,7 +17,7 @@ use app\assets\AdminLteAsset;
 AdminLteAsset::register($this);
 
 $bodyClass = $this->params['body-class'] ?? null;
-Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed', 'layout-navbar-fixed']);
+Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed', 'layout-navbar-fixed', 'accent-dark']);
 
 ?>
 <?php $this->beginPage() ?>
@@ -42,7 +42,7 @@ Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed'
         'togglerOptions' => ['data-widget' => 'pushmenu', 'type' => 'link', 'widget'=>'nav-link'],
         'renderInnerContainer' => false,
         'options' => [
-            'class' => 'main-header navbar navbar-expand navbar-light',
+            'class' => 'main-header navbar navbar-expand navbar-light navbar-warning',
         ],
     ]);
 
@@ -85,33 +85,37 @@ Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed'
     <!-- /.navbar -->
 
     <!-- Main Sidebar Container -->
-    <aside class="main-sidebar sidebar-dark-success elevation-4">
+    <aside class="main-sidebar sidebar-dark-warning elevation-4">
         <!-- Brand Logo -->
-        <a href="<?= Yii::$app->homeUrl; ?>" class="brand-link navbar-dark text-center text-uppercase">
+        <a href="<?= Yii::$app->homeUrl; ?>" class="brand-link navbar-warning text-uppercase">
             <!--<img src="../dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8">-->
-            <?= Html::img('@web/img/logo.png', ['alt' => Yii::$app->name, 'style' => 'width: 30%;opacity:.8;', 'class'=>'d-none brand-image img-circle elevation-3']); ?>
+            <?= Html::img('@web/img/logo.png', ['alt' => Yii::$app->name, 'style' => '', 'class'=>'brand-image']); ?>
             <span class="brand-text font-weight-light"><?= Yii::$app->name; ?></span>
         </a>
 
         <!-- Sidebar -->
         <div class="sidebar">
             <!-- Sidebar user panel (optional) -->
-            <div class="user-panel mt-3 pb-3 mb-3 d-flex justify-content-center">
+            <div class="user-panel mt-3 pb-3 mb-3 ">
                 <div class="image d-none">
                     <!--<img src="../dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image">-->
                     <?= Html::img('@web/img/logo.png', ['alt' => 'User Image', 'style' => '', 'class'=>'d-none img-circle elevation-2']); ?>
                 </div>
-                <div class="info">
-                    <a href="#" class="d-block" data-toggle="tooltip" title="Баланс грн"><i class="far fa-money-bill-alt text-success mr-1"></i> <?=\Yii::$app->user->identity->balance ?> </a>
-                </div>
-                <div class="info d-flex align-items-center">
-                    <a href="#" class="d-block" data-toggle="tooltip" title="Тариф: <?= \Yii::$app->user->identity->plan_title ?>"><i class="fas fa-puzzle-piece text-success"></i> <?=\Yii::$app->user->identity->plan_price ?></a>
+
+                <div class="info text-center text-white">
+                    <p>Поточний баланс: <?= \Yii::$app->user->identity->balance ?> грн</p>
+
                     <?php if (\Yii::$app->user->identity->payment_online): ?>
-                        <i class="fas fa-info-circle ml-1 text-warning" data-toggle="tooltip" title="Очікуємо зарахування коштів"></i>
-                    <div class="spinner-border spinner-border-sm text-success ml-1 d-none" role="status" data-toggle="tooltip" title="Очікуємо зарахування коштів">
-                    </div>
+                    <p style="line-height: 1">Оплачено онлайн: <?= \Yii::$app->user->identity->payment_online; ?> грн,<br>очікуємо зарахування банком</p>
+                    <?php endif; ?>
+
+                    <?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): ?>
+                    <p class="mb-0 mt-3" data-toggle="tooltip" title="Поповніть рахунок для продовження дії тарифного плану &quot;<?= \Yii::$app->user->identity->plan_title ?>&quot;">
+                        <i class="fas fa-exclamation-triangle text-danger"></i><span class="pl-2 text-danger">Недостатньо коштів</span>
+                    </p>
                     <?php endif; ?>
                 </div>
+
             </div>
 
             <!-- Sidebar Menu -->
@@ -131,11 +135,11 @@ Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed'
                      'items' => [
                          [
                              'icon' => FAS::icon('home', ['class' => ['nav-icon']]),
-                             'label' => 'Главная',
+                             'label' => 'Головна',
                              'url' => Yii::$app->homeUrl,
                              'active' => Yii::$app->controller->id === 'site',
                          ],
-                         [
+                         /*[
                              'icon' => FAS::icon('hand-holding-usd', ['class' => ['nav-icon']]),
                              'label' => 'Пополнить счет',
                              'url' => ['/pay/index'],
@@ -146,20 +150,20 @@ Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed'
                              'label' => 'Тарифы',
                              'url' => ['/pricing/index'],
                              'active' => Yii::$app->controller->id === 'pricing',
-                         ],
+                         ],*/
                          [
                              'icon' => FAS::icon('history', ['class' => ['nav-icon']]),
-                             'label' => 'История платежей',
-                             'url' => Yii::$app->homeUrl,
+                             'label' => 'Історія платежів',
+                             'url' => ['/history/index'],
                          ],
                          [
                              'icon' => FAS::icon('user-alt', ['class' => ['nav-icon']]),
-                             'label' => 'Профайл',
+                             'label' => 'Профіль',
                              'url' => ['/profile/index'],
                          ],
                          [
                              'icon' => FAS::icon('sign-out-alt', ['class' => ['nav-icon']]),
-                             'label' => 'Выход',
+                             'label' => 'Вихід',
                              'url' => ['/logout'],
                              'template' => Html::beginForm(['/logout'], 'post')
                                  . '<a href="#" onclick="this.parentNode.submit();" class="nav-link">{icon}&nbsp;<p>{label}</p></a>'
@@ -179,9 +183,9 @@ Html::addCssClass($bodyClass, ['hold-transition', 'sidebar-mini', 'layout-fixed'
         <!-- Content Header (Page header) -->
         <div class="content-header">
             <div class="container-fluid">
-                <div class="row mb-2">
+                <div class="row mb-3">
                     <div class="col-sm-6">
-                        <h1><?= Html::encode($this->title); ?></h1>
+                        <h1 class="text-uppercase"><?= Html::encode($this->title); ?></h1>
                     </div>
                     <div class="col-sm-6 align-self-end">
                         <?= Breadcrumbs::widget([

+ 2 - 2
views/profile/index.php

@@ -9,7 +9,7 @@ $this->params['breadcrumbs'][] = $this->title;
     <div class="col-md-8">
 
         <!-- Profile Box -->
-        <div class="card card-primary ">
+        <div class="card card-gray">
             <div class="card-header">
                 <h3 class="card-title">Загальна інформація</h3>
                 <div class="card-tools"><span data-toggle="tooltip" title="Номер договору" class="badge bg-white"># <?= $profile->uuid ?></span></div>
@@ -48,7 +48,7 @@ $this->params['breadcrumbs'][] = $this->title;
     <!-- /.col -->
     <div class="col-md-4">
         <!-- Financial Box -->
-        <div class="card card-success ">
+        <div class="card card-gray">
             <div class="card-header">
                 <h3 class="card-title">Фінансова інформація</h3>
                 <div class="card-tools"><span data-toggle="tooltip" title="Баланс" class="badge bg-white"><?= $profile->balance ?> грн</span></div>

+ 1 - 1
views/site/index.php

@@ -7,7 +7,7 @@ $this->title = 'Кабінет користувача';
 <div class="site-index">
     <div class="body-content">
 
-        <div class="row d-none">
+        <div class="row">
             <div class="col-md-4 col-lg-3">
                 <div class="info-box bg-gradient-warning">
                     <span class="info-box-icon"><i class="fas fa-hryvnia text-xl"></i></span>

BIN
web/img/logo.png