Parcourir la source

[backend] Onglet "Abonnés" dans les sections Utilisateurs et Communiquer

dev
Guillaume Bourgeois il y a 5 ans
Parent
révision
fc2e4171c4
9 fichiers modifiés avec 82 ajouts et 37 suppressions
  1. +10
    -4
      backend/controllers/UserController.php
  2. +4
    -2
      backend/views/communicate/index.php
  3. +17
    -7
      backend/views/user/_menu.php
  4. +1
    -0
      backend/views/user/emails.php
  5. +1
    -0
      backend/views/user/index.php
  6. +27
    -23
      backend/web/css/screen.css
  7. +4
    -0
      backend/web/sass/screen.scss
  8. +8
    -0
      common/models/User.php
  9. +10
    -1
      common/models/UserSearch.php

+ 10
- 4
backend/controllers/UserController.php Voir le fichier

@@ -81,14 +81,15 @@ class UserController extends BackendController
* @return mixed
*/
public function actionIndex(
$idPointSale = 0, $sectionInactiveUsers = false)
$idPointSale = 0, $sectionSubscribers = false, $sectionInactiveUsers = false)
{
$searchModel = new UserSearch ;
$dataProvider = $searchModel->search([
'UserSearch' => array_merge(
[
'id_point_sale' => $idPointSale,
'inactive' => (int) $sectionInactiveUsers
'inactive' => (int) $sectionInactiveUsers,
'subscribers' => (int) $sectionSubscribers
],
isset(Yii::$app->request->queryParams['UserSearch']) ?
Yii::$app->request->queryParams['UserSearch'] :
@@ -109,6 +110,7 @@ class UserController extends BackendController
'idPointSaleActive' => $idPointSale,
'pointsSaleArray' => $pointsSaleArray,
'sectionInactiveUsers' => $sectionInactiveUsers,
'sectionSubscribers' => $sectionSubscribers,
]);
}
@@ -286,11 +288,13 @@ class UserController extends BackendController
* @param integer $idPointSale
* @return mixed
*/
public function actionMail($idPointSale = 0)
public function actionMail($idPointSale = 0, $sectionSubscribers = 0, $sectionInactiveUsers = 0)
{
$users = User::findBy([
'id_producer' => Producer::getId(),
'id_point_sale' => $idPointSale
'id_point_sale' => $idPointSale,
'subscribers' => $sectionSubscribers,
'inactive' => $sectionInactiveUsers,
])->all() ;

$usersArray = [];
@@ -332,6 +336,8 @@ class UserController extends BackendController
'mailForm' => $mailForm,
'idPointSaleActive' => $idPointSale,
'incomingDistributionsArray' => $incomingDistributionsArray,
'sectionSubscribers' => $sectionSubscribers,
'sectionInactiveUsers' => $sectionInactiveUsers,
]);
}


+ 4
- 2
backend/views/communicate/index.php Voir le fichier

@@ -51,9 +51,11 @@ $this->addBreadcrumb('Communiquer') ;
<div class="panel-body">
<p>Choisissez à quels utilisateurs vous souhaitez envoyer un email :</p>
<div>
<?= Html::a('Tous',['user/mail', 'idPointSale' => 0], ['class' => 'btn btn-default btn-point-sale']); ?>
<?= Html::a('<span class="glyphicon glyphicon-th-list"></span> Tous',['user/mail', 'idPointSale' => 0], ['class' => 'btn btn-default btn-point-sale']); ?>
<?= Html::a('<span class="glyphicon glyphicon-repeat"></span> Abonnés',['user/mail', 'sectionSubscribers' => 1], ['class' => 'btn btn-default btn-point-sale']); ?>
<?= Html::a('<span class="glyphicon glyphicon-time"></span> Inactifs',['user/mail', 'sectionInactiveUsers' => 1], ['class' => 'btn btn-default btn-point-sale']); ?>
<?php foreach($pointsSaleArray as $pointSale): ?>
<?= Html::a(Html::encode($pointSale->name), ['user/mail', 'idPointSale' => $pointSale->id], ['class' => 'btn btn-default btn-point-sale']); ?>
<?= Html::a('<span class="glyphicon glyphicon-map-marker"></span> '.Html::encode($pointSale->name), ['user/mail', 'idPointSale' => $pointSale->id], ['class' => 'btn btn-default btn-point-sale']); ?>
<?php endforeach; ?>
</div>
</div>

+ 17
- 7
backend/views/user/_menu.php Voir le fichier

@@ -40,20 +40,30 @@ termes.

