Просмотр исходного кода

[Backend] Commandes automatiques (migration, index, début create)

Mise en place de la fonctionnalité de commandes automatiques avec création
des tables, modèles, création du controller, liste des commandes auto et début
du formulaire de création.
prodstable
keun 8 лет назад
Родитель
Сommit
8bad814c18
14 измененных файлов: 639 добавлений и 86 удалений
  1. +5
    -0
      backend/controllers/CommandeController.php
  2. +77
    -0
      backend/controllers/CommandeautoController.php
  3. +5
    -3
      backend/views/commande/index.php
  4. +35
    -0
      backend/views/commandeauto/_form.php
  5. +20
    -0
      backend/views/commandeauto/create.php
  6. +86
    -0
      backend/views/commandeauto/index.php
  7. Двоичные данные
      backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc
  8. +97
    -81
      backend/web/css/screen.css
  9. +23
    -2
      backend/web/sass/screen.scss
  10. +91
    -0
      common/models/CommandeAuto.php
  11. +65
    -0
      common/models/CommandeAutoForm.php
  12. +55
    -0
      common/models/CommandeAutoProduit.php
  13. +50
    -0
      console/migrations/m161125_075714_commandes_automatiques.php
  14. +30
    -0
      console/migrations/m161125_091622_add_champs_commande_auto.php

+ 5
- 0
backend/controllers/CommandeController.php Просмотреть файл

@@ -16,6 +16,7 @@ use common\models\Produit;
use common\helpers\CSV;
use common\models\User;
use kartik\mpdf\Pdf;
use common\models\CommandeAutoForm ;

class CommandeController extends BackendController {

@@ -458,6 +459,9 @@ class CommandeController extends BackendController {
])
->all();

// commandes auto
$model_commande_auto = new CommandeAutoForm ;
$datas = [
'produits' => $produits,
'points_vente' => $points_vente,
@@ -475,6 +479,7 @@ class CommandeController extends BackendController {
'poids_vrac' => $poids_vrac,
'ca_potentiel' => $ca_potentiel,
'poids_total' => $poids_total,
'model_commande_auto' => $model_commande_auto,
];

if ($return_data) {

+ 77
- 0
backend/controllers/CommandeautoController.php Просмотреть файл

@@ -0,0 +1,77 @@
<?php

namespace backend\controllers;

use Yii;
use common\models\Production;
use yii\filters\AccessControl;
use yii\web\Controller;
use common\models\LoginForm;
use yii\filters\VerbFilter;
use common\models\Commande;
use common\models\CommandeProduit;
use common\models\PointVente;
use common\models\Produit;
use common\models\User;
use common\models\CommandeAutoForm ;
use common\models\ProductionProduit;
use yii\data\ActiveDataProvider;
use common\models\CommandeAuto ;

class CommandeautoController extends BackendController {

var $enableCsrfValidation = false;

public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN
|| Yii::$app->user->identity->status == USER::STATUS_BOULANGER;
}
]
],
],
];
}
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => CommandeAuto::find()
->with('user', 'etablissement', 'pointVente','commandeAutoProduit')
->where(['id_etablissement'=>Yii::$app->user->identity->id_etablissement]),
'pagination' => [
'pageSize' => 1000,
],
]);
return $this->render('index',[
'dataProvider' => $dataProvider
]) ;
}
public function actionCreate()
{
$model = new CommandeAutoForm ;
if($model->load(Yii::$app->request->post()) && $model->validate() && $model->save())
{
}
return $this->render('create',[
'model' => $model
]) ;
}
}

+ 5
- 3
backend/views/commande/index.php Просмотреть файл

@@ -4,6 +4,7 @@ use yii\helpers\Html;
use common\models\Commande;
use common\models\User ;
use yii\helpers\ArrayHelper ;
use yii\widgets\ActiveForm;

$this->title = 'Commande';

