Bläddra i källkod

Premier commit

master
keun 8 år sedan
incheckning
92e647454c
100 ändrade filer med 3208 tillägg och 0 borttagningar
  1. +3
    -0
      .bowerrc
  2. +27
    -0
      .gitignore
  3. +29
    -0
      .htaccess
  4. +32
    -0
      LICENSE.md
  5. +97
    -0
      README.md
  6. +35
    -0
      backend/assets/AppAsset.php
  7. +2
    -0
      backend/config/.gitignore
  8. +1
    -0
      backend/config/bootstrap.php
  9. +35
    -0
      backend/config/main.php
  10. +4
    -0
      backend/config/params.php
  11. +719
    -0
      backend/controllers/CommandeController.php
  12. +135
    -0
      backend/controllers/PointVenteController.php
  13. +194
    -0
      backend/controllers/ProduitController.php
  14. +87
    -0
      backend/controllers/SiteController.php
  15. +90
    -0
      backend/controllers/StatsController.php
  16. +172
    -0
      backend/controllers/UserController.php
  17. +204
    -0
      backend/controllers/VracController.php
  18. +1
    -0
      backend/models/.gitkeep
  19. +54
    -0
      backend/models/MailForm.php
  20. +2
    -0
      backend/runtime/.gitignore
  21. +374
    -0
      backend/views/commande/index.php
  22. +76
    -0
      backend/views/layouts/main.php
  23. +38
    -0
      backend/views/point-vente/_form.php
  24. +21
    -0
      backend/views/point-vente/create.php
  25. +35
    -0
      backend/views/point-vente/index.php
  26. +21
    -0
      backend/views/point-vente/update.php
  27. +37
    -0
      backend/views/point-vente/view.php
  28. +57
    -0
      backend/views/produit/_form.php
  29. +21
    -0
      backend/views/produit/create.php
  30. +40
    -0
      backend/views/produit/index.php
  31. +21
    -0
      backend/views/produit/update.php
  32. +43
    -0
      backend/views/produit/view.php
  33. +27
    -0
      backend/views/site/error.php
  34. +17
    -0
      backend/views/site/index.php
  35. +29
    -0
      backend/views/site/login.php
  36. +38
    -0
      backend/views/stats/index.php
  37. +29
    -0
      backend/views/user/_form.php
  38. +21
    -0
      backend/views/user/create.php
  39. +45
    -0
      backend/views/user/index.php
  40. +17
    -0
      backend/views/user/liste_mails.php
  41. +42
    -0
      backend/views/user/mail.php
  42. +21
    -0
      backend/views/user/update.php
  43. +47
    -0
      backend/views/user/view.php
  44. +36
    -0
      backend/views/vrac/_form.php
  45. +21
    -0
      backend/views/vrac/create.php
  46. +37
    -0
      backend/views/vrac/index.php
  47. +21
    -0
      backend/views/vrac/update.php
  48. +43
    -0
      backend/views/vrac/view.php
  49. +2
    -0
      backend/web/.gitignore
  50. +8
    -0
      backend/web/.htaccess
  51. Binär
      backend/web/.sass-cache/05bd53ef781f54af58094c8885bd268592fc1542/_alternating-rows-and-columns.scssc
  52. Binär
      backend/web/.sass-cache/05bd53ef781f54af58094c8885bd268592fc1542/_borders.scssc
  53. Binär
      backend/web/.sass-cache/05bd53ef781f54af58094c8885bd268592fc1542/_scaffolding.scssc
  54. Binär
      backend/web/.sass-cache/06e5f5fa55abf0e37cec9d605a5a180e4f6818d3/_compass.scssc
  55. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_appearance.scssc
  56. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_background-clip.scssc
  57. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_background-origin.scssc
  58. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_background-size.scssc
  59. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_border-radius.scssc
  60. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_box-shadow.scssc
  61. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_box-sizing.scssc
  62. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_box.scssc
  63. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_columns.scssc
  64. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_filter.scssc
  65. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_font-face.scssc
  66. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_hyphenation.scssc
  67. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_images.scssc
  68. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_inline-block.scssc
  69. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_opacity.scssc
  70. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_regions.scssc
  71. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_shared.scssc
  72. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_text-shadow.scssc
  73. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_transform.scssc
  74. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_transition.scssc
  75. Binär
      backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_user-interface.scssc
  76. Binär
      backend/web/.sass-cache/2b6cc99073b83b73819259d3543913a0e716a72e/_utilities.scssc
  77. Binär
      backend/web/.sass-cache/37230ded836a6260211efa9c1384ecea3f604ff1/_utilities.scssc
  78. Binär
      backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_color.scssc
  79. Binär
      backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_general.scssc
  80. Binär
      backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_sprites.scssc
  81. Binär
      backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_tables.scssc
  82. Binär
      backend/web/.sass-cache/4c046dbb154ed5e4ecaf3abbbc71118fc23e12da/_contrast.scssc
  83. Binär
      backend/web/.sass-cache/50d897e36e931ff22c8e08ccd81d40559767c305/_hover-link.scssc
  84. Binär
      backend/web/.sass-cache/50d897e36e931ff22c8e08ccd81d40559767c305/_link-colors.scssc
  85. Binär
      backend/web/.sass-cache/50d897e36e931ff22c8e08ccd81d40559767c305/_unstyled-link.scssc
  86. Binär
      backend/web/.sass-cache/57da2fb6f5bd0fd5d4736288da4c6709a845b638/_compass.scssc
  87. Binär
      backend/web/.sass-cache/592fef85924c7076febe2d9db6a3a37ab7526062/_alternating-rows-and-columns.scssc
  88. Binär
      backend/web/.sass-cache/592fef85924c7076febe2d9db6a3a37ab7526062/_borders.scssc
  89. Binär
      backend/web/.sass-cache/592fef85924c7076febe2d9db6a3a37ab7526062/_scaffolding.scssc
  90. Binär
      backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_clearfix.scssc
  91. Binär
      backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_float.scssc
  92. Binär
      backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_hacks.scssc
  93. Binär
      backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_min.scssc
  94. Binär
      backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_reset.scssc
  95. Binär
      backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_tag-cloud.scssc
  96. Binär
      backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_ellipsis.scssc
  97. Binär
      backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_force-wrap.scssc
  98. Binär
      backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_nowrap.scssc
  99. Binär
      backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_replacement.scssc
  100. Binär
      backend/web/.sass-cache/6b26c061761d7a10c869df79b2e08ea1244330ef/_css3.scssc

+ 3
- 0
.bowerrc Visa fil

@@ -0,0 +1,3 @@
{
"directory" : "vendor/bower"
}

+ 27
- 0
.gitignore Visa fil

@@ -0,0 +1,27 @@
# yii console command
# /yii

# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store

# phpunit itself is not needed
phpunit.phar
# local phpunit config
/phpunit.xml

+ 29
- 0
.htaccess Visa fil

@@ -0,0 +1,29 @@
Options -Indexes

#<IfModule mod_rewrite.c>
# RewriteEngine on
# RewriteCond %{REQUEST_URI} !^public
# RewriteRule ^(.*)$ frontend/web/$1 [L]
#</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/
RewriteCond %{REQUEST_URI} admin
RewriteRule .* backend/web/index.php [L]

RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !admin
RewriteRule .* frontend/web/index.php [L]
</IfModule>

# Deny accessing below extensions
<Files ~ "(.json|.lock|.git)">
Order allow,deny
Deny from all
</Files>

# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]

+ 32
- 0
LICENSE.md Visa fil

@@ -0,0 +1,32 @@
The Yii framework is free software. It is released under the terms of
the following BSD License.

Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

+ 97
- 0
README.md Visa fil

@@ -0,0 +1,97 @@
Yii 2 Advanced Application Template
===================================

Yii 2 Advanced Application Template is a skeleton Yii 2 application best for
developing complex Web applications with multiple tiers.

The template includes three tiers: front end, back end, and console, each of which
is a separate Yii application.

The template is designed to work in a team development environment. It supports
deploying the application in different environments.


DIRECTORY STRUCTURE
-------------------

```
common
config/ contains shared configurations
mail/ contains view files for e-mails
models/ contains model classes used in both backend and frontend
console
config/ contains console configurations
controllers/ contains console controllers (commands)
migrations/ contains database migrations
models/ contains console-specific model classes
runtime/ contains files generated during runtime
backend
assets/ contains application assets such as JavaScript and CSS
config/ contains backend configurations
controllers/ contains Web controller classes
models/ contains backend-specific model classes
runtime/ contains files generated during runtime
views/ contains view files for the Web application
web/ contains the entry script and Web resources
frontend
assets/ contains application assets such as JavaScript and CSS
config/ contains frontend configurations
controllers/ contains Web controller classes
models/ contains frontend-specific model classes
runtime/ contains files generated during runtime
views/ contains view files for the Web application
web/ contains the entry script and Web resources
widgets/ contains frontend widgets
vendor/ contains dependent 3rd-party packages
environments/ contains environment-based overrides
tests contains various tests for the advanced application
codeception/ contains tests developed with Codeception PHP Testing Framework
```