<div id="menu-users">
<div id="nav-points-sale">
<a class="btn <?php if(!$idPointSaleActive && !$sectionInactiveUsers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section]); ?>">
Tous <span class="glyphicon glyphicon-triangle-bottom"></span>
<a class="btn <?php if(!$idPointSaleActive && !$sectionInactiveUsers && !$sectionSubscribers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section]); ?>">
<span class="glyphicon glyphicon-th-list"></span> Tous <span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php if(isset($sectionSubscribers) && !is_null($sectionSubscribers)): ?>
<a class="btn <?php if($sectionSubscribers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section,'sectionSubscribers' => 1]); ?>">
<span class="glyphicon glyphicon-repeat"></span>
Abonnés
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php endif; ?>
<?php if(isset($sectionInactiveUsers) && !is_null($sectionInactiveUsers)): ?>
<a class="btn <?php if($sectionInactiveUsers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section,'sectionInactiveUsers' => 1]); ?>">
<span class="glyphicon glyphicon-time"></span>
Inactifs
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php endif; ?>
<?php foreach($pointsSaleArray as $pointSale): ?>
<a class="btn <?php if($idPointSaleActive == $pointSale->id): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section,'idPointSale' => $pointSale->id]); ?>">
<span class="glyphicon glyphicon-map-marker"></span>
<?= Html::encode($pointSale->name) ?>
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php endforeach; ?>
<?php if(isset($sectionInactiveUsers) && !is_null($sectionInactiveUsers)): ?>
<a class="btn <?php if($sectionInactiveUsers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/index','sectionInactiveUsers' => 1]); ?>">
Inactifs <span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php endif; ?>
</div>

<div id="submenu">

+ 1
- 0
backend/views/user/emails.php Voir le fichier

@@ -50,6 +50,7 @@ $this->addBreadcrumb($this->getTitle()) ;
$this->render('_menu',[
'idPointSaleActive' => $idPointSaleActive,
'sectionInactiveUsers' => isset($sectionInactiveUsers) ? $sectionInactiveUsers : null,
'sectionSubscribers' => isset($sectionSubscribers) ? $sectionSubscribers: null,
'pointsSaleArray' => $pointsSaleArray,
'section' => 'mail'
]) ;

+ 1
- 0
backend/views/user/index.php Voir le fichier

@@ -52,6 +52,7 @@ $this->addButton(['label' => 'Nouvel utilisateur <span class="glyphicon glyphico
$this->render('_menu',[
'idPointSaleActive' => $idPointSaleActive,
'sectionInactiveUsers' => $sectionInactiveUsers,
'sectionSubscribers' => $sectionSubscribers,
'pointsSaleArray' => $pointsSaleArray,
'section' => 'index'
]) ;

+ 27
- 23
backend/web/css/screen.css Voir le fichier

@@ -1332,17 +1332,21 @@ a.btn.btn-primary .glyphicon-triangle-bottom, button.btn.btn-primary .glyphicon-
margin-bottom: 30px;
text-align: left;
}
/* line 1309, ../sass/screen.scss */
#menu-users a {
margin-bottom: 15px;
}

/* line 1311, ../sass/screen.scss */
/* line 1315, ../sass/screen.scss */
.user-index .input-group {
width: 180px;
}
/* line 1314, ../sass/screen.scss */
/* line 1318, ../sass/screen.scss */
.user-index .input-group .input-credit {
text-align: center;
}

/* line 1321, ../sass/screen.scss */
/* line 1325, ../sass/screen.scss */
.user-credit .the-credit {
float: right;
font-weight: bold;
@@ -1358,16 +1362,16 @@ a.btn.btn-primary .glyphicon-triangle-bottom, button.btn.btn-primary .glyphicon-
}

/* facturation */
/* line 1336, ../sass/screen.scss */
/* line 1340, ../sass/screen.scss */
#free-price {
padding: 20px;
background-color: #F9F9F9;
}
/* line 1340, ../sass/screen.scss */
/* line 1344, ../sass/screen.scss */
#free-price h2 {
font-family: "myriadpro-it";
}
/* line 1344, ../sass/screen.scss */
/* line 1348, ../sass/screen.scss */
#free-price .amount span {
font-size: 25px;
color: white;
@@ -1379,25 +1383,25 @@ a.btn.btn-primary .glyphicon-triangle-bottom, button.btn.btn-primary .glyphicon-
padding-top: 7px;
font-family: "myriadpro-regular";
}
/* line 1355, ../sass/screen.scss */
/* line 1359, ../sass/screen.scss */
#free-price label {
text-transform: uppercase;
font-family: "myriadpro-light";
font-size: 20px;
}
/* line 1360, ../sass/screen.scss */
/* line 1364, ../sass/screen.scss */
#free-price label span {
font-size: 16px;
}
/* line 1366, ../sass/screen.scss */
/* line 1370, ../sass/screen.scss */
#free-price .field-producer-free_price .input-group {
width: 200px;
}
/* line 1372, ../sass/screen.scss */
/* line 1376, ../sass/screen.scss */
#free-price .field-user-free_price label {
display: none;
}
/* line 1377, ../sass/screen.scss */
/* line 1381, ../sass/screen.scss */
#free-price #producer-free_price {
width: 100px;
height: 60px;
@@ -1406,37 +1410,37 @@ a.btn.btn-primary .glyphicon-triangle-bottom, button.btn.btn-primary .glyphicon-
text-align: center;
}

