Browse Source

[Administration] Tableau de bord administrateur

feature/souke
Guillaume Bourgeois 10 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

@@ -74,7 +74,8 @@ class DashboardAdminController extends BackendController
'countUsersOnline' => $this->getUserModule()->getRepository()->countUsersOnline(),
'countTicketsAdminOpen' => $this->getTicketModule()->getRepository()->countTicketsAdminStatusOpen(),
'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') ?: '',
]);
}

@@ -86,7 +87,7 @@ class DashboardAdminController extends BackendController

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

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

@@ -1,8 +1,11 @@
<?php

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

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

?>

@@ -17,6 +20,22 @@ $this->setTitle('Tableau de bord');
Yii::$app->urlManager->createUrl('online-admin/index')
) ?>
</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 class="row">
<div class="col-lg-6 col-xs-6">
@@ -41,6 +60,6 @@ $this->setTitle('Tableau de bord');
</div>

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

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

@@ -68,7 +68,6 @@ $this->setMetaRefresh(true);
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>">
<?php endif; ?>

<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]); ?>">
<?= $producer->name; ?>

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

@@ -3152,6 +3152,11 @@ termes.
color: white;
}

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

/**
Copyright distrib (2018)


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

@@ -72,8 +72,11 @@ var UrlManager = {
function opendistrib_dashboard_admin_statistics() {
var selector = '#dashboard-admin-statistics-html';
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

@@ -1,4 +1,8 @@

.dashboard-admin-index {

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

Loading…
Cancel
Save