REQUIREMENTS
------------

The minimum requirement by this application template that your Web server supports PHP 5.4.0.


INSTALLATION
------------

### Install from an Archive File

Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to
a directory named `advanced` that is directly under the Web root.

Then follow the instructions given in "GETTING STARTED".


### Install via Composer

If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions
at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).

You can then install the application using the following command:

~~~
php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced
~~~


GETTING STARTED
---------------

After you install the application, you have to conduct the following steps to initialize
the installed application. You only need to do these once for all.

1. Run command `init` to initialize the application with a specific environment.
2. Create a new database and adjust the `components['db']` configuration in `common/config/main-local.php` accordingly.
3. Apply migrations with console command `yii migrate`. This will create tables needed for the application to work.
4. Set document roots of your Web server:

- for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://frontend/`
- for backend `/path/to/yii-application/backend/web/` and using the URL `http://backend/`

To login into the application, you need to first sign up, with any of your email address, username and password.
Then, you can login into the application with same email address and password at any time.

+ 35
- 0
backend/assets/AppAsset.php Visa fil

@@ -0,0 +1,35 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/

namespace backend\assets;

use yii\web\AssetBundle;

/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
'../../frontend/web/js/jquery-ui-1.11.4.custom/jquery-ui.min.css',
'../../frontend/web/js/jquery-ui-1.11.4.custom/jquery-ui.theme.css',
'css/screen.css?v=2',
];
public $js = [
'../../frontend/web/js/jquery-ui-1.11.4.custom/jquery-ui.min.js',
'js/lechatdesnoisettes.js?v=2',
];
public $depends = [
'yii\bootstrap\BootstrapAsset',
'yii\web\YiiAsset',
];
}

+ 2
- 0
backend/config/.gitignore Visa fil

@@ -0,0 +1,2 @@
main-local.php
params-local.php

+ 1
- 0
backend/config/bootstrap.php Visa fil

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

+ 35
- 0
backend/config/main.php Visa fil

@@ -0,0 +1,35 @@
<?php
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/params-local.php')
);

return [
'id' => 'app-backend',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => 'commande/index',
'bootstrap' => ['log'],
'modules' => [],
'components' => [
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
],
'params' => $params,
];

+ 4
- 0
backend/config/params.php Visa fil

@@ -0,0 +1,4 @@
<?php
return [
'adminEmail' => 'admin@example.com',
];

+ 719
- 0
backend/controllers/CommandeController.php Visa fil

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

namespace backend\controllers;

use common\models\ProductionProduit;

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\PointVente;
use common\models\Produit;
use common\helpers\CSV ;
use common\models\User ;
use common\models\CommandeProduit;