@@ -128,10 +129,11 @@ foreach ($produits as $p) {
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Commandes
<?php if (count($commandes)): ?>
Commandes
<?php if (count($commandes)): ?>
<a id="btn-export-commandes" class="btn btn-primary" href="<?php echo Yii::$app->urlManager->createUrl(['commande/report', 'date' => $date, 'id_point_vente' => 0, 'global' => 1]); ?>"><span class="glyphicon glyphicon-download-alt"></span> Exporter</a>
<?php endif; ?>
<?php endif; ?>
<a id="btn-commande-auto" class="btn btn-default" href="<?php echo Yii::$app->urlManager->createUrl(['commandeauto/index']); ?>"><span class="glyphicon glyphicon-repeat"></span> Commandes automatiques</a>
</h3>
</div>
<div class="panel-body">

+ 35
- 0
backend/views/commandeauto/_form.php Просмотреть файл

@@ -0,0 +1,35 @@
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper ;
use common\models\User ;
use common\models\PointVente ;

?>


<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_user')->dropDownList( ArrayHelper::map(User::find()->joinWith('userEtablissement')->where('user_etablissement.id_etablissement = '.Yii::$app->user->identity->id_etablissement)->all(), 'id', function($model, $defaultValue) {
return $model['nom'].' '.$model['prenom'];
}), ['prompt' => '--','class' => 'form-control user-id']) ?>
<?= $form->field($model, 'id_etablissement')->hiddenInput() ?>
<?= $form->field($model, 'id_point_vente')->dropDownList( ArrayHelper::map(PointVente::find()->where('id_etablissement = '.Yii::$app->user->identity->id_etablissement)->all(), 'id', function($model, $defaultValue) {
return $model['nom'];
}), ['prompt' => '--','class' => 'form-control user-id']) ?>
<?= $form->field($model, 'date_debut') ?>
<?= $form->field($model, 'date_fin') ?>
<div class="jours">
<?= $form->field($model, 'lundi')->checkbox() ?>
<?= $form->field($model, 'mardi')->checkbox() ?>
<?= $form->field($model, 'mercredi')->checkbox() ?>
<?= $form->field($model, 'jeudi')->checkbox() ?>
<?= $form->field($model, 'vendredi')->checkbox() ?>
<?= $form->field($model, 'samedi')->checkbox() ?>
<?= $form->field($model, 'dimanche')->checkbox() ?>
</div>
<div class="clr"></div>
<?= $form->field($model, 'periodicite_semaine')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?>

<?= Html::submitButton('Enregistrer' , ['class' => 'btn btn-primary']) ?>
<?php ActiveForm::end(); ?>

+ 20
- 0
backend/views/commandeauto/create.php Просмотреть файл

@@ -0,0 +1,20 @@
<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model app\models\Produit */

$this->title = 'Ajouter une commande automatique';
$this->params['breadcrumbs'][] = ['label' => 'Commandes automatiques', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Ajouter';
?>
<div class="produit-create">

<h1><?= Html::encode($this->title) ?></h1>

<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

+ 86
- 0
backend/views/commandeauto/index.php Просмотреть файл

@@ -0,0 +1,86 @@
<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Commandes automatiques';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="commande-auto-index">

<h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>

<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_user',
'format' => 'raw',
'value' => function($model) {
return Html::encode($model->user->nom.' '.$model->user->prenom) ;
}
],
[
'attribute' => 'id_point_vente',
'format' => 'raw',
'value' => function($model) {
return Html::encode($model->pointVente->nom) ;
}
],
[
'attribute' => 'produits',
'format' => 'raw',
'value' => function($model) {
$html = '' ;
foreach($model->commandeAutoProduit as $commande_produit)
{
$html .= $commande_produit->quantite . ' x '.Html::encode($commande_produit->produit->nom).'<br />' ;
}
return $html ;
}
],
[
'attribute' => 'date_debut',
'value' => function($model) {
return date('d/m/Y',strtotime($model->date_debut)) ;
}
],
[
'attribute' => 'date_fin',
'value' => function($model) {
return date('d/m/Y',strtotime($model->date_fin)) ;
}
],
[
'attribute' => 'periodicite_semaine',
'value' => function($model) {
if($model->periodicite_semaine == 1)
return 'Toutes les semaines' ;
else
return 'Toutes les '.$model->periodicite_semaine.' semaines' ;
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'actions'],
'buttons' => [
'update' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}
],
],
],
]); ?>
</div>

