소스 검색

[Backend] Tableau de bord : clients au crédit pain négatif

prodstable
keun 6 년 전
부모
커밋
b9aed0edca
3개의 변경된 파일42개의 추가작업 그리고 4개의 파일을 삭제
  1. +5
    -3
      backend/controllers/SiteController.php
  2. +36
    -0
      backend/views/site/index.php
  3. +1
    -1
      common/models/User.php

+ 5
- 3
backend/controllers/SiteController.php 파일 보기

@@ -104,17 +104,19 @@ class SiteController extends BackendController
->limit(5)
->all();

$clients_credit_pain_negatif = User::findBy(['id_etablissement' => Yii::$app->user->identity->id_etablissement])
->andWhere('user_etablissement.credit < 0')
->all();
// paramètres
$etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ;
return $this->render('index',[
'productions' => $productions,
'commandes' => $commandes,
'clients' => $clients,
'nb_clients' => $nb_clients,
'clients_credit_pain_negatif' => $clients_credit_pain_negatif,
'etablissement' => $etablissement,
]);
}

+ 36
- 0
backend/views/site/index.php 파일 보기

@@ -90,6 +90,42 @@ $this->title = 'Tableau de bord';
</div>
</div>
</div>
<!-- Clients crédit pain négatif -->
<div class="">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Clients au crédit pain négatif
</h3>
</div>
<div class="panel-body">
<?php if(count($clients_credit_pain_negatif)): ?>
<p>Dernières inscriptions :</p>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Prénom, nom</th>
<th>Crédit pain</th>
</tr>
</thead>
<tbody>
<?php foreach($clients_credit_pain_negatif as $c): ?>
<tr>
<td><?= Html::encode($c['prenom'].' '.$c['nom']) ?></td>
<td><?= number_format($c['credit'],2) ?></td>
<td><?= Html::a('<span class="glyphicon glyphicon-euro"></span>', ['user/credit','id' => $c['user_id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-warning">Aucun client.</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Paramètres -->
<div class="">

+ 1
- 1
common/models/User.php 파일 보기

@@ -181,7 +181,7 @@ class User extends ActiveRecord implements IdentityInterface
$params['id_etablissement'] = Yii::$app->user->identity->id_etablissement ;
$query = (new \yii\db\Query())
->select(['user.id AS user_id', 'user.prenom','user.nom','user.telephone','user.email','user.created_at','user.date_derniere_connexion'])
->select(['user.id AS user_id', 'user.prenom','user.nom','user.telephone','user.email','user.created_at','user.date_derniere_connexion','user_etablissement.*'])
->from('user, user_etablissement')
->where('user.id = user_etablissement.id_user')
->andWhere('user_etablissement.actif = 1')

Loading…
취소
저장