class CommandeController extends \yii\web\Controller
{
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 ;
}
]
],
],
];
}
public function actionDeleteCommande($date, $id_commande) {
$commande = Commande::find()->where(['id'=>$id_commande])->one();
if($commande) {
$commande->delete() ;
CommandeProduit::deleteAll(['id_commande'=>$id_commande]) ;
}
$this->redirect(['index','date'=>$date]) ;
}
public function gestionFormCommandes($production, $date, $points_vente, $produits, $users) {
if($date != '') {
// commandes
$commandes = Commande::find()
->with('commandeProduits','user')
->joinWith('production')
->where(['production.date'=>$date])
->all() ;
foreach($commandes as $c)
$c->init() ;
foreach($points_vente as $pv) {
$pv->initCommandes($commandes) ;
if(isset($_POST['submit_pv']) && $_POST['submit_pv']) {
// modifs
foreach($pv->commandes as $c) {
// suppression des commande_produit
$commande_produits = CommandeProduit::find()->where(['id_commande'=>$c->id])->all() ;
foreach($commande_produits as $cp) $cp->delete() ;
// création des commande_produit modifiés
foreach($produits as $p) {
$quantite = Yii::$app->getRequest()->post('produit_'.$c->id.'_'.$p->id, 0) ;
if($quantite) {
$commande_produit = new CommandeProduit ;
$commande_produit->id_commande = $c->id ;
$commande_produit->id_produit = $p->id ;
$commande_produit->quantite = $quantite ;
$commande_produit->prix = $p->prix ;
$commande_produit->save() ;
}
}
}
// ajout
//$id_client = Yii::$app->getRequest()->post('user_pv_'.$pv->id, 0) ;
$username = Yii::$app->getRequest()->post('username_pv_'.$pv->id, 0) ;
$date = Yii::$app->getRequest()->post('date_commande_pv_'.$pv->id, 0) ;
$one_product = false ;
foreach($produits as $p) {
$quantite = Yii::$app->getRequest()->post('produit_pv_'.$pv->id.'_'.$p->id, 0) ;
if($quantite) {
$one_product = true ;
}
}

if(strlen($username) && $date && $one_product) {
$commande = new Commande ;
$commande->id_point_vente = $pv->id ;
$commande->id_production = $production->id ;
$commande->id_user = 0 ;
$commande->username = $username ;
$tab_date = explode('/', $date) ;
$commande->date = $tab_date[2].'-'.$tab_date[1].'-'.$tab_date[0].' 00:00:00' ;
$commande->save() ;
foreach($produits as $p) {
$quantite = Yii::$app->getRequest()->post('produit_pv_'.$pv->id.'_'.$p->id, 0) ;
if($quantite) {
$commande_produit = new CommandeProduit ;
$commande_produit->id_commande = $commande->id ;
$commande_produit->id_produit = $p->id ;
$commande_produit->quantite = $quantite ;
$commande_produit->prix = $p->prix ;
$commande_produit->save() ;
}
}
}
}
}
}
}
public function actionIndex($date = '', $return_data = false)
{
$commandes = [] ;
// points de vente
$points_vente = PointVente::find()->all() ;
// produits
$produits = Produit::find()->orderBy('order ASC')->all() ;
// users
$arr_users = [0 => '--'] ;
$users = User::find()->orderBy('prenom, nom ASC')->all() ;
foreach($users as $u) {
$arr_users[$u->id] = $u->prenom. ' '. $u->nom ;
}
// création du jour de production
$production = null ;
if($date != '') {
$production = Production::find()->where(['date' => $date])->one() ;
if(!$production) {
$production = new Production ;
$production->date = $date ;
$production->livraison = 1 ;
$production->save() ;
}
}
// gestion des commandes
$this->gestionFormCommandes($production, $date, $points_vente, $produits, $users) ;
// commandes
$commandes = Commande::find()
->with('commandeProduits','user')
->joinWith('production')
->where(['production.date'=>$date])
->orderBy('date ASC')
->all() ;
$recettes = 0 ;
$recettes_pain = 0 ;
$recettes_vrac = 0 ;
$recettes_pain_livre = 0 ;
$poids_pain = 0 ;
$poids_vrac = 0 ;
foreach($commandes as $c) {
$c->init() ;
$recettes += $c->montant ;
$recettes_pain += $c->montant_pain ;
$recettes_vrac += $c->montant_vrac ;
if($c->id_point_vente != 1)
$recettes_pain_livre += $c->montant_pain ;
$poids_pain += $c->poids_pain ;
$poids_vrac += $c->poids_vrac ;
}
$recettes = number_format($recettes, 2) ;
$recettes_pain = number_format($recettes_pain, 2) ;
$recettes_vrac = number_format($recettes_vrac, 2) ;
// init commandes point de vente
foreach($points_vente as $pv) {
$pv->initCommandes($commandes) ;
}
// gestion produits selec
if(isset($_POST['valider_produit_selec'])) {
if(isset($_POST['Produit'])) {
foreach($produits as $p) {
$produit_production = ProductionProduit::find()->where(['id_production'=>$production->id,'id_produit'=>$p->id])->one() ;
if(!$produit_production) {
$produit_production = new ProductionProduit() ;
$produit_production->id_production = $production->id ;
$produit_production->id_produit = $p->id ;
$produit_production->actif = 0 ;
if(isset($p->quantite_max))
$produit_production->quantite_max = $p->quantite_max ;
$produit_production->save() ;
}
if(isset($_POST['Produit'][$p->id]['actif']))
{
$produit_production->actif = 1 ;
}
else {
$produit_production->actif = 0 ;
}
if((isset($_POST['Produit'][$p->id]['quantite_max']) && $_POST['Produit'][$p->id]['quantite_max'] != ''))
{
$produit_production->quantite_max = (int) $_POST['Produit'][$p->id]['quantite_max'] ;
}
else {
if(isset($p->quantite_max) && is_numeric($p->quantite_max) && $p->quantite_max > 0)
{
$produit_production->quantite_max = $p->quantite_max ;
}
}
$produit_production->save() ;
}
}
}
// init produits sélectionnés pour cette production
$produits_selec = [] ;
if($production) {
$day_production = date('N',strtotime($production->date)) ;
$produits_production = ProductionProduit::find()->where(['id_production'=>$production->id])->all() ;
if(!count($produits_production)) {
foreach($produits as $p) {
$pp = new ProductionProduit() ;
$pp->id_production = $production->id ;
$pp->id_produit = $p->id ;
$pp->actif = 0 ;
if($day_production == 1 && $p->lundi) $pp->actif = 1 ;
if($day_production == 2 && $p->mardi) $pp->actif = 1 ;
if($day_production == 3 && $p->mercredi) $pp->actif = 1 ;
if($day_production == 4 && $p->jeudi) $pp->actif = 1 ;
if($day_production == 5 && $p->vendredi) $pp->actif = 1 ;
if($day_production == 6 && $p->samedi) $pp->actif = 1 ;
if($day_production == 7 && $p->dimanche) $pp->actif = 1 ;
$pp->quantite_max = $p->quantite_max ;
$pp->save() ;
}
}
// produits selec pour production
$produits_selec = ProductionProduit::findProduits($production->id) ;
}
// produit en vrac forcément activé
if($date != '') {
foreach($produits as $p) {
$produit_production = ProductionProduit::find()->where(['id_production'=>$production->id,'id_produit'=>$p->id])->one() ;
if($p->vrac) {
if(!$produit_production) {
$produit_production = new ProductionProduit() ;
$produit_production->id_production = $production->id ;
$produit_production->id_produit = $p->id ;
$produit_production->quantite_max = 0 ;
$produit_production->actif = 1 ;
$produit_production->save() ;
}
else {
$produit_production->actif = 1 ;
$produit_production->save() ;
}
}
}
}
// poids total de la production et CA potentiel
$ca_potentiel = 0 ;
$poids_total = 0 ;
foreach($produits_selec as $id_produit_selec => $produit_selec)
{
if($produit_selec['actif'])
{
foreach($produits as $produit)
{
if($produit->id == $id_produit_selec)
{
//echo $produit->nom.' : '.$produit_selec['quantite_max'].'<br />' ;
$ca_potentiel += $produit_selec['quantite_max'] * $produit->prix ;
$poids_total += $produit_selec['quantite_max'] * $produit->poids ;
}
}
}
}
// jours de production
$jours_production = Production::find()->where(['actif'=>1])->all() ;
$datas = [
'produits' => $produits,
'points_vente' => $points_vente,
'commandes' => $commandes,
'date' => $date,
'production' => $production,
'jours_production' => $jours_production,
'produits_selec' => $produits_selec,
'users' => $arr_users,
'recettes' => $recettes,
'recettes_pain' => $recettes_pain,
'recettes_vrac' => $recettes_vrac,
'recettes_pain_livre' => $recettes_pain_livre,
'poids_pain' => $poids_pain,
'poids_vrac' => $poids_vrac,
'ca_potentiel' => $ca_potentiel,
'poids_total' => $poids_total,
] ;
if($return_data)
{
return $datas ;
}
else {
return $this->render('index', $datas);
}
}
public function actionDownload($date = '', $id_point_vente = 0, $global = 0) {
// commandes
$commandes = Commande::find()
->with('commandeProduits','user')
->joinWith('production')
->where(['production.date'=>$date])
->orderBy('date ASC')
->all() ;
foreach($commandes as $c)
$c->init() ;
// points de vente
$points_vente = PointVente::find()->all() ;
foreach($points_vente as $pv)
$pv->initCommandes($commandes) ;
// produits
$produits = Produit::find()->orderBy('order ASC')->all() ;
$production = Production::find()->where('date LIKE \''.$date.'\'')->one();
$produits_selec = ProductionProduit::findProduits($production->id) ;
/*
* export global
*/
if($global) {
$data = [] ;
$filename = 'export_'.$date.'_global' ;
$num_jour_semaine = date('w',strtotime($date));
$arr_jour_semaine = [0=>'dimanche',1=>'lundi',2=>'mardi', 3=>'mercredi', 4=>'jeudi', 5=>'vendredi', 6=>'samedi'] ;
$champs_horaires_point_vente = 'horaires_'.$arr_jour_semaine[$num_jour_semaine] ;
// header
/*$line = [''] ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$line[] = $p->getLibelleAdmin() ;
}
}
$data[] = $line ;*/
// par point de vente
foreach($points_vente as $pv) {
if(count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) {
//$data[] = [$pv->nom] ;
$line = [$pv->nom, 'Produits', 'Montant', 'Commentaire'] ;
/*foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$line[] = $p->getLibelleAdmin() ;
}
}*/
$data[] = $line ;
$res = $this->contentPointVenteCSV($date, $produits, $points_vente, $pv->id) ;
foreach($res['data'] as $line) {
$data[] = $line ;
}
}
if(count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) {
$line = ['Total pain'] ;
$str_produits = '' ;
foreach($produits as $p) {
if(!$p->vrac && isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes) ;
$str_quantite = '' ;
if($quantite) {
$str_quantite = $quantite ;
$str_produits .= $str_quantite.$p->diminutif.', ' ;
}
}
}
$line[] = substr($str_produits, 0, strlen($str_produits) - 2) ;
$line[] = number_format($pv->recettes_pain,2).' €' ;
$data[] = $line ;
$line = ['Total vrac'] ;
$str_produits = '' ;
foreach($produits as $p) {
if($p->vrac && isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes) ;
$str_quantite = '' ;
if($quantite) {
$str_quantite = $quantite ;
$str_produits .= $str_quantite.$p->diminutif.', ' ;
}
}
}
$line[] = substr($str_produits, 0, strlen($str_produits) - 2) ;
$line[] = number_format($pv->recettes_vrac,2).' €' ;
$data[] = $line ;

$data[] = [] ;
}
}
// récap
//$line = ['Totaux'] ;
// pain
$line = ['Total pain'] ;
$str_produits = '' ;
foreach($produits as $p) {
if(!$p->vrac && isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ;
$str_quantite = '' ;
if($quantite) {
$str_quantite = $quantite ;
$str_produits .= $str_quantite.''.$p->diminutif.', ' ;
}
}
}
$line[] = substr($str_produits, 0, strlen($str_produits)-2) ;
$data[] = $line ;
// vrac
$line = ['Total vrac'] ;
$str_produits = '' ;
foreach($produits as $p) {
if($p->vrac && isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ;
$str_quantite = '' ;
if($quantite) {
$str_quantite = $quantite ;
$str_produits .= $str_quantite.''.$p->diminutif.', ' ;
}
}
}
$line[] = substr($str_produits, 0, strlen($str_produits)-2) ;
$data[] = $line ;
$infos = $this->actionIndex($date, true) ;
// $data[] = [] ;
/*$data[] = [
'CA potentiel boutique',
number_format($infos['ca_potentiel'] - $infos['recettes_pain_livre'], 2).' €',
] ;*/
/*$res = $this->contentRecapCSV($date, $produits, $points_vente, $commandes) ;
$data[] = ['Récapitulatif global'] ;
foreach($res['data'] as $line) {
$data[] = $line ;
}*/
CSV::downloadSendHeaders($filename.'.csv');
echo CSV::array2csv($data);
die();
}
/*
* export individuel
*/
else {
if($commandes && count($commandes)) {
$data = [] ;
// par point de vente
if($id_point_vente) {
$res = $this->contentPointVenteCSV($date, $produits, $points_vente, $id_point_vente) ;
$data = $res['data'] ;
$filename = $res['filename'] ;
}
// récapitulatif
else {
$res = $this->contentRecapCSV($date, $produits, $points_vente, $commandes) ;
$filename = 'recapitulatif_'.$date ;
$data = $res['data'] ;
}
CSV::downloadSendHeaders($filename.'.csv');
echo CSV::array2csv($data);
die();
}
}
}
public function contentRecapCSV($date, $produits, $points_vente, $commandes) {
$data = [] ;
$filename = 'recapitulatif_'.$date ;
$production = Production::find()->where('date LIKE \''.$date.'\'')->one();
$produits_selec = ProductionProduit::findProduits($production->id) ;
// head
$data[0] = ['Lieu'] ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$data[0][] = $p->description ;
}
}
$num_jour_semaine = date('w',strtotime($date));
$arr_jour_semaine = [0=>'dimanche',1=>'lundi',2=>'mardi', 3=>'mercredi', 4=>'jeudi', 5=>'vendredi', 6=>'samedi'] ;
$champs_horaires_point_vente = 'horaires_'.$arr_jour_semaine[$num_jour_semaine] ;
// datas
foreach($points_vente as $pv) {
if(count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) {
$data_add = [$pv->nom] ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$data_add[] = Commande::getQuantiteProduit($p->id, $pv->commandes) ;
}
}
$data[] = $data_add ;
}
}
$data_add = ['Total'] ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$data_add[] = Commande::getQuantiteProduit($p->id, $commandes) ;
}
}
$data[] = $data_add ;
return [
'data' => $data,
'filename' => $filename
] ;
}
public function contentPointVenteCSV($date, $produits, $points_vente, $id_point_vente) {
$data = [] ;
$production = Production::find()->where('date LIKE \''.$date.'\'')->one();
$produits_selec = ProductionProduit::findProduits($production->id) ;
// head
/*$data[0] = ['Client', 'Date commande'] ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$data[0][] = $p->description ;
}
}*/
// datas
foreach($points_vente as $pv) {
if($pv->id == $id_point_vente) {
$filename = 'export_'.$date.'_'.strtolower(str_replace(' ', '-', $pv->nom)) ;
foreach($pv->commandes as $c) {
$str_user = '' ;
// username
if($c->user) {
$str_user = $c->user->prenom." ".$c->user->nom ; //.' - '.date('d/m', strtotime($c->date)) ;
}
else {
$str_user = $c->username ; //.' - '.date('d/m', strtotime($c->date)) ;
}
// téléphone
if(strlen($c->user->telephone)) {
$str_user .= ' ('.$c->user->telephone.')' ;
}
$data_add = [$str_user] ;
// produits
$str_produits = '' ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$add = false ;
foreach($c->commandeProduits as $cp) {
if($p->id == $cp->id_produit) {
$str_produits .= $cp->quantite.''.$p->diminutif.', ' ;
$add = true ;
}
}
}
}
$data_add[] = substr($str_produits, 0, strlen($str_produits) - 2) ;
$data_add[] = number_format($c->montant,2) .' €' ;
$data_add[] = $c->commentaire ;
$data[] = $data_add ;
}
}
}
return [
'data' => $data,
'filename' => $filename
] ;
}
public function actionChangeState($date, $actif) {
// changement état
$production = Production::find()->where(['date' => $date])->one() ;
$production->actif = $actif ;
$production->save() ;
// envoi emails aux personnes qui souhaitent être informées
if($actif)
{
$jour = date('N', strtotime($date)) ;
$arr_jour_semaine = [1=>'lundi',2=>'mardi',3=>'mercredi',4=>'jeudi',5=>'vendredi',6=>'samedi',7=>'dimanche'] ;

$users = User::find()->where('mail_prod_'.$arr_jour_semaine[$jour].' = 1')->all() ;

//$str_date = strtolower(date('l j F', strtotime($date))) ;
setlocale (LC_ALL, "fr_FR");
$str_date = strtolower(strftime('%A%e %B', strtotime($date))) ;
$str_date2 = date('d/m', strtotime($date)) ;

foreach($users as $u)
{
if(!$u->no_mail)
{
Yii::$app->mailer->compose()
->setTo($u->email)
->setFrom(['matthieu@lechatdesnoisettes.com' => 'Le Chat des Noisettes'])
->setSubject('[Le Chat des Noisettes] Production de pain du '.$str_date2)
->setTextBody(
"Bonjour,

Une production de pain est prévue le ".$str_date.".

Cordialement,
Matthieu

PS : Si vous ne souhaitez plus recevoir ces emails, rendez-vous dans votre compte sur www.lechatdesnoisettes.com.
")->send();
}
}
}
$this->redirect(['index','date'=>$date]) ;
}
public function actionChangeLivraison($date, $livraison) {
$production = Production::find()->where(['date' => $date])->one() ;
$production->livraison = $livraison ;
$production->save() ;
$this->redirect(['index','date'=>$date]) ;
}

}

