*/ | */ | ||||
return [ | return [ | ||||
'adminEmail' => 'contact@laboiteapain.net', | |||||
'supportEmail' => 'contact@laboiteapain.net', | |||||
'adminEmail' => 'contact@opendistrib.net', | |||||
'supportEmail' => 'contact@opendistrib.net', | |||||
'user.passwordResetTokenExpire' => 3600, | 'user.passwordResetTokenExpire' => 3600, | ||||
]; | ]; |
public function rules() | public function rules() | ||||
{ | { | ||||
return [ | return [ | ||||
[['name', 'siret', 'order_deadline', 'order_delay','type'], 'required'], | |||||
[['name', 'order_deadline', 'order_delay','type'], 'required'], | |||||
[['order_deadline', 'order_delay'], 'integer'], | [['order_deadline', 'order_delay'], 'integer'], | ||||
['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]], | ['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]], | ||||
['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], | ['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], |
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\mysql\Schema; | |||||
class m190305_104710_producer_siret_non_requis extends Migration { | |||||
public function up() { | |||||
$this->alterColumn('producer', 'siret', Schema::TYPE_STRING.' DEFAULT NULL') ; | |||||
} | |||||
public function down() { | |||||
$this->alterColumn('producer', 'siret', Schema::TYPE_STRING.' NOT NULL') ; | |||||
} | |||||
} |
{ | { | ||||
$model = new SignupForm(); | $model = new SignupForm(); | ||||
if ($model->load(Yii::$app->request->post())) { | if ($model->load(Yii::$app->request->post())) { | ||||
if ($user = $model->signup()) { | |||||
$user = $model->signup() ; | |||||
if ($user) { | |||||
if (Yii::$app->getUser()->login($user)) { | if (Yii::$app->getUser()->login($user)) { | ||||
if($model->option_user_producer == 'producer') { | if($model->option_user_producer == 'producer') { | ||||
$this->redirect(Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index'])); | $this->redirect(Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index'])); |
return $('#option-producer').prop('checked') ; | return $('#option-producer').prop('checked') ; | ||||
}"], | }"], | ||||
['siret', 'string'], | ['siret', 'string'], | ||||
['siret', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) { | |||||
return $model->option_user_producer == 'producer'; | |||||
}, 'whenClient' => "function (attribute, value) { | |||||
return $('#option-producer').prop('checked') ; | |||||
}"], | |||||
['siret', function($attribute, $params) { | ['siret', function($attribute, $params) { | ||||
$siret = $this->$attribute; | $siret = $this->$attribute; | ||||
'lastname' => 'Nom', | 'lastname' => 'Nom', | ||||
'phone' => 'Téléphone', | 'phone' => 'Téléphone', | ||||
'is_producer' => "Je suis professionnel et souhaite mettre en place un système de réservation dans mon établissement", | 'is_producer' => "Je suis professionnel et souhaite mettre en place un système de réservation dans mon établissement", | ||||
'name_producer' => 'Nom du producteur', | |||||
'name_producer' => 'Nom de votre structure', | |||||
'siret' => 'Numéro SIRET', | 'siret' => 'Numéro SIRET', | ||||
'postcode' => 'Code postal', | 'postcode' => 'Code postal', | ||||
'city' => 'Commune', | 'city' => 'Commune', |
<div id="fields-producer"> | <div id="fields-producer"> | ||||
<?= $form->field($model, 'name_producer') ?> | <?= $form->field($model, 'name_producer') ?> | ||||
<?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?> | <?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?> | ||||
<?= $form->field($model, 'siret') ?> | |||||
<?= $form->field($model, 'postcode') ?> | <?= $form->field($model, 'postcode') ?> | ||||
<?= $form->field($model, 'city') ?> | <?= $form->field($model, 'city') ?> | ||||
<?= $form->field($model, 'free_price',[ | <?= $form->field($model, 'free_price',[ |