@@ -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 | |||
]); | |||
} | |||
@@ -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"> |
@@ -144,12 +144,12 @@ $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' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator], | |||
], | |||
], | |||
[ |
@@ -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') |
@@ -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' => [ | |||
@@ -75,6 +70,10 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico | |||
$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 ; | |||
} | |||
], |
@@ -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'); | |||
} | |||
} |
@@ -297,7 +297,8 @@ 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' | |||
], | |||
'boolean' | |||
], | |||
@@ -526,7 +527,8 @@ 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' | |||
]; | |||
} | |||