Guillaume Bourgeois 8 месяцев назад
Родитель
Сommit
5066e7de41
19 измененных файлов: 172 добавлений и 50 удалений
  1. +3
    -2
      backend/controllers/DashboardAdminController.php
  2. +1
    -10
      backend/controllers/ProducerAdminController.php
  3. +4
    -1
      backend/controllers/SiteController.php
  4. +20
    -1
      backend/views/dashboard-admin/index.php
  5. +15
    -5
      backend/views/layouts/header.php
  6. +10
    -10
      backend/views/layouts/left.php
  7. +0
    -1
      backend/views/online-admin/index.php
  8. +1
    -0
      backend/views/producer-admin/_form.php
  9. +34
    -12
      backend/views/producer-admin/index.php
  10. +4
    -2
      backend/views/producer/update.php
  11. +5
    -0
      backend/web/css/screen.css
  12. +5
    -2
      backend/web/js/backend.js
  13. +5
    -1
      backend/web/sass/dashboard-admin/_index.scss
  14. +26
    -0
      console/migrations/m240226_142541_producer_add_column_is_new.php
  15. +26
    -0
      console/migrations/m240227_073149_add_column_producer_agree_contact_software_development.php
  16. +1
    -0
      domain/Document/DeliveryNote/DeliveryNoteBuilder.php
  17. +5
    -0
      domain/Document/Document/DocumentBuilder.php
  18. +1
    -1
      domain/Order/Order/OrderRepository.php
  19. +6
    -2
      domain/Producer/Producer/Producer.php

+ 3
- 2
backend/controllers/DashboardAdminController.php Просмотреть файл

@@ -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();

+ 1
- 10
backend/controllers/ProducerAdminController.php Просмотреть файл

@@ -85,8 +85,6 @@ class ProducerAdminController extends BackendController
*/
public function actionIndex()
{
$producerModule = $this->getProducerModule();

$dataProviderProducer = new ActiveDataProvider([
'query' => Producer::find()
->with('userProducer', 'user')
@@ -96,15 +94,8 @@ class ProducerAdminController extends BackendController
],
]);

$producersArray = $producerModule->findProducersActive();
$sumPrices = 0;
foreach ($producersArray as $producer) {
$sumPrices += $producerModule->getAmountBilledLastMonthByProducer($producer);
}

return $this->render('index', [
'dataProviderProducer' => $dataProviderProducer,
'sumPrices' => $sumPrices
'dataProviderProducer' => $dataProviderProducer
]);
}


+ 4
- 1
backend/controllers/SiteController.php Просмотреть файл

