Browse Source

Adaptations frontend/site/signup

dev
Guillaume Bourgeois 5 years ago
parent
commit
78bfb0943f
14 changed files with 118 additions and 117 deletions
  1. +1
    -2
      backend/controllers/OrderController.php
  2. +1
    -1
      backend/web/js/lechatdesnoisettes.js
  3. +3
    -1
      common/components/ActiveRecordCommon.php
  4. +1
    -1
      common/helpers/Departments.php
  5. +1
    -1
      common/mail/new-producer-html.php
  6. +1
    -1
      common/mail/new-producer-text.php
  7. +4
    -4
      common/mail/signup-html.php
  8. +4
    -4
      common/mail/signup-text.php
  9. +2
    -2
      common/models/Producer.php
  10. +2
    -2
      frontend/controllers/SiteController.php
  11. +81
    -82
      frontend/models/SignupForm.php
  12. +4
    -4
      frontend/views/site/signup.php
  13. +6
    -6
      frontend/web/js/boulange.js
  14. +7
    -6
      producer/web/js/boulange.js

+ 1
- 2
backend/controllers/OrderController.php View File

use common\models\Product ; use common\models\Product ;
use common\models\User ; use common\models\User ;
use common\models\ProductDistribution ; use common\models\ProductDistribution ;
use common\models\Product ;


