Selaa lähdekoodia

Adapter le système de point de vente du backend pour gérer le multi-boulangerie

prodstable
keun 8 vuotta sitten
vanhempi
commit
0ea37186ba
9 muutettua tiedostoa jossa 126 lisäystä ja 70 poistoa
  1. +5
    -4
      backend/controllers/PointVenteController.php
  2. +5
    -0
      backend/views/layouts/main.php
  3. +8
    -10
      backend/views/point-vente/_form.php
  4. +3
    -3
      backend/views/point-vente/create.php
  5. +4
    -4
      backend/views/point-vente/update.php
  6. BIN
      backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc
  7. +56
    -31
      backend/web/css/screen.css
  8. +16
    -0
      backend/web/sass/screen.scss
  9. +29
    -18
      common/models/PointVente.php

+ 5
- 4
backend/controllers/PointVenteController.php Näytä tiedosto

@@ -22,7 +22,7 @@ class PointVenteController extends Controller
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
@@ -47,8 +47,9 @@ class PointVenteController extends Controller
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => PointVente::find(),
'query' => PointVente::find()->where(['id_boulangerie'=>Yii::$app->user->identity->id])
]);

return $this->render('index', [
@@ -78,7 +79,7 @@ class PointVenteController extends Controller
$model = new PointVente();

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

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

+ 5
- 0
backend/views/layouts/main.php Näytä tiedosto

@@ -60,6 +60,11 @@ AppAsset::register($this);
?>

<div class="container">
<?php if(!Yii::$app->user->isGuest): ?>
<div class="nom-boulange">
<span><?= Html::encode(Yii::$app->user->identity->nom_magasin) ; ?></span>
</div>
<?php endif; ?>
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>

+ 8
- 10
backend/views/point-vente/_form.php Näytä tiedosto

@@ -16,21 +16,19 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'localite')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'adresse')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'pain')->checkbox(); ?>
<?= $form->field($model, 'vrac')->checkbox(); ?>
<h2>Horaires</h2>
<div class="alert alert-info">Laisser vide si le point de vente est fermé</div>
<?= $form->field($model, 'horaires_lundi')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'horaires_mardi')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'horaires_mercredi')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'horaires_jeudi')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'horaires_vendredi')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'horaires_samedi')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'horaires_dimanche')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'horaires_lundi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_mardi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_mercredi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_jeudi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_vendredi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_samedi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_dimanche')->textarea(['rows' => 3]) ?>

<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?>

+ 3
- 3
backend/views/point-vente/create.php Näytä tiedosto

@@ -6,9 +6,9 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\models\PointVente */

