'verbs' => [ | 'verbs' => [ | ||||
'class' => VerbFilter::className(), | 'class' => VerbFilter::className(), | ||||
'actions' => [ | 'actions' => [ | ||||
'delete' => ['post'], | |||||
], | ], | ||||
], | ], | ||||
'access' => [ | 'access' => [ | ||||
*/ | */ | ||||
public function actionIndex() | public function actionIndex() | ||||
{ | { | ||||
$dataProvider = new ActiveDataProvider([ | $dataProvider = new ActiveDataProvider([ | ||||
'query' => PointVente::find(), | |||||
'query' => PointVente::find()->where(['id_boulangerie'=>Yii::$app->user->identity->id]) | |||||
]); | ]); | ||||
return $this->render('index', [ | return $this->render('index', [ | ||||
$model = new PointVente(); | $model = new PointVente(); | ||||
if ($model->load(Yii::$app->request->post()) && $model->save()) { | if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||||
return $this->redirect(['view', 'id' => $model->id]); | |||||
return $this->redirect(['index']); | |||||
} else { | } else { | ||||
return $this->render('create', [ | return $this->render('create', [ | ||||
'model' => $model, | 'model' => $model, | ||||
$model = $this->findModel($id); | $model = $this->findModel($id); | ||||
if ($model->load(Yii::$app->request->post()) && $model->save()) { | if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||||
return $this->redirect(['view', 'id' => $model->id]); | |||||
return $this->redirect(['index']); | |||||
} else { | } else { | ||||
return $this->render('update', [ | return $this->render('update', [ | ||||
'model' => $model, | 'model' => $model, |
?> | ?> | ||||
<div class="container"> | <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([ | <?= Breadcrumbs::widget([ | ||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | ||||
]) ?> | ]) ?> |
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?> | <?= $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]) ?> | <?= $form->field($model, 'adresse')->textarea(['rows' => 6]) ?> | ||||
<?= $form->field($model, 'pain')->checkbox(); ?> | |||||
<?= $form->field($model, 'vrac')->checkbox(); ?> | |||||
<h2>Horaires</h2> | <h2>Horaires</h2> | ||||
<div class="alert alert-info">Laisser vide si le point de vente est fermé</div> | <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"> | <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> | </div> | ||||
<?php ActiveForm::end(); ?> | <?php ActiveForm::end(); ?> |
/* @var $this yii\web\View */ | /* @var $this yii\web\View */ | ||||
/* @var $model backend\models\PointVente */ | /* @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"> | <div class="point-vente-create"> | ||||
/* @var $this yii\web\View */ | /* @var $this yii\web\View */ | ||||
/* @var $model backend\models\PointVente */ | /* @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"> | <div class="point-vente-update"> | ||||
clear: both; | 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 { | .nav-header .retour-site { | ||||
border-left: solid 1px #9d9d9d; | border-left: solid 1px #9d9d9d; | ||||
padding: 10px 15px; | 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 { | .table thead th.actions { | ||||
width: 220px; | width: 220px; | ||||
} | } | ||||
/* line 26, ../sass/screen.scss */ | |||||
/* line 42, ../sass/screen.scss */ | |||||
.table thead th.order { | .table thead th.order { | ||||
width: 58px; | width: 58px; | ||||
} | } | ||||
/* line 29, ../sass/screen.scss */ | |||||
/* line 45, ../sass/screen.scss */ | |||||
.table thead th.actif { | .table thead th.actif { | ||||
width: 75px; | width: 75px; | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 35, ../sass/screen.scss */ | |||||
/* line 51, ../sass/screen.scss */ | |||||
.table tbody td.center { | .table tbody td.center { | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 43, ../sass/screen.scss */ | |||||
/* line 59, ../sass/screen.scss */ | |||||
#page-commande h1 .btn-group { | #page-commande h1 .btn-group { | ||||
float: right; | float: right; | ||||
} | } | ||||
/* line 48, ../sass/screen.scss */ | |||||
/* line 64, ../sass/screen.scss */ | |||||
#page-commande #jours-production { | #page-commande #jours-production { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 53, ../sass/screen.scss */ | |||||
/* line 69, ../sass/screen.scss */ | |||||
#page-commande #calendar .fc-header-title { | #page-commande #calendar .fc-header-title { | ||||
margin-left: 10px; | margin-left: 10px; | ||||
} | } | ||||
/* line 59, ../sass/screen.scss */ | |||||
/* line 75, ../sass/screen.scss */ | |||||
#page-commande #calendar .dayWithEvent { | #page-commande #calendar .dayWithEvent { | ||||
background-color: #fee48d; | background-color: #fee48d; | ||||
cursor: pointer; | cursor: pointer; | ||||
} | } | ||||
/* line 63, ../sass/screen.scss */ | |||||
/* line 79, ../sass/screen.scss */ | |||||
#page-commande #calendar .fc-event-container { | #page-commande #calendar .fc-event-container { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 64, ../sass/screen.scss */ | |||||
/* line 80, ../sass/screen.scss */ | |||||
#page-commande #calendar .fc-today { | #page-commande #calendar .fc-today { | ||||
border-bottom: solid 1px #C9302C; | border-bottom: solid 1px #C9302C; | ||||
background-color: white; | background-color: white; | ||||
} | } | ||||
/* line 68, ../sass/screen.scss */ | |||||
/* line 84, ../sass/screen.scss */ | |||||
#page-commande #calendar .fc-today.dayWithEvent { | #page-commande #calendar .fc-today.dayWithEvent { | ||||
background-color: #fee48d; | background-color: #fee48d; | ||||
} | } | ||||
/* line 73, ../sass/screen.scss */ | |||||
/* line 89, ../sass/screen.scss */ | |||||
#page-commande #calendar .fc-day { | #page-commande #calendar .fc-day { | ||||
cursor: pointer; | cursor: pointer; | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 76, ../sass/screen.scss */ | |||||
/* line 92, ../sass/screen.scss */ | |||||
#page-commande #calendar .fc-day:hover { | #page-commande #calendar .fc-day:hover { | ||||
-moz-box-shadow: 0px 0px 2px black inset; | -moz-box-shadow: 0px 0px 2px black inset; | ||||
-webkit-box-shadow: 0px 0px 2px black inset; | -webkit-box-shadow: 0px 0px 2px black inset; | ||||
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 { | #page-commande #calendar .current-date { | ||||
-moz-box-shadow: 0px 0px 2px black inset; | -moz-box-shadow: 0px 0px 2px black inset; | ||||
-webkit-box-shadow: 0px 0px 2px black inset; | -webkit-box-shadow: 0px 0px 2px black inset; | ||||
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 { | #page-commande #calendar .fc-day-number { | ||||
float: none; | float: none; | ||||
padding-top: 2px; | padding-top: 2px; | ||||
} | } | ||||
/* line 92, ../sass/screen.scss */ | |||||
/* line 108, ../sass/screen.scss */ | |||||
#page-commande #produits-production input.quantite-max { | #page-commande #produits-production input.quantite-max { | ||||
background-color: white; | background-color: white; | ||||
border: 1px solid #e0e0e0; | border: 1px solid #e0e0e0; | ||||
text-align: center; | text-align: center; | ||||
width: 50px; | width: 50px; | ||||
} | } | ||||
/* line 100, ../sass/screen.scss */ | |||||
/* line 116, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente { | #page-commande .form-commandes-point-vente { | ||||
margin-top: 20px; | margin-top: 20px; | ||||
} | } | ||||
/* line 104, ../sass/screen.scss */ | |||||
/* line 120, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .title-point-vente { | #page-commande .form-commandes-point-vente .title-point-vente { | ||||
background-color: #fff8e2; | background-color: #fff8e2; | ||||
border-left: solid 3px #fdd44b; | border-left: solid 3px #fdd44b; | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 110, ../sass/screen.scss */ | |||||
/* line 126, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente input.quantite { | #page-commande .form-commandes-point-vente input.quantite { | ||||
width: 50px; | width: 50px; | ||||
background-color: white; | background-color: white; | ||||
border: solid 1px #e0e0e0; | border: solid 1px #e0e0e0; | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 117, ../sass/screen.scss */ | |||||
/* line 133, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .td-produit { | #page-commande .form-commandes-point-vente .td-produit { | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 121, ../sass/screen.scss */ | |||||
/* line 137, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .submit-pv { | #page-commande .form-commandes-point-vente .submit-pv { | ||||
float: right; | float: right; | ||||
} | } | ||||
/* line 125, ../sass/screen.scss */ | |||||
/* line 141, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .select-user { | #page-commande .form-commandes-point-vente .select-user { | ||||
background-color: #F9F9F9; | background-color: #F9F9F9; | ||||
border: solid 1px #e0e0e0; | border: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 130, ../sass/screen.scss */ | |||||
/* line 146, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .date-commande { | #page-commande .form-commandes-point-vente .date-commande { | ||||
font-size: 12px; | 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 { | #page-commande .form-commandes-point-vente .datepicker, #page-commande .form-commandes-point-vente .text { | ||||
background-color: white; | background-color: white; | ||||
border: solid 1px #e0e0e0; | border: solid 1px #e0e0e0; | ||||
margin-top: 3px; | margin-top: 3px; | ||||
width: 100px; | width: 100px; | ||||
} | } | ||||
/* line 142, ../sass/screen.scss */ | |||||
/* line 158, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente td.center { | #page-commande .form-commandes-point-vente td.center { | ||||
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 146, ../sass/screen.scss */ | |||||
/* line 162, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .depasse { | #page-commande .form-commandes-point-vente .depasse { | ||||
color: #b32815; | color: #b32815; | ||||
} | } | ||||
/* line 150, ../sass/screen.scss */ | |||||
/* line 166, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .total strong span { | #page-commande .form-commandes-point-vente .total strong span { | ||||
font-weight: normal; | font-weight: normal; | ||||
font-size: 13px; | font-size: 13px; | ||||
} | } | ||||
/* line 155, ../sass/screen.scss */ | |||||
/* line 171, ../sass/screen.scss */ | |||||
#page-commande .form-commandes-point-vente .vrac { | #page-commande .form-commandes-point-vente .vrac { | ||||
display: none; | display: none; | ||||
} | } | ||||
/* line 167, ../sass/screen.scss */ | |||||
/* line 183, ../sass/screen.scss */ | |||||
#email-masse-form #ids-users { | #email-masse-form #ids-users { | ||||
line-height: 30px; | line-height: 30px; | ||||
} | } | ||||
/* line 169, ../sass/screen.scss */ | |||||
/* line 185, ../sass/screen.scss */ | |||||
#email-masse-form #ids-users .label { | #email-masse-form #ids-users .label { | ||||
text-transform: capitalize; | text-transform: capitalize; | ||||
} | } |
} | } | ||||
.nav-header { | .nav-header { | ||||
@include box-shadow(0px 0px 5px black) ; | |||||
.retour-site { | .retour-site { | ||||
//color: #9d9d9d ; | //color: #9d9d9d ; | ||||
border-left : solid 1px #9d9d9d ; | border-left : solid 1px #9d9d9d ; | ||||
} | } | ||||
} | } | ||||
.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 { | .table { | ||||
thead { | thead { | ||||
th.actions { | th.actions { |
* @property integer $id | * @property integer $id | ||||
* @property string $nom | * @property string $nom | ||||
* @property string $adresse | * @property string $adresse | ||||
* @property integer $id_boulangerie | |||||
*/ | */ | ||||
class PointVente extends \yii\db\ActiveRecord | class PointVente extends \yii\db\ActiveRecord | ||||
{ | { | ||||
{ | { | ||||
return [ | return [ | ||||
[['nom'], 'required'], | [['nom'], 'required'], | ||||
[['nom'], 'string', 'max' => 255], | |||||
[['adresse','localite','horaires_lundi','horaires_mardi','horaires_mercredi','horaires_jeudi','horaires_vendredi','horaires_samedi','horaires_dimanche'], 'string'], | [['adresse','localite','horaires_lundi','horaires_mardi','horaires_mercredi','horaires_jeudi','horaires_vendredi','horaires_samedi','horaires_dimanche'], 'string'], | ||||
[['point_fabrication','vrac','pain'], 'boolean'], | [['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'], | |||||
]; | ]; | ||||
} | } | ||||
]; | ]; | ||||
} | } | ||||
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() { | public function strListeVrac() { | ||||
return substr($str, 0, strlen($str) - 2) ; | 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) ; | |||||
} | |||||
} | } |