Parcourir la source

Mise en place des notifications dans le header (dernières inscriptions + utilisateurs au crédit négatif)

dev
Guillaume Bourgeois il y a 6 ans
Parent
révision
f4717f1519
4 fichiers modifiés avec 102 ajouts et 203 suppressions
  1. +37
    -185
      backend/views/layouts/header.php
  2. +37
    -16
      backend/web/css/screen.css
  3. +26
    -1
      backend/web/sass/_adminlte.scss
  4. +2
    -1
      common/models/User.php

+ 37
- 185
backend/views/layouts/header.php Voir le fichier

@@ -57,218 +57,70 @@ use yii\helpers\ArrayHelper;
</a>

<div class="navbar-custom-menu">

<?php
$usersArray = User::findBy(['id_producer' => Producer::getId()])
->andWhere('CAST(FROM_UNIXTIME(user.created_at) AS date) > \''.date("Y-m-d", strtotime("-7 days")).'\'')
->orderBy('created_at DESC')
->all();
?>
<ul class="nav navbar-nav">

<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu">
<li class="dropdown users-menu notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
<i class="fa fa-user-plus"></i>
<?php if(count($usersArray)): ?><span class="label label-success"><?= count($usersArray) ?></span>
<?php else: ?><span class="label label-warning">0</span><?php endif; ?>
</a>
<ul class="dropdown-menu">
<li class="header">You have 4 messages</li>
<li class="header">Inscriptions des 7 derniers jours</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle"
alt="User Image"/>
</div>
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="<?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
AdminLTE Design Team
<small><i class="fa fa-clock-o"></i> 2 hours</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="<?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Developers
<small><i class="fa fa-clock-o"></i> Today</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="<?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Sales Department
<small><i class="fa fa-clock-o"></i> Yesterday</small>
</h4>
<p>Why not buy a new awesome theme?</p>
</a>
</li>
<?php foreach($usersArray as $user): ?>
<li>
<a href="#">
<div class="pull-left">
<img src="<?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle"
alt="user image"/>
</div>
<h4>
Reviewers
<small><i class="fa fa-clock-o"></i> 2 days</small>
</h4>
<p>Why not buy a new awesome theme?</p>
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['user/update','id' => $user['user_id']]) ; ?>">
<h5><?= Html::encode($user['name'].' '.$user['lastname']) ; ?> <small><i class="fa fa-clock-o"></i> <?= date('d/m/Y à H:i',$user['created_at']); ?></small></h5>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
</li>
<li class="dropdown notifications-menu">
<?php
$usersNegativeCreditArray = User::findBy(['id_producer' => Producer::getId()])
->andWhere('user_producer.credit < 0')
->orderBy('lastname, name ASC')
->all();

?>
<li class="dropdown users-negative-credit-menu notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
<i class="fa fa-euro"></i>
<?php if(count($usersNegativeCreditArray)): ?><span class="label label-warning"><?= count($usersNegativeCreditArray) ?></span>
<?php else: ?><span class="label label-success">0</span><?php endif; ?>
</a>
<ul class="dropdown-menu">
<li class="header">You have 10 notifications</li>
<li class="header">Utilisateurs au crédit négatif</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<?php foreach($usersNegativeCreditArray as $user): ?>
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i> 5 new members joined today
</a>
</li>
<li>
<a href="#">
<i class="fa fa-warning text-yellow"></i> Very long description here that may
not fit into the page and may cause design problems
</a>
</li>
<li>
<a href="#">
<i class="fa fa-users text-red"></i> 5 new members joined
</a>
</li>

<li>
<a href="#">
<i class="fa fa-shopping-cart text-green"></i> 25 sales made
</a>
</li>
<li>
<a href="#">
<i class="fa fa-user text-red"></i> You changed your username
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['user/credit','id' => $user['user_id']]) ; ?>">
<h5><?= Html::encode($user['name'].' '.$user['lastname']) ; ?> <small><i class="fa fa-euro"></i> <?= Price::format($user['credit']); ?></small></h5>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
<li class="footer"><a href="#">View all</a></li>
</ul>
</li>
<!-- Tasks: style can be found in dropdown.less -->
<li class="dropdown tasks-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul class="dropdown-menu">
<li class="header">You have 9 tasks</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Design some buttons
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Create a nice theme
<small class="pull-right">40%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-green" style="width: 40%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Some task I need to do
<small class="pull-right">60%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-red" style="width: 60%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">60% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Make beautiful transitions
<small class="pull-right">80%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-yellow" style="width: 80%"
role="progressbar" aria-valuenow="20" aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">80% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
</li>
<?php if (User::isCurrentProducer() || User::isCurrentAdmin()): ?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-home"></i>

+ 37
- 16
backend/web/css/screen.css Voir le fichier

