|
|
@@ -37,13 +37,16 @@ termes. |
|
|
|
*/ |
|
|
|
|
|
|
|
use common\logic\PointSale\PointSale\Model\PointSale; |
|
|
|
use common\logic\Producer\Producer\Wrapper\ProducerManager; |
|
|
|
use common\logic\Product\Product\Model\Product; |
|
|
|
use common\logic\Product\Product\Wrapper\ProductManager; |
|
|
|
use yii\helpers\Html; |
|
|
|
use yii\grid\GridView; |
|
|
|
use common\helpers\GlobalParam; |
|
|
|
use yii\helpers\ArrayHelper; |
|
|
|
|
|
|
|
$producerManager = $this->getProducerManager(); |
|
|
|
$producerManager = ProducerManager::getInstance(); |
|
|
|
$productManager = ProductManager::getInstance(); |
|
|
|
|
|
|
|
$this->setTitle('Abonnements') ; |
|
|
|
$this->addButton(['label' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'subscription/form', 'class' => 'btn btn-primary']) ; |
|
|
@@ -53,12 +56,12 @@ $columns = [ |
|
|
|
'attribute' => 'product_name', |
|
|
|
'label' => 'Produits', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
'value' => function($model) use ($productManager) { |
|
|
|
$html = '' ; |
|
|
|
foreach($model->productSubscription as $productSubscription) |
|
|
|
{ |
|
|
|
if(isset($productSubscription->product)) { |
|
|
|
$html .= Html::encode($productSubscription->product->name).' ('.($productSubscription->quantity * Product::$unitsArray[$productSubscription->product->unit]['coefficient']) . ' '. Product::strUnit($productSubscription->product->unit, 'wording_short').')<br />' ; |
|
|
|
if(isset($productSubscription->product) && $productSubscription->product) { |
|
|
|
$html .= Html::encode($productSubscription->product->name).' ('.($productSubscription->quantity * Product::$unitsArray[$productSubscription->product->unit]['coefficient']) . ' '. $productManager->strUnit($productSubscription->product->unit, 'wording_short').')<br />' ; |
|
|
|
} |
|
|
|
else { |
|
|
|
$html .= 'Produit non défini<br />' ; |
|
|
@@ -79,7 +82,10 @@ $columns = [ |
|
|
|
'format' => 'raw', |
|
|
|
'filter' => ArrayHelper::map(PointSale::find()->where(['id_producer' => GlobalParam::getCurrentProducerId()])->asArray()->all(), 'id', 'name'), |
|
|
|
'value' => function($model) { |
|
|
|
return Html::encode($model->pointSale->name) ; |
|
|
|
if($model->pointSale) { |
|
|
|
return Html::encode($model->pointSale->name) ; |
|
|
|
} |
|
|
|
return ''; |
|
|
|
} |
|
|
|
], |
|
|
|
[ |