/* line 1387, ../sass/screen.scss */
/* line 1391, ../sass/screen.scss */
.development-index ul#tabs-status-developments {
margin-bottom: 30px;
border-bottom: solid 3px #FF7F00;
}
/* line 1391, ../sass/screen.scss */
/* line 1395, ../sass/screen.scss */
.development-index ul#tabs-status-developments a {
text-transform: uppercase;
}
/* line 1394, ../sass/screen.scss */
/* line 1398, ../sass/screen.scss */
.development-index ul#tabs-status-developments .active {
border: 0px none;
background: none;
}
/* line 1397, ../sass/screen.scss */
/* line 1401, ../sass/screen.scss */
.development-index ul#tabs-status-developments .active a {
background-color: #FF7F00;
color: white;
}
/* line 1405, ../sass/screen.scss */
/* line 1409, ../sass/screen.scss */
.development-index #tab-developments .btn-group-priority {
width: 100%;
margin-bottom: 5px;
}
/* line 1409, ../sass/screen.scss */
/* line 1413, ../sass/screen.scss */
.development-index #tab-developments .btn-group-priority .btn-priority {
display: block;
float: none;
width: 100%;
}
/* line 1416, ../sass/screen.scss */
/* line 1420, ../sass/screen.scss */
.development-index #tab-developments .label-priority {
display: block;
width: 100%;
@@ -1445,24 +1449,24 @@ a.btn.btn-primary .glyphicon-triangle-bottom, button.btn.btn-primary .glyphicon-
}

/* stats */
/* line 1429, ../sass/screen.scss */
/* line 1433, ../sass/screen.scss */
.stats-products #nav-year {
float: right;
}
/* line 1434, ../sass/screen.scss */
/* line 1438, ../sass/screen.scss */
.stats-products tr.month th {
text-align: center;
}
/* line 1439, ../sass/screen.scss */
/* line 1443, ../sass/screen.scss */
.stats-products tr.sub-head th {
font-weight: normal;
font-size: 12px;
}
/* line 1445, ../sass/screen.scss */
/* line 1449, ../sass/screen.scss */
.stats-products td.name {
text-transform: uppercase;
}
/* line 1449, ../sass/screen.scss */
/* line 1453, ../sass/screen.scss */
.stats-products td.align-center {
text-align: center;
}

+ 4
- 0
backend/web/sass/screen.scss Voir le fichier

@@ -1305,6 +1305,10 @@ a.btn, button.btn {
margin-bottom: 30px ;
text-align: left ;
}
a {
margin-bottom: 15px ;
}
}

.user-index {

+ 8
- 0
common/models/User.php Voir le fichier

@@ -320,6 +320,14 @@ class User extends ActiveRecordCommon implements IdentityInterface
}
}
if(isset($params['subscribers']) && $params['subscribers']) {
$query->innerJoin(
'subscription',
'user.id = subscription.id_user AND subscription.id_producer = :id_producer',
[':id_producer' => Producer::getId()]
)->groupBy('user.id') ;
}
if(isset($params['inactive']) && $params['inactive']) {
$query->innerJoin(
'order',

+ 10
- 1
common/models/UserSearch.php Voir le fichier

@@ -43,6 +43,7 @@ use common\models\User ;
class UserSearch extends User
{
var $id_point_sale ;
var $subscribers ;
var $inactive ;
var $username ;
@@ -51,7 +52,7 @@ class UserSearch extends User
return [
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday', 'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday', 'mail_distribution_sunday'], 'boolean'],
[['lastname', 'name', 'phone', 'address'], 'string'],
[['id_point_sale', 'inactive'],'integer'],
[['id_point_sale', 'inactive', 'subscribers'],'integer'],
[['date_last_connection', 'id_point_sale', 'username'], 'safe'],
];
}
@@ -114,6 +115,14 @@ class UserSearch extends User
$query->innerJoin('user_point_sale','user.id = user_point_sale.id_user AND user_point_sale.id_point_sale = :id_point_sale',[':id_point_sale' => $this->id_point_sale]) ;
}
if(isset($this->subscribers) && $this->subscribers) {
$query->innerJoin(
'subscription',
'user.id = subscription.id_user AND subscription.id_producer = :id_producer',
[':id_producer' => Producer::getId()]
)->groupBy('user.id') ;
}
if(isset($this->inactive) && $this->inactive) {
$query->having([
'count_orders' => 0

Chargement…
Annuler
Enregistrer