Browse Source

[Administration] Communiquer : possibilité de configurer un message et un sujet par défaut

feature/rotating_product
Guillaume Bourgeois 6 months ago
parent
commit
8d8cbd7c33
5 changed files with 57 additions and 6 deletions
  1. +3
    -0
      backend/controllers/CommunicateController.php
  2. +16
    -5
      backend/views/producer/update.php
  3. +5
    -0
      backend/web/js/vuejs/producer-update.js
  4. +28
    -0
      console/migrations/m240620_070618_add_columns_producer_communicate_email_defaults.php
  5. +5
    -1
      domain/Producer/Producer/Producer.php

+ 3
- 0
backend/controllers/CommunicateController.php View File

@@ -88,6 +88,9 @@ class CommunicateController extends BackendController
$userModule = $this->getUserModule();
$distributionModule = $this->getDistributionModule();
$mailForm = new MailForm();
// Sujet et message par défaut
$mailForm->subject = $this->getProducerModule()->getSolver()->getConfig('option_communicate_email_default_subject');
$mailForm->message = $this->getProducerModule()->getSolver()->getConfig('option_communicate_email_default_message');

if ($idPointSale && !$usersPointSaleLink && !$usersPointSaleHasOrder) {
$usersPointSaleLink = 1;

+ 16
- 5
backend/views/producer/update.php View File

@@ -153,11 +153,6 @@ $this->addBreadcrumb($this->getTitle());
<?= $form->field($model, 'option_leave_period_message_title')->textInput(); ?>
<?= $form->field($model, 'option_leave_period_message')->textarea(); ?>

<h4>Communication</h4>
<?= $form->field($model, 'option_newsletter_description')
->hint('Description affichée sur la page "Infolettre" de la boutique')
->textarea(); ?>

<h4>Groupes utilisateurs</h4>
<?= $form->field($model, 'id_user_group_default')
->dropDownList($userGroupModule->getRepository()->populateUserGroupDropdownList()); ?>
@@ -356,6 +351,22 @@ $this->addBreadcrumb($this->getTitle());
</div>
</div>

<div v-show="currentSection == 'communication'" class="panel panel-default">
<div class="panel-body">
<h4>Boutique</h4>
<?= $form->field($model, 'option_newsletter_description')
->hint('Description affichée sur la page "Infolettre" de la boutique')
->textarea(); ?>
<h4>Envoi d'emails</h4>
<?= $form->field($model, 'option_communicate_email_default_subject')->textInput(); ?>
<?= $form->field($model, 'option_communicate_email_default_message')->widget(letyii\tinymce\Tinymce::class, [
'configs' => [
'plugins' => Yii::$app->parameterBag->get('tinyMcePlugins'),
]
]); ?>
</div>
</div>

<div v-show="currentSection == 'credit-payment'" class="panel panel-default">
<div class="panel-body">
<h4>Cagnotte</h4>

+ 5
- 0
backend/web/js/vuejs/producer-update.js View File

@@ -73,6 +73,11 @@ if($(selector).length) {
nameDisplay: 'Abonnements',
isAdminSection: 0
},
{
name: 'communication',
nameDisplay: 'Communication',
isAdminSection: 0
},
{
name: 'tableau-bord',
nameDisplay: 'Tableau de bord',

+ 28
- 0
console/migrations/m240620_070618_add_columns_producer_communicate_email_defaults.php View File

@@ -0,0 +1,28 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240620_070618_add_columns_producer_communicate_email_defaults
*/
class m240620_070618_add_columns_producer_communicate_email_defaults extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'option_communicate_email_default_subject', Schema::TYPE_STRING);
$this->addColumn('producer', 'option_communicate_email_default_message', Schema::TYPE_TEXT);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'option_communicate_email_default_subject');
$this->dropColumn('producer', 'option_communicate_email_default_message');
}
}

+ 5
- 1
domain/Producer/Producer/Producer.php View File

@@ -262,7 +262,9 @@ class Producer extends ActiveRecordCommon
'option_leave_period_message_title',
'option_leave_period_message',
'option_credit_description',
'sponsorship_code'
'sponsorship_code',
'option_communicate_email_default_subject',
'option_communicate_email_default_message',
],
'string'
],
@@ -548,6 +550,8 @@ class Producer extends ActiveRecordCommon
'option_leave_period_message' => 'Message des congés',
'option_credit_description' => "Description Cagnotte",
'sponsorship_sponsor_reward' => 'Récompense parrain',
'option_communicate_email_default_subject' => 'Sujet par défaut',
'option_communicate_email_default_message' => 'Message par défaut',
];
}


Loading…
Cancel
Save