소스 검색

Backend : points de fabrication

Gestion des points de fabrication. Le boulanger peut définir dans le 
backend quel point de vente correspond à son lieu de production.
prodstable
keun 8 년 전
부모
커밋
d4dd8e9ca5
4개의 변경된 파일31개의 추가작업 그리고 2개의 파일을 삭제
  1. +2
    -0
      backend/controllers/PointVenteController.php
  2. +2
    -2
      backend/views/point-vente/_form.php
  3. +14
    -0
      backend/views/point-vente/index.php
  4. +13
    -0
      common/models/PointVente.php

+ 2
- 0
backend/controllers/PointVenteController.php 파일 보기

@@ -79,6 +79,7 @@ class PointVenteController extends BackendController
$model = new PointVente();

if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->gestionPointFabrication() ;
return $this->redirect(['index']);
} else {
return $this->render('create', [
@@ -98,6 +99,7 @@ class PointVenteController extends BackendController
$model = $this->findModel($id);

if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->gestionPointFabrication() ;
return $this->redirect(['index']);
} else {
return $this->render('update', [

+ 2
- 2
backend/views/point-vente/_form.php 파일 보기

@@ -12,9 +12,9 @@ use yii\widgets\ActiveForm;

<?php $form = ActiveForm::begin(); ?>

<?php //$form->field($model, 'point_fabrication')->checkbox() ?>
<?= $form->field($model, 'point_fabrication')->checkbox()->hint('Cochez cette case si ce point de vente correspond à votre lieu de production.') ?>
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'localite')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'localite')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'adresse')->textarea(['rows' => 6]) ?>
<h2>Horaires</h2>

+ 14
- 0
backend/views/point-vente/index.php 파일 보기

@@ -18,6 +18,20 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
'nom',
'localite',
[
'attribute' => 'point_fabrication',
'format' => 'raw',
'value' => function($model) {
if($model->point_fabrication)
{
return '<span class="label label-success">Oui</span>' ;
}
else {
return '<span class="label label-danger">Non</span>' ;
}
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',

+ 13
- 0
common/models/PointVente.php 파일 보기

@@ -111,4 +111,17 @@ class PointVente extends \yii\db\ActiveRecord
$this->pain = 1 ;
return parent::save($runValidation, $attributeNames) ;
}
public function gestionPointFabrication()
{
if($this->point_fabrication)
{
PointVente::updateAll(
['point_fabrication' => 0],
['id_etablissement' => $this->id_etablissement]
) ;
$this->point_fabrication = 1 ;
$this->save() ;
}
}
}

Loading…
취소
저장