|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?php
-
-
-
- use common\helpers\Image;
- use common\helpers\Price;
- use domain\Distribution\Distribution\DistributionModule;
- use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
- use domain\Feature\Feature\Feature;
- use domain\PointSale\PointSale\PointSaleModule;
- use domain\Producer\Producer\Producer;
- use domain\Producer\Producer\ProducerModule;
- use domain\Product\Product\ProductModule;
- use yii\grid\GridView;
- use yii\helpers\Html;
-
- $productModule = ProductModule::getInstance();
- $producerModule = ProducerModule::getInstance();
- $distributionModule = DistributionModule::getInstance();
- $pointSaleModule = PointSaleModule::getInstance();
- $sharedPointSaleModule = $this->getSharedPointSaleModule();
- $featureChecker = $this->getFeatureModule()->getChecker();
-
- $producer = $this->context->getProducerCurrent();
-
- $this->setTitle($producerModule->getSolver()->getPointSaleWording($producer));
- $this->setPageTitle($producerModule->getSolver()->getPointSaleWording($producer));
- $this->setMeta('description', $producerModule->getSeoGenerator()->generateMetaDescriptionPointsSale());
-
- ?>
-
- <div id="points-sale">
- <?= GridView::widget([
- 'dataProvider' => $dataProviderPointsSale,
- 'summary' => '',
- 'columns' => [
- [
- 'attribute' => 'name',
- 'format' => 'raw',
- 'contentOptions' => ['class' => 'name'],
- 'value' => function ($model) use ($pointSaleModule, $sharedPointSaleModule, $featureChecker) {
- $html = '<span class="the-name">' . Html::encode($model->name) . '</span>';
- if (strlen($model->locality)) {
- $html .= '<br />' . $pointSaleModule->getSolver()->getLocalityWithAddressTooltip($model);
- }
-
- if($featureChecker->isEnabled(Feature::ALIAS_SHARED_POINT_SALE)) {
- if($sharedPointSaleModule->getResolver()->countPointsSaleSharedWithPointSale($model)) {
- $html .= '<div class="shared-point-sale-producers">Autres producteurs présents :<br />';
- $html .= $sharedPointSaleModule->getResolver()->getProducersSharingPointSaleAsString($model, null, ', ', true);
- $html .= '</div>';
- }
- }
-
- return $html;
- }
- ],
- [
- 'label' => 'Informations',
- 'format' => 'raw',
- 'contentOptions' => ['class' => 'days'],
- 'value' => function ($model) use ($distributionModule) {
-
- $producer = \Yii::$app->controller->getProducerCurrent();
-
- if ($producer->behavior_home_point_sale_day_list == Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_WEEK) {
- $arrayDays = [
- 'monday' => 'Lundi',
- 'tuesday' => 'Mardi',
- 'wednesday' => 'Mercredi',
- 'thursday' => 'Jeudi',
- 'friday' => 'Vendredi',
- 'saturday' => 'Samedi',
- 'sunday' => 'Dimanche'
- ];
-
- $html = '';
- foreach ($arrayDays as $dayEn => $dayFr) {
- $fieldDelivery = 'delivery_' . $dayEn;
- $fieldInfos = 'infos_' . $dayEn;
-
- if ($model->$fieldDelivery) {
- $html .= '<div class="block-day"><strong>' . $dayFr . '</strong>';
- if (strlen($model->$fieldInfos)) {
- $html .= '<br /><small>' . nl2br(str_replace(['[select_previous_day]', '[/select_previous_day]'], '', $model->$fieldInfos)) . '</small>';
- }
- $html .= '</div>';
- }
- }
-
- return $html;
- } elseif ($producer->behavior_home_point_sale_day_list == Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_INCOMING_DISTRIBUTIONS) {
- $html = '';
- $incomingDistributions = $distributionModule->findDistributionsIncoming();
- $cpt = 0;
- foreach ($incomingDistributions as $distribution) {
- $countPointSaleDistribution = PointSaleDistribution::searchCount([
- 'id_distribution' => $distribution->id,
- 'id_point_sale' => $model->id,
- 'delivery' => 1
- ]);
- if ($countPointSaleDistribution) {
- $html .= strftime('%A %d %B', strtotime($distribution->date)) . '<br />';
- }
-
- $cpt++;
- }
- return $html;
- }
- }
- ]
- ],
- ]); ?>
- </div>
|