class OrderController extends BackendController class OrderController extends BackendController
{ {
/** /**
* Génère le contenu nécessaire aux exports au format CSV. * Génère le contenu nécessaire aux exports au format CSV.
* *
* @see CommandeController::actionDownload()
* @see OrderController::actionDownload()
* @param string $date * @param string $date
* @param array $produits * @param array $produits
* @param array $points_vente * @param array $points_vente

+ 1
- 1
backend/web/js/lechatdesnoisettes.js View File

dayClick: function(date, jsEvent, view) { dayClick: function(date, jsEvent, view) {
var url = $(location).attr('href') ; var url = $(location).attr('href') ;
var tab_url = url.split('?') ; var tab_url = url.split('?') ;
$(location).attr('href',tab_url[0]+'?r=commande/index&date='+date.format());
$(location).attr('href',tab_url[0]+'?r=order/index&date='+date.format());
}, },
eventRender: function (event, element) { eventRender: function (event, element) {
var dataToFind = moment(event.start).format('YYYY-MM-DD'); var dataToFind = moment(event.start).format('YYYY-MM-DD');

+ 3
- 1
common/components/ActiveRecordCommon.php View File

$pk = $class::primaryKey() ; $pk = $class::primaryKey() ;
$pk = $class::tableName().'.'.$pk[0] ; $pk = $class::tableName().'.'.$pk[0] ;
if (!isset($params[$options['attribute_id_producer']]) && !Yii::$app->user->isGuest) {
if (isset($options['attribute_id_producer']) && strlen($options['attribute_id_producer'])
&& !isset($params[$options['attribute_id_producer']]) && !Yii::$app->user->isGuest)
{
$params[$options['attribute_id_producer']] = Producer::getId(); $params[$options['attribute_id_producer']] = Producer::getId();
} }

common/helpers/Departements.php → common/helpers/Departments.php View File



namespace common\helpers; namespace common\helpers;


class Departements {
class Departments {


public static function get() public static function get()
{ {

common/mail/new-boulanger-html.php → common/mail/new-producer-html.php View File



?> ?>


<p>Un nouveau producteur vient de s'inscrire : <strong><?= Html::encode($etablissement->nom) ?></strong>.</p>
<p>Un nouveau producteur vient de s'inscrire : <strong><?= Html::encode($producer->name) ?></strong>.</p>





common/mail/new-boulanger-text.php → common/mail/new-producer-text.php View File



?> ?>


Un nouveau producteur vient de s'inscrire : <?= $etablissement->nom; ?>.
Un nouveau producteur vient de s'inscrire : <?= $producer->name; ?>.

+ 4
- 4
common/mail/signup-html.php View File



?> ?>


<p>Bonjour <?= Html::encode($user->prenom) ?>,</p>
<p>Bonjour <?= Html::encode($user->name) ?>,</p>


<p>Votre inscription sur <strong>La boîte à pain</strong> a bien été prise en compte.</p> <p>Votre inscription sur <strong>La boîte à pain</strong> a bien été prise en compte.</p>


<strong><?= Html::encode($user->email) ?></strong></p> <strong><?= Html::encode($user->email) ?></strong></p>


<?php if($user->status == User::STATUS_PRODUCER): ?> <?php if($user->status == User::STATUS_PRODUCER): ?>
<p>Vous pouvez dès maintenant vous connecter à votre <a href="<?= Url::backend(); ?>">Espace boulanger</a> pour mettre
<p>Vous pouvez dès maintenant vous connecter à votre <a href="<?= Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']); ?>">Espace producteur</a> pour mettre
en place votre système de réservation.</p> en place votre système de réservation.</p>
<?php else: ?> <?php else: ?>
<?php if(!is_null($etablissement)): ?>
<p>Vous pouvez maintenant <a href="<?= Url::frontend().'index.php?r=commande/create&id_etablissement='.$etablissement->id ?>">passer commande</a> chez votre producteur <strong><?= Html::encode($etablissement->nom); ?></strong>.</p>
<?php if(!is_null($producer)): ?>
<p>Vous pouvez maintenant <a href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]); ?>">passer commande</a> chez votre producteur <strong><?= Html::encode($producer->name); ?></strong>.</p>
<?php else: ?> <?php else: ?>
<p>Vous pouvez maintenant passer commande chez votre producteur.</p> <p>Vous pouvez maintenant passer commande chez votre producteur.</p>
<?php endif; ?> <?php endif; ?>

+ 4
- 4
common/mail/signup-text.php View File



<?php if($user->status == User::STATUS_PRODUCER): ?> <?php if($user->status == User::STATUS_PRODUCER): ?>
Vous pouvez dès maintenant vous connecter à votre Espace boulanger pour mettre en place votre système de réservation : Vous pouvez dès maintenant vous connecter à votre Espace boulanger pour mettre en place votre système de réservation :
<?= Url::backend(); ?>
<?= Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']); ?>
<?php else: ?> <?php else: ?>
<?php if(!is_null($etablissement)): ?>
Vous pouvez maintenant passer commande chez votre producteur "<?= $etablissement->nom ?>" :
<?= Url::frontend().'index.php?r=commande/create&id_etablissement='.$etablissement->id ?>
<?php if(!is_null($producer)): ?>
Vous pouvez maintenant passer commande chez votre producteur "<?= $producer->name ?>" :
<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]) ; ?>
<?php else: ?> <?php else: ?>
Vous pouvez maintenant passer commande chez votre producteur. Vous pouvez maintenant passer commande chez votre producteur.
<?php endif; ?> <?php endif; ?>

+ 2
- 2
common/models/Producer.php View File

['orderby' => 'postcode, city ASC'] ['orderby' => 'postcode, city ASC']
) ; ) ;
$departments = Departmments::get();
$departments = Departments::get();
$dataProducers = []; $dataProducers = [];
$optionsProducers = []; $optionsProducers = [];
foreach ($producers as $p) { foreach ($producers as $p) {
if (!key_exists('d' . substr($p->postcode, 0, 2), $dataProducers)) { if (!key_exists('d' . substr($p->postcode, 0, 2), $dataProducers)) {
$dataProducers['d' . substr($p->postcode, 0, 2)] = '<strong>' . $departments[substr($e->postcode, 0, 2)] . '</strong>';
$dataProducers['d' . substr($p->postcode, 0, 2)] = '<strong>' . $departments[substr($p->postcode, 0, 2)] . '</strong>';
$optionsProducers['d' . substr($p->postcode, 0, 2)] = ['disabled' => true]; $optionsProducers['d' . substr($p->postcode, 0, 2)] = ['disabled' => true];
} }



+ 2
- 2
frontend/controllers/SiteController.php View File

public function actionLogin() public function actionLogin()
{ {
if (!\Yii::$app->user->isGuest) { if (!\Yii::$app->user->isGuest) {
return Yii::$app->getResponse()->redirect(['commande/index']);
return Yii::$app->getResponse()->redirect(['order/index']);
} }


$model = new LoginForm(); $model = new LoginForm();
if ($model->load(Yii::$app->request->post())) { if ($model->load(Yii::$app->request->post())) {
if ($user = $model->signup()) { if ($user = $model->signup()) {
if (Yii::$app->getUser()->login($user)) { if (Yii::$app->getUser()->login($user)) {
$this->redirect(['commande/index']);
$this->redirect(['site/index']);
} }
} }
} }

+ 81
- 82
frontend/models/SignupForm.php View File



use Yii; use Yii;
use common\models\User; use common\models\User;
use common\models\Etablissement;
use common\models\Producer;
use yii\base\Model; use yii\base\Model;
use common\models\UserEtablissement;
use common\models\UserProducer;
use common\helpers\Password; use common\helpers\Password;


/** /**
public $phone; public $phone;
public $is_producer; public $is_producer;
public $siret; public $siret;
public $nom_magasin;
public $code_postal;
public $ville;
public $id_etablissement;
public $option_client_boulanger;
public $name_producer;
public $postcode;
public $city;
public $id_producer;
public $option_user_producer;
public $cgv; public $cgv;
public $code; public $code;
public $type; public $type;
public $prix_libre ;
public $free_price ;


/** /**
* @inheritdoc * @inheritdoc
['email', 'required', 'message' => 'Champs obligatoire'], ['email', 'required', 'message' => 'Champs obligatoire'],
['email', 'email'], ['email', 'email'],
['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'Cet email est déjà utilisé'], ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'Cet email est déjà utilisé'],
[['nom', 'prenom', 'telephone'], 'required', 'message' => 'Champs obligatoire'],
[['nom', 'prenom', 'telephone', 'option_client_boulanger'], 'string', 'min' => 2, 'max' => 255],
[['name', 'lastname', 'phone'], 'required', 'message' => 'Champs obligatoire'],
[['name', 'lastname', 'phone', 'option_user_producer'], 'string', 'min' => 2, 'max' => 255],
['password', 'required', 'message' => 'Champs obligatoire'], ['password', 'required', 'message' => 'Champs obligatoire'],
['password', 'string', 'min' => 6, 'tooShort' => 'Votre mot de passe doit contenir au moins 6 caractères'], ['password', 'string', 'min' => 6, 'tooShort' => 'Votre mot de passe doit contenir au moins 6 caractères'],
['is_boulanger', 'boolean'],
['is_producer', 'boolean'],
['cgv', 'boolean'], ['cgv', 'boolean'],
['cgv', function($attribute, $params) { ['cgv', function($attribute, $params) {
$cgv = $this->$attribute; $cgv = $this->$attribute;


if ($this->option_client_boulanger == 'boulanger' && !$cgv) {
if ($this->option_user_producer == 'producer' && !$cgv) {
$this->addError($attribute, 'Vous devez accepter les conditions générales de vente pour vous inscrire.'); $this->addError($attribute, 'Vous devez accepter les conditions générales de vente pour vous inscrire.');
} }
}], }],
['code_postal', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_client_boulanger == 'boulanger';
['postcode', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) { }, 'whenClient' => "function (attribute, value) {
return $('#option-boulanger').prop('checked') ;
return $('#option-producer').prop('checked') ;
}"], }"],
['ville', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_client_boulanger == 'boulanger';
['city', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) { }, 'whenClient' => "function (attribute, value) {
return $('#option-boulanger').prop('checked') ;
return $('#option-producer').prop('checked') ;
}"], }"],
['nom_magasin', 'string'],
['nom_magasin', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_client_boulanger == 'boulanger';
['name_producer', 'string'],
['name_producer', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) { }, 'whenClient' => "function (attribute, value) {
return $('#option-boulanger').prop('checked') ;
return $('#option-producer').prop('checked') ;
}"], }"],
['type', 'string'], ['type', 'string'],
['type', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) { ['type', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_client_boulanger == 'boulanger';
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) { }, 'whenClient' => "function (attribute, value) {
return $('#option-boulanger').prop('checked') ;
return $('#option-producer').prop('checked') ;
}"], }"],
['siret', 'string'], ['siret', 'string'],
['siret', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) { ['siret', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_client_boulanger == 'boulanger';
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) { }, 'whenClient' => "function (attribute, value) {
return $('#option-boulanger').prop('checked') ;
return $('#option-producer').prop('checked') ;
}"], }"],
['siret', function($attribute, $params) { ['siret', function($attribute, $params) {


if (($sum % 10) != 0) if (($sum % 10) != 0)
$this->addError($attribute, 'Numéro SIRET invalide'); $this->addError($attribute, 'Numéro SIRET invalide');
}], }],
['id_etablissement', 'integer'],
['id_etablissement', function($attribute, $params) {
if ($this->id_etablissement) {
$etablissement = Etablissement::findOne($this->id_etablissement);
if (!$etablissement) {
['id_producer', 'integer'],
['id_producer', function($attribute, $params) {
if ($this->id_producer) {
$producer = Producer::findOne($this->id_producer);
if (!$producer) {
$this->addError($attribute, 'Ce producteur n\'existe pas.'); $this->addError($attribute, 'Ce producteur n\'existe pas.');
} }
} }
}], }],
['code', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) { ['code', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
$etablissement = Etablissement::findOne($this->id_etablissement);
if ($etablissement) {
return strlen($etablissement->code);
$producer = Producer::findOne($this->id_producer);
if ($producer) {
return strlen($producer->code);
} else { } else {
return false; return false;
} }
}], }],
['code', function($attribute, $params) { ['code', function($attribute, $params) {
$code = $this->$attribute; $code = $this->$attribute;
$etablissement = Etablissement::findOne($this->id_etablissement);
$producer = Producer::findOne($this->id_producer);


if ($etablissement && strtolower(trim($code)) != strtolower(trim($etablissement->code))) {
if ($producer && strtolower(trim($code)) != strtolower(trim($producer->code))) {
$this->addError($attribute, 'Code incorrect'); $this->addError($attribute, 'Code incorrect');
} }
}], }],
['prix_libre', 'number'],
['free_price', 'number'],
]; ];
} }
'username' => 'Identifiant', 'username' => 'Identifiant',
'password' => 'Mot de passe', 'password' => 'Mot de passe',
'rememberMe' => 'Se souvenir de moi', 'rememberMe' => 'Se souvenir de moi',
'prenom' => 'Prénom',
'telephone' => 'Téléphone',
'is_boulanger' => "Je suis professionnel et souhaite mettre en place un système de réservation dans mon établissement",
'nom_magasin' => 'Nom de l\'établissement',
'name' => 'Prénom',
'lastname' => 'Nom',
'phone' => 'Téléphone',
'is_producer' => "Je suis professionnel et souhaite mettre en place un système de réservation dans mon établissement",
'name_producer' => 'Nom du producteur',
'siret' => 'Numéro SIRET', 'siret' => 'Numéro SIRET',
'code_postal' => 'Code postal',
'ville' => 'Commune',
'id_etablissement' => 'Producteur',
'type' => 'Type d\'établissement',
'prix_libre' => 'Prix libre'
'postcode' => 'Code postal',
'city' => 'Commune',
'id_producer' => 'Producteur',
'type' => 'Type de producteur',
'free_price' => 'Prix libre'
]; ];
} }


$user = new User(); $user = new User();
$user->username = $this->email; $user->username = $this->email;
$user->email = $this->email; $user->email = $this->email;
$user->nom = $this->nom;
$user->prenom = $this->prenom;
$user->telephone = $this->telephone;
$user->confiance = 1;
$user->name = $this->name;
$user->lastname = $this->lastname;
$user->phone = $this->phone;


if ($this->option_client_boulanger == 'boulanger') {
if ($this->option_user_producer == 'producer') {
// etablissement // etablissement
$etablissement = new Etablissement;
$etablissement->nom = $this->nom_magasin;
$etablissement->type = $this->type;
$etablissement->siret = $this->siret;
$etablissement->code_postal = $this->code_postal;
$etablissement->ville = $this->ville;
$etablissement->heure_limite_commande = 20;
$etablissement->delai_commande = 1;
$etablissement->gratuit = 1;
$etablissement->prix_libre = (float) abs($this->prix_libre);
$etablissement->slug = \common\helpers\Url::slugify($this->nom_magasin) ;
$producer = new Producer;
$producer->name = $this->name_producer;
$producer->type = $this->type;
$producer->siret = $this->siret;
$producer->postcode = $this->postcode;
$producer->city = $this->city;
$producer->order_deadline = 20;
$producer->order_delay = 1;
$producer->free_price = (float) abs($this->free_price);
$producer->slug = \common\helpers\Url::slugify($this->name_producer) ;


// génération d'un code // génération d'un code
do { do {
$code = Password::generate(); $code = Password::generate();
$etablissement->code = $code;
} while (Etablissement::findOne(['code' => $code]));
$producer->code = $code;
} while (Producer::findOne(['code' => $code]));


$etablissement->save();
$producer->save();


// user // user
$user->id_etablissement = $etablissement->id;
$user->id_producer = $producer->id;
$user->status = User::STATUS_PRODUCER; $user->status = User::STATUS_PRODUCER;


// envoi d'un email à l'administrateur pour le prévenir // envoi d'un email à l'administrateur pour le prévenir
Yii::$app->mailer->compose( Yii::$app->mailer->compose(
[ [
'html' => 'new-boulanger-html',
'text' => 'new-boulanger-text'
'html' => 'new-producer-html',
'text' => 'new-producer-text'
], [ ], [
'etablissement' => $etablissement
'producer' => $producer
]) ])
->setTo(Yii::$app->params['adminEmail']) ->setTo(Yii::$app->params['adminEmail'])
->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain']) ->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain'])
if ($user->save()) { if ($user->save()) {


// on ajoute l'établissement sélectionnée par l'user en favoris // on ajoute l'établissement sélectionnée par l'user en favoris
if ($this->option_client_boulanger == 'client') {
if ($this->id_etablissement) {
$etablissement = Etablissement::find()->where(['id' => $this->id_etablissement])->one();
if ($etablissement) {
Etablissement::addUser($user->id, $this->id_etablissement) ;
if ($this->option_user_producer == 'producer') {
if ($this->id_producer) {
$producer = Producer::find()->where(['id' => $this->id_producer])->one();
if ($producer) {
Producer::addUser($user->id, $this->id_producer) ;


// envoi d'un email à l'utilisateur // envoi d'un email à l'utilisateur
Yii::$app->mailer->compose( Yii::$app->mailer->compose(
], ],
[ [
'user' => $user, 'user' => $user,
'etablissement' => $etablissement
'producer' => $producer
]) ])
->setTo($user->email) ->setTo($user->email)
->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain']) ->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain'])
} }
} }


if ($this->option_client_boulanger == 'boulanger') {
$etab_user = new UserEtablissement;
$etab_user->id_etablissement = $etablissement->id;
$etab_user->id_user = $user->id;
$etab_user->credit = 0;
$etab_user->actif = 1;
$etab_user->save();
if ($this->option_user_producer == 'producer') {
$userProducer = new UserProducer;
$userProducer->id_producer = $producer->id;
$userProducer->id_user = $user->id;
$userProducer->credit = 0;
$userProducer->active = 1;
$userProducer->save();
} }


return $user; return $user;

+ 4
- 4
frontend/views/site/signup.php View File

</label> </label>
</div> </div>


<div id="champs-boulanger">
<?= $form->field($model, 'name') ?>
<div id="fields-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, 'siret') ?>
<?= $form->field($model, 'postcode') ?> <?= $form->field($model, 'postcode') ?>
]) ])
->label('Prix libre HT / mois') ->label('Prix libre HT / mois')
->hint('Laissez ce champs vide si vous souhaitez dans un premier temps simplement tester la plateforme. Une fois l\'outil mis en place dans votre structure, vous pourrez modifier ce coût dans la section "Mon abonnement" de votre panneau d\'administration.') ; ?> ->hint('Laissez ce champs vide si vous souhaitez dans un premier temps simplement tester la plateforme. Une fois l\'outil mis en place dans votre structure, vous pourrez modifier ce coût dans la section "Mon abonnement" de votre panneau d\'administration.') ; ?>
<?= $form->field($model, 'cgv')->checkbox()->label('J\'accepte les <a class="btn btn-xs btn-default" data-toggle="modal" data-target="#modal-cgv" href="javascript:void(0);">conditions générales de service</a> et les <a class="btn btn-xs btn-default" data-toggle="modal" data-target="#modal-tarifs" href="javascript:void(0);">conditions tarifaires</a> (prix libre).') ?>
<?= $form->field($model, 'cgv')->checkbox()->label('J\'accepte les <a class="btn btn-xs btn-default" data-toggle="modal" data-target="#modal-cgv" href="javascript:void(0);">conditions générales de service</a> et les <a class="btn btn-xs btn-default" data-toggle="modal" data-target="#modal-prices" href="javascript:void(0);">conditions tarifaires</a> (prix libre).') ?>
</div> </div>
<div id="champs-user">
<div id="fields-user">
<?= $form->field($model, 'id_producer')->dropDownList($dataProducers, ['prompt' => '--','encode' => false,'options' => $optionsProducers]) ?> <?= $form->field($model, 'id_producer')->dropDownList($dataProducers, ['prompt' => '--','encode' => false,'options' => $optionsProducers]) ?>
<div id="bloc-code-acces"> <div id="bloc-code-acces">
<?= $form->field($model, 'code',[ <?= $form->field($model, 'code',[

+ 6
- 6
frontend/web/js/boulange.js View File

if($('#form-signup').size()) if($('#form-signup').size())
{ {
boulange_signup_champs_boulanger() ; boulange_signup_champs_boulanger() ;
$('#option-client, #option-boulanger').change(function() {
$('#option-user, #option-producer').change(function() {
boulange_signup_champs_boulanger() ; boulange_signup_champs_boulanger() ;
}) ; }) ;
} }


function boulange_signup_champs_boulanger() function boulange_signup_champs_boulanger()
{ {
if($('#option-boulanger').prop('checked'))
if($('#option-producer').prop('checked'))
{ {
$('#champs-boulanger').fadeIn() ;
$('#champs-client').hide() ;
$('#fields-producer').fadeIn() ;
$('#fields-user').hide() ;
} }
else { else {
$('#champs-boulanger').hide() ;
$('#champs-client').fadeIn() ;
$('#fields-producer').hide() ;
$('#fields-user').fadeIn() ;
} }
} }



+ 7
- 6
producer/web/js/boulange.js View File

if($('#form-signup').size()) if($('#form-signup').size())
{ {
boulange_signup_champs_boulanger() ; boulange_signup_champs_boulanger() ;
$('#option-client, #option-boulanger').change(function() {
$('#option-user, #option-producer').change(function() {
boulange_signup_champs_boulanger() ; boulange_signup_champs_boulanger() ;
}) ; }) ;
} }


function boulange_signup_champs_boulanger() function boulange_signup_champs_boulanger()
{ {
if($('#option-boulanger').prop('checked'))
if($('#option-producer').prop('checked'))
{ {
$('#champs-boulanger').fadeIn() ;
$('#champs-client').hide() ;
$('#fields-producer').fadeIn() ;
$('#fields-user').hide() ;
} }
else { else {
$('#champs-boulanger').hide() ;
$('#champs-client').fadeIn() ;
$('#fields-producer').hide() ;
$('#fields-user').fadeIn() ;
} }
} }



Loading…
Cancel
Save