@@ -136,13 +136,16 @@ class SiteController extends BackendController
* Change le producteur courant de l'utilisateur connecté.
* Permet de passer d'un producteur à un autre en tant qu'administrateur.
*/
public function actionSwitchProducer(int $id)
public function actionSwitchProducer(int $id, bool $createTicket = false)
{
$user = $this->getUserCurrent();
$producer = $this->getProducerModule()->getRepository()->findOneProducerById($id);

if($producer) {
$this->getUserModule()->getBuilder()->switchProducer($user, $producer);
if($createTicket) {
return $this->redirect($this->getUrlManagerBackend()->createUrl(['support/create']));
}
}
else {
$this->addFlash('error', 'Producteur introuvable.');

+ 20
- 1
backend/views/dashboard-admin/index.php Просмотреть файл

@@ -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>

+ 15
- 5
backend/views/layouts/header.php Просмотреть файл

@@ -97,7 +97,6 @@ $userCurrent = GlobalParam::getCurrentUser();
?>

<ul class="nav navbar-nav">

<?php if ($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)): ?>
<li class="dropdown producer-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
@@ -114,14 +113,25 @@ $userCurrent = GlobalParam::getCurrentUser();
</li>
<?php $producersArray = Producer::find()->orderBy('name ASC')->all(); ?>
<?php foreach ($producersArray as $producer): ?>
<?php if ($producer->active == 1): ?>
<?php if ($producer->active == 1 && $producer->is_new): ?>
<li class="producer">
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>">
<label class="label label-info">Nouveau</label>
<?= Html::encode($producer->name) ?>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach ($producersArray as $producer): ?>
<?php if ($producer->active == 1 && !$producer->is_new): ?>
<li class="producer">
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>"><?= Html::encode($producer->name) ?></a>
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>">
<?php if($producer->is_new): ?> <label class="label label-info">Nouveau</label> <?php endif; ?>
<?= Html::encode($producer->name) ?>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
<!--<li class="header"><a href="javascript:void(0);" id="link-display-producers-offline">Afficher
les producteurs hors-ligne</a></li>-->
<?php foreach ($producersArray as $producer): ?>
<?php if ($producer->active != 1): ?>
<li class="producer">

+ 10
- 10
backend/views/layouts/left.php Просмотреть файл

@@ -126,13 +126,6 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
'url' => ['dashboard-admin/index'],
'visible' => $isUserCurrentGrantedAsAdministrator,
],
[
'label' => 'En ligne',
'icon' => 'wifi',
'url' => ['online-admin/index'],
'visible' => $isUserCurrentGrantedAsAdministrator,
'template' => '<a href="{url}">{icon} {label}' . $countUsersProducersOnlineLabel . '</a>'
],
[
'label' => 'Support',
'icon' => 'comments',
@@ -144,12 +137,19 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
[
'label' => 'Statistiques',
'icon' => 'line-chart',
'url' => ['/stats-admin/matomo'],
'url' => ['/stats-admin/turnover'],
'visible' => $isUserCurrentGrantedAsAdministrator,
'items' => [
['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats-admin/turnover'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Commandes clients', 'icon' => 'calendar', 'url' => ['/stats-admin/customer-orders'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Commandes clients', 'icon' => 'line-chart', 'url' => ['/stats-admin/customer-orders'], 'visible' => $isUserCurrentGrantedAsAdministrator],
[
'label' => 'En ligne',
'icon' => 'wifi',
'url' => ['online-admin/index'],
'visible' => $isUserCurrentGrantedAsAdministrator,
//'template' => '<a href="{url}">{icon} {label}' . $countUsersProducersOnlineLabel . '</a>'
],
['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator],
],
],
[

+ 0
- 1
backend/views/online-admin/index.php Просмотреть файл

@@ -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; ?>

+ 1
- 0
backend/views/producer-admin/_form.php Просмотреть файл

@@ -55,6 +55,7 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'longitude') ?>
<?= $form->field($model, 'code')->label('Code d\'accès') ?>
<?= $form->field($model, 'admin_comment')->textarea(['rows' => 7]) ?>
<?= $form->field($model, 'is_new')->checkbox() ?>

<h3>Facturation</h3>
<?= $form->field($model, 'option_billing_type')

+ 34
- 12
backend/views/producer-admin/index.php Просмотреть файл

@@ -50,11 +50,6 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico

?>
<div class="producer-admin-index">

<div class="alert alert-info">
Facturé le mois dernier : <strong><?= $sumPrices ?> €</strong><br />
</div>

<?= GridView::widget([
'dataProvider' => $dataProviderProducer,
'columns' => [
@@ -70,9 +65,16 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico
$html .= '<span class="label label-danger">Hors-ligne</span>' ;
}

if(strlen($model->code))
{
$html .= ' <span class="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="bottom" data-original-title="'.Html::encode($model->code).'"></span>' ;
if(strlen($model->code)) {
$html .= ' <span class="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="bottom" title="'.Html::encode($model->code).'"></span>' ;
}

if($model->is_new) {
$html .= ' <span class="label label-info">Nouveau</span>' ;
}

if(!$model->agree_contact_about_software_development) {
$html .= ' <span class="label label-danger">Développement</span>';
}

return $html ;
@@ -104,7 +106,6 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico
.'<br />'.Html::encode($u->phone) ;
}
}

}
}
],
@@ -112,7 +113,6 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico
'label' => 'Facturation',
'format' => 'raw',
'value' => function($producer) use ($producerModule) {

$str = '';
$str .= '<ul style="margin: 0px;padding-left: 15px;">';

@@ -144,7 +144,9 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico
}
$str .= '</li>';

$str .= '<li>Facturation '.strtolower(Producer::$billingFrequencyArray[$producer->option_billing_frequency]).'</li>';
if(!$isBillingFrequencyMonthly) {
$str .= '<li>Facturation '.strtolower(Producer::$billingFrequencyArray[$producer->option_billing_frequency]).'</li>';
}
}

