{ | { | ||||
$sharedPointSaleModule = $this->getSharedPointSaleModule(); | $sharedPointSaleModule = $this->getSharedPointSaleModule(); | ||||
$sharedPointSaleModel = $sharedPointSaleModule->getBuilder()->instanciateSharedPointSale(null, null, $this->getUserCurrent()); | $sharedPointSaleModel = $sharedPointSaleModule->getBuilder()->instanciateSharedPointSale(null, null, $this->getUserCurrent()); | ||||
$sharedPointSaleModel->scenario = SharedPointSale::SCENARIO_CREATE; | |||||
if($sharedPointSaleModel->load(\Yii::$app->request->post()) && $sharedPointSaleModel->validate()) { | if($sharedPointSaleModel->load(\Yii::$app->request->post()) && $sharedPointSaleModel->validate()) { | ||||
$sharedPointSaleModule->getManager()->createSharedPointSale( | $sharedPointSaleModule->getManager()->createSharedPointSale( | ||||
$sharedPointSaleModel->getPointSale(), | $sharedPointSaleModel->getPointSale(), | ||||
{ | { | ||||
$sharedPointSale = $this->findSharedPointSale($id); | $sharedPointSale = $this->findSharedPointSale($id); | ||||
$sharedPointSale->scenario = SharedPointSale::SCENARIO_CONFIRM; | $sharedPointSale->scenario = SharedPointSale::SCENARIO_CONFIRM; | ||||
$sharedPointSale->producerCurrent = $this->getProducerCurrent(); | |||||
if($sharedPointSale->load(\Yii::$app->request->post()) && $sharedPointSale->validate()) { | if($sharedPointSale->load(\Yii::$app->request->post()) && $sharedPointSale->validate()) { | ||||
$pointSaleWithSharing = $sharedPointSale->getPointSaleWithSharing(); | $pointSaleWithSharing = $sharedPointSale->getPointSaleWithSharing(); | ||||
if($this->getSharedPointSaleModule()->getManager()->confirmSharedPointSale($sharedPointSale, $pointSaleWithSharing, $this->getUserCurrent())) { | if($this->getSharedPointSaleModule()->getManager()->confirmSharedPointSale($sharedPointSale, $pointSaleWithSharing, $this->getUserCurrent())) { | ||||
} | } | ||||
} | } | ||||
else { | 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']); | return $this->redirect(['index']); | ||||
public function actionDecline(int $id) | public function actionDecline(int $id) | ||||
{ | { | ||||
$sharedPointSale = $this->findSharedPointSale($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 { | 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']); | return $this->redirect(['index']); |
* termes. | * termes. | ||||
*/ | */ | ||||
use common\helpers\GlobalParam; | |||||
use domain\PointSale\UserPointSale\UserPointSale; | use domain\PointSale\UserPointSale\UserPointSale; | ||||
use domain\Producer\Producer\Producer; | use domain\Producer\Producer\Producer; | ||||
use yii\grid\GridView; | use yii\grid\GridView; | ||||
<div class="shared-point-sale-index"> | <div class="shared-point-sale-index"> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-md-8"> | <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> | </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> | </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> | <thead> | ||||
<tr> | <tr> | ||||
<td>Point de vente</td> | <td>Point de vente</td> | ||||
<td>Partagé avec</td> | <td>Partagé avec</td> | ||||
<td></td> | |||||
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<tbody> | <tbody> | ||||
<?php foreach($pointsSaleArray as $pointSale): ?> | <?php foreach($pointsSaleArray as $pointSale): ?> | ||||
<?php | <?php | ||||
$pointsSaleSharedWithPointSaleArray = $sharedPointSaleModule->getResolver()->getPointsSaleSharedWithPointSale($pointSale); | $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->getProducer()->getName()); ?> | ||||
- <?= Html::encode($pointSaleSharedWithPointSale->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> | </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 endif; ?> | ||||
<?php endforeach; ?> | <?php endforeach; ?> | ||||
</tbody> | </tbody> | ||||
</table> | </table> | ||||
</div> | |||||
<?php else: ?> | |||||
<p><em>Aucun résultat</em></p> | |||||
<?php endif; ?> | |||||
</div> | </div> | ||||
<?php endif; ?> | |||||
</div> | |||||
</div> | </div> | ||||
<div class="col-md-4"> | <div class="col-md-4"> | ||||
<div class="callout callout-info"> | <div class="callout callout-info"> | ||||
Cette fonctionnalité vous permet de partager des points de vente avec d'autres producteurs inscrits sur Souke | 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 /> | 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 | 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> | </div> | ||||
</div> | </div> |
class SharedPointSale extends ActiveRecordCommon | class SharedPointSale extends ActiveRecordCommon | ||||
{ | { | ||||
/* Yii */ | |||||
public ?Producer $producerCurrent; | |||||
public const SCENARIO_CREATE = 'create'; | |||||
public const SCENARIO_CONFIRM = 'confirm'; | public const SCENARIO_CONFIRM = 'confirm'; | ||||
public static function tableName() | public static function tableName() | ||||
[['id_point_sale', 'id_producer_with_sharing', 'id_point_sale_with_sharing', 'status', | [['id_point_sale', 'id_producer_with_sharing', 'id_point_sale_with_sharing', 'status', | ||||
'created_by', 'confirmed_by', 'declined_by'], 'integer'], | 'created_by', 'confirmed_by', 'declined_by'], 'integer'], | ||||
[['created_at', 'confirmed_at', 'declined_at'], 'safe'], | [['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', 'exist', 'targetClass' => PointSale::class, 'targetAttribute' => 'id'], | ||||
['id_point_sale_with_sharing', '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'], | ['id_producer_with_sharing', 'exist', 'targetClass' => Producer::class, 'targetAttribute' => 'id'], | ||||
[['created_by', 'confirmed_by', 'declined_by'], 'exist', 'targetClass' => User::class, 'targetAttribute' => 'id'], | [['created_by', 'confirmed_by', 'declined_by'], 'exist', 'targetClass' => User::class, 'targetAttribute' => 'id'], | ||||
]; | ]; | ||||
]; | ]; | ||||
} | } | ||||
/* 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 | public function getId(): ?int | ||||
{ | { |
use domain\_\AbstractRepository; | use domain\_\AbstractRepository; | ||||
use domain\PointSale\PointSale\PointSale; | use domain\PointSale\PointSale\PointSale; | ||||
use domain\Producer\Producer\Producer; | |||||
class SharedPointSaleRepository extends AbstractRepository | class SharedPointSaleRepository extends AbstractRepository | ||||
{ | { | ||||
->find(); | ->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() | return $this->createQuery() | ||||
->filterByPointSale($pointSale) | ->filterByPointSale($pointSale) | ||||
->filterByProducer($producer) | |||||
->filterIsConfirmed() | ->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(); | |||||
} | } | ||||
} | } |
return $this; | 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') | $this->andWhere('id_point_sale = :id_point_sale OR id_point_sale_with_sharing = :id_point_sale') | ||||
->addParams(['id_point_sale' => $pointSale->id]); | ->addParams(['id_point_sale' => $pointSale->id]); | ||||
return $this; | 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() | public function filterIsRequest() | ||||
{ | { | ||||
$this->filterIsPointSaleWithSharingIsNull() | $this->filterIsPointSaleWithSharingIsNull() | ||||
public function filterIsConfirmed() | public function filterIsConfirmed() | ||||
{ | { | ||||
$this->filterIsStatusOnline(); | $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; | return $this; | ||||
} | } | ||||
use yii\helpers\Html; | use yii\helpers\Html; | ||||
$producerModule = $this->getProducerModule(); | $producerModule = $this->getProducerModule(); | ||||
$featureModule = $this->getFeatureModule(); | |||||
$featureChecker = $this->getFeatureModule()->getChecker(); | |||||
$this->setTitle('Fonctionnalités, services & tarifs'); | $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."); | $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."); | ||||
</div> | </div> | ||||
<div class="panel-body"> | <div class="panel-body"> | ||||
<div class="row"> | <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> | ||||
<div class="row"> | <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> | ||||
<div class="row"> | <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> | ||||
<div class="row"> | <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> | ||||
<div class="row"> | <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> | ||||
<div class="row"> | <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> | ||||
<div class="row"> | <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> | </div> | ||||
</div> | </div> | ||||
<h3>Support</h3> | <h3>Support</h3> | ||||
<p>Je suis disponible pour répondre rapidement à toutes vos questions par email | <p>Je suis disponible pour répondre rapidement à toutes vos questions par email | ||||
ou par téléphone. | 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 | <br />J'assure également le support pour vos clients s'ils | ||||
rencontrent un problème dans l'utilisation du logiciel. | rencontrent un problème dans l'utilisation du logiciel. | ||||
<?php endif; ?> | <?php endif; ?> |
]; | ]; | ||||
} | } | ||||
public function actionOrder(int $id = 0, $date = '') | |||||
public function actionOrder(int $id = 0, string $date = '', int $idPointSale = null) | |||||
{ | { | ||||
$orderModule = $this->getOrderModule(); | $orderModule = $this->getOrderModule(); | ||||
$distributionModule = $this-> getDistributionModule(); | $distributionModule = $this-> getDistributionModule(); | ||||
); | ); | ||||
} | } | ||||
$order = $orderModule->findOneOrderById($id); | |||||
if ($order && $orderModule->isOrderStateOpen($order)) { | |||||
$order = $orderModule->getRepository()->findOneOrderById($id); | |||||
if ($order && $orderModule->getRepository()->isOrderStateOpen($order)) { | |||||
$params['order'] = $order; | $params['order'] = $order; | ||||
} | } | ||||
$params['date'] = $date; | $params['date'] = $date; | ||||
} | } | ||||
if($idPointSale) { | |||||
$params['idPointSale'] = $idPointSale; | |||||
} | |||||
return $this->render('order', $params); | return $this->render('order', $params); | ||||
} | } | ||||
var appInitValues = { | 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])]) ?>', | 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 ?>', | 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> | </script> | ||||