Двоичные данные
backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc Просмотреть файл


+ 97
- 81
backend/web/css/screen.css Просмотреть файл

@@ -346,32 +346,38 @@ a:hover, a:focus, a:active {
font-weight: normal;
}
/* line 317, ../sass/screen.scss */
#page-commande #btn-export-commandes {
#page-commande #btn-export-commandes,
#page-commande #btn-commande-auto {
float: right;
color: white;
position: relative;
top: -5px;
right: -7px;
padding: 2px 5px;
}
/* line 328, ../sass/screen.scss */
/* line 326, ../sass/screen.scss */
#page-commande #btn-export-commandes {
color: white;
margin-left: 10px;
padding: 1px 5px;
}
/* line 334, ../sass/screen.scss */
#page-commande #bloc-totaux .table-produits .depasse {
color: #b32815;
}
/* line 332, ../sass/screen.scss */
/* line 338, ../sass/screen.scss */
#page-commande #bloc-totaux .table-produits .total strong span {
font-weight: normal;
font-size: 13px;
}
/* line 341, ../sass/screen.scss */
/* line 347, ../sass/screen.scss */
#page-commande #commandes-points-vente .tab-pane {
padding-top: 20px;
}
/* line 348, ../sass/screen.scss */
/* line 354, ../sass/screen.scss */
#page-commande #commandes-points-vente .recap-pv.no-commande .recettes {
display: none;
}
/* line 352, ../sass/screen.scss */
/* line 358, ../sass/screen.scss */
#page-commande #commandes-points-vente .recap-pv .recettes {
float: right;
color: #BB8757;
@@ -384,11 +390,11 @@ a:hover, a:focus, a:active {
position: relative;
top: -3px;
}
/* line 366, ../sass/screen.scss */
/* line 372, ../sass/screen.scss */
#page-commande #commandes-points-vente .alert.commentaire {
display: none;
}
/* line 370, ../sass/screen.scss */
/* line 376, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes {
margin-top: 10px;
list-style-type: none;
@@ -400,12 +406,12 @@ a:hover, a:focus, a:active {
width: 100%;
overflow-y: scroll;
}
/* line 382, ../sass/screen.scss */
/* line 388, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li {
padding: 0;
margin: 0;
}
/* line 385, ../sass/screen.scss */
/* line 391, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a {
text-align: left;
-moz-border-radius: 0px;
@@ -415,17 +421,17 @@ a:hover, a:focus, a:active {
padding: 7px;
color: #333;
}
/* line 393, ../sass/screen.scss */
/* line 399, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a .montant {
float: right;
color: #BB8757;
font-weight: bold;
}
/* line 399, ../sass/screen.scss */
/* line 405, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a .glyphicon-comment {
color: #BB8757;
}
/* line 403, ../sass/screen.scss */
/* line 409, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a:hover, #page-commande #commandes-points-vente ul.liste-commandes li a:active, #page-commande #commandes-points-vente ul.liste-commandes li a.active {
text-decoration: none;
background-color: #FCF8E3;
@@ -436,73 +442,73 @@ a:hover, a:focus, a:active {
-webkit-transition: all 0.1s;
transition: all 0.1s;
}
/* line 417, ../sass/screen.scss */
/* line 423, ../sass/screen.scss */
#page-commande #commandes-points-vente .creer-commande {
width: 100%;
}
/* line 421, ../sass/screen.scss */
/* line 427, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user {
display: none;
font-size: 19px;
margin-top: 0px;
}
/* line 426, ../sass/screen.scss */
/* line 432, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .btn-edit, #page-commande #commandes-points-vente .title-user .btn-remove,
#page-commande #commandes-points-vente .title-user .btn-cancel, #page-commande #commandes-points-vente .title-user .btn-save {
float: right;
position: relative;
top: -6px;
}
/* line 433, ../sass/screen.scss */
/* line 439, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .btn-edit, #page-commande #commandes-points-vente .title-user .btn-cancel {
margin-right: 10px;
}
/* line 437, ../sass/screen.scss */
/* line 443, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .buttons-save-cancel {
display: none;
}
/* line 441, ../sass/screen.scss */
/* line 447, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .choix-user {
display: none;
}
/* line 444, ../sass/screen.scss */
/* line 450, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .choix-user .form-control {
width: 200px;
display: inline;
}
/* line 452, ../sass/screen.scss */
/* line 458, ../sass/screen.scss */
#page-commande #commandes-points-vente table.table-produits .td-commande {
text-align: center;
}
/* line 455, ../sass/screen.scss */
/* line 461, ../sass/screen.scss */
#page-commande #commandes-points-vente table.table-produits input.form-control {
text-align: center;
}
/* line 461, ../sass/screen.scss */
/* line 467, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-produit,
#page-commande #commandes-points-vente .th-produit {
width: 70%;
}
/* line 466, ../sass/screen.scss */
/* line 472, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-commande,
#page-commande #commandes-points-vente .th-commande {
width: 30%;
text-align: center;
}
/* line 472, ../sass/screen.scss */
/* line 478, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-produit {
text-transform: uppercase;
}
/* line 476, ../sass/screen.scss */
/* line 482, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-commande {
font-weight: bold;
}
/* line 480, ../sass/screen.scss */
/* line 486, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-total {
font-size: 20px;
text-align: center;
}
/* line 484, ../sass/screen.scss */
/* line 490, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-total span {
padding: 5px 10px;
background-color: #BB8757;
@@ -512,19 +518,29 @@ a:hover, a:focus, a:active {
-webkit-border-radius: 15px;
border-radius: 15px;
}
/* line 495, ../sass/screen.scss */
/* line 500, ../sass/screen.scss */
#page-commande #commandes-points-vente .panel-commande-automatique .field-commandeautoform-id_user,
#page-commande #commandes-points-vente .panel-commande-automatique .field-commandeautoform-id_etablissement {
display: none;
}
/* line 507, ../sass/screen.scss */
#page-commande #commandes-points-vente .panel-commande-automatique .jours .form-group {
float: left;
margin-right: 10px;
}
/* line 516, ../sass/screen.scss */
#page-commande #old-commandes {
display: none;
}
/* line 499, ../sass/screen.scss */
/* line 520, ../sass/screen.scss */
#page-commande .form-commandes-point-vente {
margin-top: 20px;
}
/* line 503, ../sass/screen.scss */
/* line 524, ../sass/screen.scss */
#page-commande .form-commandes-point-vente table {
border-bottom: solid 1px #e0e0e0;
}
/* line 507, ../sass/screen.scss */
/* line 528, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .title-point-vente {
background-color: #fff8e2;
border-left: solid 3px #BB8757;
@@ -532,76 +548,76 @@ a:hover, a:focus, a:active {
text-align: left;
padding: 10px;
}
/* line 515, ../sass/screen.scss */
/* line 536, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .title-totaux {
text-align: center;
}
/* line 519, ../sass/screen.scss */
/* line 540, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .border-left {
border-left: solid 1px #e0e0e0;
}
/* line 523, ../sass/screen.scss */
/* line 544, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .border-right {
border-right: solid 1px #e0e0e0;
}
/* line 527, ../sass/screen.scss */
/* line 548, ../sass/screen.scss */
#page-commande .form-commandes-point-vente input.quantite {
width: 30px;
background-color: white;
border: solid 1px #e0e0e0;
text-align: center;
}
/* line 535, ../sass/screen.scss */
/* line 556, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .td-produit {
text-align: center;
}
/* line 539, ../sass/screen.scss */
/* line 560, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .submit-pv {
float: right;
}
/* line 543, ../sass/screen.scss */
/* line 564, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .select-user {
background-color: #F9F9F9;
border: solid 1px #e0e0e0;
}
/* line 548, ../sass/screen.scss */
/* line 569, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .date-commande {
font-size: 12px;
}
/* line 552, ../sass/screen.scss */
/* line 573, ../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 560, ../sass/screen.scss */
/* line 581, ../sass/screen.scss */
#page-commande .form-commandes-point-vente td.center {
text-align: center;
}
/* line 566, ../sass/screen.scss */
/* line 587, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .depasse {
color: #b32815;
}
/* line 570, ../sass/screen.scss */
/* line 591, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .total strong span {
font-weight: normal;
font-size: 13px;
}
/* line 575, ../sass/screen.scss */
/* line 596, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .vrac {
display: none;
}
/* line 579, ../sass/screen.scss */
/* line 600, ../sass/screen.scss */
#page-commande .form-commandes-point-vente td.client {
text-align: left;
padding: 3px;
}
/* line 582, ../sass/screen.scss */
/* line 603, ../sass/screen.scss */
#page-commande .form-commandes-point-vente td.client .date-commande {
color: gray;
}
/* line 593, ../sass/screen.scss */
/* line 614, ../sass/screen.scss */
#page-commande .table-header-rotated td {
width: 20px;
padding: 0px;
@@ -611,7 +627,7 @@ a:hover, a:focus, a:active {
vertical-align: middle;
text-align: center;
}
/* line 603, ../sass/screen.scss */
/* line 624, ../sass/screen.scss */
#page-commande .table-header-rotated th.rotate-45 {
height: 80px;
width: 20px;
@@ -623,7 +639,7 @@ a:hover, a:focus, a:active {
font-size: 12px;
line-height: 0.8;
}
/* line 615, ../sass/screen.scss */
/* line 636, ../sass/screen.scss */
#page-commande .table-header-rotated th.rotate-45 > div {
position: relative;
top: 0px;
@@ -640,7 +656,7 @@ a:hover, a:focus, a:active {
border-right: 1px solid #dddddd;
border-top: 1px solid #dddddd;
}
/* line 631, ../sass/screen.scss */
/* line 652, ../sass/screen.scss */
#page-commande .table-header-rotated th.rotate-45 span {
-ms-transform: skew(45deg, 0deg) rotate(315deg);
-moz-transform: skew(45deg, 0deg) rotate(315deg);
@@ -663,51 +679,51 @@ a:hover, a:focus, a:active {
/*whether to display in one line or not*/
}