if($producer->option_billing_permanent_transfer) {
@@ -176,7 +178,7 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {billing} {dolibarr} {alwaysdata}',
'template' => '{update} {switch} {create-ticket} {billing} {dolibarr} {alwaysdata}',
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
@@ -190,6 +192,26 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico
]
);
},
'switch' => function ($url, $model) {
return Html::a(
'<span class="glyphicon glyphicon-hand-up"></span>',
Yii::$app->urlManager->createUrl(['site/switch-producer', 'id' => $model->id]),
[
'title' => 'Aller sur le compte de ce producteur',
'class' => 'btn btn-default'
]
);
},
'create-ticket' => function ($url, $model) {
return Html::a(
'<span class="glyphicon glyphicon-comment"></span>',
Yii::$app->urlManager->createUrl(['site/switch-producer', 'id' => $model->id, 'createTicket' => true]),
[
'title' => 'Créer un ticket',
'class' => 'btn btn-default'
]
);
},
'dolibarr' => function ($url, $model) {
return Html::a(
'<span class="glyphicon glyphicon-paste"></span>',

+ 4
- 2
backend/views/producer/update.php Просмотреть файл

@@ -495,6 +495,10 @@ $this->addBreadcrumb($this->getTitle());
<div v-show="currentSection == 'software'" class="panel panel-default">
<div class="panel-body">
<h4>Opendistrib</h4>
<?= $form->field($model, 'option_display_message_new_opendistrib_version')
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'agree_contact_about_software_development')
->dropDownList(Dropdown::noYesChoices()); ?>
<?php $urlAboutPage = Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/about']); ?>
<?= $form->field($model, 'option_testimony')
->textarea(['rows' => 7])
@@ -513,8 +517,6 @@ $this->addBreadcrumb($this->getTitle());
8 => '8 heures',
])
->hint("Sélectionnez le temps que vous estimez gagner chaque semaine en utilisant ce logiciel. Cette donnée sera utilisée sur la page <a href=\"" . $urlAboutPage . "\" target=\"_blanck\">À propos</a> du site."); ?>
<?= $form->field($model, 'option_display_message_new_opendistrib_version')
->dropDownList(Dropdown::noYesChoices()); ?>
</div>
</div>


+ 5
- 0
backend/web/css/screen.css Просмотреть файл

@@ -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 Просмотреть файл

@@ -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 Просмотреть файл

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

.dashboard-admin-index {

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

+ 26
- 0
console/migrations/m240226_142541_producer_add_column_is_new.php Просмотреть файл

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240226_142541_producer_add_column_is_new
*/
class m240226_142541_producer_add_column_is_new extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'is_new', Schema::TYPE_BOOLEAN);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'is_new');
}
}

+ 26
- 0
console/migrations/m240227_073149_add_column_producer_agree_contact_software_development.php Просмотреть файл

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240227_073149_add_column_producer_agree_contact_software_development
*/
class m240227_073149_add_column_producer_agree_contact_software_development extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'agree_contact_about_software_development', Schema::TYPE_BOOLEAN.' DEFAULT 1');
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'agree_contact_about_software_development');
}
}

+ 1
- 0
domain/Document/DeliveryNote/DeliveryNoteBuilder.php Просмотреть файл

@@ -34,6 +34,7 @@ class DeliveryNoteBuilder extends DocumentBuilder
$deliveryNote = new DeliveryNote();

$deliveryNote->status = Document::STATUS_DRAFT;
$this->initDocumentDate($deliveryNote);
$this->initDocumentProducer($deliveryNote);
$this->initTaxCalculationMethod($deliveryNote);


+ 5
- 0
domain/Document/Document/DocumentBuilder.php Просмотреть файл

@@ -34,6 +34,11 @@ class DocumentBuilder extends AbstractBuilder
}
}

public function initDocumentDate(Document $document)
{
$document->date = date('Y-m-d H:i:s');
}

public function updateDocumentIsSend(Document $document, bool $isSent)
{
$document->is_sent = $isSent;

+ 1
- 1
domain/Order/Order/OrderRepository.php Просмотреть файл

@@ -429,7 +429,7 @@ class OrderRepository extends AbstractRepository
$lastOrder = $this->findOneOrderLastByUser($user);
if ($lastOrder) {
$pointSale = $this->pointSaleRepository->findOnePointSaleById($lastOrder->id_point_sale);
if($distribution && !$this->pointSaleSolver->isDelivered($pointSale, $distribution)) {
if($distribution && $pointSale && !$this->pointSaleSolver->isDelivered($pointSale, $distribution)) {
$pointSale = null;
}
}

+ 6
- 2
domain/Producer/Producer/Producer.php Просмотреть файл

@@ -297,7 +297,9 @@ class Producer extends ActiveRecordCommon
'option_invoice_only_based_on_delivery_notes',
'option_document_display_price_unit_reference',
'option_check_by_default_prevent_user_credit',
'delivery_note_automatic_validation'
'delivery_note_automatic_validation',
'is_new',
'agree_contact_about_software_development'
],
'boolean'
],
@@ -526,7 +528,9 @@ class Producer extends ActiveRecordCommon
'tiller_access_token' => 'Tiller : access token',
'tiller_refresh_token' => 'Tiller : refresh token',
'tiller_redirect_uri' => 'Tiller : callback URL',
'tiller_store_id' => 'Tiller : store ID'
'tiller_store_id' => 'Tiller : store ID',
'is_new' => 'Nouveau',
'agree_contact_about_software_development' => "J'accepte d'être contacté dans le cadre de l'amélioration du logiciel"
];
}


Загрузка…
Отмена
Сохранить