* Change le producteur courant de l'utilisateur connecté. | * Change le producteur courant de l'utilisateur connecté. | ||||
* Permet de passer d'un producteur à un autre en tant qu'administrateur. | * 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(); | $user = $this->getUserCurrent(); | ||||
$producer = $this->getProducerModule()->getRepository()->findOneProducerById($id); | $producer = $this->getProducerModule()->getRepository()->findOneProducerById($id); | ||||
if($producer) { | if($producer) { | ||||
$this->getUserModule()->getBuilder()->switchProducer($user, $producer); | $this->getUserModule()->getBuilder()->switchProducer($user, $producer); | ||||
if($createTicket) { | |||||
return $this->redirect($this->getUrlManagerBackend()->createUrl(['support/create'])); | |||||
} | |||||
} | } | ||||
else { | else { | ||||
$this->addFlash('error', 'Producteur introuvable.'); | $this->addFlash('error', 'Producteur introuvable.'); |
'url' => ['dashboard-admin/index'], | 'url' => ['dashboard-admin/index'], | ||||
'visible' => $isUserCurrentGrantedAsAdministrator, | 'visible' => $isUserCurrentGrantedAsAdministrator, | ||||
], | ], | ||||
[ | |||||
'label' => 'En ligne', | |||||
'icon' => 'wifi', | |||||
'url' => ['online-admin/index'], | |||||
'visible' => $isUserCurrentGrantedAsAdministrator, | |||||
'template' => '<a href="{url}">{icon} {label}' . $countUsersProducersOnlineLabel . '</a>' | |||||
], | |||||
[ | [ | ||||
'label' => 'Support', | 'label' => 'Support', | ||||
'icon' => 'comments', | 'icon' => 'comments', | ||||
'items' => [ | 'items' => [ | ||||
['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' => 'line-chart', '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], | ['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator], | ||||
], | ], | ||||
], | ], |
$html .= '<span class="label label-danger">Hors-ligne</span>' ; | $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) { | if($model->is_new) { | ||||
$html .= ' <span class="label label-info">Nouveau</span>' ; | $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 ; | return $html ; | ||||
} | } | ||||
], | ], | ||||
.'<br />'.Html::encode($u->phone) ; | .'<br />'.Html::encode($u->phone) ; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
], | ], | ||||
'label' => 'Facturation', | 'label' => 'Facturation', | ||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function($producer) use ($producerModule) { | 'value' => function($producer) use ($producerModule) { | ||||
$str = ''; | $str = ''; | ||||
$str .= '<ul style="margin: 0px;padding-left: 15px;">'; | $str .= '<ul style="margin: 0px;padding-left: 15px;">'; | ||||
} | } | ||||
$str .= '</li>'; | $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) { | if($producer->option_billing_permanent_transfer) { | ||||
], | ], | ||||
[ | [ | ||||
'class' => 'yii\grid\ActionColumn', | 'class' => 'yii\grid\ActionColumn', | ||||
'template' => '{update} {billing} {dolibarr} {alwaysdata}', | |||||
'template' => '{update} {switch} {create-ticket} {billing} {dolibarr} {alwaysdata}', | |||||
'headerOptions' => ['class' => 'column-actions'], | 'headerOptions' => ['class' => 'column-actions'], | ||||
'contentOptions' => ['class' => 'column-actions'], | 'contentOptions' => ['class' => 'column-actions'], | ||||
'buttons' => [ | 'buttons' => [ | ||||
] | ] | ||||
); | ); | ||||
}, | }, | ||||
'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) { | 'dolibarr' => function ($url, $model) { | ||||
return Html::a( | return Html::a( | ||||
'<span class="glyphicon glyphicon-paste"></span>', | '<span class="glyphicon glyphicon-paste"></span>', |
<div v-show="currentSection == 'software'" class="panel panel-default"> | <div v-show="currentSection == 'software'" class="panel panel-default"> | ||||
<div class="panel-body"> | <div class="panel-body"> | ||||
<h4>Opendistrib</h4> | <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']); ?> | <?php $urlAboutPage = Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/about']); ?> | ||||
<?= $form->field($model, 'option_testimony') | <?= $form->field($model, 'option_testimony') | ||||
->textarea(['rows' => 7]) | ->textarea(['rows' => 7]) | ||||
8 => '8 heures', | 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."); ?> | ->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> | ||||
</div> | </div> | ||||
<?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'); | |||||
} | |||||
} |
'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' | |||||
'is_new', | |||||
'agree_contact_about_software_development' | |||||
], | ], | ||||
'boolean' | 'boolean' | ||||
], | ], | ||||
'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' | |||||
'is_new' => 'Nouveau', | |||||
'agree_contact_about_software_development' => "J'accepte d'être contacté dans le cadre de l'amélioration du logiciel" | |||||
]; | ]; | ||||
} | } | ||||