*/ | */ | ||||
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 | |||||
]); | ]); | ||||
} | } | ||||
?> | ?> | ||||
<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"> |
[ | [ | ||||
'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], | |||||
], | ], | ||||
], | ], | ||||
[ | [ |
<?= $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') |
?> | ?> | ||||
<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 ; | ||||
} | } | ||||
], | ], |
<?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'); | |||||
} | |||||
} |
'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' | |||||
]; | ]; | ||||
} | } | ||||