+ 135
- 0
backend/controllers/PointVenteController.php Visa fil

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

namespace backend\controllers;

use Yii;
use yii\filters\AccessControl;
use common\models\PointVente;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\User;

/**
* PointVenteController implements the CRUD actions for PointVente model.
*/
class PointVenteController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ;
}
],
],
],
];
}

/**
* Lists all PointVente models.
* @return mixed
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => PointVente::find(),
]);

return $this->render('index', [
'dataProvider' => $dataProvider,
]);
}

/**
* Displays a single PointVente model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}

/**
* Creates a new PointVente model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new PointVente();

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

/**
* Updates an existing PointVente model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);

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

/**
* Deletes an existing PointVente model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();

return $this->redirect(['index']);
}

/**
* Finds the PointVente model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return PointVente the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = PointVente::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

+ 194
- 0
backend/controllers/ProduitController.php Visa fil

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

namespace backend\controllers;

use common\models\ProductionProduit;

use Yii;
use yii\filters\AccessControl;
use common\models\Produit;
use common\models\Production;
use common\models\User;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\UploadedFile;


/**
* ProduitController implements the CRUD actions for Produit model.
*/
class ProduitController extends Controller
{
var $enableCsrfValidation = false ;
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ;
}
]
],
],
];
}

/**
* Lists all Produit models.
* @return mixed
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => Produit::find()->where('(vrac IS NULL OR vrac = 0)')->orderBy('order ASC'),
]);

return $this->render('index', [
'dataProvider' => $dataProvider,
]);
}

/**
* Displays a single Produit model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}

/**
* Creates a new Produit model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Produit();

if ($model->load(Yii::$app->request->post()) && $model->save()) {
self::uploadFile($model, 'illustration') ;
self::uploadFile($model, 'photo') ;
// on ajoute un enregistrement ProductionProduit pour chaque production
$productions = Production::find()->where('date > '.date('Y-m-d'))->all() ;
foreach($productions as $prod) {
$production_produit = new ProductionProduit ;
$production_produit->id_production = $prod->id ;
$production_produit->id_produit = $model->id ;
$production_produit->actif = 0 ;
$production_produit->save() ;
}
return $this->redirect(['index']);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}

/**
* Updates an existing Produit model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$request = Yii::$app->request ;
$model = $this->findModel($id);
$illustration_filename_old = $model->illustration ;
$photo_filename_old = $model->photo ;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
self::uploadFile($model, 'illustration', $illustration_filename_old) ;
self::uploadFile($model, 'photo', $photo_filename_old) ;
$delete_illustration = $request->post('delete_illustration',0) ;
if($delete_illustration) {
$model->illustration = '' ;
$model->save() ;
}
$delete_photo = $request->post('delete_photo',0) ;
if($delete_photo) {
$model->photo = '' ;
$model->save() ;
}
return $this->redirect(['index']);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
public static function uploadFile($model, $champs, $filename_old = '') {
$file = UploadedFile::getInstance($model, $champs);
if($file) {
$file_name = $file->baseName.'-'.uniqid().'.' . $file->extension ;
$file->saveAs('../../frontend/web/uploads/' . $file_name);
$model->$champs = $file_name ;
}
else {
$model->$champs = $filename_old ;
}
$model->save() ;
}

/**
* Deletes an existing Produit model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();

$productions_produits = ProductionProduit::find()->where(['id_produit'=>$id])->all() ;
foreach($productions_produits as $pp) {
$pp->delete() ;
}
return $this->redirect(['index']);
}

/**
* Finds the Produit model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Produit the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Produit::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

+ 87
- 0
backend/controllers/SiteController.php Visa fil

@@ -0,0 +1,87 @@
<?php
namespace backend\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use common\models\LoginForm;
use common\models\User;
use yii\filters\VerbFilter;

/**
* Site controller
*/
class SiteController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error'],
'allow' => true,
],
[
'actions' => ['logout', 'index'],
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == User::STATUS_ADMIN ;
}
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
}

/**
* @inheritdoc
*/
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
];
}

public function actionIndex()
{
return $this->render('index');
}

public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}

$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
]);
}
}

public function actionLogout()
{
Yii::$app->user->logout();

return $this->goHome();
}
}

+ 90
- 0
backend/controllers/StatsController.php Visa fil

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

namespace backend\controllers;

use yii\web\Controller;
use yii\filters\AccessControl;
use Yii;
use common\models\User;
use common\models\Commande;
use DateTime;
use DateInterval;
use DatePeriod;

