Browse Source

[Administration] Liste producteurs : mettre en avant les nouveaux en cours d'intégration

feature/souke
Guillaume Bourgeois 8 months ago
parent
commit
14e823a86e
7 changed files with 54 additions and 25 deletions
  1. +1
    -10
      backend/controllers/ProducerAdminController.php
  2. +15
    -5
      backend/views/layouts/header.php
  3. +3
    -3
      backend/views/layouts/left.php
  4. +1
    -0
      backend/views/producer-admin/_form.php
  5. +4
    -5
      backend/views/producer-admin/index.php
  6. +26
    -0
      console/migrations/m240226_142541_producer_add_column_is_new.php
  7. +4
    -2
      domain/Producer/Producer/Producer.php

+ 1
- 10
backend/controllers/ProducerAdminController.php View File

*/ */
public function actionIndex() public function actionIndex()
{ {
$producerModule = $this->getProducerModule();

$dataProviderProducer = new ActiveDataProvider([ $dataProviderProducer = new ActiveDataProvider([
'query' => Producer::find() 'query' => Producer::find()
->with('userProducer', 'user') ->with('userProducer', 'user')
], ],
]); ]);


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

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



+ 15
- 5
backend/views/layouts/header.php View File

?> ?>


<ul class="nav navbar-nav"> <ul class="nav navbar-nav">

<?php if ($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)): ?> <?php if ($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)): ?>
<li class="dropdown producer-menu"> <li class="dropdown producer-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
</li> </li>
<?php $producersArray = Producer::find()->orderBy('name ASC')->all(); ?> <?php $producersArray = Producer::find()->orderBy('name ASC')->all(); ?>
<?php foreach ($producersArray as $producer): ?> <?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"> <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> </li>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?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 foreach ($producersArray as $producer): ?>
<?php if ($producer->active != 1): ?> <?php if ($producer->active != 1): ?>
<li class="producer"> <li class="producer">

+ 3
- 3
backend/views/layouts/left.php View File

[ [
'label' => 'Statistiques', 'label' => 'Statistiques',
'icon' => 'line-chart', 'icon' => 'line-chart',
'url' => ['/stats-admin/matomo'],
'url' => ['/stats-admin/turnover'],
'visible' => $isUserCurrentGrantedAsAdministrator, 'visible' => $isUserCurrentGrantedAsAdministrator,
'items' => [ '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' => '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' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator],
], ],
], ],
[ [

+ 1
- 0
backend/views/producer-admin/_form.php View File

<?= $form->field($model, 'longitude') ?> <?= $form->field($model, 'longitude') ?>
<?= $form->field($model, 'code')->label('Code d\'accès') ?> <?= $form->field($model, 'code')->label('Code d\'accès') ?>
<?= $form->field($model, 'admin_comment')->textarea(['rows' => 7]) ?> <?= $form->field($model, 'admin_comment')->textarea(['rows' => 7]) ?>
<?= $form->field($model, 'is_new')->checkbox() ?>


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

+ 4
- 5
backend/views/producer-admin/index.php View File



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

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

<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProviderProducer, 'dataProvider' => $dataProviderProducer,
'columns' => [ 'columns' => [
$html .= ' <span class="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="bottom" data-original-title="'.Html::encode($model->code).'"></span>' ; $html .= ' <span class="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="bottom" data-original-title="'.Html::encode($model->code).'"></span>' ;
} }


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

return $html ; return $html ;
} }
], ],

+ 26
- 0
console/migrations/m240226_142541_producer_add_column_is_new.php View File

<?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');
}
}

+ 4
- 2
domain/Producer/Producer/Producer.php View File

'option_invoice_only_based_on_delivery_notes', 'option_invoice_only_based_on_delivery_notes',
'option_document_display_price_unit_reference', 'option_document_display_price_unit_reference',
'option_check_by_default_prevent_user_credit', 'option_check_by_default_prevent_user_credit',
'delivery_note_automatic_validation'
'delivery_note_automatic_validation',
'is_new'
], ],
'boolean' 'boolean'
], ],
'tiller_access_token' => 'Tiller : access token', 'tiller_access_token' => 'Tiller : access token',
'tiller_refresh_token' => 'Tiller : refresh token', 'tiller_refresh_token' => 'Tiller : refresh token',
'tiller_redirect_uri' => 'Tiller : callback URL', 'tiller_redirect_uri' => 'Tiller : callback URL',
'tiller_store_id' => 'Tiller : store ID'
'tiller_store_id' => 'Tiller : store ID',
'is_new' => 'Nouveau'
]; ];
} }



Loading…
Cancel
Save