])); | ])); | ||||
} | } | ||||
public function actionReportProblemReceivingEmails(int $id) | |||||
{ | |||||
$user = $this->findModel($id); | |||||
if($this->getUserModule()->getManager()->reportProblemReceivingEmails($user)) { | |||||
$this->setFlash('success', "L'utilisateur <strong>".$this->getUserModule()->getSolver()->getUsername($user)."</strong> a bien été signalé comme ayant des problèmes dans la réception de vos emails. L'administrateur débloquera la situation dès que possible et préviendra l'utilisateur."); | |||||
} | |||||
else { | |||||
$this->setFlash('error', "Une erreur est survenue."); | |||||
} | |||||
return $this->redirect('index'); | |||||
} | |||||
public function initForm($model) | public function initForm($model) | ||||
{ | { | ||||
$userPointSaleModule = $this->getUserPointSaleModule(); | $userPointSaleModule = $this->getUserPointSaleModule(); |
], | ], | ||||
] | ] | ||||
); ?> | ); ?> | ||||
<?= $form->field($model, 'problem_receiving_emails')->widget(Toggle::class, | |||||
[ | |||||
'options' => [ | |||||
'data-id' => $model->id, | |||||
'data-on' => 'Oui', | |||||
'data-off' => 'Non', | |||||
'data-onstyle' => 'danger', | |||||
'data-offstyle' => 'success', | |||||
], | |||||
] | |||||
); ?> | |||||
<?php endif; ?> | <?php endif; ?> | ||||
</div> | </div> | ||||
</div> | </div> |
], | ], | ||||
[ | [ | ||||
'class' => 'yii\grid\ActionColumn', | 'class' => 'yii\grid\ActionColumn', | ||||
'template' => '{view} {update} | |||||
'template' => '{view} {update} | |||||
<div class="wrapper-button-dropdown"> | <div class="wrapper-button-dropdown"> | ||||
<button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-default dropdown-toggle"><span class="caret"></span></button> | <button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-default dropdown-toggle"><span class="caret"></span></button> | ||||
<ul class="dropdown-menu"> | <ul class="dropdown-menu"> | ||||
<li>{problemReceivingEmails}</li> | |||||
<li>{delete}</li> | <li>{delete}</li> | ||||
<li>{switch}</li> | <li>{switch}</li> | ||||
</ul></div>', | </ul></div>', | ||||
'class' => 'btn btn-default' | 'class' => 'btn btn-default' | ||||
]); | ]); | ||||
}, | }, | ||||
'problemReceivingEmails' => function($url, $model) use ($userModule, $userCurrent) { | |||||
if(!$model->getProblemReceivingEmails()) { | |||||
return Html::a('<i class="fa fa-life-ring"></i> Réception emails', | |||||
Yii::$app->urlManager->createUrl(['user/report-problem-receiving-emails', 'id' => $model->id]), | |||||
[ | |||||
'title' => 'Signaler comme ayant des problèmes de réception des emails', | |||||
'class' => '' | |||||
]); | |||||
} | |||||
}, | |||||
'delete' => function ($url, $model) { | 'delete' => function ($url, $model) { | ||||
return Html::a('<span class="glyphicon glyphicon-minus"></span> Enlever', | return Html::a('<span class="glyphicon glyphicon-minus"></span> Enlever', | ||||
Yii::$app->urlManager->createUrl(array_merge(['user/delete', 'id' => $model->id], Yii::$app->getRequest()->getQueryParams())), | Yii::$app->urlManager->createUrl(array_merge(['user/delete', 'id' => $model->id], Yii::$app->getRequest()->getQueryParams())), |
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\Schema; | |||||
/** | |||||
* Class m240611_091617_add_column_user_problem_receiving_emails | |||||
*/ | |||||
class m240611_091617_add_column_user_problem_receiving_emails extends Migration | |||||
{ | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeUp() | |||||
{ | |||||
$this->addColumn('user', 'problem_receiving_emails', Schema::TYPE_BOOLEAN); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeDown() | |||||
{ | |||||
$this->dropColumn('user', 'problem_receiving_emails'); | |||||
} | |||||
} |
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday', | [['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday', | ||||
'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday', | 'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday', | ||||
'mail_distribution_sunday', 'is_main_contact', 'newsletter', 'exclude_export_shopping_cart_labels', | 'mail_distribution_sunday', 'is_main_contact', 'newsletter', 'exclude_export_shopping_cart_labels', | ||||
'send_mail_welcome', 'trust_alert', 'newsletter_souke'], 'boolean'], | |||||
'send_mail_welcome', 'trust_alert', 'newsletter_souke', 'problem_receiving_emails'], 'boolean'], | |||||
[['lastname', 'name', 'phone', 'address', 'type', 'name_legal_person', 'evoliz_code', 'trust_alert_comment'], 'string'], | [['lastname', 'name', 'phone', 'address', 'type', 'name_legal_person', 'evoliz_code', 'trust_alert_comment'], 'string'], | ||||
['lastname', 'verifyOneName', 'skipOnError' => false, 'skipOnEmpty' => false], | ['lastname', 'verifyOneName', 'skipOnError' => false, 'skipOnEmpty' => false], | ||||
[['email', 'email_sending_invoicing_documents'], 'email', 'message' => 'Cette adresse email n\'est pas valide'], | [['email', 'email_sending_invoicing_documents'], 'email', 'message' => 'Cette adresse email n\'est pas valide'], | ||||
'email_sending_invoicing_documents' => 'Email facturation', | 'email_sending_invoicing_documents' => 'Email facturation', | ||||
'trust_alert' => 'Alerte confiance', | 'trust_alert' => 'Alerte confiance', | ||||
'trust_alert_comment' => 'Commentaire', | 'trust_alert_comment' => 'Commentaire', | ||||
'newsletter_souke' => "S'abonner à l'infolettre de Souke" | |||||
'newsletter_souke' => "S'abonner à l'infolettre de Souke", | |||||
'problem_receiving_emails' => "Rencontre des problèmes pour recevoir les emails" | |||||
]; | ]; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/* Getters / Setters */ | |||||
public function getProblemReceivingEmails(): ?bool | |||||
{ | |||||
return $this->problem_receiving_emails; | |||||
} | |||||
public function setProblemReceivingEmails(bool $problemReceivingEmails = null): self | |||||
{ | |||||
$this->problem_receiving_emails = $problemReceivingEmails; | |||||
return $this; | |||||
} | |||||
/* | /* | ||||
* Relations | * Relations | ||||
*/ | */ |
{ | { | ||||
$password = $this->userBuilder->generatePassword($user); | $password = $this->userBuilder->generatePassword($user); | ||||
$this->userNotifier->sendMailWelcome($user, $password); | $this->userNotifier->sendMailWelcome($user, $password); | ||||
} | } | ||||
public function newPassword(User $user) | public function newPassword(User $user) | ||||
$password = $this->userBuilder->generatePassword($user); | $password = $this->userBuilder->generatePassword($user); | ||||
$this->userNotifier->sendMailNewPassword($user, $password); | $this->userNotifier->sendMailNewPassword($user, $password); | ||||
} | } | ||||
public function reportProblemReceivingEmails(User $user): bool | |||||
{ | |||||
$user->setProblemReceivingEmails(true); | |||||
return $this->userBuilder->update($user); | |||||
} | |||||
} | } |
return $this->redirect('index'); | return $this->redirect('index'); | ||||
} | } | ||||
public function actionReportProblemReceivingEmails() | |||||
{ | |||||
if(!$this->getUserCurrent()) { | |||||
return $this->redirectProducerLoginFrontend('index'); | |||||
} | |||||
if(!$this->getUserModule()->getManager()->reportProblemReceivingEmails($this->getUserCurrent())) { | |||||
$this->setFlash('error', "Une erreur est survenue."); | |||||
} | |||||
return $this->redirect('index'); | |||||
} | |||||
public function redirectProducerLoginFrontend(string $actionNewsletter) | public function redirectProducerLoginFrontend(string $actionNewsletter) | ||||
{ | { | ||||
return $this->redirect($this->getUrlManagerFrontend()->createAbsoluteUrl(['site/producer', 'id' => $this->getProducerCurrent()->id, 'return_url' => \Yii::$app->urlManagerProducer->createAbsoluteUrl(['newsletter/'.$actionNewsletter, 'slug_producer' => $this->getProducerCurrent()->slug])])); | return $this->redirect($this->getUrlManagerFrontend()->createAbsoluteUrl(['site/producer', 'id' => $this->getProducerCurrent()->id, 'return_url' => \Yii::$app->urlManagerProducer->createAbsoluteUrl(['newsletter/'.$actionNewsletter, 'slug_producer' => $this->getProducerCurrent()->slug])])); |
?> | ?> | ||||
<div class="newsletter-index"> | <div class="newsletter-index"> | ||||
<div class="alert alert-info"> | |||||
<i class="bi bi-info-circle"></i> | |||||
<?php if($producer->option_newsletter_description): ?> | |||||
<?= nl2br(Html::encode($producer->option_newsletter_description)); ?> | |||||
<?php else: ?> | |||||
L'infolettre vous permet de recevoir les emails de prise de commande et les actualités de ce producteur. | |||||
<?php endif; ?> | |||||
</div> | |||||
<?php if($userModule->isUserSubscribedNewsletter($user)): ?> | |||||
<div class="alert alert-success"> | |||||
<i class="bi bi-megaphone"></i> | |||||
Vous êtes inscrit à l'infolettre <strong><?= Html::encode($producer->name) ?></strong>. | |||||
<div class="row"> | |||||
<div class="col-md-8"> | |||||
<div class="alert alert-info"> | |||||
<i class="bi bi-info-circle"></i> | |||||
<?php if($producer->option_newsletter_description): ?> | |||||
<?= nl2br(Html::encode($producer->option_newsletter_description)); ?> | |||||
<?php else: ?> | |||||
L'infolettre vous permet de recevoir les emails de prise de commande et les actualités de ce producteur. | |||||
<?php endif; ?> | |||||
</div> | |||||
<?php if($userModule->isUserSubscribedNewsletter($user)): ?> | |||||
<div class="alert alert-success"> | |||||
<i class="bi bi-megaphone"></i> | |||||
Vous êtes inscrit à l'infolettre <strong><?= Html::encode($producer->name) ?></strong>. | |||||
</div> | |||||
<?php else: ?> | |||||
<div class="alert alert-danger"> | |||||
<i class="bi bi-x-circle"></i> | |||||
Vous n'êtes pas inscrit à l'infolettre <strong><?= Html::encode($producer->name) ?></strong>. | |||||
</div> | |||||
<?php endif; ?> | |||||
</div> | </div> | ||||
<?php else: ?> | |||||
<div class="alert alert-danger"> | |||||
<i class="bi bi-x-circle"></i> | |||||
Vous n'êtes pas inscrit à l'infolettre <strong><?= Html::encode($producer->name) ?></strong>. | |||||
<div class="col-md-4"> | |||||
<div class="alert alert-dark"> | |||||
<i class="bi bi-life-preserver"></i> | |||||
<?php if(!$user->getProblemReceivingEmails()): ?> | |||||
Vous rencontrez des problèmes pour recevoir les emails de ce producteur ? | |||||
<a href="<?= Yii::$app->urlManager->createUrl('newsletter/report-problem-receiving-emails') ?>">Cliquez ici</a> pour nous prévenir. | |||||
<?php else: ?> | |||||
Nous avons bien été prévenu de vos difficultés à recevoir les emails de ce producteur, | |||||
nous reviendrons vers vous dès que possible. | |||||
<?php endif; ?> | |||||
</div> | |||||
</div> | </div> | ||||
<?php endif; ?> | |||||
</div> | |||||
</div> | </div> |