class StatsController extends Controller {
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 ;
}
]
],
],
];
}
public function actionIndex() {
/*
* Volume de commande de l'année passée (par mois)
*/
$date_start = date('Y-m-d',time() - 60 * 60 * 24 * 365) ;
$date_end = date('Y-m-d');
$data_pain = [] ;
$data_vrac = [] ;
// labels
$data_labels = [] ;

$start = new DateTime($date_start);
$interval = new DateInterval('P1M');
$end = new DateTime($date_end);
$period = new DatePeriod($start, $interval, $end);
foreach($period as $date) {
$mois = date('m/Y',$date->getTimestamp()) ;
$data_labels[] = $mois ;
$data_pain[$mois] = 0 ;
$data_vrac[$mois] = 0 ;
}
// commandes
$commandes = Commande::find()
->with('commandeProduits')
->joinWith('production')
->where('production.date > '.$date_start)
->all() ;
foreach($commandes as $c) {
$c->init();
$mois = date('m/Y',strtotime($c->production->date)) ;
if(isset($data_pain[$mois]))
{
$data_pain[$mois] += $c->montant_pain ;
$data_vrac[$mois] += $c->montant_vrac ;
}
}
return $this->render('index', [
'data_labels' => $data_labels,
'data_pain' => $data_pain,
'data_vrac' => $data_vrac,
]);
}
}


?>

+ 172
- 0
backend/controllers/UserController.php Visa fil

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

namespace backend\controllers;

use Yii;
use common\models\User;
use backend\models\MailForm;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;

/**
* UserController implements the CRUD actions for User model.
*/
class UserController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
/*'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ;
}*/
]
],
],
];
}

/**
* Lists all User models.
* @return mixed
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => User::find(),
]);

return $this->render('index', [
'dataProvider' => $dataProvider,
]);
}

/**
* Displays a single User model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}

/**
* Creates a new User model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new User();

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

/**
* Updates an existing User model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);

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

/**
* Deletes an existing User model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();

return $this->redirect(['index']);
}

public function actionMail() {
/*$model = new MailForm() ;
$model->subject = '[Le Chat des Noisettes] ' ;
$model->body =
"Bonjour,



PS : Si vous ne souhaitez plus recevoir ces emails, rendez-vous dans votre compte sur www.lechatdesnoisettes.com." ;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$id_user = Yii::$app->request->post('id_user') ;
$user = User::findIdentity($id_user) ;
if($user)
{
$model->sendEmail($user->email) ;
}
}*/
$users = User::find()->all() ;
$arr_users = [] ;
foreach($users as $u)
$arr_users[] = $u->email ;
return $this->render('liste_mails', [
//'model' => $model,
'users' => $arr_users
]);
}
/**
* Finds the User model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return User the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = User::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

+ 204
- 0
backend/controllers/VracController.php Visa fil

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

namespace backend\controllers;

use common\models\ProductionProduit;

use Yii;
use yii\filters\AccessControl;
use common\models\Produit;
use common\models\Production;
use common\models\User;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\UploadedFile;


/**
* ProduitController implements the CRUD actions for Produit model.
*/
class VracController extends Controller
{
var $enableCsrfValidation = false ;
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ;
}
]
],
],
];
}

/**
* Lists all Produit models.
* @return mixed
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => Produit::find()->where('vrac = 1')->orderBy('order ASC'),
]);

return $this->render('index', [
'dataProvider' => $dataProvider,
]);
}

/**
* Displays a single Produit model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}

/**
* Creates a new Produit model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Produit();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
self::uploadFile($model, 'illustration') ;
self::uploadFile($model, 'photo') ;
$model->vrac = 1 ;
$model->lundi = 1 ;
$model->mardi = 1 ;
$model->mercredi = 1 ;
$model->jeudi = 1 ;
$model->vendredi = 1 ;
$model->samedi = 1 ;
$model->dimanche = 1 ;
$model->save() ;
// on ajoute un enregistrement ProductionProduit pour chaque production
$productions = Production::find()->where('date > '.date('Y-m-d'))->all() ;
foreach($productions as $prod) {
$production_produit = new ProductionProduit ;
$production_produit->id_production = $prod->id ;
$production_produit->id_produit = $model->id ;
$production_produit->actif = 0 ;
$production_produit->save() ;
}
return $this->redirect(['index']);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}

/**
* Updates an existing Produit model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$request = Yii::$app->request ;
$model = $this->findModel($id);
$illustration_filename_old = $model->illustration ;
$photo_filename_old = $model->photo ;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
self::uploadFile($model, 'illustration', $illustration_filename_old) ;
self::uploadFile($model, 'photo', $photo_filename_old) ;
$delete_illustration = $request->post('delete_illustration',0) ;
if($delete_illustration) {
$model->illustration = '' ;
$model->save() ;
}
$delete_photo = $request->post('delete_photo',0) ;
if($delete_photo) {
$model->photo = '' ;
$model->save() ;
}
return $this->redirect(['index']);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
public static function uploadFile($model, $champs, $filename_old = '') {
$file = UploadedFile::getInstance($model, $champs);
if($file) {
$file_name = $file->baseName.'-'.uniqid().'.' . $file->extension ;
$file->saveAs('../../frontend/web/uploads/' . $file_name);
$model->$champs = $file_name ;
}
else {
$model->$champs = $filename_old ;
}
$model->save() ;
}

/**
* Deletes an existing Produit model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();

$productions_produits = ProductionProduit::find()->where(['id_produit'=>$id])->all() ;
foreach($productions_produits as $pp) {
$pp->delete() ;
}
return $this->redirect(['index']);
}

/**
* Finds the Produit model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Produit the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Produit::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

+ 1
- 0
backend/models/.gitkeep Visa fil

@@ -0,0 +1 @@
*

+ 54
- 0
backend/models/MailForm.php Visa fil

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

namespace backend\models;

use Yii;
use yii\base\Model;

/**
* ContactForm is the model behind the contact form.
*/
class MailForm extends Model
{
public $subject;
public $body;

/**
* @inheritdoc
*/
public function rules()
{
return [
// name, email, subject and body are required
[['subject', 'body'], 'required', 'message' => 'Champs obligatoire'],
];
}

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'subject' => 'Sujet',
'body' => 'Message',
];
}

/**
* Sends an email to the specified email address using the information collected by this model.
*
* @param string $email the target email address
* @return boolean whether the email was sent
*/
public function sendEmail($email)
{
return Yii::$app->mailer->compose()
->setTo($email)
->setFrom(['matthieu@lechatdesnoisettes.com' => 'Le Chat des Noisettes'])
->setSubject($this->subject)
->setTextBody($this->body)
->send();
}
}

+ 2
- 0
backend/runtime/.gitignore Visa fil

@@ -0,0 +1,2 @@
*
!.gitignore

+ 374
- 0
backend/views/commande/index.php Visa fil

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

use yii\helpers\Html ;
use common\models\Commande ;

$this->title = 'Commande' ;

$cpt_non_vrac = 0 ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
if(!$p->vrac) {
$cpt_non_vrac ++ ;
}
}
}

?>

<div id="page-commande">
<div class="col-md-3">
<?php
// chargement assets
common\components\fullcalendar\FullcalendarWidget::widget() ;
// --> lancement du js en manuel (via lechatdesnoisettes.js)
?>
<div id="calendar"></div>
<?php if($production): ?>
<!-- produits sélectionnés -->
<br />
<form id="produits-production" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index','date'=>$date]); ?>" method="post">
<table class="table table-bordered">
<tbody>
<?php foreach($produits as $p): ?>
<tr<?php if($p->vrac): ?> style="display:none;"<?php endif;?>>
<td><label for="produit-<?php echo $p->id; ?>"><?php if(strlen($p->description)): echo Html::encode($p->description) ; else: echo Html::encode($p->nom) ; endif; ?></label></td>
<td><input id="produit-<?php echo $p->id; ?>" name="Produit[<?php echo $p->id; ?>][actif]" type="checkbox" <?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>checked="checked"<?php endif; ?> /></td>
<td><input class="quantite-max" name="Produit[<?php echo $p->id; ?>][quantite_max]" type="text" value="<?php if(isset($produits_selec[$p->id])) echo $produits_selec[$p->id]['quantite_max'] ; ?>" /></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="submit" name="valider_produit_selec" class="btn btn-default" value="Valider" />
</form>
<?php endif; ?>
</div>
<div class="col-md-9">
<input type="hidden" value="<?php echo $date; ?>" id="current-date" />
<ul id="jours-production">
<?php foreach($jours_production as $j) :?>
<li><?php echo $j->date ; ?></li>
<?php endforeach; ?>
</ul>
<?php if($date != ''): ?>
<h1>
Production du <?php echo date('d/m/Y',strtotime($date)) ; ?>
<div class="btn-group" role="group">
<a class="btn btn-default<?php if($production->actif): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state','date'=>$date,'actif'=>1]); ?>">Activé</a>
<a class="btn btn-default<?php if(!$production->actif): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state','date'=>$date,'actif'=>0]); ?>">Désactivé</a>
</div>
</h1>

