@@ -30,6 +30,7 @@ use common\models\User ; | |||
<?= $form->field($model, 'id_user')->dropDownList(User::populateDropdownList()); ?> | |||
<?= $form->field($model, 'id_user_group')->dropDownList(UserGroup::populateDropdownList()); ?> | |||
<?= $form->field($model, 'id_point_sale')->dropDownList(PointSale::populateDropdownList()); ?> | |||
<?= $form->field($model, 'from_quantity')->label('À partir de la quantité ('.Product::strUnit($modelProduct->unit, 'wording').')'); ?> | |||
<?php | |||
$producer = GlobalParam::getCurrentProducer(); |
@@ -102,6 +102,16 @@ $this->addBreadcrumb('Modifier'); | |||
return '<span class="label label-success">Tous</span>' ; | |||
} | |||
], | |||
[ | |||
'attribute' => 'from_quantity', | |||
'value' => function ($productPrice) { | |||
if($productPrice->from_quantity) { | |||
return $productPrice->from_quantity.' '.$productPrice->product->wording_unit; | |||
} | |||
return '' ; | |||
} | |||
], | |||
[ | |||
'attribute' => 'price', | |||
'value' => function ($productPrice) { |
@@ -78,7 +78,7 @@ class ProductPrice extends ActiveRecordCommon | |||
}, 'message' => 'Vous devez renseigner au moins un utilisateur, un point de vente ou un groupe d\'utilisateur'], | |||
[['id_product', 'price'], 'required'], | |||
[['id_product', 'id_user', 'id_point_sale', 'id_user_group', 'percent'], 'integer'], | |||
[['price'], 'double'], | |||
[['price', 'from_quantity'], 'double'], | |||
]; | |||
} | |||
@@ -95,6 +95,7 @@ class ProductPrice extends ActiveRecordCommon | |||
'id_user_group' => "Groupe d'utilisateur", | |||
'price' => 'Prix (HT)', | |||
'percent' => 'Pourcentage', | |||
'from_quantity' => 'À partir de la quantité', | |||
]; | |||
} | |||
@@ -0,0 +1,26 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\Schema; | |||
/** | |||
* Class m220804_095203_prix_degressifs_champs_from_quantity | |||
*/ | |||
class m220804_095203_prix_degressifs_champs_from_quantity extends Migration | |||
{ | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeUp() | |||
{ | |||
$this->addColumn('product_price', 'from_quantity', Schema::TYPE_FLOAT.' DEFAULT NULL'); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeDown() | |||
{ | |||
$this->dropColumn('product_price', 'from_quantity'); | |||
} | |||
} |