Browse Source

Points de vente partagés

feature/rotating_product
Guillaume Bourgeois 6 months ago
parent
commit
3f37c7cd67
8 changed files with 248 additions and 121 deletions
  1. +17
    -5
      backend/controllers/SharedPointSaleController.php
  2. +123
    -90
      backend/views/shared-point-sale/index.php
  3. +39
    -2
      domain/PointSale/SharedPointSale/SharedPointSale.php
  4. +30
    -2
      domain/PointSale/SharedPointSale/SharedPointSaleRepository.php
  5. +9
    -2
      domain/PointSale/SharedPointSale/SharedPointSaleRepositoryQuery.php
  6. +20
    -16
      frontend/views/site/service.php
  7. +7
    -3
      producer/controllers/OrderController.php
  8. +3
    -1
      producer/views/order/order.php

+ 17
- 5
backend/controllers/SharedPointSaleController.php View File

@@ -85,7 +85,7 @@ class SharedPointSaleController extends BackendController
{
$sharedPointSaleModule = $this->getSharedPointSaleModule();
$sharedPointSaleModel = $sharedPointSaleModule->getBuilder()->instanciateSharedPointSale(null, null, $this->getUserCurrent());
$sharedPointSaleModel->scenario = SharedPointSale::SCENARIO_CREATE;
if($sharedPointSaleModel->load(\Yii::$app->request->post()) && $sharedPointSaleModel->validate()) {
$sharedPointSaleModule->getManager()->createSharedPointSale(
$sharedPointSaleModel->getPointSale(),
@@ -105,6 +105,8 @@ class SharedPointSaleController extends BackendController
{
$sharedPointSale = $this->findSharedPointSale($id);
$sharedPointSale->scenario = SharedPointSale::SCENARIO_CONFIRM;
$sharedPointSale->producerCurrent = $this->getProducerCurrent();

if($sharedPointSale->load(\Yii::$app->request->post()) && $sharedPointSale->validate()) {
$pointSaleWithSharing = $sharedPointSale->getPointSaleWithSharing();
if($this->getSharedPointSaleModule()->getManager()->confirmSharedPointSale($sharedPointSale, $pointSaleWithSharing, $this->getUserCurrent())) {
@@ -115,7 +117,11 @@ class SharedPointSaleController extends BackendController
}
}
else {
$this->addFlash('error', "Veuillez sélectionner un point de vente pour confirmer le partage");
foreach($sharedPointSale->getErrors() as $errorArray) {
foreach($errorArray as $errorMessage) {
$this->addFlash('error', $errorMessage);
}
}
}

return $this->redirect(['index']);
@@ -124,11 +130,17 @@ class SharedPointSaleController extends BackendController
public function actionDecline(int $id)
{
$sharedPointSale = $this->findSharedPointSale($id);
if($this->getSharedPointSaleModule()->getManager()->declineSharedPointSale($sharedPointSale, $this->getUserCurrent())) {
$this->addFlash('success', "La demande de partage de point de vente a bien été annulée.");

if(!in_array($this->getProducerCurrent()->id, [$sharedPointSale->getProducerWithSharing()->id, $sharedPointSale->getPointSale()->id_producer])) {
$this->addFlash('error', "Vous ne pouvez pas refuser cette demande de partage.");
}
else {
$this->addFlash('error', "Une erreur est survenue lors de l'annulation de la demande de partage.");
if($this->getSharedPointSaleModule()->getManager()->declineSharedPointSale($sharedPointSale, $this->getUserCurrent())) {
$this->addFlash('success', "La demande de partage de point de vente a bien été annulée.");
}
else {
$this->addFlash('error', "Une erreur est survenue lors de l'annulation de la demande de partage.");
}
}

return $this->redirect(['index']);

+ 123
- 90
backend/views/shared-point-sale/index.php View File

@@ -36,6 +36,7 @@
* termes.
*/

use common\helpers\GlobalParam;
use domain\PointSale\UserPointSale\UserPointSale;
use domain\Producer\Producer\Producer;
use yii\grid\GridView;
@@ -61,118 +62,150 @@ $this->addButton(
<div class="shared-point-sale-index">
<div class="row">
<div class="col-md-8">
<?php if(count($sharedPointsSaleRequestOfMe)): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Mes demandes de partages en attente
</h3>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered">
<tbody>
<?php foreach($sharedPointsSaleRequestOfMe as $sharedPointSale): ?>
<tr>
<td>
Vous souhaitez partager votre point de vente <strong><?= Html::encode($sharedPointSale->getPointSale()->getName()); ?></strong>
avec le producteur <strong><?= Html::encode($sharedPointSale->getProducerWithSharing()->getName()); ?></strong>
</td>
<td>
<a href="<?= Yii::$app->urlManager->createUrl(['shared-point-sale/decline', 'id' => $sharedPointSale->getId()]) ?>" class="btn btn-default">Annuler</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Mes demandes de partages en attente
</h3>
</div>
<?php endif; ?>
<div class="panel-body">
<?php if(count($sharedPointsSaleRequestOfMe)): ?>
<table class="table table-striped table-bordered">
<tbody>
<?php foreach($sharedPointsSaleRequestOfMe as $sharedPointSale): ?>
<tr>
<td>
Vous souhaitez partager votre point de vente <strong><?= Html::encode($sharedPointSale->getPointSale()->getName()); ?></strong>
avec le producteur <strong><?= Html::encode($sharedPointSale->getProducerWithSharing()->getName()); ?></strong>.
<br /><small>Demande de partage effectuée le <?= $sharedPointSale->getCreatedAt()->format('d/m/Y à H:i') ?></small>
</td>
<td>
<a href="<?= Yii::$app->urlManager->createUrl(['shared-point-sale/decline', 'id' => $sharedPointSale->getId()]) ?>" class="btn btn-default">Annuler</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p><em>Aucun résultat</em></p>
<?php endif; ?>
</div>
</div>

<?php if(count($sharedPointsSaleRequestOthers)): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Demandes de partage des autres producteurs
</h3>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered">
<tbody>
<?php foreach($sharedPointsSaleRequestOthers as $sharedPointSale): ?>
<tr>
<td>Le producteur <strong><?= Html::encode($sharedPointSale->getPointSale()->getProducer()->getName()); ?></strong>
souhaite partager son point de vente <strong><?= Html::encode($sharedPointSale->getPointSale()->getName()); ?></strong>
avec vous.
</td>
<td>
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'action' => Yii::$app->urlManager->createUrl(['shared-point-sale/confirm', 'id' => $sharedPointSale->getId()])
]); ?>
<?= $form->field($sharedPointSale, 'id_point_sale_with_sharing')
->dropDownList($pointSaleModule->getRepository()->populatePointSaleDropdownList())
->label('Votre point de vente correspondant')
->hint('Absent de la liste ? <a href="'.Yii::$app->urlManager->createUrl(['point-sale/create']).'">Créer le point de vente</a>'); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Demandes de partage des autres producteurs
</h3>
</div>
<div class="panel-body">
<?php if(count($sharedPointsSaleRequestOthers)): ?>
<table class="table table-striped table-bordered">
<tbody>
<?php foreach($sharedPointsSaleRequestOthers as $sharedPointSale): ?>
<tr>
<td>Le producteur <strong><?= Html::encode($sharedPointSale->getPointSale()->getProducer()->getName()); ?></strong>
souhaite partager son point de vente <strong><?= Html::encode($sharedPointSale->getPointSale()->getName()); ?></strong>
avec vous.
<br /><br /><small>Demande de partage effectuée le <?= $sharedPointSale->getCreatedAt()->format('d/m/Y à H:i') ?></small>
</td>
<td>
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'action' => Yii::$app->urlManager->createUrl(['shared-point-sale/confirm', 'id' => $sharedPointSale->getId()])
]); ?>
<?= $form->field($sharedPointSale, 'id_point_sale_with_sharing')
->dropDownList($pointSaleModule->getRepository()->populatePointSaleDropdownList())
->label('Votre point de vente correspondant')
->hint('Absent de la liste ? <a href="'.Yii::$app->urlManager->createUrl(['point-sale/create']).'">Créer le point de vente</a>'); ?>

<?= Html::submitButton('Confirmer', ['class' => 'btn btn-success', 'name' => 'save']) ?>
<?php ActiveForm::end(); ?>
</td>
<td>
<br />
<a href="<?= Yii::$app->urlManager->createUrl(['shared-point-sale/decline', 'id' => $sharedPointSale->getId()]) ?>" class="btn btn-danger">
Refuser
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?= Html::submitButton('Confirmer', ['class' => 'btn btn-success', 'name' => 'save']) ?>
<?php ActiveForm::end(); ?>
</td>
<td>
<br />
<a href="<?= Yii::$app->urlManager->createUrl(['shared-point-sale/decline', 'id' => $sharedPointSale->getId()]) ?>" class="btn btn-danger">
Refuser
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p><em>Aucun résultat</em></p>
<?php endif; ?>
</div>
<?php endif; ?>
</div>

<?php if($sharedPointSaleModule->getResolver()->countPointsSaleShared()): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Partages confirmés
</h3>
</div>
<div class="panel-body">
<table class="table table-striped table-bordered">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Partages confirmés
</h3>
</div>
<div class="panel-body">
<?php if($sharedPointSaleModule->getResolver()->countPointsSaleShared()): ?>
<table id="table-shared-point-sale-confirmed" class="table table-striped table-bordered">
<thead>
<tr>
<td>Point de vente</td>
<td>Partagé avec</td>
<td></td>
</tr>
</thead>
<tbody>
<?php foreach($pointsSaleArray as $pointSale): ?>
<?php
$pointsSaleSharedWithPointSaleArray = $sharedPointSaleModule->getResolver()->getPointsSaleSharedWithPointSale($pointSale);
if(count($pointsSaleSharedWithPointSaleArray)):
?>
<tr>
<td><?= Html::encode($pointSale->getName()); ?></td>
<td>
<?php foreach($pointsSaleSharedWithPointSaleArray as $pointSaleSharedWithPointSale): ?>
<div>
$countPointsSaleSharedWithPointSale = count($pointsSaleSharedWithPointSaleArray);
if($countPointsSaleSharedWithPointSale):?>
<?php foreach($pointsSaleSharedWithPointSaleArray as $key => $pointSaleSharedWithPointSale): ?>
<?php $sharedPointSale = $sharedPointSaleModule->getRepository()->findOneSharedPointsSaleConfirmed(
$pointSaleSharedWithPointSale,
GlobalParam::getCurrentProducer()
); ?>
<tr>
<?php if($key === array_key_first($pointsSaleSharedWithPointSaleArray)): ?>
<td rowspan="<?= $countPointsSaleSharedWithPointSale ?>">
<?= Html::encode($pointSale->getName()); ?><br />
<span class="badge">
<?= $countPointsSaleSharedWithPointSale ?>
</span>
</td>
<?php endif; ?>
<td>
<div class="shared-point-sale-confirmed">
<?= Html::encode($pointSaleSharedWithPointSale->getProducer()->getName()); ?>
- <?= Html::encode($pointSaleSharedWithPointSale->getName()); ?>
<!--<a href="<?= Yii::$app->urlManager->createUrl(['shared-point-sale/decline']) ?>" class="btn btn-xs btn-default">
<span class="glyphicon glyphicon-remove"></span>
</a>-->
<br /><small>
<?php if($sharedPointSale):?>
Depuis le <?= $sharedPointSale->getConfirmedAt()->format('d/m/Y') ?>
<?php else: ?>
Partage hérité
<?php endif; ?>
</small>
</div>
<?php endforeach; ?>
</td>
</tr>
</td>
<td>
<?php if($sharedPointSale):?>
<a href="<?= Yii::$app->urlManager->createUrl(['shared-point-sale/decline', 'id' => $sharedPointSale->id]) ?>" class="btn btn-xs btn-default" title="Annuler">
<span class="glyphicon glyphicon-remove"></span>
</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p><em>Aucun résultat</em></p>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<div class="col-md-4">
<div class="callout callout-info">
@@ -180,7 +213,7 @@ $this->addButton(
Cette fonctionnalité vous permet de partager des points de vente avec d'autres producteurs inscrits sur Souke
et avec qui vous avez des distributions en commun.<br />
Quand vous partagez un point de vente avec un autre producteur, un lien vers votre boutique est
proposé aux clients de ce producteur quand ils passent commande sur le point de vente en partage.
proposé aux clients de ce producteur quand ils passent commande sur le point de vente partagé.
</div>
</div>
</div>

+ 39
- 2
domain/PointSale/SharedPointSale/SharedPointSale.php View File

@@ -9,8 +9,9 @@ use domain\User\User\User;

class SharedPointSale extends ActiveRecordCommon
{
/* Yii */
public ?Producer $producerCurrent;

public const SCENARIO_CREATE = 'create';
public const SCENARIO_CONFIRM = 'confirm';

public static function tableName()
@@ -26,8 +27,10 @@ class SharedPointSale extends ActiveRecordCommon
[['id_point_sale', 'id_producer_with_sharing', 'id_point_sale_with_sharing', 'status',
'created_by', 'confirmed_by', 'declined_by'], 'integer'],
[['created_at', 'confirmed_at', 'declined_at'], 'safe'],
['id_point_sale', 'verifySharedPointSale', 'on' => [self::SCENARIO_CREATE, self::SCENARIO_CONFIRM]],
['id_point_sale', 'exist', 'targetClass' => PointSale::class, 'targetAttribute' => 'id'],
['id_point_sale_with_sharing', 'exist', 'targetClass' => PointSale::class, 'targetAttribute' => 'id'],
['id_point_sale_with_sharing', 'verifyConfirm'],
['id_producer_with_sharing', 'exist', 'targetClass' => Producer::class, 'targetAttribute' => 'id'],
[['created_by', 'confirmed_by', 'declined_by'], 'exist', 'targetClass' => User::class, 'targetAttribute' => 'id'],
];
@@ -42,7 +45,41 @@ class SharedPointSale extends ActiveRecordCommon
];
}

/* Get / Set */
public function verifySharedPointSale($attribute, $params)
{
$sharedPointSaleRepository = SharedPointSaleRepository::getInstance();

if($this->scenario == self::SCENARIO_CREATE || $this->scenario == self::SCENARIO_CONFIRM) {
$sharedPointSaleConfirmed = $sharedPointSaleRepository->findSharedPointsSaleConfirmedByPointSale(
$this->getPointSale(),
$this->getProducerWithSharing()
);
if($sharedPointSaleConfirmed && count($sharedPointSaleConfirmed)) {
$this->addError($attribute, "Ce point de vente est déjà partagé avec ce producteur.");
}
}

if($this->scenario == self::SCENARIO_CREATE) {
$sharedPointSaleRequest = $sharedPointSaleRepository->findSharedPointSaleRequestByPointSale(
$this->getPointSale(),
$this->getProducerWithSharing()
);
if($sharedPointSaleRequest && count($sharedPointSaleRequest)) {
$this->addError($attribute, "Ce point de vente a déjà une demande de partage en attente avec ce producteur.");
}
}
}

public function verifyConfirm($attribute, $params)
{
if($this->scenario == self::SCENARIO_CONFIRM) {
if($this->producerCurrent->id != $this->getProducerWithSharing()->id) {
$this->addError($attribute, "Vous ne pouvez pas confirmer cette demande de partage.");
}
}
}

/* Getters / Setters */

public function getId(): ?int
{

+ 30
- 2
domain/PointSale/SharedPointSale/SharedPointSaleRepository.php View File

@@ -4,6 +4,7 @@ namespace domain\PointSale\SharedPointSale;

use domain\_\AbstractRepository;
use domain\PointSale\PointSale\PointSale;
use domain\Producer\Producer\Producer;

class SharedPointSaleRepository extends AbstractRepository
{
@@ -47,11 +48,38 @@ class SharedPointSaleRepository extends AbstractRepository
->find();
}

public function findSharedPointsSaleConfirmedByPointSale(PointSale $pointSale)
public function findSharedPointsSaleConfirmedByPointSale(PointSale $pointSale, Producer $producerWithSharing = null)
{
$query = $this->createQuery()
->filterByPointSale($pointSale)
->filterIsConfirmed();

if($producerWithSharing) {
$query->filterByProducerWithSharing($producerWithSharing);
}

return $query->find();
}

public function findOneSharedPointsSaleConfirmed(PointSale $pointSale, Producer $producer)
{
return $this->createQuery()
->filterByPointSale($pointSale)
->filterByProducer($producer)
->filterIsConfirmed()
->find();
->findOne();
}

public function findSharedPointSaleRequestByPointSale(PointSale $pointSale, Producer $producerWithSharing = null)
{
$query = $this->createQuery()
->filterByPointSale($pointSale)
->filterIsRequest();

if($producerWithSharing) {
$query->filterByProducerWithSharing($producerWithSharing);
}

return $query->find();
}
}

+ 9
- 2
domain/PointSale/SharedPointSale/SharedPointSaleRepositoryQuery.php View File

@@ -34,13 +34,20 @@ class SharedPointSaleRepositoryQuery extends AbstractRepositoryQuery
return $this;
}

public function filterByPointSale(PointSale $pointSale)
public function filterByPointSale(PointSale $pointSale): self
{
$this->andWhere('id_point_sale = :id_point_sale OR id_point_sale_with_sharing = :id_point_sale')
->addParams(['id_point_sale' => $pointSale->id]);
return $this;
}

public function filterByProducer(Producer $producer): self
{
$this->andWhere('point_sale.id_producer = :id_producer OR id_producer_with_sharing = :id_producer')
->addParams(['id_producer' => $producer->id]);
return $this;
}

public function filterIsRequest()
{
$this->filterIsPointSaleWithSharingIsNull()
@@ -51,7 +58,7 @@ class SharedPointSaleRepositoryQuery extends AbstractRepositoryQuery
public function filterIsConfirmed()
{
$this->filterIsStatusOnline();
$this->andWhere('id_point_sale_with_sharing IS NOT NULL AND confirmed_at IS NOT NULL');
$this->andWhere('id_point_sale_with_sharing IS NOT NULL AND confirmed_at IS NOT NULL AND declined_at IS NULL');
return $this;
}


+ 20
- 16
frontend/views/site/service.php View File

@@ -39,7 +39,7 @@ use domain\Feature\Feature\Feature;
use yii\helpers\Html;

$producerModule = $this->getProducerModule();
$featureModule = $this->getFeatureModule();
$featureChecker = $this->getFeatureModule()->getChecker();

$this->setTitle('Fonctionnalités, services & tarifs');
$this->setMeta('description', "Découvrez les fonctionnalités du logiciel, les services proposés et les tarifs pour l’hébergement de votre circuit court sur Souke.");
@@ -56,32 +56,36 @@ $this->setMeta('description', "Découvrez les fonctionnalités du logiciel, les
</div>
<div class="panel-body">
<div class="row">
<?= block_feature('shop', "Une boutique dédiée accessible à vos clients pour leur présenter votre activité et gérer vos prises de commandes."); ?>
<?= block_feature("gear", "Une administration complète et intuitive pour gérer votre activité de producteur."); ?>
<?= block_feature('shop', "Une boutique dédiée accessible à vos clients pour leur présenter votre activité et gérer vos prises de commandes"); ?>
<?= block_feature("gear", "Une administration complète et intuitive pour gérer votre activité de producteur"); ?>
</div>
<div class="row">
<?= block_feature("calendar3", "Planification des jours de distributions."); ?>
<?= block_feature("download", "Récapitulatif des commandes par jour de distribution (PDF et CSV), génération d'étiquettes (PDF)."); ?>
<?= block_feature("calendar3", "Planification des jours de distributions"); ?>
<?= block_feature("download", "Récapitulatif des commandes par jour de distribution (PDF et CSV), génération d'étiquettes (PDF)"); ?>
</div>
<div class="row">
<?= block_feature("basket", "Gestion des produits, catégories et prix spécifiques."); ?>
<?= block_feature("geo-alt", "Gestion des points de vente."); ?>
<?= block_feature("basket", "Gestion des produits, catégories et prix spécifiques"); ?>
<?php $featureSharedPointSaleDescription = '';
if($featureChecker->isEnabled(Feature::ALIAS_SHARED_POINT_SALE)):
$featureSharedPointSaleDescription .= "<br />Partage de points de vente entre plusieurs producteurs pour des distributions communes";
endif; ?>
<?= block_feature("geo-alt", "Gestion des points de vente ".$featureSharedPointSaleDescription); ?>
</div>
<div class="row">
<?= block_feature("arrow-repeat", "Gestion des abonnements pour les commandes récurrentes."); ?>
<?= block_feature("people", "Gestion des clients."); ?>
<?= block_feature("arrow-repeat", "Gestion des abonnements pour les commandes récurrentes"); ?>
<?= block_feature("people", "Gestion des clients"); ?>
</div>
<div class="row">
<?= block_feature("piggy-bank", "Système de cagnotte permettant la comptabilisation des paiements."); ?>
<?= block_feature("credit-card", "Paiement en ligne possible via la plateforme <strong>Stripe</strong> pour que les clients puissent alimenter leur cagnotte de manière autonome."); ?>
<?= block_feature("piggy-bank", "Système de cagnotte permettant la comptabilisation des paiements"); ?>
<?= block_feature("credit-card", "Paiement en ligne possible via la plateforme <strong>Stripe</strong> pour que les clients puissent alimenter leur cagnotte de manière autonome"); ?>
</div>
<div class="row">
<?= block_feature("megaphone", "Communication facilitée avec les clients via l'envoi d'emails en masse."); ?>
<?= block_feature("file-earmark-text", "Génération de bons de livraison, factures & devis."); ?>
<?= block_feature("megaphone", "Communication facilitée avec les clients via l'envoi d'emails en masse"); ?>
<?= block_feature("file-earmark-text", "Génération de bons de livraison, factures & devis"); ?>
</div>
<div class="row">
<?= block_feature("graph-up", "Statistiques et rapports de vente."); ?>
<?= block_feature("cloud-arrow-up", "Exports vers les logiciels <strong>Evoliz</strong> (comptabilité) et <strong>Tiller</strong> (caisse)."); ?>
<?= block_feature("graph-up", "Statistiques et rapports de vente"); ?>
<?= block_feature("cloud-arrow-up", "Exports vers les logiciels <strong>Evoliz</strong> (comptabilité) et <strong>Tiller</strong> (caisse)"); ?>
</div>
</div>
</div>
@@ -125,7 +129,7 @@ $this->setMeta('description', "Découvrez les fonctionnalités du logiciel, les
<h3>Support</h3>
<p>Je suis disponible pour répondre rapidement à toutes vos questions par email
ou par téléphone.
<?php if($featureModule->getChecker()->isEnabled(Feature::ALIAS_SHOP_SUPPORT)): ?>
<?php if($featureChecker->isEnabled(Feature::ALIAS_SHOP_SUPPORT)): ?>
<br />J'assure également le support pour vos clients s'ils
rencontrent un problème dans l'utilisation du logiciel.
<?php endif; ?>

+ 7
- 3
producer/controllers/OrderController.php View File

@@ -82,7 +82,7 @@ class OrderController extends ProducerBaseController
];
}

public function actionOrder(int $id = 0, $date = '')
public function actionOrder(int $id = 0, string $date = '', int $idPointSale = null)
{
$orderModule = $this->getOrderModule();
$distributionModule = $this-> getDistributionModule();
@@ -96,8 +96,8 @@ class OrderController extends ProducerBaseController
);
}

$order = $orderModule->findOneOrderById($id);
if ($order && $orderModule->isOrderStateOpen($order)) {
$order = $orderModule->getRepository()->findOneOrderById($id);
if ($order && $orderModule->getRepository()->isOrderStateOpen($order)) {
$params['order'] = $order;
}

@@ -105,6 +105,10 @@ class OrderController extends ProducerBaseController
$params['date'] = $date;
}

if($idPointSale) {
$params['idPointSale'] = $idPointSale;
}

return $this->render('order', $params);
}


+ 3
- 1
producer/views/order/order.php View File

@@ -59,7 +59,9 @@ $this->setMeta('description', $producerModule->getSeoGenerator()->generateMetaDe
var appInitValues = {
urlLogin: '<?= \Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/producer', 'id' => $this->context->getProducerCurrent()->id, 'return_url' => \Yii::$app->urlManagerProducer->createAbsoluteUrl(['order/order', 'slug_producer' => $this->context->getProducerCurrent()->slug])]) ?>',
producerOptionOrderEntryPoint: '<?= $producer->option_order_entry_point ?>',
<?php if (isset($order)): ?>pointSaleActiveId: <?= $order->id_point_sale ?><?php endif; ?>
<?php if (isset($order)): ?>pointSaleActiveId: <?= $order->id_point_sale ?>
<?php elseif(isset($idPointSale)): ?>pointSaleActiveId: <?= $idPointSale ?>
<?php endif; ?>
};
</script>


Loading…
Cancel
Save