<strong>Livraison</strong>
<div class="btn-group" role="group">
<a class="btn btn-default<?php if($production->livraison): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison','date'=>$date,'livraison'=>1]); ?>">Activé</a>
<a class="btn btn-default<?php if(!$production->livraison): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison','date'=>$date,'livraison'=>0]); ?>">Désactivé</a>
</div>
<br /><br />
<?php if(!count($commandes)): ?>
<div class="alert alert-info">Aucune commande passée pour cette date</div>
<?php else: ?>
<a class="btn btn-primary" href="<?php echo Yii::$app->urlManager->createUrl(['commande/download','date'=>$date,'id_point_vente'=>0,'global'=>1]); ?>"><span class="glyphicon glyphicon-download-alt"></span> Récapitulatif global</a>
<br />
<br />
<?php endif;?>

<?php
$num_jour_semaine = date('w',strtotime($date));
$arr_jour_semaine = [0=>'dimanche',1=>'lundi',2=>'mardi', 3=>'mercredi', 4=>'jeudi', 5=>'vendredi', 6=>'samedi'] ;
$champs_horaires_point_vente = 'horaires_'.$arr_jour_semaine[$num_jour_semaine] ;
?>
<?php //if(count($pv->commandes)):?>
<form class="form-commandes-point-vente" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index','date'=>$date]); ?>" method="post">
<!-- <h2><?php //echo Html::encode($pv->nom); ?> <a href="<?php //echo Yii::$app->urlManager->createUrl(['commande/download','date'=>$date,'id_point_vente'=>$pv->id]); ?>" class="btn btn-default">CSV</a></h2> -->
<!-- <p><?php //echo Html::encode($pv->adresse); ?></p> -->
<table class="table table-striped table-bordered">
<thead>
<tr>
<td class="title-point-vente" colspan="<?php echo count($produits)+4; ?>"><strong>Global</strong></td>
</tr>
<tr>
<td></td>
<?php foreach($produits as $p): ?>
<?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>
<td class="center<?php if($p->vrac): ?> vrac<?php endif; ?>">
<strong><?php echo Html::encode($p->getLibelleAdmin()); ?></strong>
</td>
<?php endif; ?>
<?php endforeach; ?>
<td><strong>Potentiel</strong></td>
<td><strong>Commandé</strong></td>
</tr>
<tr>
<td><strong>Pain</strong></td>
<?php
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ;
$str_quantite = '' ;
if($quantite)
$str_quantite = $quantite ;
$classe = 'center total' ;
if($str_quantite > $produits_selec[$p->id]['quantite_max'] && !$produits_selec[$p->id]['vrac']) {
$classe .= ' depasse' ;
}
if($p->vrac) {
$classe .= ' vrac' ;
}
echo '<td class="'.$classe.'"><strong>'.$str_quantite.' <span>' ;
if($produits_selec[$p->id]['quantite_max'] && $str_quantite)
echo '/ '.$produits_selec[$p->id]['quantite_max'].'</span></strong></td>' ;
}
}
?>
<td><strong><?php echo number_format($ca_potentiel,2) ; ?> €</strong><br /><?php echo number_format($poids_total/1000,2) ; ?> kg</td>
<td><strong><?php echo str_replace(' ','&nbsp;',$recettes_pain.' €') ; ?></strong><br /><?php echo round($poids_pain).' kg'; ?></td>
<td></td>
</tr>
<tr>
<td><strong>Vrac</strong></td>
<td colspan="<?php echo $cpt_non_vrac; ?>">
<?php
$first = true ;
foreach($produits as $p) {
if($p->vrac) {
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ;
if($quantite) {
if(!$first)
echo ', ' ;
echo $quantite.'&nbsp;'.Html::encode($p->diminutif) ;
$first = false ;
}
}
}
?>
</td>
<!-- liste vrac -->
<td></td>
<?php
foreach($produits as $p) {
if($p->vrac)
echo '<td class="vrac"></td>' ;
}
?>
<td><strong><?php echo str_replace(' ','&nbsp;',$recettes_vrac.' €') ; ?></strong><br /><?php echo round($poids_vrac).' kg'; ?></td>
<td></td>
</tr>
</thead>
<tbody>
<?php foreach($points_vente as $pv): ?>
<?php
if(strlen($pv->$champs_horaires_point_vente)):
?>
<tr>
<td class="title-point-vente" colspan="<?php echo count($produits)+4; ?>"><?php echo Html::encode($pv->nom); ?></td>
</tr>
<tr>
<td></td>
<?php foreach($produits as $p): ?>
<?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>
<td class="center<?php if($p->vrac): ?> vrac<?php endif; ?>">
<strong><?php echo Html::encode($p->getLibelleAdmin()); ?></strong>
</td>
<?php endif; ?>
<?php endforeach; ?>
<td class="center">
<strong>VRAC</strong>
</td>
<td></td>
<td></td>
</tr>
<?php foreach($pv->commandes as $c): ?>
<tr>
<td>
<?php if(isset($c->user)): ?>
<?php echo Html::encode($c->user->prenom.' '.$c->user->nom) ;?>
<?php else: ?>
<?php echo Html::encode($c->username) ; ?>
<?php endif; ?>
<?php if(strlen($c->commentaire)): ?>
<button type="button" class="btn btn-xs btn-info" data-toggle="popover" title="Commentaire" data-content="<?php echo Html::encode($c->commentaire); ?>"><span class="glyphicon glyphicon-comment"></span></button>
<?php endif; ?>
<br /><span class="date-commande"><?php echo date('d/m/Y à H:i ',strtotime($c->date)) ; if($c->date_update && date('d/m/Y',strtotime($c->date_update)) != date('d/m/Y',strtotime($c->date))): ?><br />modif. <?php echo date('d/m/Y',strtotime($c->date_update)) ; ?><?php endif;?></span>
</td>
<?php
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$add = false ;
$quantite = 0 ;
foreach($c->commandeProduits as $cp) {
if($p->id == $cp->id_produit) {
$quantite = $cp->quantite ;
$add = true ;
}
}
echo '<td class="td-produit'.(($p->vrac) ? ' vrac' : '').'"><input class="quantite" type="text" value="'.$quantite.'" name="produit_'.$c->id.'_'.$p->id.'" /></td>' ;
}
}
?>
<!-- liste vrac -->
<td><?php echo $c->strListeVrac(); ?></td>
<td><?php echo str_replace(' ','&nbsp;',number_format($c->montant,2).' €') ; ?></td>
<td><a href="<?php echo Yii::$app->urlManager->createUrl(['commande/delete-commande','date'=>$date,'delete'=>1,'id_commande'=>$c->id]) ; ?>" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td>
</tr>
<?php endforeach; ?>
<tr>
<td><!-- <select class="select-user" name="user_pv_<?php echo $pv->id;?>">
<?php foreach($users as $id_user => $libelle_user) {
echo '<option value="'.$id_user.'">'.$libelle_user.'</option>' ;
}?>
</select> -->
<input type="text" placeholder="Nom" class="text" name="username_pv_<?php echo $pv->id;?>" />
<br />
<input type="text" name="date_commande_pv_<?php echo $pv->id;?>" class="datepicker" value="<?php echo date('d/m/Y'); ?>" />
</td>
<?php
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
echo '<td class="td-produit'.(($p->vrac) ? ' vrac' : '').'"><input class="quantite" type="text" value="0" name="produit_pv_'.$pv->id.'_'.$p->id.'" /></td>' ;
}
}
?>
<!-- liste vrac -->
<td><a href="javascript:void(0):" class="btn btn-default btn-xs edit-vrac"><i class="glyphicon glyphicon-pencil"></i></a></td>
<td></td>
<td></td>
</tr>
<?php if(count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) {
echo '<tr>' ;
echo '<td><strong>Total pain</strong></td>' ;
//$cpt_non_vrac = 0 ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes) ;
$str_quantite = '' ;
if(!$p->vrac) {
//$cpt_non_vrac ++ ;
if($quantite)
$str_quantite = $quantite ;
}
echo '<td class="center'.(($p->vrac) ? ' vrac' : '').'"><strong>'.$str_quantite.'</strong></td>' ;
}
}
// liste vrac
echo '<td></td>' ;
// total
echo '<td><strong>'.number_format($pv->recettes_pain,2).' €</strong></td><td></td></tr>' ;
/*
* VRAC
*/
echo '<tr>' ;
echo '<td><strong>Total vrac</strong></td>' ;
echo '<td colspan="'.$cpt_non_vrac.'">'.$pv->strListeVrac().'</td>' ;
foreach($produits as $p) {
if($p->vrac)
echo '<td class="vrac"></td>' ;
}
// liste vrac
echo '<td></td>' ;
echo '<td><strong>'.number_format($pv->recettes_vrac,2).' €</strong></td><td></td></tr>' ;
} ?>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<input type="submit" class="btn btn-primary submit-pv" value="Enregistrer" name="submit_pv" />
</form>
<div class="clr"></div>
<?php if(count($commandes) && false): ?>
<h2>Récapitulatif production <a href="<?php echo Yii::$app->urlManager->createUrl(['commande/download','date'=>$date]); ?>" class="btn btn-default">CSV</a></h2>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Lieu</th>
<?php foreach($produits as $p): ?>
<?php if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) : ?>
<th><?php echo Html::encode($p->description); ?></th>
<?php endif; ?>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php
foreach($points_vente as $pv) {
if(count($pv->commandes) && strlen($pv->$champs_horaires_point_vente)) {
echo '<tr>' ;
echo '<td>'.Html::encode($pv->nom).'</td>' ;
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $pv->commandes) ;
$str_quantite = '' ;
if($quantite)
$str_quantite = $quantite ;
echo '<td>'.$str_quantite.'</td>' ;
}
}
echo '</tr>' ;
}
}
?>
</tbody>
<tfoot>
<tr>
<td><strong>Total</strong></td>
<?php
foreach($produits as $p) {
if(isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
$quantite = Commande::getQuantiteProduit($p->id, $commandes) ;
$str_quantite = '' ;
if($quantite)
$str_quantite = $quantite ;
echo '<td class="'.(($p->vrac) ? 'vrac' : '').'">'.$str_quantite.'</td>' ;
}
}
?>
</tr>
</tfoot>
</table>
<?php endif;?>
<?php endif; ?>
</div>
</div>

