Browse Source

[Administration] Tableau de bord administrateur

feature/souke
Guillaume Bourgeois 9 months ago
parent
commit
a6e9f8a277
6 changed files with 38 additions and 7 deletions
  1. +3
    -2
      backend/controllers/DashboardAdminController.php
  2. +20
    -1
      backend/views/dashboard-admin/index.php
  3. +0
    -1
      backend/views/online-admin/index.php
  4. +5
    -0
      backend/web/css/screen.css
  5. +5
    -2
      backend/web/js/backend.js
  6. +5
    -1
      backend/web/sass/dashboard-admin/_index.scss

+ 3
- 2
backend/controllers/DashboardAdminController.php View File

'countUsersOnline' => $this->getUserModule()->getRepository()->countUsersOnline(), 'countUsersOnline' => $this->getUserModule()->getRepository()->countUsersOnline(),
'countTicketsAdminOpen' => $this->getTicketModule()->getRepository()->countTicketsAdminStatusOpen(), 'countTicketsAdminOpen' => $this->getTicketModule()->getRepository()->countTicketsAdminStatusOpen(),
'countTicketsAdminUnread' => $this->getTicketModule()->getRepository()->countTicketsAdminUnreadByUser($this->getUserCurrent()), 'countTicketsAdminUnread' => $this->getTicketModule()->getRepository()->countTicketsAdminUnreadByUser($this->getUserCurrent()),
'statisticsCacheHtml' => \Yii::$app->cache->get('dashboard_statistics10') ?: ''
'usersWithStatusProducerOnlineArray' => $this->getUserModule()->getRepository()->findUsersWithStatusProducerAndOnline()
//'statisticsCacheHtml' => \Yii::$app->cache->get('dashboard_statistics12') ?: '',
]); ]);
} }




public function actionAjaxStatisticsHtml() public function actionAjaxStatisticsHtml()
{ {
return \Yii::$app->cache->getOrSet('dashboard_statistics10', function () {
return \Yii::$app->cache->getOrSet('dashboard_statistics12', function () {
$producerModule = $this->getProducerModule(); $producerModule = $this->getProducerModule();
$pointSaleModule = $this->getPointSaleModule(); $pointSaleModule = $this->getPointSaleModule();
$userModule = $this->getUserModule(); $userModule = $this->getUserModule();

+ 20
- 1
backend/views/dashboard-admin/index.php View File

<?php <?php


use common\helpers\AdminLTE; use common\helpers\AdminLTE;
use common\helpers\Image;
use yii\helpers\Html;


$this->setTitle('Tableau de bord'); $this->setTitle('Tableau de bord');
$this->setMetaRefresh(true);


?> ?>


Yii::$app->urlManager->createUrl('online-admin/index') Yii::$app->urlManager->createUrl('online-admin/index')
) ?> ) ?>
</div> </div>
<div class="col-lg-6 col-xs-6" id="producers-online">
<!--<h3>Producteurs en ligne :</h3>-->
<?php if($usersWithStatusProducerOnlineArray && count($usersWithStatusProducerOnlineArray) > 0): ?>
<?php foreach ($usersWithStatusProducerOnlineArray as $userWithStatusProducerOnline): ?>
<?php $producer = $userWithStatusProducerOnline->producer; ?>
<?php if($producer): ?>
<a class="btn btn-default" title="Aller sur le compte de ce producteur" href="<?= $this->getUrlManagerBackend()->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>">
<?= $producer->name; ?>
</a>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
<?php else: ?>
<div class="alert alert-info">Aucun producteur en ligne actuellement.</div>
<?php endif; ?>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-6 col-xs-6"> <div class="col-lg-6 col-xs-6">
</div> </div>


<div id="dashboard-admin-statistics-html"> <div id="dashboard-admin-statistics-html">
<?= $statisticsCacheHtml ?>
<a class="btn btn-default btn-load" href="javascript:void(0);">Charger les statistiques</a>
</div> </div>
</div> </div>

+ 0
- 1
backend/views/online-admin/index.php View File

src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>" src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>"> alt="Logo <?= Html::encode($producer->name) ?>">
<?php endif; ?> <?php endif; ?>

<h3 class="profile-username text-center"> <h3 class="profile-username text-center">
<a title="Aller sur le compte de ce producteur" href="<?= $this->getUrlManagerBackend()->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>"> <a title="Aller sur le compte de ce producteur" href="<?= $this->getUrlManagerBackend()->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>">
<?= $producer->name; ?> <?= $producer->name; ?>

+ 5
- 0
backend/web/css/screen.css View File

color: white; color: white;
} }


/* line 4, ../sass/dashboard-admin/_index.scss */
.dashboard-admin-index #producers-online h3 {
margin-top: 0px;
}

/** /**
Copyright distrib (2018) Copyright distrib (2018)



+ 5
- 2
backend/web/js/backend.js View File

function opendistrib_dashboard_admin_statistics() { function opendistrib_dashboard_admin_statistics() {
var selector = '#dashboard-admin-statistics-html'; var selector = '#dashboard-admin-statistics-html';
if($(selector).length) { if($(selector).length) {
$.get(UrlManager.getBaseUrl() + 'dashboard-admin/ajax-statistics-html', {}, function(result) {
$(selector).html(result);
$(selector+' .btn-load').click(function() {
$(selector).html('Chargement ...');
$.get(UrlManager.getBaseUrl() + 'dashboard-admin/ajax-statistics-html', {}, function(result) {
$(selector).html(result);
});
}); });
} }
} }

+ 5
- 1
backend/web/sass/dashboard-admin/_index.scss View File



.dashboard-admin-index { .dashboard-admin-index {

#producers-online {
h3 {
margin-top: 0px;
}
}
} }

Loading…
Cancel
Save