/* line 656, ../sass/screen.scss */
/* line 677, ../sass/screen.scss */
#email-masse-form #ids-users {
line-height: 30px;
}
/* line 658, ../sass/screen.scss */
/* line 679, ../sass/screen.scss */
#email-masse-form #ids-users .label {
text-transform: capitalize;
}

/* line 666, ../sass/screen.scss */
/* line 687, ../sass/screen.scss */
.produit-create #jours-production .form-group, .produit-update #jours-production .form-group {
float: left;
margin-right: 15px;
}
/* line 670, ../sass/screen.scss */
/* line 691, ../sass/screen.scss */
.produit-create #jours-production .form-group label, .produit-update #jours-production .form-group label {
font-weight: normal;
}
/* line 675, ../sass/screen.scss */
/* line 696, ../sass/screen.scss */
.produit-create .field-produit-id_etablissement, .produit-update .field-produit-id_etablissement {
display: none;
}

/* line 680, ../sass/screen.scss */
/* line 701, ../sass/screen.scss */
.table-striped > tbody > tr:nth-of-type(2n) {
background-color: white;
}

/* line 685, ../sass/screen.scss */
/* line 706, ../sass/screen.scss */
.wrap .produit-index .td-photo {
max-width: 100px;
width: 100px;
}
/* line 689, ../sass/screen.scss */
/* line 710, ../sass/screen.scss */
.wrap .produit-index .photo-produit {
max-width: 100px;
}
/* line 693, ../sass/screen.scss */
/* line 714, ../sass/screen.scss */
.wrap .produit-index .ui-state-highlight {
height: 75px;
background-color: #F8F1DD;
}