+ 76
- 0
backend/views/layouts/main.php Visa fil

@@ -0,0 +1,76 @@
<?php
use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;

/* @var $this \yii\web\View */
/* @var $content string */

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?> - Le Chat des Noisettes</title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
<?php
NavBar::begin([
'brandLabel' => 'Le Chat des Noisettes',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);
$menuItems = [
['label' => 'Production', 'url' => ['/commande/index'], 'visible'=> !Yii::$app->user->isGuest],
['label' => 'Pain', 'url' => ['/produit/index'], 'visible'=> !Yii::$app->user->isGuest],
['label' => 'Vrac', 'url' => ['/vrac/index'], 'visible'=> !Yii::$app->user->isGuest],
['label' => 'Points de vente', 'url' => ['/point-vente/index'], 'visible'=> !Yii::$app->user->isGuest],
['label' => 'Utilisateurs', 'url' => ['/user/index'], 'visible'=> !Yii::$app->user->isGuest],
['label' => 'Statistiques', 'url' => ['/stats/index'], 'visible'=> !Yii::$app->user->isGuest],
];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
} else {
$menuItems[] = [
'label' => 'Déconnexion (' . Yii::$app->user->identity->username . ')',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']
];
}
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
]);
NavBar::end();
?>

<div class="container">
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
<?= $content ?>
</div>
</div>

<footer class="footer">
<div class="container">
<p class="pull-left"></p>
<p class="pull-right"><?= Yii::powered() ?></p>
</div>
</footer>

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

+ 38
- 0
backend/views/point-vente/_form.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model backend\models\PointVente */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="point-vente-form">

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

<?php //$form->field($model, 'point_fabrication')->checkbox() ?>
<?= $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]) ?>

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

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

</div>

+ 21
- 0
backend/views/point-vente/create.php Visa fil

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

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;
?>
<div class="point-vente-create">

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

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

</div>

+ 35
- 0
backend/views/point-vente/index.php Visa fil

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

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

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

$this->title = 'Point Ventes';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="point-vente-index">

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

<p>
<?= Html::a('Create Point Vente', ['create'], ['class' => 'btn btn-success']) ?>
</p>

<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
//['class' => 'yii\grid\SerialColumn'],

//'id',
'nom',
'localite',
//'point_fabrication',
//'adresse:ntext',

['class' => 'yii\grid\ActionColumn'],
],
]); ?>

</div>

+ 21
- 0
backend/views/point-vente/update.php Visa fil

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

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';
?>
<div class="point-vente-update">

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

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

</div>

+ 37
- 0
backend/views/point-vente/view.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\models\PointVente */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Point Ventes', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="point-vente-view">

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

<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>

<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'nom',
'adresse:ntext',
],
]) ?>

</div>

+ 57
- 0
backend/views/produit/_form.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\Produit */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="produit-form">

<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>

<?= $form->field($model, 'actif')->radioList([1 => 'Oui',0 => 'Non' ]) ?>
<?= $form->field($model, 'order')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'diminutif')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'recette')->textarea() ?>
<?= $form->field($model, 'saison')->dropDownList(['all' => 'Toutes les saisons', 'printemps' => 'Printemps', 'ete' => 'Été', 'automne' => 'Automne', 'hiver' => 'Hiver']) ; ?>
<?= $form->field($model, 'prix')->textInput() ?>
<?= $form->field($model, 'poids')->textInput() ?>
<?= $form->field($model, 'quantite_max')->textInput() ?>
<?= $form->field($model, 'illustration')->fileInput() ?>
<?php
if(strlen($model->illustration)) {
echo '<img src="../../frontend/web/uploads/'.$model->illustration.'" width="200px" /><br />' ;
echo '<input type="checkbox" name="delete_illustration" id="delete_illustration" /> <label for="delete_illustration">Supprimer l\'illustration</label><br /><br />' ;
}
?>
<?= $form->field($model, 'photo')->fileInput() ?>
<?php
if(strlen($model->photo)) {
echo '<img src="../../frontend/web/uploads/'.$model->photo.'" width="200px" /><br />' ;
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label><br /><br />' ;
}
?>
<h2>Production</h2>
<?= $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 class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

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

</div>

+ 21
- 0
backend/views/produit/create.php Visa fil

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

use yii\helpers\Html;


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

$this->title = 'Create Produit';
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="produit-create">

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

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

</div>

+ 40
- 0
backend/views/produit/index.php Visa fil

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

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

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

$this->title = 'Produits';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="produit-index">

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

<p>
<?= Html::a('Create Produit', ['create'], ['class' => 'btn btn-success']) ?>
</p>

<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
//['class' => 'yii\grid\SerialColumn'],

'order',
'diminutif',
'nom',
//'description',
//'actif',
//'illustration',
// 'photo',
'saison',
// 'prix',
// 'poids',
'actif',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>

</div>

+ 21
- 0
backend/views/produit/update.php Visa fil

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

use yii\helpers\Html;

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

$this->title = 'Update Produit: ' . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="produit-update">

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

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

</div>

+ 43
- 0
backend/views/produit/view.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\DetailView;

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

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="produit-view">

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

<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>

<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'nom',
'description',
'actif',
'illustration',
'photo',
'saison',
'prix',
'poids',
],
]) ?>

</div>

+ 27
- 0
backend/views/site/error.php Visa fil

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

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */

$this->title = $name;
?>
<div class="site-error">

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

<div class="alert alert-danger">
<?= nl2br(Html::encode($message)) ?>
</div>

<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>

</div>

+ 17
- 0
backend/views/site/index.php Visa fil

@@ -0,0 +1,17 @@
<?php
/* @var $this yii\web\View */

$this->title = 'Administration';
?>
<div class="site-index">
<?php
// chargement assets
common\components\fullcalendar\FullcalendarWidget::widget() ;
// --> lancement du js en manuel (via lechatdesnoisettes.js)
?>
<div id="calendar"></div>

</div>

+ 29
- 0
backend/views/site/login.php Visa fil

@@ -0,0 +1,29 @@
<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-login">
<h1><?= Html::encode($this->title) ?></h1>

<p>Please fill out the following fields to login:</p>

<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
<?= $form->field($model, 'email') ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= $form->field($model, 'rememberMe')->checkbox() ?>
<div class="form-group">
<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>

+ 38
- 0
backend/views/stats/index.php Visa fil

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

$this->title = 'Statistiques' ;

use dosamigos\chartjs\ChartJs;

?>

<h2>Recettes des commandes (pain / vrac)</h2>

<?= ChartJs::widget([
'type' => 'Line',
'options' => [
'height' => 400,
'width' => 1100
],
'data' => [
'labels' => $data_labels,
'datasets' => [
[
'fillColor' => "rgba(220,220,220,0.5)",
'strokeColor' => "rgba(220,220,220,1)",
'pointColor' => "rgba(220,220,220,1)",
'pointStrokeColor' => "#fff",
'data' => $data_vrac
],
[
'fillColor' => "rgba(253,212,75,0.5)",
'strokeColor' => "rgba(253,212,75,1)",
'pointColor' => "rgba(253,212,75,1)",
'pointStrokeColor' => "#fff",
'data' => $data_pain
]
]
]
]);

?>

+ 29
- 0
backend/views/user/_form.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\User */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="user-form">

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

