Sfoglia il codice sorgente

Possibilité de configurer le libellé "Points de vente" de la page d'accueil de l'espace producteurs #923

refactoring
Guillaume Bourgeois 1 anno fa
parent
commit
a61449e1ec
5 ha cambiato i file con 45 aggiunte e 4 eliminazioni
  1. +4
    -1
      common/logic/Producer/Producer/Model/Producer.php
  2. +10
    -0
      common/logic/Producer/Producer/Service/ProducerSolver.php
  3. +26
    -0
      console/migrations/m230320_080836_producer_add_option_point_sale_wording.php
  4. +3
    -2
      producer/views/order/_form.php
  5. +2
    -1
      producer/views/site/index.php

+ 4
- 1
common/logic/Producer/Producer/Model/Producer.php Vedi File

@@ -218,7 +218,8 @@ class Producer extends ActiveRecordCommon
'option_online_payment_type',
'option_tax_calculation_method',
'latest_version_opendistrib',
'option_csv_separator'
'option_csv_separator',
'option_point_sale_wording'
],
'string'
],
@@ -273,6 +274,7 @@ class Producer extends ActiveRecordCommon
'document_delivery_note_first_reference',
'option_billing_type',
'option_billing_frequency',
'option_point_sale_wording',
],
'string',
'max' => 255
@@ -395,6 +397,7 @@ class Producer extends ActiveRecordCommon
'option_billing_reduction_percentage' => 'Réduction : pourcentage',
'option_billing_permanent_transfer' => 'Virement permanent',
'option_billing_permanent_transfer_amount' => 'Virement permanent : montant',
'option_point_sale_wording' => 'Libellé points de vente'
];
}


+ 10
- 0
common/logic/Producer/Producer/Service/ProducerSolver.php Vedi File

@@ -7,6 +7,7 @@ use common\logic\AbstractService;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\SolverInterface;
use common\logic\User\User\Model\User;
use yii\helpers\Html;

class ProducerSolver extends AbstractService implements SolverInterface
{
@@ -242,4 +243,13 @@ class ProducerSolver extends AbstractService implements SolverInterface
{
return $producer->option_billing_frequency == Producer::BILLING_FREQUENCY_BIANNUAL;
}

public function getPointSaleWording(Producer $producer)
{
if($producer->option_point_sale_wording && strlen($producer->option_point_sale_wording)) {
return Html::encode($producer->option_point_sale_wording);
}

return 'Points de vente';
}
}

+ 26
- 0
console/migrations/m230320_080836_producer_add_option_point_sale_wording.php Vedi File

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m230320_080836_producer_add_option_point_sale_wording
*/
class m230320_080836_producer_add_option_point_sale_wording extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'option_point_sale_wording', Schema::TYPE_STRING .' DEFAULT NULL');
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'option_point_sale_wording');
}
}

+ 3
- 2
producer/views/order/_form.php Vedi File

@@ -38,7 +38,8 @@ termes.

use common\helpers\GlobalParam;
use yii\widgets\ActiveForm;
use common\logic\Producer\Producer\Producer;

$producerManager = $this->getProducerManager();

?>
<div class="order-form">
@@ -105,7 +106,7 @@ use common\logic\Producer\Producer\Producer;
<div class="clr"></div>

<div id="block-points-sale">
<h3 id="step-point-sale"><span>Points de vente</span></h3>
<h3 id="step-point-sale"><span><?= $producerManager->getPointSaleWording($producer); ?></span></h3>
<?=
$form->field($model, 'id_point_sale')
->label('')

+ 2
- 1
producer/views/site/index.php Vedi File

@@ -43,6 +43,7 @@ use common\helpers\Price;

$producer = $this->context->getProducer() ;
$productManager = $this->getProductManager();
$producerManager = $this->getProducerManager();
$this->setTitle('Accueil');
$this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;

@@ -59,7 +60,7 @@ $this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;


<section id="points-sale">
<h3><span>Points de vente</span></h3>
<h3><span><?= $producerManager->getPointSaleWording($producer); ?></span></h3>
<?= GridView::widget([
'dataProvider' => $dataProviderPointsSale,
'summary' => '',

Loading…
Annulla
Salva