/* communiquer */
/* line 701, ../sass/screen.scss */
/* line 722, ../sass/screen.scss */
.communiquer-mode-emploi {
border: solid 1px #e0e0e0;
padding: 10px;
@@ -717,18 +733,18 @@ a:hover, a:focus, a:active {
margin-bottom: 30px;
font-family: "myriadpro-regular";
}
/* line 709, ../sass/screen.scss */
/* line 730, ../sass/screen.scss */
.communiquer-mode-emploi .header .logo {
float: left;
width: 75px;
padding-right: 20px;
padding-top: 10px;
}
/* line 715, ../sass/screen.scss */
/* line 736, ../sass/screen.scss */
.communiquer-mode-emploi .header .logo img {
width: 75px;
}
/* line 721, ../sass/screen.scss */
/* line 742, ../sass/screen.scss */
.communiquer-mode-emploi .header h1 {
font-family: "comfortaaregular";
font-size: 40px;
@@ -736,7 +752,7 @@ a:hover, a:focus, a:active {
margin-bottom: 0px;
font-weight: normal;
}
/* line 729, ../sass/screen.scss */
/* line 750, ../sass/screen.scss */
.communiquer-mode-emploi .header h2 {
margin-top: 0px;
font-family: "myriadpro-regular";
@@ -746,7 +762,7 @@ a:hover, a:focus, a:active {
left: 2px;
font-weight: normal;
}
/* line 740, ../sass/screen.scss */
/* line 761, ../sass/screen.scss */
.communiquer-mode-emploi h3 {
font-family: "comfortaalight";
font-family: "myriadpro-regular";
@@ -756,45 +772,45 @@ a:hover, a:focus, a:active {
margin-bottom: 0px;
}

/* line 750, ../sass/screen.scss */
/* line 771, ../sass/screen.scss */
.communiquer-mode-emploi-encart {
width: 420px;
margin-top: 20px;
}
/* line 754, ../sass/screen.scss */
/* line 775, ../sass/screen.scss */
.communiquer-mode-emploi-encart .header .logo {
width: 60px;
margin-right: 20px;
padding-top: 5px;
}
/* line 759, ../sass/screen.scss */
/* line 780, ../sass/screen.scss */
.communiquer-mode-emploi-encart .header .logo img {
width: 60px;
}
/* line 765, ../sass/screen.scss */
/* line 786, ../sass/screen.scss */
.communiquer-mode-emploi-encart .header h1 {
margin-bottom: 3px;
}
/* line 774, ../sass/screen.scss */
/* line 795, ../sass/screen.scss */
.communiquer-mode-emploi-encart h3 {
margin-top: 15px;
margin-bottom: 15px;
}

/* line 780, ../sass/screen.scss */
/* line 801, ../sass/screen.scss */
.bloc-mode-emploi-pdf {
width: 49.9%;
float: left;
border-bottom: dotted 1px gray;
}

/* line 786, ../sass/screen.scss */
/* line 807, ../sass/screen.scss */
.bloc-mode-emploi-border {
border-right: dotted 1px gray;
border-bottom: dotted 1px gray;
}

/* line 791, ../sass/screen.scss */
/* line 812, ../sass/screen.scss */
.communiquer-mode-emploi-pdf {
border: 0px none;
-moz-border-radius: 0px;
@@ -803,31 +819,31 @@ a:hover, a:focus, a:active {
margin-bottom: 0px;
padding: 20px 0px 20px 30px;
}
/* line 799, ../sass/screen.scss */
/* line 820, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header .logo {
float: left;
width: 55px;
padding-right: 15px;
padding-top: 10px;
}
/* line 805, ../sass/screen.scss */
/* line 826, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header .logo img {
width: 55px;
}
/* line 809, ../sass/screen.scss */
/* line 830, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header h1 {
font-size: 32px;
}
/* line 812, ../sass/screen.scss */
/* line 833, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header h2 {
font-size: 16px;
}
/* line 817, ../sass/screen.scss */
/* line 838, ../sass/screen.scss */
.communiquer-mode-emploi-pdf h3 {
font-weight: normal;
}

/* line 822, ../sass/screen.scss */
/* line 843, ../sass/screen.scss */
.bloc-mode-emploi-bottom {
border-bottom: 0px none;
border-bottom: solid 1px white;

+ 23
- 2
backend/web/sass/screen.scss Просмотреть файл

@@ -314,15 +314,21 @@ a {
}
}
#btn-export-commandes {
#btn-export-commandes,
#btn-commande-auto {
float: right ;
color: white ;
position: relative;
top: -5px ;
right: -7px ;
padding: 2px 5px ;
}
#btn-export-commandes {
color: white ;
margin-left: 10px ;
padding: 1px 5px ;
}
#bloc-totaux {
.table-produits {
.depasse {
@@ -490,6 +496,21 @@ a {
}
}
.panel-commande-automatique {
.field-commandeautoform-id_user,
.field-commandeautoform-id_etablissement
{
display: none ;
}
.jours {
.form-group {
float: left ;
margin-right: 10px ;
}
}
}
}
#old-commandes {

+ 91
- 0
common/models/CommandeAuto.php Просмотреть файл

@@ -0,0 +1,91 @@
<?php

namespace common\models;

use Yii;

use common\models\Etablissement ;
use common\models\PointVente ;

/**
* This is the model class for table "commande_auto".
*
* @property integer $id
* @property integer $id_user
* @property integer $id_etablissement
* @property string $date_debut
* @property string $date_fin
* @property integer $lundi
* @property integer $mardi
* @property integer $mercredi
* @property integer $jeudi
* @property integer $vendredi
* @property integer $samedi
* @property integer $dimanche
* @property integer $periodicite_semaine
*/
class CommandeAuto extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'commande_auto';
}

/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_user', 'id_etablissement', 'id_point_vente'], 'required'],
[['id_user', 'id_etablissement', 'id_point_vente', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche', 'periodicite_semaine'], 'integer'],
[['date_debut', 'date_fin'], 'safe'],
];
}

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'id_user' => 'Utilisateur',
'id_etablissement' => 'Etablissement',
'id_point_vente' => 'Point de vente',
'date_debut' => 'Date de début',
'date_fin' => 'Date de fin',
'lundi' => 'Lundi',
'mardi' => 'Mardi',
'mercredi' => 'Mercredi',
'jeudi' => 'Jeudi',
'vendredi' => 'Vendredi',
'samedi' => 'Samedi',
'dimanche' => 'Dimanche',
'periodicite_semaine' => 'Périodicité',
];
}
public function getUser()
{
return $this->hasOne(User::className(), ['id'=>'id_user']) ;
}
public function getEtablissement()
{
return $this->hasOne(Etablissement::className(), ['id'=>'id_etablissement']) ;
}
public function getPointVente()
{
return $this->hasOne(PointVente::className(), ['id'=>'id_point_vente']) ;
}
public function getCommandeAutoProduit()
{
return $this->hasMany(CommandeAutoProduit::className(), ['id_commande_auto'=>'id'])->with('produit') ;
}
}