<p>Si cette option n'est pas cochée, l'utilisateur ne pourra commander que 3 pains à la fois.</p>
<?= $form->field($model, 'confiance')->checkbox() ?>
<?= $form->field($model, 'nom')->textInput() ?>
<?= $form->field($model, 'prenom')->textInput() ?>
<?= $form->field($model, 'telephone')->textInput() ?>
<?= $form->field($model, 'email')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>

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

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

+ 21
- 0
backend/views/user/create.php Visa fil

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

use yii\helpers\Html;


/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = 'Create User';
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-create">

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

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

</div>

+ 45
- 0
backend/views/user/index.php Visa fil

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

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

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

$this->title = 'Utilisateurs';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">

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

<p>
<?= Html::a('Ajouter un utilisateur', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('<span class="glyphicon glyphicon-envelope"></span> Liste des emails', ['mail'], ['class' => 'btn btn-default']) ?>
</p>

<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
//['class' => 'yii\grid\SerialColumn'],

//'id',
//'username',
//'auth_key',
//'password_hash',
//'password_reset_token',
// 'email:email',
// 'status',
// 'created_at',
// 'updated_at',
'nom',
'prenom',
//'telephone',
//'email',
//'confiance',

['class' => 'yii\grid\ActionColumn'],
],
]); ?>

</div>

+ 17
- 0
backend/views/user/liste_mails.php Visa fil

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

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

$this->title = 'Liste des emails utilisateurs';

?>


<h1><?= count($users); ?> utilisateurs</h1>

<?= implode(', ', $users); ?>


+ 42
- 0
backend/views/user/mail.php Visa fil

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

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

$this->title = 'Envoi d\'un email à tous les utilisateurs';

?>

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

<?php

$form = ActiveForm::begin(['id' => 'email-masse-form','enableClientValidation' => false]); ?>
<?= $form->field($model, 'subject') ?>
<?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>

<div class="form-group">
<label class="control-label">Envoyer à</label>
<p>Cliquer sur les utilisateurs pour modifier leur état.<br />
Légende : <span class="label label-default">à envoyer</span> <span class="label label-danger">ne pas envoyer</span> <span class="label label-success">envoyé</span></p>
<div id="ids-users">
<?php foreach($users as $u): ?>
<a href="javascript:void(0);" class="label <?php if($u->no_mail): ?>label-danger<?php else: ?>label-default<?php endif; ?>" data-send="0" data-id="<?php echo $u->id; ?>"><?php echo Html::encode($u->prenom.' '.$u->nom); ?></a>
<?php endforeach; ?>
</div>
<input name="id_user" type="hidden" value="" />
</div>
<br />

<div class="form-group">
<?= Html::submitButton('Envoyer', ['class' => 'btn btn-default', 'name' => 'email-masse-button']) ?>
</div>
<?php ActiveForm::end(); ?>



+ 21
- 0
backend/views/user/update.php Visa fil

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

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = 'Update User: ' . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="user-update">

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

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

</div>

+ 47
- 0
backend/views/user/view.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view">

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

<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>

<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'username',
'auth_key',
'password_hash',
'password_reset_token',
'email:email',
'status',
'created_at',
'updated_at',
'nom',
'prenom',
'telephone',
'confiance',
],
]) ?>

</div>

+ 36
- 0
backend/views/vrac/_form.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\Produit */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="produit-form">

<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>

<?= $form->field($model, 'actif')->radioList([1 => 'Oui',0 => 'Non' ]) ?>
<?= $form->field($model, 'order')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'diminutif')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'prix')->textInput() ?>
<?= $form->field($model, 'epuise')->checkbox() ?>
<?= $form->field($model, 'photo')->fileInput() ?>
<?php
if(strlen($model->photo)) {
echo '<img src="../../frontend/web/uploads/'.$model->photo.'" width="200px" /><br />' ;
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label><br /><br />' ;
}
?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

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

+ 21
- 0
backend/views/vrac/create.php Visa fil

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

use yii\helpers\Html;


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

$this->title = 'Ajouter vrac';
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="produit-create">

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

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

</div>

+ 37
- 0
backend/views/vrac/index.php Visa fil

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

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

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

$this->title = 'Vrac';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="produit-index">

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

<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
//['class' => 'yii\grid\SerialColumn'],

//'id',
'order',
'diminutif',
'nom',
'epuise',
'actif',
//'illustration',
// 'photo',
// 'saison',
// 'prix',
// 'poids',

['class' => 'yii\grid\ActionColumn'],
],
]); ?>

</div>

+ 21
- 0
backend/views/vrac/update.php Visa fil

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

use yii\helpers\Html;

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

$this->title = 'Modifier vrac #'. $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="produit-update">

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

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

</div>

+ 43
- 0
backend/views/vrac/view.php Visa fil

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

use yii\helpers\Html;
use yii\widgets\DetailView;

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

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="produit-view">

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

<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>

<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'nom',
'description',
'actif',
'illustration',
'photo',
'saison',
'prix',
'poids',
],
]) ?>

</div>

+ 2
- 0
backend/web/.gitignore Visa fil

@@ -0,0 +1,2 @@
/index.php
/index-test.php

+ 8
- 0
backend/web/.htaccess Visa fil

@@ -0,0 +1,8 @@
RewriteEngine on

# if a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward the request to index.php
RewriteRule . index.php

Binär
backend/web/.sass-cache/05bd53ef781f54af58094c8885bd268592fc1542/_alternating-rows-and-columns.scssc Visa fil


Binär
backend/web/.sass-cache/05bd53ef781f54af58094c8885bd268592fc1542/_borders.scssc Visa fil


Binär
backend/web/.sass-cache/05bd53ef781f54af58094c8885bd268592fc1542/_scaffolding.scssc Visa fil


Binär
backend/web/.sass-cache/06e5f5fa55abf0e37cec9d605a5a180e4f6818d3/_compass.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_appearance.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_background-clip.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_background-origin.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_background-size.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_border-radius.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_box-shadow.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_box-sizing.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_box.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_columns.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_filter.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_font-face.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_hyphenation.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_images.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_inline-block.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_opacity.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_regions.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_shared.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_text-shadow.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_transform.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_transition.scssc Visa fil


Binär
backend/web/.sass-cache/2ab931e314902320f054d93b6c55c4185e894dd6/_user-interface.scssc Visa fil


Binär
backend/web/.sass-cache/2b6cc99073b83b73819259d3543913a0e716a72e/_utilities.scssc Visa fil


Binär
backend/web/.sass-cache/37230ded836a6260211efa9c1384ecea3f604ff1/_utilities.scssc Visa fil


Binär
backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_color.scssc Visa fil


Binär
backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_general.scssc Visa fil


Binär
backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_sprites.scssc Visa fil


Binär
backend/web/.sass-cache/375fa841b0238a5719b882c8d635fb90e521f291/_tables.scssc Visa fil


Binär
backend/web/.sass-cache/4c046dbb154ed5e4ecaf3abbbc71118fc23e12da/_contrast.scssc Visa fil


Binär
backend/web/.sass-cache/50d897e36e931ff22c8e08ccd81d40559767c305/_hover-link.scssc Visa fil


Binär
backend/web/.sass-cache/50d897e36e931ff22c8e08ccd81d40559767c305/_link-colors.scssc Visa fil


Binär
backend/web/.sass-cache/50d897e36e931ff22c8e08ccd81d40559767c305/_unstyled-link.scssc Visa fil


Binär
backend/web/.sass-cache/57da2fb6f5bd0fd5d4736288da4c6709a845b638/_compass.scssc Visa fil


Binär
backend/web/.sass-cache/592fef85924c7076febe2d9db6a3a37ab7526062/_alternating-rows-and-columns.scssc Visa fil


Binär
backend/web/.sass-cache/592fef85924c7076febe2d9db6a3a37ab7526062/_borders.scssc Visa fil


Binär
backend/web/.sass-cache/592fef85924c7076febe2d9db6a3a37ab7526062/_scaffolding.scssc Visa fil


Binär
backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_clearfix.scssc Visa fil


Binär
backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_float.scssc Visa fil


Binär
backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_hacks.scssc Visa fil


Binär
backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_min.scssc Visa fil


Binär
backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_reset.scssc Visa fil


Binär
backend/web/.sass-cache/5f77d7f53ef9a7af11eb2463e6a26f8c87f724bc/_tag-cloud.scssc Visa fil


Binär
backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_ellipsis.scssc Visa fil


Binär
backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_force-wrap.scssc Visa fil


Binär
backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_nowrap.scssc Visa fil


Binär
backend/web/.sass-cache/63ae9bd153f67148c32c9bd801c62b5b9d8942a9/_replacement.scssc Visa fil


Binär
backend/web/.sass-cache/6b26c061761d7a10c869df79b2e08ea1244330ef/_css3.scssc Visa fil


Vissa filer visades inte eftersom för många filer har ändrats

Laddar…
Avbryt
Spara