Browse Source

Adaptations frontend/site/producer

dev
Guillaume Bourgeois 5 years ago
parent
commit
db88b40908
4 changed files with 15 additions and 13 deletions
  1. +1
    -1
      common/models/LoginForm.php
  2. +3
    -1
      frontend/controllers/SiteController.php
  3. +1
    -1
      frontend/models/AddProducerForm.php
  4. +10
    -10
      frontend/views/site/producer.php

+ 1
- 1
common/models/LoginForm.php View File

}], }],
['id_producer', 'integer'], ['id_producer', 'integer'],
['id_producer', function($attribute, $params) { ['id_producer', function($attribute, $params) {
if ($this->id_producr) {
if ($this->id_producer) {
$producer = Producer::findOne($this->id_producer); $producer = Producer::findOne($this->id_producer);
if (!$producer) { if (!$producer) {
$this->addError($attribute, 'Ce producteur n\'existe pas.'); $this->addError($attribute, 'Ce producteur n\'existe pas.');

+ 3
- 1
frontend/controllers/SiteController.php View File

$loginForm = new LoginForm(); $loginForm = new LoginForm();
$signupForm = new SignupForm(); $signupForm = new SignupForm();
$producer = Producer::searchOne($id);
$producer = Producer::searchOne([
'id' => $id
]);
$loginForm->id_producer = $id; $loginForm->id_producer = $id;
$signupForm->id_producer = $id; $signupForm->id_producer = $id;

+ 1
- 1
frontend/models/AddProducerForm.php View File

} else { } else {
$userProducer = new UserProducer(); $userProducer = new UserProducer();
$userProducer->id_user = User::getCurrentId(); $userProducer->id_user = User::getCurrentId();
$userProducer->id_producer = $this->id_producr;
$userProducer->id_producer = $this->id_producer;
$userProducer->credit = 0; $userProducer->credit = 0;
$userProducer->actif = 1; $userProducer->actif = 1;
$userProducer->save(); $userProducer->save();

+ 10
- 10
frontend/views/site/producer.php View File

<div class="col-md-6"> <div class="col-md-6">
<h2>Connexion</h2> <h2>Connexion</h2>
<?php $form = ActiveForm::begin(['id' => 'login-form','enableClientValidation'=> false]); ?> <?php $form = ActiveForm::begin(['id' => 'login-form','enableClientValidation'=> false]); ?>
<?= $form->field($model_login, 'email') ?>
<?= $form->field($model_login, 'password')->passwordInput() ?>
<?= $form->field($model_login, 'rememberMe')->checkbox() ?>
<?= $form->field($loginForm, 'email') ?>
<?= $form->field($loginForm, 'password')->passwordInput() ?>
<?= $form->field($loginForm, 'rememberMe')->checkbox() ?>
<p> <p>
Si vous avez oublié votre mot de passe, vous pouvez le <?= Html::a('réinitialiser', ['site/request-password-reset']) ?>. Si vous avez oublié votre mot de passe, vous pouvez le <?= Html::a('réinitialiser', ['site/request-password-reset']) ?>.
</p> </p>
<?php if(strlen($producer->code)): ?> <?php if(strlen($producer->code)): ?>
<?= $form->field($modelLogin, 'code',[
<?= $form->field($loginForm, 'code',[
'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>', 'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
]) ])
->label('Code du producteur') ->label('Code du producteur')
<div class="col-md-6"> <div class="col-md-6">
<h2>Inscription</h2> <h2>Inscription</h2>
<?php $form = ActiveForm::begin(['id' => 'form-signup','enableClientValidation'=> false]); ?> <?php $form = ActiveForm::begin(['id' => 'form-signup','enableClientValidation'=> false]); ?>
<?= $form->field($model_signup, 'email') ?>
<?= $form->field($model_signup, 'password')->passwordInput() ?>
<?= $form->field($model_signup, 'lastname') ?>
<?= $form->field($model_signup, 'name') ?>
<?= $form->field($model_signup, 'phone') ?>
<?= $form->field($signupForm, 'email') ?>
<?= $form->field($signupForm, 'password')->passwordInput() ?>
<?= $form->field($signupForm, 'lastname') ?>
<?= $form->field($signupForm, 'name') ?>
<?= $form->field($signupForm, 'phone') ?>


<?php if(strlen($producer->code)): ?> <?php if(strlen($producer->code)): ?>
<?= $form->field($modelSignup, 'code',[
<?= $form->field($signupForm, 'code',[
'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>', 'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
]) ])
->label('Code du producteur') ->label('Code du producteur')

Loading…
Cancel
Save