+ 65
- 0
common/models/CommandeAutoForm.php Просмотреть файл

@@ -0,0 +1,65 @@
<?php
namespace common\models;

use Yii;
use yii\base\Model;

/**
* Login form
*/
class CommandeAutoForm extends Model
{
public $id ;
public $id_user ;
public $id_etablissement ;
public $id_point_vente ;
public $date_debut;
public $date_fin ;
public $lundi ;
public $mardi ;
public $mercredi ;
public $jeudi ;
public $vendredi ;
public $samedi ;
public $dimanche ;
public $periodicite_semaine ;
public $produits ;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_user', 'id_etablissement', 'periodicite_semaine'], 'integer'],
[['date_debut', 'date_fin'], 'date'],
[['lundi','mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche'], 'boolean'],
[['id_user', 'id_etablissement'],'required', 'message' => 'Champs obligatoire']
];
}
public function attributeLabels()
{
return [
'id' => 'ID',
'id_user' => 'Utilisateur',
'id_etablissement' => 'ID Etablissement',
'id_point_vente' => 'Point de vente',
'date_debut' => 'Date de début',
'date_fin' => 'Date de fin',
'lundi' => 'Lundi',
'mardi' => 'Mardi',
'mercredi' => 'Mercredi',
'jeudi' => 'Jeudi',
'vendredi' => 'Vendredi',
'samedi' => 'Samedi',
'dimanche' => 'Dimanche',
'periodicite_semaine' => 'Périodicité (semaines)',
];
}
public function save()
{
}
}

