Kaynağa Gözat

[Backend] Prix dégressifs : ajout champs "volume" au formulaire de prix spécifiques #248

refactoring
Guillaume 2 yıl önce
ebeveyn
işleme
86f3ed2b48
4 değiştirilmiş dosya ile 39 ekleme ve 1 silme
  1. +1
    -0
      backend/views/product/update/prices/_form.php
  2. +10
    -0
      backend/views/product/update/prices/list.php
  3. +2
    -1
      common/models/ProductPrice.php
  4. +26
    -0
      console/migrations/m220804_095203_prix_degressifs_champs_from_quantity.php

+ 1
- 0
backend/views/product/update/prices/_form.php Dosyayı Görüntüle

@@ -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();

+ 10
- 0
backend/views/product/update/prices/list.php Dosyayı Görüntüle

@@ -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) {

+ 2
- 1
common/models/ProductPrice.php Dosyayı Görüntüle

@@ -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é',
];
}


+ 26
- 0
console/migrations/m220804_095203_prix_degressifs_champs_from_quantity.php Dosyayı Görüntüle

@@ -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');
}
}

Yükleniyor…
İptal
Kaydet