$this->title = 'Create Point Vente';
$this->params['breadcrumbs'][] = ['label' => 'Point Ventes', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$this->title = 'Ajouter un point de vente';
$this->params['breadcrumbs'][] = ['label' => 'Points de vente', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Ajouter';
?>
<div class="point-vente-create">


+ 4
- 4
backend/views/point-vente/update.php Näytä tiedosto

@@ -5,10 +5,10 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\models\PointVente */

$this->title = 'Update Point Vente: ' . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Point Ventes', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
$this->title = 'Modifier un point de vente';
$this->params['breadcrumbs'][] = ['label' => 'Points de vente', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Html::encode($model->nom), 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Modifier';
?>
<div class="point-vente-update">


BIN
backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc Näytä tiedosto


+ 56
- 31
backend/web/css/screen.css Näytä tiedosto

@@ -7,153 +7,178 @@
clear: both;
}

/* line 13, ../sass/screen.scss */
/* line 12, ../sass/screen.scss */
.nav-header {
-moz-box-shadow: 0px 0px 5px black;
-webkit-box-shadow: 0px 0px 5px black;
box-shadow: 0px 0px 5px black;
}
/* line 14, ../sass/screen.scss */
.nav-header .retour-site {
border-left: solid 1px #9d9d9d;
padding: 10px 15px;
}

/* line 23, ../sass/screen.scss */
/* line 22, ../sass/screen.scss */
.nom-boulange {
margin-bottom: 15px;
text-align: center;
}
/* line 25, ../sass/screen.scss */
.nom-boulange span {
position: relative;
top: -12px;
background-color: #337ab7;
color: white;
-moz-border-radius: 0px 0px 5px 5px;
-webkit-border-radius: 0px;
border-radius: 0px 0px 5px 5px;
font-size: 20px;
padding: 8px 15px;
margin-bottom: 20px;
}

/* line 39, ../sass/screen.scss */
.table thead th.actions {
width: 220px;
}
/* line 26, ../sass/screen.scss */
/* line 42, ../sass/screen.scss */
.table thead th.order {
width: 58px;
}
/* line 29, ../sass/screen.scss */
/* line 45, ../sass/screen.scss */
.table thead th.actif {
width: 75px;
text-align: center;
}
/* line 35, ../sass/screen.scss */
/* line 51, ../sass/screen.scss */
.table tbody td.center {
text-align: center;
}

/* line 43, ../sass/screen.scss */
/* line 59, ../sass/screen.scss */
#page-commande h1 .btn-group {
float: right;
}
/* line 48, ../sass/screen.scss */
/* line 64, ../sass/screen.scss */
#page-commande #jours-production {
display: none;
}
/* line 53, ../sass/screen.scss */
/* line 69, ../sass/screen.scss */
#page-commande #calendar .fc-header-title {
margin-left: 10px;
}
/* line 59, ../sass/screen.scss */
/* line 75, ../sass/screen.scss */
#page-commande #calendar .dayWithEvent {
background-color: #fee48d;
cursor: pointer;
}
/* line 63, ../sass/screen.scss */
/* line 79, ../sass/screen.scss */
#page-commande #calendar .fc-event-container {
display: none;
}
/* line 64, ../sass/screen.scss */
/* line 80, ../sass/screen.scss */
#page-commande #calendar .fc-today {
border-bottom: solid 1px #C9302C;
background-color: white;
}
/* line 68, ../sass/screen.scss */
/* line 84, ../sass/screen.scss */
#page-commande #calendar .fc-today.dayWithEvent {
background-color: #fee48d;
}
/* line 73, ../sass/screen.scss */
/* line 89, ../sass/screen.scss */
#page-commande #calendar .fc-day {
cursor: pointer;
text-align: center;
}
/* line 76, ../sass/screen.scss */
/* line 92, ../sass/screen.scss */
#page-commande #calendar .fc-day:hover {
-moz-box-shadow: 0px 0px 2px black inset;
-webkit-box-shadow: 0px 0px 2px black inset;
box-shadow: 0px 0px 2px black inset;
}
/* line 81, ../sass/screen.scss */
/* line 97, ../sass/screen.scss */
#page-commande #calendar .current-date {
-moz-box-shadow: 0px 0px 2px black inset;
-webkit-box-shadow: 0px 0px 2px black inset;
box-shadow: 0px 0px 2px black inset;
}
/* line 85, ../sass/screen.scss */
/* line 101, ../sass/screen.scss */
#page-commande #calendar .fc-day-number {
float: none;
padding-top: 2px;
}
/* line 92, ../sass/screen.scss */
/* line 108, ../sass/screen.scss */
#page-commande #produits-production input.quantite-max {
background-color: white;
border: 1px solid #e0e0e0;
text-align: center;
width: 50px;
}
/* line 100, ../sass/screen.scss */
/* line 116, ../sass/screen.scss */
#page-commande .form-commandes-point-vente {
margin-top: 20px;
}
/* line 104, ../sass/screen.scss */
/* line 120, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .title-point-vente {
background-color: #fff8e2;
border-left: solid 3px #fdd44b;
font-weight: bold;
}
/* line 110, ../sass/screen.scss */
/* line 126, ../sass/screen.scss */
#page-commande .form-commandes-point-vente input.quantite {
width: 50px;
background-color: white;
border: solid 1px #e0e0e0;
text-align: center;
}
/* line 117, ../sass/screen.scss */
/* line 133, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .td-produit {
text-align: center;
}
/* line 121, ../sass/screen.scss */
/* line 137, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .submit-pv {
float: right;
}
/* line 125, ../sass/screen.scss */
/* line 141, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .select-user {
background-color: #F9F9F9;
border: solid 1px #e0e0e0;
}
/* line 130, ../sass/screen.scss */
/* line 146, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .date-commande {
font-size: 12px;
}
/* line 134, ../sass/screen.scss */
/* line 150, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .datepicker, #page-commande .form-commandes-point-vente .text {
background-color: white;
border: solid 1px #e0e0e0;
margin-top: 3px;
width: 100px;
}
/* line 142, ../sass/screen.scss */
/* line 158, ../sass/screen.scss */
#page-commande .form-commandes-point-vente td.center {
text-align: center;
}
/* line 146, ../sass/screen.scss */
/* line 162, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .depasse {
color: #b32815;
}
/* line 150, ../sass/screen.scss */
/* line 166, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .total strong span {
font-weight: normal;
font-size: 13px;
}
/* line 155, ../sass/screen.scss */
/* line 171, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .vrac {
display: none;
}

/* line 167, ../sass/screen.scss */
/* line 183, ../sass/screen.scss */
#email-masse-form #ids-users {
line-height: 30px;
}
/* line 169, ../sass/screen.scss */
/* line 185, ../sass/screen.scss */
#email-masse-form #ids-users .label {
text-transform: capitalize;
}