+ 55
- 0
common/models/CommandeAutoProduit.php Просмотреть файл

@@ -0,0 +1,55 @@
<?php

namespace common\models;

use Yii;
use common\models\Produit ;

/**
* This is the model class for table "commande_auto_produit".
*
* @property integer $id
* @property integer $id_commande_auto
* @property integer $id_produit
* @property double $quantite
*/
class CommandeAutoProduit extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'commande_auto_produit';
}

/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_commande_auto', 'id_produit'], 'required'],
[['id_commande_auto', 'id_produit'], 'integer'],
[['quantite'], 'number'],
];
}

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'id_commande_auto' => 'Id Commande Auto',
'id_produit' => 'Id Produit',
'quantite' => 'Quantite',
];
}
public function getProduit()
{
return $this->hasOne(Produit::className(), ['id'=>'id_produit']) ;
}
}

+ 50
- 0
console/migrations/m161125_075714_commandes_automatiques.php Просмотреть файл

@@ -0,0 +1,50 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

class m161125_075714_commandes_automatiques extends Migration
{
public function up()
{
$this->createTable('commande_auto', [
'id' => 'pk',
'id_user' => Schema::TYPE_INTEGER . ' NOT NULL',
'id_etablissement' => Schema::TYPE_INTEGER. ' NOT NULL',
'date_debut' => Schema::TYPE_DATE,
'date_fin' => Schema::TYPE_DATE,
'lundi' => Schema::TYPE_BOOLEAN,
'mardi' => Schema::TYPE_BOOLEAN,
'mercredi' => Schema::TYPE_BOOLEAN,
'jeudi' => Schema::TYPE_BOOLEAN,
'vendredi' => Schema::TYPE_BOOLEAN,
'samedi' => Schema::TYPE_BOOLEAN,
'dimanche' => Schema::TYPE_BOOLEAN,
'periodicite_semaine' => Schema::TYPE_INTEGER,
]);
$this->createTable('commande_auto_produit', [
'id' => 'pk',
'id_commande_auto' => Schema::TYPE_INTEGER . ' NOT NULL',
'id_produit' => Schema::TYPE_INTEGER . ' NOT NULL',
'quantite' => Schema::TYPE_FLOAT,
]);
}

public function down()
{
$this->dropTable('commande_auto') ;
$this->dropTable('commande_auto_produit') ;
}

/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}

public function safeDown()
{
}
*/
}

+ 30
- 0
console/migrations/m161125_091622_add_champs_commande_auto.php Просмотреть файл

@@ -0,0 +1,30 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

class m161125_091622_add_champs_commande_auto extends Migration
{
public function up()
{
$this->addColumn('commande_auto', 'id_point_vente', Schema::TYPE_INTEGER.' NOT NULL') ;
$this->addColumn('commande', 'type', Schema::TYPE_STRING) ;
}

public function down()
{
$this->dropColumn('commande_auto', 'id_point_vente') ;
$this->dropColumn('commande', 'type') ;
}

/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}

public function safeDown()
{
}
*/
}

Загрузка…
Отмена
Сохранить