Kaynağa Gözat

[Administration] Distribution : affichage lien à communiquer aux clients #1335

feature/souke
Guillaume Bourgeois 1 yıl önce
ebeveyn
işleme
df95ccbe77
6 değiştirilmiş dosya ile 24 ekleme ve 3 silme
  1. +0
    -1
      backend/controllers/CommunicateController.php
  2. +3
    -0
      backend/controllers/DistributionController.php
  3. +3
    -1
      backend/models/MailForm.php
  4. +4
    -1
      backend/views/distribution/index.php
  5. +6
    -0
      backend/web/js/vuejs/distribution-index.js
  6. +8
    -0
      common/logic/Distribution/Distribution/Service/DistributionSolver.php

+ 0
- 1
backend/controllers/CommunicateController.php Dosyayı Görüntüle

@@ -47,7 +47,6 @@ use yii\filters\VerbFilter;
*/
class CommunicateController extends BackendController
{

public function behaviors()
{
return [

+ 3
- 0
backend/controllers/DistributionController.php Dosyayı Görüntüle

@@ -269,6 +269,8 @@ class DistributionController extends BackendController
{
$productManager = $this->getProductManager();
$orderManager = $this->getOrderManager();
$distributionManager = $this->getDistributionManager();

$distributionJsonData = [
'id' => $distribution->id,
'active' => $distribution->active,
@@ -281,6 +283,7 @@ class DistributionController extends BackendController
'url_export_shopping_cart_labels' => $this->getUrlManagerBackend()->createUrl(
['distribution/export-shopping-cart-labels', 'date' => $distribution->date]
),
'url_order' => $distributionManager->getLinkOrder($distribution),
];

// montant et poids des commandes

+ 3
- 1
backend/models/MailForm.php Dosyayı Görüntüle

@@ -41,6 +41,7 @@ namespace backend\models;
use common\helpers\GlobalParam;
use common\helpers\Mailjet;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Distribution\Distribution\Wrapper\DistributionManager;
use common\logic\Producer\Producer\Wrapper\ProducerManager;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Wrapper\ProductManager;
@@ -94,6 +95,7 @@ class MailForm extends Model
{
$productManager = ProductManager::getInstance();
$producerManager = ProducerManager::getInstance();
$distributionManager = DistributionManager::getInstance();

$mj = new \Mailjet\Client(
Mailjet::getApiKey('public'),
@@ -117,7 +119,7 @@ class MailForm extends Model
if($distribution) {
$linkOrder = Yii::$app->urlManagerProducer->createAbsoluteUrl(['order/order','slug_producer' => GlobalParam::getCurrentProducer()->slug, 'date' => $distribution->date]) ;
$linkOrder = $distributionManager->getLinkOrder($distribution);
$dateOrder = strftime('%A %d %B %Y', strtotime($distribution->date)) ;
$messageAutoHtml .= '<a href="'.$linkOrder.'">Passer ma commande du '.$dateOrder.'</a>' ;
$messageAutoText .= 'Suivez ce lien pour passer votre commande du '.$dateOrder.' :

+ 4
- 1
backend/views/distribution/index.php Dosyayı Görüntüle

@@ -90,7 +90,10 @@ $this->setPageTitle('Distributions') ;
<span :class="'info-box-icon '+(distribution.active ? 'bg-green' : 'bg-red')"><i :class="'fa '+(distribution.active ? 'fa-check' : 'fa-remove')"></i></span>
<div class="info-box-content">
<span class="info-box-text">
<h4>Distribution du <strong>{{ dateFormat }}</strong></h4>
<h4>
Distribution du <strong>{{ dateFormat }}</strong>
<a class="btn btn-default" :href="distribution.url_order" @click="copyLinkOrder($event, distribution.url_order)"><span class="glyphicon glyphicon-link"></span></a>
</h4>
<a @click="activeWeekDistribution" data-active="0" class="btn btn-default btn-active-week" v-if="oneDistributionWeekActive">Désactiver cette semaine</a>
<a @click="activeWeekDistribution" data-active="1" class="btn btn-default btn-active-week" v-else>Activer cette semaine</a>

+ 6
- 0
backend/web/js/vuejs/distribution-index.js Dosyayı Görüntüle

@@ -944,6 +944,12 @@ var app = new Vue({
}

return null;
},
copyLinkOrder: function($event, urlOrder) {
$event.preventDefault();
navigator.clipboard.writeText(urlOrder);
appAlerts.alert('success', 'Lien vers la page de commande de la distribution copié.');
return false;
}
},
});

+ 8
- 0
common/logic/Distribution/Distribution/Service/DistributionSolver.php Dosyayı Görüntüle

@@ -114,4 +114,12 @@ class DistributionSolver extends AbstractService implements SolverInterface
return false;
}

public function getLinkOrder(Distribution $distribution): string
{
return \Yii::$app->urlManagerProducer->createAbsoluteUrl([
'order/order',
'slug_producer' => $this->getProducerContext()->slug,
'date' => $distribution->date
]) ;
}
}

Yükleniyor…
İptal
Kaydet