+ 16
- 0
backend/web/sass/screen.scss Näytä tiedosto

@@ -10,6 +10,7 @@
}

.nav-header {
@include box-shadow(0px 0px 5px black) ;
.retour-site {
//color: #9d9d9d ;
border-left : solid 1px #9d9d9d ;
@@ -18,6 +19,21 @@
}
}

.nom-boulange {
margin-bottom: 15px ;
text-align: center ;
span {
position: relative ;
top: -12px ;
background-color: #337ab7 ;
color: white ;
@include border-radius(0px 0px 5px 5px) ;
font-size: 20px ;
padding: 8px 15px ;
margin-bottom: 20px ;
}
}

.table {
thead {
th.actions {

+ 29
- 18
common/models/PointVente.php Näytä tiedosto

@@ -11,6 +11,7 @@ use yii\helpers\Html ;
* @property integer $id
* @property string $nom
* @property string $adresse
* @property integer $id_boulangerie
*/
class PointVente extends \yii\db\ActiveRecord
{
@@ -36,10 +37,12 @@ class PointVente extends \yii\db\ActiveRecord
{
return [
[['nom'], 'required'],
[['nom'], 'string', 'max' => 255],
[['adresse','localite','horaires_lundi','horaires_mardi','horaires_mercredi','horaires_jeudi','horaires_vendredi','horaires_samedi','horaires_dimanche'], 'string'],
[['point_fabrication','vrac','pain'], 'boolean'],
['point_fabrication', 'default','value'=>0],
[['nom'], 'string', 'max' => 255]
['point_fabrication', 'default','value'=>0],
['id_boulangerie','integer'],
['id_boulangerie','required'],
];
}

@@ -66,22 +69,22 @@ class PointVente extends \yii\db\ActiveRecord
];
}
public function initCommandes($commandes) {
$this->commandes = [] ;
$this->recettes = 0 ;
$this->recettes_pain = 0 ;
$this->recettes_vrac = 0 ;
foreach($commandes as $c) {
if($this->id == $c->id_point_vente) {
$this->commandes[] = $c ;
$this->recettes += (float) $c->montant ;
$this->recettes_pain += (float) $c->montant_pain ;
$this->recettes_vrac += (float) $c->montant_vrac ;
}
}
public function initCommandes($commandes) {
$this->commandes = [] ;
$this->recettes = 0 ;
$this->recettes_pain = 0 ;
$this->recettes_vrac = 0 ;
foreach($commandes as $c) {
if($this->id == $c->id_point_vente) {
$this->commandes[] = $c ;
$this->recettes += (float) $c->montant ;
$this->recettes_pain += (float) $c->montant_pain ;
$this->recettes_vrac += (float) $c->montant_vrac ;
}
}
}
public function strListeVrac() {
@@ -100,4 +103,12 @@ class PointVente extends \yii\db\ActiveRecord
return substr($str, 0, strlen($str) - 2) ;
}
public function save($runValidation = true, $attributeNames = NULL)
{
$this->id_boulangerie = Yii::$app->user->identity->id ;
$this->pain = 1 ;
return parent::save($runValidation, $attributeNames) ;
}
}

Loading…
Peruuta
Tallenna