], []) | ], []) | ||||
->label('Activer le producteur') | ->label('Activer le producteur') | ||||
->hint('Activez cette option pour rendre votre établissement visible à vos clients.') ; ?> | ->hint('Activez cette option pour rendre votre établissement visible à vos clients.') ; ?> | ||||
<?= $form->field($model, 'nom') ?> | |||||
<?= $form->field($model, 'type') ?> | |||||
<?= $form->field($model, 'description') | |||||
->textarea(['rows' => 6]) | |||||
->hint('Affiché sur la page d\'accueil') ?> | |||||
<?= $form->field($model, 'code_postal') ?> | <?= $form->field($model, 'code_postal') ?> | ||||
<?= $form->field($model, 'ville') ?> | <?= $form->field($model, 'ville') ?> | ||||
*/ | */ | ||||
public function rules() { | public function rules() { | ||||
return [ | return [ | ||||
[['nom', 'siret', 'heure_limite_commande', 'delai_commande'], 'required'], | |||||
[['nom', 'siret', 'heure_limite_commande', 'delai_commande','type'], 'required'], | |||||
[['heure_limite_commande', 'delai_commande'], 'integer'], | [['heure_limite_commande', 'delai_commande'], 'integer'], | ||||
['heure_limite_commande', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]], | ['heure_limite_commande', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]], | ||||
['delai_commande', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], | ['delai_commande', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], | ||||
}], | }], | ||||
[['description', 'infos_commande','slug'], 'string'], | [['description', 'infos_commande','slug'], 'string'], | ||||
[['solde_negatif', 'credit_pain', 'actif'], 'boolean'], | [['solde_negatif', 'credit_pain', 'actif'], 'boolean'], | ||||
[['nom', 'siret', 'logo', 'photo', 'code_postal', 'ville', 'code'], 'string', 'max' => 255], | |||||
[['nom', 'siret', 'logo', 'photo', 'code_postal', 'ville', 'code','type'], 'string', 'max' => 255], | |||||
['prix_libre', 'double'], | ['prix_libre', 'double'], | ||||
['prix_libre', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], | ['prix_libre', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], | ||||
]; | ]; | ||||
'date_creation' => 'Date de création', | 'date_creation' => 'Date de création', | ||||
'infos_commande' => 'Informations', | 'infos_commande' => 'Informations', | ||||
'slug' => 'Slug', | 'slug' => 'Slug', | ||||
'type' => 'Type d\'établissement' | |||||
]; | ]; | ||||
} | } | ||||
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\Schema; | |||||
class m180314_081214_add_champs_etablissement extends Migration { | |||||
public function up() { | |||||
$this->addColumn('etablissement', 'type', Schema::TYPE_STRING); | |||||
} | |||||
public function down() { | |||||
$this->dropColumn('etablissement','type'); | |||||
} | |||||
} |
public $option_client_boulanger; | public $option_client_boulanger; | ||||
public $cgv; | public $cgv; | ||||
public $code; | public $code; | ||||
public $type; | |||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
}, 'whenClient' => "function (attribute, value) { | }, 'whenClient' => "function (attribute, value) { | ||||
return $('#option-boulanger').prop('checked') ; | return $('#option-boulanger').prop('checked') ; | ||||
}"], | }"], | ||||
['type', 'string'], | |||||
['type', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) { | |||||
return $model->option_client_boulanger == 'boulanger'; | |||||
}, 'whenClient' => "function (attribute, value) { | |||||
return $('#option-boulanger').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_client_boulanger == 'boulanger'; | ||||
// etablissement | // etablissement | ||||
$etablissement = new Etablissement; | $etablissement = new Etablissement; | ||||
$etablissement->nom = $this->nom_magasin; | $etablissement->nom = $this->nom_magasin; | ||||
$etablissement->type = $this->type; | |||||
$etablissement->siret = $this->siret; | $etablissement->siret = $this->siret; | ||||
$etablissement->code_postal = $this->code_postal; | $etablissement->code_postal = $this->code_postal; | ||||
$etablissement->ville = $this->ville; | $etablissement->ville = $this->ville; | ||||
'code_postal' => 'Code postal', | 'code_postal' => 'Code postal', | ||||
'ville' => 'Commune', | 'ville' => 'Commune', | ||||
'id_etablissement' => 'Producteur', | 'id_etablissement' => 'Producteur', | ||||
'type' => 'Type d\'établissement', | |||||
]; | ]; | ||||
} | } | ||||
<div id="champs-boulanger"> | <div id="champs-boulanger"> | ||||
<?= $form->field($model, 'nom_magasin') ?> | <?= $form->field($model, 'nom_magasin') ?> | ||||
<?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?> | |||||
<?= $form->field($model, 'siret') ?> | <?= $form->field($model, 'siret') ?> | ||||
<?= $form->field($model, 'code_postal') ?> | <?= $form->field($model, 'code_postal') ?> | ||||
<?= $form->field($model, 'ville') ?> | <?= $form->field($model, 'ville') ?> |
<div id="header-bap"> | <div id="header-bap"> | ||||
<div class="container"> | <div class="container"> | ||||
<a id="logo" href="<?= Url::frontend(); ?>"> | |||||
<a id="logo" href="<?= Yii::$app->urlManager->createUrl(['producer/index']); ?>"> | |||||
<img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" /> | <img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" /> | ||||
<span class="text">La boîte à pain</span> | <span class="text">La boîte à pain</span> | ||||
</a> | </a> | ||||
'options' => ['id' =>'nav-bap'], | 'options' => ['id' =>'nav-bap'], | ||||
]); | ]); | ||||
?> | ?> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<header id="header"> | <header id="header"> | ||||
<div class="container"> | <div class="container"> | ||||
<h1><?= Html::encode($producer->nom); ?></h1> | <h1><?= Html::encode($producer->nom); ?></h1> | ||||
<h2>Boulangerie à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2> | |||||
<h2><?= Html::encode($producer->type) ?> à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2> | |||||
<?php if(!Yii::$app->user->isGuest): ?> | <?php if(!Yii::$app->user->isGuest): ?> | ||||
<?php | <?php | ||||
$user_etablissement = UserEtablissement::findOne(['id_user' => Yii::$app->user->identity->id, 'id_etablissement' => $producer->id ]) ; | $user_etablissement = UserEtablissement::findOne(['id_user' => Yii::$app->user->identity->id, 'id_etablissement' => $producer->id ]) ; |