@@ -1438,81 +1438,102 @@ body.skin-black .main-header .logo, body.skin-black .main-header .navbar .sideba
border-right: solid 1px #d1ae8d;
}
/* line 50, ../sass/_adminlte.scss */
body.skin-black .main-header .messages-menu, body.skin-black .main-header .notifications-menu, body.skin-black .main-header .tasks-menu, body.skin-black .main-header .link-control-sidebar {
body.skin-black .main-header .link-control-sidebar {
display: none;
}
/* line 55, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu {
max-height: 300px;
}
/* line 58, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a {
padding-top: 4px;
padding-bottom: 4px;
}
/* line 62, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a h5 {
margin-bottom: 2px;
}
/* line 65, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a h5 small {
float: right;
}
/* line 70, ../sass/_adminlte.scss */
body.skin-black .main-header .notifications-menu ul.menu li a p {
margin-left: 10px;
}
/* line 80, ../sass/_adminlte.scss */
body.skin-black .sidebar-menu > li.active > a {
border-color: #BB8757;
}
/* line 59, ../sass/_adminlte.scss */
/* line 84, ../sass/_adminlte.scss */
body.skin-black .content-wrapper {
background-color: #f5f5f5;
}
/* line 62, ../sass/_adminlte.scss */
/* line 87, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .content-header {
background-color: #eeeeee;
padding-bottom: 15px;
border-bottom: solid 1px #e0e0e0;
}
/* line 68, ../sass/_adminlte.scss */
/* line 93, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .content-header .btn {
padding: 3px 6px;
font-size: 13px;
}
/* line 74, ../sass/_adminlte.scss */
/* line 99, ../sass/_adminlte.scss */
body.skin-black .content-wrapper a {
color: #BB8757;
}
/* line 78, ../sass/_adminlte.scss */
/* line 103, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn {
color: white;
}
/* line 82, ../sass/_adminlte.scss */
/* line 107, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn-default {
color: #333;
}
/* line 86, ../sass/_adminlte.scss */
/* line 111, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .btn-primary, body.skin-black .content-wrapper .btn-success {
background-color: #BB8757;
color: white;
border-color: #BB8757;
}
/* line 94, ../sass/_adminlte.scss */
/* line 119, ../sass/_adminlte.scss */
body.skin-black .main-footer a {
color: #BB8757;
}

/* line 100, ../sass/_adminlte.scss */
/* line 125, ../sass/_adminlte.scss */
body.login-page {
background: none;
background-color: #F8F1DD;
}
/* line 104, ../sass/_adminlte.scss */
/* line 129, ../sass/_adminlte.scss */
body.login-page .login-box .login-logo {
text-align: center;
font-family: "comfortaalight";
}
/* line 107, ../sass/_adminlte.scss */
/* line 132, ../sass/_adminlte.scss */
body.login-page .login-box .login-logo img {
width: 50px;
}
/* line 112, ../sass/_adminlte.scss */
/* line 137, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body .btn-primary {
background-color: #BB8757;
border-color: #BB8757;
padding: 5px 10px;
}
/* line 117, ../sass/_adminlte.scss */
/* line 142, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body .btn-primary:active {
background-color: #c29469;
border-color: #BB8757;
}
/* line 123, ../sass/_adminlte.scss */
/* line 148, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body a {
color: #BB8757;
}
/* line 125, ../sass/_adminlte.scss */
/* line 150, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body a:hover {
color: #c29469;
}

+ 26
- 1
backend/web/sass/_adminlte.scss Voir le fichier

@@ -47,9 +47,34 @@ body.skin-black {
border-right: solid 1px lighten($color1, 15) ;
}
.messages-menu, .notifications-menu, .tasks-menu, .link-control-sidebar {
.link-control-sidebar {
display: none ;
}
.notifications-menu {
ul.menu {
max-height: 300px ;
li {
a {
padding-top: 4px ;
padding-bottom: 4px ;
h5 {
margin-bottom: 2px ;
small {
float: right ;
}
}
p {
margin-left: 10px ;
}
}
}
}
}
}

.sidebar-menu > li.active > a {

+ 2
- 1
common/models/User.php Voir le fichier

@@ -287,12 +287,13 @@ class User extends ActiveRecordCommon implements IdentityInterface
*/
public static function findBy($params = [])
{
if (!isset($params['id_producer'])) {
$params['id_producer'] = Producer::getId() ;
}
$query = (new Query())
->select(['user.id AS user_id', 'user.name', 'user.lastname', 'user.phone', 'user.email', 'user.created_at', 'CAST(FROM_UNIXTIME(user.created_at) AS date) as date_created_at','user.date_last_connection', 'user_producer.*'])
->select(['user.id AS user_id', 'user.name', 'user.lastname', 'user.phone', 'user.email', 'user.created_at','user.date_last_connection', 'user_producer.*'])
->from('user');
$active = (isset($params['inactive']) && $params['inactive']) ? 0 : 1 ;

Chargement…
Annuler
Enregistrer