Parcourir la source

Refactoring services #885

refactoring
Guillaume il y a 1 an
Parent
révision
3883c5c24d
3 fichiers modifiés avec 14 ajouts et 9 suppressions
  1. +7
    -4
      backend/views/point-sale/index.php
  2. +6
    -4
      backend/views/product/index.php
  3. +1
    -1
      common/helpers/Price.php

+ 7
- 4
backend/views/point-sale/index.php Voir le fichier

@@ -38,7 +38,10 @@

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\PointVenteUser;
use common\logic\PointSale\UserPointSale\Model\UserPointSale;
use common\logic\Producer\Producer\Model\Producer;

$pointSaleManager = $this->getPointSaleManager();

$this->setTitle('Points de vente');
$this->addBreadcrumb($this->getTitle());
@@ -84,8 +87,8 @@ $this->addButton(
'saterday' => 'Samedi',
'sunday' => 'Dimanche',
],
'value' => function ($model) {
return $model->getStrDeliveryDays();
'value' => function ($model) use ($pointSaleManager) {
return $pointSaleManager->getStrDeliveryDays($model);
}
],
[
@@ -128,7 +131,7 @@ $this->addButton(
'label' => 'Crédit',
'format' => 'raw',
'value' => function ($model) {
if ($model->credit && isset(ProducerModel::$creditFunctioningArray[$model->credit_functioning])) {
if ($model->credit && isset(Producer::$creditFunctioningArray[$model->credit_functioning])) {
return '<span class="glyphicon glyphicon-euro"></span> ' . Producer::$creditFunctioningArray[$model->credit_functioning];
}


+ 6
- 4
backend/views/product/index.php Voir le fichier

@@ -38,15 +38,17 @@

use yii\helpers\Html;
use yii\grid\GridView;
use common\helpers\Url;
use common\helpers\GlobalParam;
use \lo\widgets\Toggle;
use common\helpers\Price;
use common\logic\Product\Product\Model\Product;

$productManager = $this->getProductManager();

$this->setTitle('Produits');
$this->addBreadcrumb($this->getTitle());
$this->addButton(['label' => 'Nouveau produit <span class="glyphicon glyphicon-plus"></span>', 'url' => 'product/create', 'class' => 'btn btn-primary']);


?>

<span style="display: none;" id="page-size"><?= $dataProvider->pagination->pageSize; ?></span>
@@ -110,10 +112,10 @@ $this->addButton(['label' => 'Nouveau produit <span class="glyphicon glyphicon-p
],
[
'attribute' => 'price',
'value' => function ($model) {
'value' => function ($model) use ($productManager) {
$return = '';
if ($model->price) {
$return = Price::format($model->getPriceWithTax()) . ' (' . Product::strUnit($model->unit, 'wording_unit', true) . ')';
$return = Price::format($productManager->getPriceWithTax($model)) . ' (' . $productManager->strUnit($model->unit, 'wording_unit', true) . ')';
}

return $return;

+ 1
- 1
common/helpers/Price.php Voir le fichier

@@ -38,7 +38,7 @@

namespace common\helpers;

use common\logic\Document\Document\Document;
use common\logic\Document\Document\Model\Document;

class Price
{

Chargement…
Annuler
Enregistrer