|
- <?php
-
-
-
- use common\helpers\Image;
- use common\helpers\Price;
- use domain\Distribution\Distribution\DistributionModule;
- use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
- 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();
-
- $producer = $this->context->getProducerCurrent();
-
- $this->setTitle('Points de vente');
- $this->setPageTitle('Points de vente');
-
- ?>
-
- <div id="points-sale">
- <?= GridView::widget([
- 'dataProvider' => $dataProviderPointsSale,
- 'summary' => '',
- 'columns' => [
- [
- 'attribute' => 'name',
- 'format' => 'raw',
- 'contentOptions' => ['class' => 'name'],
- 'value' => function ($model) use ($pointSaleModule) {
- $html = '<span class="the-name">' . Html::encode($model->name) . '</span>';
- if (strlen($model->locality)) {
- $html .= '<br />' . $pointSaleModule->getSolver()->getLocalityWithAddressTooltip($model);
- }
- return $html;
- }
- ],
- [
- 'label' => 'Jours',
- '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>
|