Browse Source

Inscription des producteurs : renseignement obligatoire de la TVA par dééfaut

dev
Guillaume Bourgeois 4 years ago
parent
commit
6c015609c7
3 changed files with 14 additions and 3 deletions
  1. +1
    -1
      backend/views/producer/update.php
  2. +8
    -2
      frontend/models/SignupForm.php
  3. +5
    -0
      frontend/views/site/signup.php

+ 1
- 1
backend/views/producer/update.php View File

@@ -255,7 +255,7 @@ $this->addBreadcrumb($this->getTitle()) ;
<div class="panel-body">
<?= $form->field($model, 'id_tax_rate_default')
->dropDownList(ArrayHelper::map(TaxRate::find()->all(), 'id', function($model) { return $model->name; }))
->label('TVA à appliquer par défaut');; ?>
->label('TVA à appliquer par défaut'); ?>
<?= $form->field($model, 'document_quotation_prefix') ; ?>
<?= $form->field($model, 'document_quotation_first_reference') ; ?>
<?= $form->field($model, 'document_quotation_duration') ; ?>

+ 8
- 2
frontend/models/SignupForm.php View File

@@ -68,6 +68,7 @@ class SignupForm extends Model
public $code;
public $type;
public $free_price ;
public $id_tax_rate_default ;

/**
* @inheritdoc
@@ -79,7 +80,7 @@ class SignupForm extends Model
['email', 'required', 'message' => 'Champs obligatoire'],
['email', 'email'],
['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'Cet email est déjà utilisé'],
[['name', 'lastname', 'phone'], 'required', 'message' => 'Champs obligatoire'],
[['name', 'lastname', 'phone','id_tax_rate_default'], 'required', 'message' => 'Champs obligatoire'],
[['name', 'lastname', 'phone', 'option_user_producer'], 'string', 'min' => 2, 'max' => 255],
['password', 'required', 'message' => 'Champs obligatoire'],
['password', 'string', 'min' => 6, 'tooShort' => 'Votre mot de passe doit contenir au moins 6 caractères'],
@@ -178,6 +179,9 @@ class SignupForm extends Model
}
}],
['free_price', 'number'],
['id_tax_rate_default', 'exist',
'targetClass' => TaxRate::className(),
'targetAttribute' => ['id_tax_rate_default' => 'id']]
];
}
@@ -198,7 +202,8 @@ class SignupForm extends Model
'city' => 'Commune',
'id_producer' => 'Producteur',
'type' => 'Type de producteur',
'free_price' => 'Prix libre'
'free_price' => 'Prix libre',
'id_tax_rate_default' => 'TVA par défaut',
];
}

@@ -228,6 +233,7 @@ class SignupForm extends Model
$producer->order_deadline = 20;
$producer->order_delay = 1;
$producer->free_price = (float) abs($this->free_price);
$producer->id_tax_rate_default = $this->id_tax_rate_default ;

$cptSlug = 0 ;
do {

+ 5
- 0
frontend/views/site/signup.php View File

@@ -80,6 +80,11 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?>
<?= $form->field($model, 'postcode') ?>
<?= $form->field($model, 'city') ?>
<?= $form->field($model, 'id_tax_rate_default')
->dropDownList(ArrayHelper::map(TaxRate::find()->all(), 'id', function($model) { return $model->name; }), [
'prompt' => '--',
])
->label('TVA à appliquer par défaut'); ?>
<?= $form->field($model, 'free_price',[
'inputTemplate' => '<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>',
])

Loading…
Cancel
Save