Browse Source

Merge branch 'layout/backend/admin-lte' into dev

refactoring
Guillaume Bourgeois 6 years ago
parent
commit
b60e181a09
75 changed files with 3620 additions and 1215 deletions
  1. +11
    -0
      backend/config/main.php
  2. +3
    -1
      backend/controllers/BackendController.php
  3. +9
    -2
      backend/controllers/CronController.php
  4. +2
    -1
      backend/controllers/OrderController.php
  5. +5
    -5
      backend/controllers/PointSaleController.php
  6. +11
    -10
      backend/controllers/ProductController.php
  7. +10
    -6
      backend/controllers/SiteController.php
  8. +18
    -7
      backend/controllers/StatsController.php
  9. +13
    -13
      backend/controllers/SubscriptionController.php
  10. +18
    -19
      backend/controllers/UserController.php
  11. +5
    -5
      backend/models/CreditForm.php
  12. +2
    -9
      backend/views/communicate/index.php
  13. +4
    -10
      backend/views/development/create.php
  14. +5
    -14
      backend/views/development/index.php
  15. +5
    -10
      backend/views/development/update.php
  16. +281
    -0
      backend/views/layouts/content.php
  17. +160
    -0
      backend/views/layouts/header.php
  18. +108
    -0
      backend/views/layouts/left.php
  19. +71
    -0
      backend/views/layouts/main-login.php
  20. +290
    -0
      backend/views/layouts/main-old.php
  21. +66
    -239
      backend/views/layouts/main.php
  22. +4
    -9
      backend/views/point-sale/create.php
  23. +27
    -12
      backend/views/point-sale/index.php
  24. +5
    -10
      backend/views/point-sale/update.php
  25. +2
    -5
      backend/views/producer-admin/index.php
  26. +4
    -7
      backend/views/producer/billing.php
  27. +3
    -5
      backend/views/producer/update.php
  28. +4
    -10
      backend/views/product/create.php
  29. +12
    -11
      backend/views/product/index.php
  30. +6
    -10
      backend/views/product/update.php
  31. +29
    -12
      backend/views/site/error.php
  32. +77
    -206
      backend/views/site/index.php
  33. +49
    -22
      backend/views/site/login.php
  34. +2
    -5
      backend/views/stats/index.php
  35. +42
    -29
      backend/views/stats/products.php
  36. +4
    -9
      backend/views/subscription/create.php
  37. +77
    -41
      backend/views/subscription/index.php
  38. +4
    -8
      backend/views/subscription/update.php
  39. +4
    -7
      backend/views/user/create.php
  40. +10
    -11
      backend/views/user/credit.php
  41. +7
    -9
      backend/views/user/emails.php
  42. +42
    -73
      backend/views/user/index.php
  43. +13
    -16
      backend/views/user/orders.php
  44. +5
    -10
      backend/views/user/update.php
  45. BIN
      backend/web/.sass-cache/2a0ffb00578c9d5a537db16d14c734a22b18f35c/screen.scssc
  46. +439
    -237
      backend/web/css/screen.css
  47. +4
    -4
      backend/web/js/lechatdesnoisettes.js
  48. +197
    -0
      backend/web/sass/_adminlte.scss
  49. +15
    -0
      backend/web/sass/product/_index.scss
  50. +8
    -27
      backend/web/sass/screen.scss
  51. +34
    -0
      backend/web/sass/site/_index.scss
  52. +5
    -0
      backend/web/sass/stats/_products.scss
  53. +8
    -0
      backend/web/sass/subscription/_index.scss
  54. +2
    -2
      common/components/ActiveRecordCommon.php
  55. +15
    -3
      common/components/MyView.php
  56. +4
    -2
      common/config/main.php
  57. +2
    -2
      common/models/CreditHistory.php
  58. +3
    -3
      common/models/Distribution.php
  59. +3
    -3
      common/models/Order.php
  60. +121
    -0
      common/models/PointSaleSearch.php
  61. +1
    -1
      common/models/Producer.php
  62. +91
    -0
      common/models/ProductSearch.php
  63. +4
    -3
      common/models/Subscription.php
  64. +139
    -0
      common/models/SubscriptionSearch.php
  65. +66
    -2
      common/models/User.php
  66. +123
    -0
      common/models/UserSearch.php
  67. +2
    -1
      composer.json
  68. +370
    -3
      composer.lock
  69. +2
    -2
      frontend/controllers/SiteController.php
  70. +21
    -30
      frontend/models/SignupForm.php
  71. +1
    -0
      vendor/composer/autoload_namespaces.php
  72. +3
    -0
      vendor/composer/autoload_psr4.php
  73. +380
    -1
      vendor/composer/installed.json
  74. +27
    -0
      vendor/yiisoft/extensions.php
  75. +1
    -1
      vendor/yiisoft/yii2/web/User.php

+ 11
- 0
backend/config/main.php View File

@@ -46,6 +46,7 @@ $common_config_main = array_merge(require(__DIR__ . '/../../common/config/main.p

return [
'id' => 'app-backend',
'name' => 'La boîte à pain',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => 'site/index',
@@ -65,6 +66,16 @@ return [
'errorAction' => 'site/error',
],
'urlManager' => $common_config_main['components']['urlManagerBackend'],
'assetManager' => [
'bundles' => [
'dmstr\web\AdminLteAsset' => [
'skin' => 'skin-black',
],
],
],
'view' => [
'class' => 'common\components\MyView',
],
],
'params' => $params,
];

+ 3
- 1
backend/controllers/BackendController.php View File

@@ -38,9 +38,11 @@ termes.

namespace backend\controllers;

use common\models\Producer ;

class BackendController extends \common\controllers\CommonController
{
}

?>

+ 9
- 2
backend/controllers/CronController.php View File

@@ -240,11 +240,16 @@ class CronController extends BackendController
*/
$arrayOrders = Order::searchAll([
'distribution.date' => $date
'distribution.date' => $date,
'distribution.id_producer' => $producer['id']
], [
'conditions' => 'date_delete IS NULL'
]) ;

$configCredit = Producer::getConfig('credit', $producer['id']) ;
foreach($arrayOrders as $order) {
if($order->payment_auto && Producer::getConfig('credit', $order->distribution->id_producer)) {
if($order->payment_auto && $configCredit) {
if ($order->getAmount(Order::AMOUNT_REMAINING) > 0) {
$order->saveCreditHistory(
@@ -265,6 +270,8 @@ class CronController extends BackendController
$arrayOrders = Order::searchAll([
'distribution.date' => $date,
'distribution.id_producer' => $producer['id']
], [
'conditions' => 'date_delete IS NULL'
]) ;
$user = User::searchOne([

+ 2
- 1
backend/controllers/OrderController.php View File

@@ -43,6 +43,7 @@ use common\models\ProductOrder ;
use common\models\Product ;
use common\models\User ;
use common\models\ProductDistribution ;
use common\models\Distribution ;

class OrderController extends BackendController
{
@@ -252,7 +253,7 @@ class OrderController extends BackendController
*/
public function actionIndex($date = '', $returnData = false)
{
if (!Product::count() && !PointSale::count()) {
if (!Product::searchCount() || !PointSale::searchCount()) {
$this->redirect(['site/index', 'error_products_points_sale' => 1]);
}


+ 5
- 5
backend/controllers/PointSaleController.php View File

@@ -83,12 +83,12 @@ class PointSaleController extends BackendController
* @return mixed
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => PointSale::find()->where(['id_producer' => Producer::getId()])
]);
{
$searchModel = new PointSaleSearch() ;
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);

return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
@@ -107,7 +107,7 @@ class PointSaleController extends BackendController
$model->processRestrictedAccess();
return $this->redirect(['index']);
} else {
return $this->render('update', array_merge($this->initForm(), [
return $this->render('create', array_merge($this->initForm(), [
'model' => $model,
]));
}

+ 11
- 10
backend/controllers/ProductController.php View File

@@ -89,16 +89,11 @@ class ProductController extends BackendController
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => Product::find()
->where(['id_producer' => Producer::getId()])
->orderBy('order ASC'),
'pagination' => [
'pageSize' => 1000,
],
]);

$searchModel = new ProductSearch() ;
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
@@ -133,6 +128,8 @@ class ProductController extends BackendController
$productDistribution->active = 0;
$productDistribution->save();
}
Yii::$app->getSession()->setFlash('success', 'Produit <strong>'.Html::encode($model->name).'</strong> ajouté');

return $this->redirect(['index']);
} else {
@@ -166,6 +163,7 @@ class ProductController extends BackendController
$model->save();
}

Yii::$app->getSession()->setFlash('success', 'Produit <strong>'.Html::encode($model->name).'</strong> modifié');
return $this->redirect(['index']);
} else {
return $this->render('update', [
@@ -184,9 +182,12 @@ class ProductController extends BackendController
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
$model = $this->findModel($id) ;
$model->delete();
ProductDistribution::deleteAll(['id_product' => $id]) ;
Yii::$app->getSession()->setFlash('success', 'Produit <strong>'.Html::encode($model->name).'</strong> supprimé');
return $this->redirect(['index']);
}


+ 10
- 6
backend/controllers/SiteController.php View File

@@ -78,7 +78,7 @@ class SiteController extends BackendController
}
],
[
'actions' => ['change-etablissement'],
'actions' => ['change-producer'],
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
@@ -90,7 +90,6 @@ class SiteController extends BackendController
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
@@ -118,7 +117,7 @@ class SiteController extends BackendController
public function actionIndex()
{
// commandes
$distributions = Distribution::find()
$distributionsArray = Distribution::find()
->with('order')
->where(['>=', 'distribution.date', date('Y-m-d')])
->andWhere([
@@ -126,7 +125,7 @@ class SiteController extends BackendController
'distribution.active' => 1
])
->orderBy('date ASC')
->limit(5)
->limit(3)
->all();

// dernières commandes
@@ -149,15 +148,20 @@ class SiteController extends BackendController
->all();

// paramètres
$producer = Producer::get();
$producer = Producer::getCurrent();

$productsCount = Product::searchCount() ;
$pointsSaleCount = PointSale::searchCount() ;
return $this->render('index', [
'distributionsArray' => $distributions,
'distributionsArray' => $distributionsArray,
'ordersArray' => $ordersArray,
'usersArray' => $usersArray,
'nbUsers' => $nbUsers,
'usersNegativeCredit' => $usersNegativeCredit,
'producer' => $producer,
'productsCount' => $productsCount,
'pointsSaleCount' => $pointsSaleCount
]);
}


+ 18
- 7
backend/controllers/StatsController.php View File

@@ -105,10 +105,12 @@ class StatsController extends BackendController
'params' => [':date' => $dateStart]
]) ;

foreach ($ordersArray as $order) {
$month = date('m/Y', strtotime($order->distribution->date));
if (isset($data[$month])) {
$data[$month] += $order->amount;
if($ordersArray) {
foreach ($ordersArray as $order) {
$month = date('m/Y', strtotime($order->distribution->date));
if (isset($data[$month])) {
$data[$month] += $order->amount;
}
}
}

@@ -133,7 +135,7 @@ class StatsController extends BackendController
* @param integer $year
* @return mixed
*/
public function actionProducts($year = 0)
public function actionProducts($year = 0, $section = 1)
{
if(!$year) $year = date('Y') ;
@@ -147,8 +149,14 @@ class StatsController extends BackendController
$dataProducts[self::TOTALS]['orders'][$product['name']] = 0 ;
}
if(!in_array($section, [1, 2, 3, 4])) {
$section = 1 ;
}
$iStart = (3 * ($section - 1)) + 1 ;
$iEnd = 3 * $section ;
$empty = true ;
for($i = 1; $i <= 12; $i++) {
for($i = $iStart; $i <= $iEnd; $i++) {
// Maximums
$resMaximums = Yii::$app->db->createCommand("SELECT product.name, SUM(IF(product_distribution.active, product_distribution.quantity_max,0)) AS total
FROM distribution, product_distribution, product
@@ -210,7 +218,10 @@ class StatsController extends BackendController
'monthArray' => $monthArray,
'productsArray' => $productsArray,
'dataProducts' => $dataProducts,
'empty' => $empty
'empty' => $empty,
'section' => $section,
'iStart' => $iStart,
'iEnd' => $iEnd,
]);
}


+ 13
- 13
backend/controllers/SubscriptionController.php View File

@@ -102,18 +102,15 @@ class SubscriptionController extends BackendController
*/
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => Subscription::find()
->with(['user', 'producer', 'pointSale', 'productSubscription'])
->joinWith(['user'])
->where(['subscription.id_producer' => Producer::getId()])
->orderBy('subscription.id_point_sale ASC, CASE `subscription`.`username` WHEN "" THEN `user`.`name` ELSE `subscription`.`username` END ASC'),
'pagination' => [
'pageSize' => 1000,
],
]);
if (!Product::searchCount() || !PointSale::searchCount()) {
$this->redirect(['site/index', 'error_products_points_sale' => 1]);
}

$searchModel = new SubscriptionSearch ;
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
]);
}
@@ -135,7 +132,8 @@ class SubscriptionController extends BackendController
if ($model->load(Yii::$app->request->post()) && $model->validate()
&& $model->save())
{
$this->redirect(['subscription/index']);
Yii::$app->getSession()->setFlash('success', 'Abonnement ajouté');
return $this->redirect(['subscription/index']);
}

return $this->render('create', [
@@ -198,7 +196,8 @@ class SubscriptionController extends BackendController
$model->date_end = null;
}
if ($model->save()) {
$this->redirect(['subscription/index']);
Yii::$app->getSession()->setFlash('success', 'Abonnement modifié');
return $this->redirect(['subscription/index']);
}
}

@@ -217,7 +216,8 @@ class SubscriptionController extends BackendController
{
ProductSubscription::deleteAll(['id_subscription' => $id]);
Subscription::findOne($id)->delete();
$this->redirect(['subscription/index']);
Yii::$app->getSession()->setFlash('success', 'Abonnement supprimé');
return $this->redirect(['subscription/index']);
}

}

+ 18
- 19
backend/controllers/UserController.php View File

@@ -76,21 +76,19 @@ class UserController extends BackendController
*/
public function actionIndex(
$idPointSale = 0, $sectionInactiveUsers = false)
{
$params = Yii::$app->request->queryParams;
if($idPointSale) {
$params['id_point_sale'] = $idPointSale ;
}
if($sectionInactiveUsers) {
$params['inactive'] = true ;
}
$query = User::findBy($params);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['lastname','name']],
]);
{
$searchModel = new UserSearch ;
$dataProvider = $searchModel->search([
'UserSearch' => array_merge(
[
'id_point_sale' => $idPointSale,
'inactive' => (int) $sectionInactiveUsers
],
isset(Yii::$app->request->queryParams['UserSearch']) ?
Yii::$app->request->queryParams['UserSearch'] :
[]
)
]) ;
$producer = Producer::searchOne([
'id' => Producer::getId()
@@ -99,6 +97,7 @@ class UserController extends BackendController
$pointsSaleArray = PointSale::searchAll() ;

return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'producer' => $producer,
'idPointSaleActive' => $idPointSale,
@@ -224,7 +223,7 @@ class UserController extends BackendController
])->all() ;

$usersArray = [];
foreach ($usersArray as $user) {
foreach ($users as $user) {
if (isset($user['email']) && strlen($user['email']))
$usersArray[] = $user['email'];
}
@@ -233,7 +232,7 @@ class UserController extends BackendController
$pointSale = null ;
if($idPointSale) {
$pointSale = PointSale::findOne(['id' => $idPointSale, 'id_producer' => Producer::getId()]) ;
$pointSale = PointSale::findOne(['id' => $idPointSale]) ;
}

return $this->render('emails', [
@@ -295,11 +294,11 @@ class UserController extends BackendController
{
$user = User::findOne($id);

$orders = Order::searchAll([
$ordersArray = Order::searchAll([
'id_user' => $id
], ['orderby' => 'distribution.date DESC']) ;

return $this->render('commandes', [
return $this->render('orders', [
'ordersArray' => $ordersArray,
'user' => $user
]);

+ 5
- 5
backend/models/CreditForm.php View File

@@ -57,7 +57,7 @@ class CreditForm extends Model
public $id_producer ;
public $type ;
public $amount ;
public $means_payment ;
public $mean_payment ;
public $comment ;
public $send_mail ;

@@ -71,7 +71,7 @@ class CreditForm extends Model
[['id_user', 'id_user_action', 'id_producer'], 'integer'],
[['date','send_mail'], 'safe'],
[['amount'], 'double'],
[['type', 'means_payment', 'comment'], 'string', 'max' => 255],
[['type', 'mean_payment', 'comment'], 'string', 'max' => 255],
];
}

@@ -87,7 +87,7 @@ class CreditForm extends Model
'amount' => 'Montant',
'type' => 'Type',
'id_producer' => 'Producteur',
'means_payment' => 'Moyen de paiement',
'mean_payment' => 'Moyen de paiement',
'comment' => 'Commentaire',
'send_mail' => 'Prévenir l\'utilisateur',
];
@@ -106,13 +106,13 @@ class CreditForm extends Model
$creditHistory->type = $this->type ;
$creditHistory->comment = $this->comment ;
$creditHistory->amount = $this->amount ;
$creditHistory->means_payment = $this->means_payment ;
$creditHistory->mean_payment = $this->mean_payment ;
$creditHistory->save();
// on prévient l'utilisateur que son compte vient d'être crédité
if($this->send_mail) {
$user = User::findOne($this->id_user) ;
$producer = Producer::get() ;
$producer = Producer::getCurrent() ;
$userProducer = UserProducer::searchOne([
'id_user' => $this->id_user
]);

+ 2
- 9
backend/views/communicate/index.php View File

@@ -38,18 +38,11 @@ termes.

use yii\helpers\Html ;

/*
* 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 = 'Communiquer' ;
$this->setTitle('Communiquer') ;
$this->addBreadcrumb('Communiquer') ;

?>

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

<p>Imprimez ce petit encart pour expliquer à vos clients comment passer leurs commandes.</p>
<?php echo $this->render('instructions', ['producer' => $producer]) ; ?>
<p><?php echo Html::a('<span class="glyphicon glyphicon-download-alt"></span> Télécharger', ['communicate/instructions'], ['class'=>'btn btn-primary']) ?></p>

+ 4
- 10
backend/views/development/create.php View File

@@ -38,20 +38,14 @@ termes.

use yii\helpers\Html;

$this->setTitle('Ajouter un développement') ;
$this->addBreadcrumb(['label' => 'Développement', 'url' => ['index']]) ;
$this->addBreadcrumb('Ajouter') ;

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

$this->title = 'Ajouter un développement';
$this->params['breadcrumbs'][] = ['label' => 'Développement', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="development-create">

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

<div class="development-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

+ 5
- 14
backend/views/development/index.php View File

@@ -43,27 +43,18 @@ use common\models\DevelopmentPriority;
use common\models\User;
use common\helpers\Url;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->setTitle('Développement') ;
$this->addButton(['label' => '+', 'url' => ['development/create'], 'class' => 'btn btn-primary']) ;
$this->addBreadcrumb($this->getTitle()) ;

$this->title = 'Développement';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="development-index">

<h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>
<div class="development-index">
<div class="well">
Cette page liste les besoins recencés auprès des producteurs utilisant la plateforme. N'hésitez pas à me <a href="<?= Url::frontend('site/contact') ?>">contacter</a> pour la faire évoluer. Les remontées de bugs sont également bienvenues.<br />
Cette page liste les besoins recencés auprès des producteurs utilisant la plateforme. N'hésitez pas à me <a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/contact']) ; ?>">contacter</a> pour la faire évoluer. Les remontées de bugs sont également bienvenues.<br />
Afin d'orienter de manière pertinente le développement de la plateforme, je vous invite à définir la priorité des évolutions qui vous intéressent.
</div>
<?php
foreach (Yii::$app->session->getAllFlashes() as $key => $message) {
echo '<div class="alert alert-' . $key . '">' . $message . '</div>';
}
?>
<ul id="tab-status-developments" class="nav nav-tabs" role="tablist">
<li role="presentation" class="<?php if($status == Development::STATUS_OPEN): ?>active<?php endif; ?>"><a href="<?= Yii::$app->urlManager->createUrl(['development/index','status' => Development::STATUS_OPEN]); ?>" id="" aria-controls="" role="tab">Ouvert</a></li>
<li role="presentation" class="<?php if($status == Development::STATUS_CLOSED): ?>active<?php endif; ?>"><a href="<?= Yii::$app->urlManager->createUrl(['development/index','status' => Development::STATUS_CLOSED]); ?>" id="" aria-controls="" role="tab">Fermé</a></li>

+ 5
- 10
backend/views/development/update.php View File

@@ -38,20 +38,15 @@ termes.

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model common\models\Developpement */
$this->setTitle('Modifier un développement') ;
$this->addBreadcrumb(['label' => 'Développement', 'url' => ['index']]) ;
$this->addBreadcrumb(['label' => '#'.$model->id, 'url' => ['update', 'id' => $model->id]]) ;
$this->addBreadcrumb('Modifier') ;

$this->title = 'Modifier un développement';
$this->params['breadcrumbs'][] = ['label' => 'Développement', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => '#'.$model->id, 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Modifier';
?>
<div class="development-update">

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

<div class="development-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

+ 281
- 0
backend/views/layouts/content.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\widgets\Breadcrumbs;
use dmstr\widgets\Alert;

?>
<div class="content-wrapper">
<section class="content-header">
<?php if (isset($this->blocks['content-header'])) { ?>
<h1><?= $this->blocks['content-header'] ?></h1>
<?php } else { ?>
<h1>
<?php
if ($this->title !== null) {
echo $this->title;
} else {
echo \yii\helpers\Inflector::camel2words(
\yii\helpers\Inflector::id2camel($this->context->module->id)
);
echo ($this->context->module->id !== \Yii::$app->id) ? '<small>Module</small>' : '';
} ?>
<?php
if(count($this->buttons)) {
foreach($this->buttons as $button) {
echo '<a href="'.Yii::$app->urlManagerBackend->createUrl($button['url']).'" class="'.$button['class'].'">'.$button['label'].'</a>' ;
}
}
?>
</h1>
<?php } ?>

<?=
Breadcrumbs::widget(
[
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]
) ?>
</section>

<section class="content">
<?= Alert::widget() ?>
<?= $content ?>
<div class="clr"></div>
</section>
</div>

<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 2.0
</div>
<strong>Copyright &copy; 2014-2015 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights
reserved.
</footer>

<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<!-- Home tab content -->
<div class="tab-pane" id="control-sidebar-home-tab">
<h3 class="control-sidebar-heading">Recent Activity</h3>
<ul class='control-sidebar-menu'>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-birthday-cake bg-red"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

<p>Will be 23 on April 24th</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-user bg-yellow"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>

<p>New phone +1(800)555-1234</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-envelope-o bg-light-blue"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>

<p>nora@example.com</p>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<i class="menu-icon fa fa-file-code-o bg-green"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>

<p>Execution time 5 seconds</p>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->

<h3 class="control-sidebar-heading">Tasks Progress</h3>
<ul class='control-sidebar-menu'>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Custom Template Design
<span class="label label-danger pull-right">70%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Update Resume
<span class="label label-success pull-right">95%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-success" style="width: 95%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Laravel Integration
<span class="label label-waring pull-right">50%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-warning" style="width: 50%"></div>
</div>
</a>
</li>
<li>
<a href='javascript::;'>
<h4 class="control-sidebar-subheading">
Back End Framework
<span class="label label-primary pull-right">68%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-primary" style="width: 68%"></div>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->

</div>
<!-- /.tab-pane -->

<!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab">
<form method="post">
<h3 class="control-sidebar-heading">General Settings</h3>

<div class="form-group">
<label class="control-sidebar-subheading">
Report panel usage
<input type="checkbox" class="pull-right" checked/>
</label>

<p>
Some information about this general settings option
</p>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Allow mail redirect
<input type="checkbox" class="pull-right" checked/>
</label>

<p>
Other sets of options are available
</p>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Expose author name in posts
<input type="checkbox" class="pull-right" checked/>
</label>

<p>
Allow the user to show his name in blog posts
</p>
</div>
<!-- /.form-group -->

<h3 class="control-sidebar-heading">Chat Settings</h3>

<div class="form-group">
<label class="control-sidebar-subheading">
Show me as online
<input type="checkbox" class="pull-right" checked/>
</label>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Turn off notifications
<input type="checkbox" class="pull-right"/>
</label>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Delete chat history
<a href="javascript::;" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
</label>
</div>
<!-- /.form-group -->
</form>
</div>
<!-- /.tab-pane -->
</div>
</aside><!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class='control-sidebar-bg'></div>

+ 160
- 0
backend/views/layouts/header.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

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

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

<header class="main-header">

<?= Html::a('<span class="logo-mini"><img src="'.Yii::$app->urlManagerBackend->getBaseUrl().'/img/laboulange3.png" /></span><span class="logo-lg"><img src="'.Yii::$app->urlManagerBackend->getBaseUrl().'/img/laboulange3.png" /></span>', Yii::$app->homeUrl, ['class' => 'logo']) ?>

<nav class="navbar navbar-static-top" role="navigation">

<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
</a>

<div class="navbar-custom-menu">
<?php
$usersArray = User::findBy(['id_producer' => Producer::getId()])
->andWhere('CAST(FROM_UNIXTIME(user.created_at) AS date) > \''.date("Y-m-d", strtotime("-7 days")).'\'')
->orderBy('created_at DESC')
->all();
?>
<ul class="nav navbar-nav">
<li class="dropdown users-menu notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user-plus"></i>
<?php if(count($usersArray)): ?><span class="label label-success"><?= count($usersArray) ?></span>
<?php else: ?><span class="label label-warning">0</span><?php endif; ?>
</a>
<ul class="dropdown-menu">
<li class="header">Inscriptions des 7 derniers jours</li>
<li>
<ul class="menu">
<?php foreach($usersArray as $user): ?>
<li>
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['user/update','id' => $user['user_id']]) ; ?>">
<h5><?= Html::encode($user['name'].' '.$user['lastname']) ; ?> <small><i class="fa fa-clock-o"></i> <?= date('d/m/Y à H:i',$user['created_at']); ?></small></h5>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</li>
<?php
$usersNegativeCreditArray = User::findBy(['id_producer' => Producer::getId()])
->andWhere('user_producer.credit < 0')
->orderBy('lastname, name ASC')
->all();

?>
<li class="dropdown users-negative-credit-menu notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-euro"></i>
<?php if(count($usersNegativeCreditArray)): ?><span class="label label-warning"><?= count($usersNegativeCreditArray) ?></span>
<?php else: ?><span class="label label-success">0</span><?php endif; ?>
</a>
<ul class="dropdown-menu">
<li class="header">Utilisateurs au crédit négatif</li>
<li>
<ul class="menu">
<?php foreach($usersNegativeCreditArray as $user): ?>
<li>
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['user/credit','id' => $user['user_id']]) ; ?>">
<h5><?= Html::encode($user['name'].' '.$user['lastname']) ; ?> <small><i class="fa fa-euro"></i> <?= Price::format($user['credit']); ?></small></h5>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</li>
<?php if (User::isCurrentProducer() || User::isCurrentAdmin()): ?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-home"></i>
<span><?= Html::encode(Yii::$app->user->identity->getNameProducer()); ?></span>
</a>
<?php if(User::isCurrentAdmin()): ?>
<ul class="dropdown-menu">
<?php $producersArray = Producer::find()->orderBy('name ASC')->all(); ?>
<?php foreach($producersArray as $producer): ?>
<li><a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/change-producer', 'id' => $producer->id]); ?>"><?= Html::encode($producer->name) ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endif; ?>
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user"></i>
<span class="hidden-xs"><?= Html::encode(User::getCurrent()->name.' '.User::getCurrent()->lastname) ; ?></span>
</a>
<ul class="dropdown-menu">
<li><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['user/update']); ?>"><i class="fa fa-user"></i> Profil</a></li>
<li><a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/logout']); ?>"><i class="fa fa-sign-out"></i> Déconnexion</a></li>
</ul>
</li>

<!-- User Account: style can be found in dropdown.less -->
<li class="link-control-sidebar">
<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
</li>
</ul>
</div>
</nav>
</header>

+ 108
- 0
backend/views/layouts/left.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

?>

<aside class="main-sidebar">

<section class="sidebar">

<?= dmstr\widgets\Menu::widget(
[
'options' => ['class' => 'sidebar-menu tree', 'data-widget'=> 'tree'],
'items' => [
['label' => 'Tableau de bord','icon' => 'dashboard','url' => ['/site/index'], 'visible' => User::isCurrentProducer()],
['label' => 'Distributions','icon' => 'calendar','url' => ['/order/index'], 'visible' => User::isCurrentProducer()],
['label' => 'Abonnements','icon' => 'repeat','url' => ['/subscription/index'], 'visible' => User::isCurrentProducer(), 'active' => Yii::$app->controller->id == 'subscription'],
['label' => 'Produits','icon' => 'clone','url' => ['/product/index'], 'visible' => User::isCurrentProducer(), 'active' => Yii::$app->controller->id == 'product'],
['label' => 'Points de vente','icon' => 'map-marker','url' => ['/point-sale/index'], 'visible' => User::isCurrentProducer(), 'active' => Yii::$app->controller->id == 'point-sale'],
['label' => 'Utilisateurs','icon' => 'users','url' => ['/user/index'], 'visible' => User::isCurrentProducer(), 'active' => Yii::$app->controller->id == 'user'],
['label' => 'Paramètres','icon' => 'cog','url' => ['/producer/update'], 'visible' => User::isCurrentProducer()],
['label' => 'Communiquer','icon' => 'bullhorn','url' => ['/communicate/index'], 'visible' => User::isCurrentProducer()],
[
'label' => 'Statistiques',
'icon' => 'line-chart',
'url' => '#',
'items' => [
['label' => 'Chiffre d\'affaire','icon' => 'line-chart','url' => ['/stats/index'], 'visible' => User::isCurrentProducer()],
['label' => 'Produits','icon' => 'table','url' => ['/stats/products'], 'visible' => User::isCurrentProducer()],
],
],
['label' => 'Développement','icon' => 'wrench','url' => ['/development/index'], 'visible' => User::isCurrentProducer(), 'active' => Yii::$app->controller->id == 'development'],
['label' => 'Mon abonnement','icon' => 'euro','url' => ['/producer/billing'], 'visible' => User::isCurrentProducer()],
['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => User::isCurrentAdmin()],
['label' => 'Producteurs','icon' => 'th-list','url' => ['/producer-admin/index'], 'visible' => User::isCurrentAdmin()],
['label' => 'Outils', 'options' => ['class' => 'header'], 'visible' => User::isCurrentAdmin()],
['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii'], 'visible' => User::isCurrentAdmin()],
['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug'], 'visible' => User::isCurrentAdmin()],
['label' => 'Login', 'url' => ['site/login'], 'visible' => !User::isCurrentConnected()],
/*[
'label' => 'Some tools',
'icon' => 'share',
'url' => '#',
'items' => [
['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii'],],
['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug'],],
[
'label' => 'Level One',
'icon' => 'circle-o',
'url' => '#',
'items' => [
['label' => 'Level Two', 'icon' => 'circle-o', 'url' => '#',],
[
'label' => 'Level Two',
'icon' => 'circle-o',
'url' => '#',
'items' => [
['label' => 'Level Three', 'icon' => 'circle-o', 'url' => '#',],
['label' => 'Level Three', 'icon' => 'circle-o', 'url' => '#',],
],
],
],
],
],
],*/
],
]
) ?>

</section>

</aside>

+ 71
- 0
backend/views/layouts/main-login.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use backend\assets\AppAsset;
use yii\helpers\Html;

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

if (class_exists('backend\assets\AppAsset')) {
backend\assets\AppAsset::register($this);
} else {
app\assets\AppAsset::register($this);
}
dmstr\web\AdminLteAsset::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) ?></title>
<?php $this->head() ?>
</head>
<body class="login-page">

<?php $this->beginBody() ?>

<?= $content ?>

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

+ 290
- 0
backend/views/layouts/main-old.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\models\Producer;
use common\models\User;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\helpers\Url;

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

\common\assets\CommonAsset::register($this);
\backend\assets\AppAsset::register($this);

$producer = null ;
if(!Yii::$app->user->isGuest) {
$producer = Producer::findOne(Producer::getId()) ;
}

?>
<?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">
<meta name="baseurl" content="<?= Yii::$app->urlManagerBackend->baseUrl ; ?>">
<meta name="baseurl-absolute" content="<?= Yii::$app->urlManagerBackend->getHostInfo().Yii::$app->urlManagerBackend->baseUrl; ?>">
<link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon3.png" />
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?> - La boîte à pain</title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
<?php
NavBar::begin([
'brandLabel' => '<img class="logo" src="' . Yii::$app->urlManager->getBaseUrl() . '/img/laboulange3.png" />',
'brandUrl' => Yii::$app->homeUrl,
'innerContainerOptions' => ['class' => 'container-fluid'],
'options' => [
'class' => 'navbar-inverse navbar-fixed-top nav-header',
],
]);

$menuItems = [
[
'label' => '<span class="glyphicon glyphicon-home"></span> Tableau de bord',
'url' => ['/site/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes',
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-repeat"></span> Abonnements',
'url' => ['/subscription/index'],
'visible' => !Yii::$app->user->isGuest
],
]
],
[
'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
'url' => ['/product/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
'url' => ['/point-sale/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-user"></span> Clients',
'url' => ['/user/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-plus"></span>',
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
'url' => ['/communicate/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Mon abonnement',
'url' => ['/producer/billing'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques',
'url' => ['/stats/index'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques produits',
'url' => ['/stats/products'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-wrench"></span> Développement',
'url' => ['/development/index'],
'visible' => !Yii::$app->user->isGuest
],
],
]
];

if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
} else {

if (Yii::$app->user->identity->status == USER::STATUS_ADMIN) {
$menuItems[] = [
'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
'url' => '#',
'items' => [
[
'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs',
'url' => ['producer-admin/index'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
'url' => ['producer-admin/billing'],
'visible' => false,
],
]
];
}

$menuItems[] = [
'label' => '<span class="glyphicon glyphicon-off"></span>',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post', 'title' => 'Déconnexion']
];

$menuItems[] = [
'label' => '<span class="retour-site">Retour sur le site</span>',
'url' => Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $producer->slug]),
];
}
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
'encodeLabels' => false
]);
NavBar::end();
?>

<div class="container-fluid container-body">
<?php if (YII_ENV == 'dev' || YII_ENV == 'demo'): ?>
<div id="env-dev"><?php if (YII_ENV == 'dev'): ?>Dév.<?php elseif (YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
<?php endif; ?>
<?php if (!Yii::$app->user->isGuest): ?>
<div class="name-producer">
<?php if (User::getCurrentStatus() == User::STATUS_PRODUCER): ?>
<span><?= Html::encode(Yii::$app->user->identity->getNameProducer()); ?></span>
<?php elseif (User::getCurrentStatus() == User::STATUS_ADMIN): ?>
<?php $form = ActiveForm::begin(['id' => 'select-producer']); ?>
<?=
Html::dropDownList('select_producer', Producer::getId(), ArrayHelper::map(Producer::find()->orderBy('name ASC')->all(), 'id', function($model, $defaultValue) {
return $model->name;
}));
?>
<?php ActiveForm::end(); ?>
<?php endif; ?>

<?php
$producer = Producer::findOne(Producer::getId());
if (!$producer->active):
?>
<span class="label label-danger" data-toggle="tooltip" data-placement="bottom" data-original-title="Activez votre établissement quand vous le souhaitez afin de la rendre visible à vos clients.">
<?= Html::a('Hors-ligne', ['producer/update']); ?>
</span>
<?php endif; ?>

<div class="clr"></div>
</div>
<?php endif; ?>

<?php if (YII_ENV == 'demo'): ?>
<div id="block-demo">
<div class="container-fluid">
<span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
</div>
</div>
<?php endif; ?>

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

<div id="alerts-fixed"></div>

<footer class="footer">
<div class="container-fluid">
<p class="pull-left">
<a href="<?php echo Url::frontend('site/contact'); ?>">Contact</a> &bull;
<a href="<?php echo Url::frontend('site/mentions'); ?>">Mentions légales</a> &bull;
<a href="<?php echo Url::frontend('site/cgv'); ?>">CGS</a>
<a id="code-source" href="https://framagit.org/guillaume-bourgeois/laboiteapain">Code source <img src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/logo-framagit.png" alt="Hébergé par Framasoft" /> <img src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/logo-gitlab.png" alt="Propulsé par Gitlab" /></a>
</p>
<p class="pull-right"><?= Yii::powered() ?></p>
</div>
</footer>

<?php $this->endBody() ?>

<!-- analytics -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
<?php $this->endPage() ?>

+ 66
- 239
backend/views/layouts/main.php View File

@@ -37,254 +37,81 @@ termes.
*/

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\models\Producer;
use common\models\User;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\helpers\Url;

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

\common\assets\CommonAsset::register($this);
\backend\assets\AppAsset::register($this);

$producer = null ;
if(!Yii::$app->user->isGuest) {
$producer = Producer::findOne(Producer::getId()) ;
}

?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
if (Yii::$app->controller->action->id === 'login') {
/**
* Do not use this code in your template. Remove it.
* Instead, use the code $this->layout = '//main-login'; in your controller.
*/
echo $this->render(
'main-login',
['content' => $content]
);
} else {

\dmstr\web\AdminLteAsset::register($this);
\backend\assets\AppAsset::register($this);

$directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta charset="<?= Yii::$app->charset ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="baseurl" content="<?= Yii::$app->urlManagerBackend->baseUrl ; ?>">
<meta name="baseurl-absolute" content="<?= Yii::$app->urlManagerBackend->getHostInfo().Yii::$app->urlManagerBackend->baseUrl; ?>">
<link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon3.png" />
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?> - La boîte à pain</title>
<?php $this->head() ?>
<title><?= Html::encode($this->title) ?></title>
<link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManagerBackend->getBaseUrl(); ?>/img/favicon3.png" />
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
<?php
NavBar::begin([
'brandLabel' => '<img class="logo" src="' . Yii::$app->urlManager->getBaseUrl() . '/img/laboulange3.png" />',
'brandUrl' => Yii::$app->homeUrl,
'innerContainerOptions' => ['class' => 'container-fluid'],
'options' => [
'class' => 'navbar-inverse navbar-fixed-top nav-header',
],
]);

$menuItems = [
[
'label' => '<span class="glyphicon glyphicon-home"></span> Tableau de bord',
'url' => ['/site/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes',
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-repeat"></span> Abonnements',
'url' => ['/subscription/index'],
'visible' => !Yii::$app->user->isGuest
],
]
],
[
'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
'url' => ['/product/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
'url' => ['/point-sale/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-user"></span> Clients',
'url' => ['/user/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-plus"></span>',
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
'url' => ['/communicate/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Mon abonnement',
'url' => ['/producer/billing'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques',
'url' => ['/stats/index'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques produits',
'url' => ['/stats/products'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-wrench"></span> Développement',
'url' => ['/development/index'],
'visible' => !Yii::$app->user->isGuest
],
],
]
];

if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
} else {

if (Yii::$app->user->identity->status == USER::STATUS_ADMIN) {
$menuItems[] = [
'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
'url' => '#',
'items' => [
[
'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs',
'url' => ['producer-admin/index'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
'url' => ['producer-admin/billing'],
'visible' => false,
],
]
];
}

$menuItems[] = [
'label' => '<span class="glyphicon glyphicon-off"></span>',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post', 'title' => 'Déconnexion']
];

$menuItems[] = [
'label' => '<span class="retour-site">Retour sur le site</span>',
'url' => Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $producer->slug]),
];
}
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
'encodeLabels' => false
]);
NavBar::end();
?>

<div class="container-fluid container-body">
<?php if (YII_ENV == 'dev' || YII_ENV == 'demo'): ?>
<div id="env-dev"><?php if (YII_ENV == 'dev'): ?>Dév.<?php elseif (YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
<?php endif; ?>
<?php if (!Yii::$app->user->isGuest): ?>
<div class="name-producer">
<?php if (User::getCurrentStatus() == User::STATUS_PRODUCER): ?>
<span><?= Html::encode(Yii::$app->user->identity->getNameProducer()); ?></span>
<?php elseif (User::getCurrentStatus() == User::STATUS_ADMIN): ?>
<?php $form = ActiveForm::begin(['id' => 'select-producer']); ?>
<?=
Html::dropDownList('select_producer', Producer::getId(), ArrayHelper::map(Producer::find()->orderBy('name ASC')->all(), 'id', function($model, $defaultValue) {
return $model->name;
}));
?>
<?php ActiveForm::end(); ?>
<?php endif; ?>

<?php
$producer = Producer::findOne(Producer::getId());
if (!$producer->active):
?>
<span class="label label-danger" data-toggle="tooltip" data-placement="bottom" data-original-title="Activez votre établissement quand vous le souhaitez afin de la rendre visible à vos clients.">
<?= Html::a('Hors-ligne', ['producer/update']); ?>
</span>
<?php endif; ?>

<div class="clr"></div>
</div>
<?php endif; ?>

<?php if (YII_ENV == 'demo'): ?>
<div id="block-demo">
<div class="container-fluid">
<span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
</div>
</div>
<?php endif; ?>

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

<div id="alerts-fixed"></div>

<footer class="footer">
<div class="container-fluid">
<p class="pull-left">
<a href="<?php echo Url::frontend('site/contact'); ?>">Contact</a> &bull;
<a href="<?php echo Url::frontend('site/mentions'); ?>">Mentions légales</a> &bull;
<a href="<?php echo Url::frontend('site/cgv'); ?>">CGS</a>
<a id="code-source" href="https://framagit.org/guillaume-bourgeois/laboiteapain">Code source <img src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/logo-framagit.png" alt="Hébergé par Framasoft" /> <img src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/logo-gitlab.png" alt="Propulsé par Gitlab" /></a>
</p>
<p class="pull-right"><?= Yii::powered() ?></p>
</div>
</footer>

<?php $this->endBody() ?>

<!-- analytics -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>
<body class="hold-transition <?= \dmstr\helpers\AdminLteHelper::skinClass() ?> sidebar-mini">
<?php $this->beginBody() ?>
<div class="wrapper">

<?= $this->render(
'header.php',
['directoryAsset' => $directoryAsset]
) ?>

<?= $this->render(
'left.php',
['directoryAsset' => $directoryAsset]
)
?>

<?= $this->render(
'content.php',
['content' => $content, 'directoryAsset' => $directoryAsset]
) ?>

</div>

<?php $this->endBody() ?>
<!-- analytics -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
<?php $this->endPage() ?>
</html>
<?php $this->endPage() ?>
<?php } ?>

+ 4
- 9
backend/views/point-sale/create.php View File

@@ -39,20 +39,15 @@ termes.
use yii\helpers\Html;


/* @var $this yii\web\View */
/* @var $model backend\models\PointVente */
$this->setTitle('Ajouter un point de vente') ;
$this->addBreadcrumb(['label' => 'Points de vente', 'url' => ['index']]) ;
$this->addBreadcrumb('Ajouter') ;

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

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

<div class="point-sale-create">
<?= $this->render('_form', [
'model' => $model,
'users' => $users,
]) ?>

</div>

+ 27
- 12
backend/views/point-sale/index.php View File

@@ -40,17 +40,15 @@ use yii\helpers\Html;
use yii\grid\GridView;
use common\models\PointVenteUser ;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->setTitle('Points de vente') ;
$this->addBreadcrumb($this->getTitle()) ;
$this->addButton(['label' => '+', 'url' => 'point-sale/create', 'class' => 'btn btn-primary']) ;

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

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

<div class="point-sale-index">
<?= GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
'name',
@@ -58,6 +56,7 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'point_production',
'format' => 'raw',
'filter' => [0 => 'Non',1 => 'Oui'],
'value' => function($model) {
if($model->point_production)
{
@@ -70,13 +69,29 @@ $this->params['breadcrumbs'][] = $this->title;
}
],
[
'attribute' => 'delivery',
'label' => 'Livraison',
'filter' => [
'monday' => 'Lundi',
'tuesday' => 'Mardi',
'wednesday' => 'Mercredi',
'thursday' => 'Jeudi',
'friday' => 'Vendredi',
'saterday' => 'Samedi',
'sunday' => 'Dimanche',
],
'value' => function($model) {
return $model->getStrDeliveryDays() ;
}
],
[
'attribute' => 'acces_restreint',
'attribute' => 'access_type',
'label' => 'Accès',
'filter' => [
'open' => 'Ouvert',
'code' => 'Code',
'restricted_access' => 'Accès restreint'
],
'format' => 'raw',
'value' => function($model) {
$count = UserPointSale::find()->where(['id_point_sale' => $model->id])->count();
@@ -118,15 +133,16 @@ $this->params['breadcrumbs'][] = $this->title;
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'actions'],
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'update' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}
@@ -134,5 +150,4 @@ $this->params['breadcrumbs'][] = $this->title;
],
],
]); ?>

</div>

+ 5
- 10
backend/views/point-sale/update.php View File

@@ -38,21 +38,16 @@ termes.

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model backend\models\PointVente */
$this->setTitle('Modifier un point de vente') ;
$this->addBreadcrumb(['label' => 'Points de vente', 'url' => ['index']]) ;
$this->addBreadcrumb(['label' => Html::encode($model->name), 'url' => ['update', 'id' => $model->id]]) ;
$this->addBreadcrumb('Modifier') ;

$this->title = 'Modifier un point de vente';
$this->params['breadcrumbs'][] = ['label' => 'Points de vente', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Html::encode($model->name), 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Modifier';
?>
<div class="point-sale-update">

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

<div class="point-sale-update">
<?= $this->render('_form', [
'model' => $model,
'users' => $users
]) ?>

</div>

+ 2
- 5
backend/views/producer-admin/index.php View File

@@ -41,14 +41,11 @@ use yii\grid\GridView;
use common\models\User ;
use common\models\Producer ;

$this->title = 'Producteurs';
$this->params['breadcrumbs'][] = 'Administration' ;
$this->params['breadcrumbs'][] = $this->title;
$this->setTitle('Producteurs') ;
$this->addBreadcrumb($this->getTitle()) ;

?>

<h1>Producteurs</h1>

<?= GridView::widget([
'dataProvider' => $dataProviderProducer,
'columns' => [

+ 4
- 7
backend/views/producer/billing.php View File

@@ -42,18 +42,15 @@ use common\models\User ;
use common\models\Producer ;
use yii\bootstrap\ActiveForm;

$this->title = 'Mon abonnement';
$this->params['breadcrumbs'][] = 'Administration' ;
$this->params['breadcrumbs'][] = $this->title;
$this->setTitle('Mon abonnement') ;
$this->addBreadcrumb($this->getTitle()) ;

?>

<h1>Mon abonnement</h1>

<p class="">
<div class="well">
Vous seuls savez ce que vous apporte cet outil et dans quelle mesure vous souhaitez le soutenir.<br />
C'est pourquoi le modèle économique est basé sur un prix libre facturé mensuellement.<br />
</p>
</div>

<div id="free-price" class="">

+ 3
- 5
backend/views/producer/update.php View File

@@ -40,14 +40,12 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\helpers\Url ;

/* @var $this yii\web\View */
/* @var $model common\models\User */
$this->setTitle('Paramètres') ;
$this->addBreadcrumb($this->getTitle()) ;

$this->title = 'Paramètres';
$this->params['breadcrumbs'][] = 'Paramètres';
?>

<div class="user-update">
<h1><?= Html::encode($this->title) ?></h1>
<div class="user-form">
<?php $form = ActiveForm::begin(); ?>
<div class="">

+ 4
- 10
backend/views/product/create.php View File

@@ -38,20 +38,14 @@ termes.

use yii\helpers\Html;

$this->setTitle('Ajouter un produit') ;
$this->addBreadcrumb(['label' => 'Produits', 'url' => ['index']]) ;
$this->addBreadcrumb('Ajouter') ;

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

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

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

<div class="product-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

+ 12
- 11
backend/views/product/index.php View File

@@ -40,23 +40,22 @@ use yii\helpers\Html;
use yii\grid\GridView;
use common\helpers\Url ;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->setTitle('Produits') ;
$this->addBreadcrumb($this->getTitle()) ;
$this->addButton(['label' => '+', 'url' => 'product/create', 'class' => 'btn btn-primary']) ;

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

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

<div class="product-index">
<?= GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'order',
'headerOptions' => ['class' => 'order'],
'format' => 'raw',
'filter' => '',
'value' => function($model) {
return '<a class="btn-order btn btn-default" href="javascript:void(0);"><span class="glyphicon glyphicon-resize-vertical"></span></a>' ;
}
@@ -65,6 +64,7 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'photo',
'format' => 'raw',
'headerOptions' => ['class' => 'td-photo'],
'filter' => '',
'value' => function($model) {
if(strlen($model->photo)) {
$url = Yii::$app->urlManagerProducer->getBaseUrl() ;
@@ -80,6 +80,7 @@ $this->params['breadcrumbs'][] = $this->title;
'headerOptions' => ['class' => 'active'],
'contentOptions' => ['class' => 'center'],
'format' => 'raw',
'filter' => [0 => 'Non', 1 => 'Oui'],
'value' => function($model) {
if($model->active)
{
@@ -94,15 +95,16 @@ $this->params['breadcrumbs'][] = $this->title;
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'actions'],
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'update' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}
@@ -110,5 +112,4 @@ $this->params['breadcrumbs'][] = $this->title;
],
],
]); ?>

</div>

+ 6
- 10
backend/views/product/update.php View File

@@ -38,20 +38,16 @@ termes.

use yii\helpers\Html;

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

$this->title = 'Modifier un produit';
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Modifier';
?>
<div class="product-update">
$this->setTitle('Modifier un produit') ;
$this->addBreadcrumb(['label' => 'Produits', 'url' => ['index']]) ;
$this->addBreadcrumb(['label' => $model->name, 'url' => ['update', 'id' => $model->id]]) ;
$this->addBreadcrumb('Modifier') ;

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

<div class="product-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

+ 29
- 12
backend/views/site/error.php View File

@@ -45,19 +45,36 @@ use yii\helpers\Html;

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

<h1><?= Html::encode($this->title) ?></h1>
<div class="error-page">
<h2 class="headline text-info"><i class="fa fa-warning text-yellow"></i></h2>

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

<p>
<?= nl2br(Html::encode($message)) ?>
</p>

<p>
The above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. Thank you.
Meanwhile, you may <a href='<?= Yii::$app->homeUrl ?>'>return to dashboard</a> or try using the search
form.
</p>

<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>
<form class='search-form'>
<div class='input-group'>
<input type="text" name="search" class='form-control' placeholder="Search"/>

<div class="input-group-btn">
<button type="submit" name="submit" class="btn btn-primary"><i class="fa fa-search"></i>
</button>
</div>
</div>
</form>
</div>
</div>

</div>
</section>

+ 77
- 206
backend/views/site/index.php View File

@@ -42,224 +42,98 @@ $this->title = 'Tableau de bord';

?>
<div class="site-index">

<?php if(!$producer->getFreePrice()): ?>
<div class="callout callout-info">
<h4>Abonnement à prix libre</h4>
<p><i>La boîte à pain</i> fonctionne avec système d'abonnement à prix libre pour en
assurer la plus grande diffusion possible. Ceci correspond également à l'unique source de revenus
nécessaire à la maintenance et au développement de la plateforme.<br />
Si cet outil est important dans votre activité, nous vous encourageons à nous soutenir en vous abonnant.
</p>
<p><?= Html::a('&gt; Définir le montant de mon abonnement', ['producer/billing'], ['class' => 'btn btn-default']); ?></p>
</div>
<?php endif; ?>
<?php if(Yii::$app->request->get('error_products_points_sale')): ?>
<div class="alert alert-danger">Vous devez saisir vos produits et vos points de vente
avant d'initialiser vos jours de production.</div>
<div class="alert alert-warning">
Vous devez ajouter <?php if(!$productsCount): ?> des produits<?php endif; ?>
<?php if(!$productsCount && !$pointsSaleCount): ?> et<?php endif; ?>
<?php if(!$pointsSaleCount): ?> un ou des points de vente <?php endif; ?>
avant d'effectuer cette action.
</div>
<?php endif; ?>
<div class="col-md-4">
<!-- commandes -->
<div class="">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Commandes
<?= Html::a('Voir', ['order/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
</h3>
</div>
<div class="panel-body">
<?php if(count($distributionsArray)): ?>
<p>Prochaines distributions : </p>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Date</th>
<th>Commandes</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($distributionsArray as $distribution): ?>
<tr>
<td><?= date('d/m/Y',strtotime($distribution['date'])); ?></td>
<td><?= count($distribution->order); ?></td>
<td>
<?= Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['order/index','date' => $distribution['date']], ['class' => 'btn btn-default btn-xs']) ; ?>
<?php if(count($distribution->order)): ?><?= Html::a('<span class="glyphicon glyphicon-download-alt"></span>', ['order/report','date' => $distribution['date'],'global' => 1], ['class' => 'btn btn-default btn-xs']) ; ?><?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-warning">Aucune production de programmée.</div>
<?php endif; ?>
</div>
<?php if(!$productsCount): ?>
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-clone"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br /><?= Html::a('Ajouter des produits', ['product/create'], ['class' => 'btn btn-default']); ?></span>
</div>
</div>
<?php endif; ?>
<!-- Clients -->
<div class="">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<?= $nbUsers; ?> client<?php if($nbUsers > 1): ?>s<?php endif; ?>
<?= Html::a('Ajouter',['user/create'],['class' => 'btn btn-success btn-xs margin-left']) ; ?>
<?= Html::a('Liste', ['user/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
</h3>
</div>
<div class="panel-body">
<?php if($nbUsers): ?>
<p>Dernières inscriptions :</p>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Prénom, nom</th>
<th>Inscription</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($usersArray as $user): ?>
<tr>
<td><?= Html::encode($user['lastname'].' '.$user['name']) ?></td>
<td><?= date('d/m/Y', $user['created_at']); ?></td>
<td><?= Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['user/update','id' => $user['user_id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-warning">Aucun client.</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Clients crédit négatif -->
<div class="">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Clients au crédit pain négatif
</h3>
</div>
<div class="panel-body">
<?php if(count($usersNegativeCredit)): ?>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Prénom, nom</th>
<th>Crédit pain</th>
</tr>
</thead>
<tbody>
<?php foreach($usersNegativeCredit as $user): ?>
<tr>
<td><?= Html::encode($user['lastname'].' '.$user['name']) ?></td>
<td><?= number_format($user['credit'],2) ?></td>
<td><?= Html::a('<span class="glyphicon glyphicon-euro"></span>', ['user/credit','id' => $user['user_id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-warning">Aucun client.</div>
<?php endif; ?>
</div>
<?php if(!$pointsSaleCount): ?>
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-map-marker"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br /><?= Html::a('Ajouter des points de vente', ['point-sale/create'], ['class' => 'btn btn-default']); ?></span>
</div>
</div>
<?php endif; ?>
<!-- Paramètres -->
<div class="">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Paramètres
<?= Html::a('Configurer',['producer/update'],['class' => 'btn btn-default btn-xs']) ; ?>
</h3>
</div>
<div class="panel-body">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Configuration</th>
<th>Valeur</th>
</tr>
</thead>
<tbody>
<tr>
<td>Producteur activé</td>
<td>
<?php if($producer->active): ?>
<span class="label label-success">Active</span>
<?php else: ?>
<span class="label label-danger">Hors-ligne</span>
<?php endif; ?>
</td>
</tr>
<tr>
<td>Producteur protégé par un code</td>
<td>
<?php if(strlen($producer->code)): ?>
<span class="label label-success">Oui</span><br />
<strong><?= Html::encode($producer->code) ?></strong>
<?php else: ?>
<span class="label label-danger">Non</span>
<?php endif; ?>
</td>
</tr>
<tr>
<td>Délai de commande</td>
<td><?= $producer->order_delay ?> jour<?php if($producer->order_delay > 1): ?>s<?php endif; ?></td>
</tr>
<tr>
<td>Heure limite de commande</td>
<td><?= $producer->order_deadline ?>h</td>
</tr>
<tr>
<td>Système de Crédit activé</td>
<td>
<?php if($producer->credit): ?>
<span class="label label-success">Oui</span><br />
<?php else: ?>
<span class="label label-danger">Non</span>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
</div>
<?php if($productsCount && $pointsSaleCount && !count($distributionsArray)): ?>
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-calendar"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br /><?= Html::a('Ajouter des jours de distribution', ['order/index'], ['class' => 'btn btn-default']); ?></span>
</div>
</div>

<!-- Mon abonnement -->
<div class="" id="billing">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Mon abonnement
<?= Html::a('Voir',['producer/billing'],['class' => 'btn btn-default btn-xs']) ; ?>
</h3>
</div>
<div class="panel-body">
<div class="col-md-12">
<?php if(is_null($producer->free_price)): ?>
<h2>Prix libre</h2>
<p>Le modèle économique de <em>La boîte à pain</em> est basé sur un système de prix libre. <?= Html::a('En savoir plus',['producer/billing']); ?></p>
<?php else: ?>
<h2><?= $producer->getFreePrice() ?> / mois <?= Html::a('Modifier',['producer/billing'],['class' => 'btn btn-xs btn-primary']) ?></h2>
<?php endif; ?>
<?php endif; ?>
<div id="distributions">
<!-- distributions -->
<?php if(count($distributionsArray)): ?>
<?php foreach($distributionsArray as $distribution): ?>
<div class="col-md-4 col-sm-12 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-green date">
<span class="day"><?= strftime('%A', strtotime($distribution->date)) ?></span>
<span class="num"><?= date('d', strtotime($distribution->date)) ?></span>
<span class="month"><?= strftime('%B', strtotime($distribution->date)) ?></span>
</span>
<div class="info-box-content">
<span class="info-box-text">
<?php if(count($distribution->order)): ?>
<strong><?= count($distribution->order); ?></strong> COMMANDES
<?php else: ?>
AUCUNE COMMANDE
<?php endif; ?>
</span>
<span class="info-box-number"></span>
<div class="buttons">
<?= Html::a('<span class="fa fa-eye"></span>', ['order/index', 'date' => $distribution->date], ['class' => 'btn btn-default']); ?>
<?php if(count($distribution->order)): ?><?= Html::a('<span class="fa fa-download"></span>', ['order/report', 'date' => $distribution->date], ['class' => 'btn btn-default']); ?><?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="col-md-8">
<!-- dernières commandes -->
<div id="last-orders" class="">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Dernières commandes clients
</h3>
</div>
<div class="panel-body">
<?php if(count($ordersArray)): ?>
<div class="clr"></div>
<!-- dernières commandes -->
<?php if(is_array($ordersArray) && count($ordersArray)): ?>
<div id="last-orders" class="">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Commandes à venir
</h3>
</div>
<div class="panel-body">
<table class="table table-condensed table-bordered">
<thead>
<tr>
@@ -294,11 +168,8 @@ $this->title = 'Tableau de bord';
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-warning">Aucune commande</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>

+ 49
- 22
backend/views/site/login.php View File

@@ -36,6 +36,7 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/


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

@@ -43,29 +44,55 @@ use yii\bootstrap\ActiveForm;
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

$this->title = 'Connexion';
$this->params['breadcrumbs'][] = $this->title;
$this->title = 'Sign In';

$fieldOptions1 = [
'options' => ['class' => 'form-group has-feedback'],
'inputTemplate' => "{input}<span class='glyphicon glyphicon-envelope form-control-feedback'></span>"
];

$fieldOptions2 = [
'options' => ['class' => 'form-group has-feedback'],
'inputTemplate' => "{input}<span class='glyphicon glyphicon-lock form-control-feedback'></span>"
];
?>
<div class="site-login">
<h1><?= Html::encode($this->title) ?></h1>

<div class="row">
<div class="col-lg-5">
<?php if(YII_ENV == 'demo') : ?>
<div class="alert alert-warning">
Identifiant : <strong>producteur@laboiteapain.net</strong><br />
Mot de passe : <strong>laboiteapain</strong>
</div>
<?php endif; ?>
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
<?= $form->field($model, 'email') ?>
<?= $form->field($model, 'password')->passwordInput() ?>

<div class="login-box">
<div class="login-logo">
<img src="<?= Yii::$app->urlManagerBackend->getBaseUrl(); ?>/img/laboulange4.png" />
La boîte à pain
</div>
<!-- /.login-logo -->
<div class="login-box-body">

<?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>

<?= $form
->field($model, 'email', $fieldOptions1)
->label(false)
->textInput(['placeholder' => $model->getAttributeLabel('username')]) ?>

<?= $form
->field($model, 'password', $fieldOptions2)
->label(false)
->passwordInput(['placeholder' => $model->getAttributeLabel('password')]) ?>

<div class="row">
<div class="col-xs-8">
<?= $form->field($model, 'rememberMe')->checkbox() ?>
<div class="form-group">
<?= Html::submitButton('Connexion', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<!-- /.col -->
<div class="col-xs-4">
<?= Html::submitButton('Connexion', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']) ?>
</div>
<!-- /.col -->
</div>


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

<a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/request-password-reset']) ; ?>">J'ai oublié mon mot de passe</a><br>

</div>
</div>
<!-- /.login-box-body -->
</div><!-- /.login-box -->

+ 2
- 5
backend/views/stats/index.php View File

@@ -36,16 +36,13 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

$this->title = 'Statistiques' ;

use dosamigos\chartjs\ChartJs;

$this->params['breadcrumbs'][] = 'Statistiques';
$this->setTitle('Statistiques <small>Chiffre d\'affaire</small>') ;
$this->addBreadcrumb($this->getTitle()) ;

?>

<h1>Statistiques</h1>

<?= ChartJs::widget([
'type' => 'line',
'options' => [

+ 42
- 29
backend/views/stats/products.php View File

@@ -37,35 +37,40 @@ termes.
*/

use \backend\controllers\StatsController ;
use yii\helpers\Html;

$this->title = 'Statistiques produits' ;
$this->params['breadcrumbs'][] = 'Statistiques produits';
$this->setTitle('Statistiques <small>Produits '.$year.'</small>', 'Statistiques produits '.$year) ;
$this->addBreadcrumb('Statistiques produits '.$year) ;
$this->addButton(['label' => '&lt; '.($year - 1), 'url' => ['stats/products','year' => $year - 1], 'class' => 'btn btn-default']) ;
$this->addButton(['label' => ($year + 1).' &gt;', 'url' => ['stats/products','year' => $year + 1], 'class' => 'btn btn-default']) ;

$theMonth = 1 ;

?>
<div class="stats-products">
<h1>Statistiques produits <?= $year ?>
<div id="nav-year">
<a class="btn btn-default" href="<?= Yii::$app->urlManager->createUrl(['stats/products','year' => $year - 1]); ?>">&lt; <?= ($year - 1) ?></a>
<a class="btn btn-default" href="<?= Yii::$app->urlManager->createUrl(['stats/products','year' => $year + 1]); ?>"><?= ($year + 1) ?> &gt;</a>
</div>
</h1>
<?php if($empty): ?>
<div class="alert alert-warning">Aucune statistique disponible pour cette période</div>
<?php else: ?>
<table id="table-stats-products" class="table table-bordered table-hover header-fixed">
<thead>
<tr class="mois">
<th></th>
<?php foreach($monthArray as $month): ?>
<th colspan="2"><?= $month; ?></th>
<?php endforeach; ?>
<?php foreach($monthArray as $key => $month):
if(($key + 1) >= $iStart && ($key + 1) <= $iEnd):
?>
<th colspan="2">
<?php if($section != 1 && $key + 1 == $iStart): echo Html::a('&lt;', ['stats/products', 'year' => $year, 'section' => $section - 1], ['class' => 'btn btn-default']) ; ?><?php endif; ?>
<?= $month; ?>
<?php if($key + 1 == $iEnd && $section != 4): echo Html::a('&gt;', ['stats/products', 'year' => $year, 'section' => $section + 1], ['class' => 'btn btn-default']) ; ?><?php endif; ?>
</th>
<?php
endif;
endforeach;
?>
<th colspan="2">Totaux</th>
</tr>
<tr class="sub-head">
<th></th>
<?php for($i=1; $i<=13; $i++): ?>
<?php for($i=$iStart; $i<=$iEnd + 1; $i++): ?>
<th>Maximum</th>
<th>Commandés</th>
<?php endfor; ?>
@@ -76,6 +81,7 @@ $this->params['breadcrumbs'][] = 'Statistiques produits';
<tr>
<td class="name"><?= Html::encode($currentProduct['name']) ?></td>
<?php foreach($dataProducts as $month => $productsMonthArray):
$findMax = false ;
$findOrders = false ;
?>
@@ -83,14 +89,14 @@ $this->params['breadcrumbs'][] = 'Statistiques produits';
<!-- max -->
<?php
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($currentProduct['name']).' / '.$monthArray[$month - 1] .' '. $year.' / Maximum"' ;
$tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / '.$monthArray[$month - 1] .' '. $year.' / Maximum"' ;
foreach($productsMonthArray['max'] as $product):
?>
<?php if($product['name'] == $currentProduct['name']):
$findMax = true ;
?>
<td class="align-center">
<div <?= $tooltip; ?>><?= $product['total'] ?></div>
<div <?= $tooltip; ?>><?= (int) $product['total'] ?></div>
</td>
<?php endif; ?>
<?php endforeach; ?>
@@ -98,14 +104,14 @@ $this->params['breadcrumbs'][] = 'Statistiques produits';

<!-- commandes -->
<?php
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($currentProduct['name']).' / '. $monthArray[$month - 1] . ' '. $year .' / Commandés"' ;
$tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / '. $monthArray[$month - 1] . ' '. $year .' / Commandés"' ;
foreach($productsMonthArray['orders'] as $product):
?>
<?php if($product['name'] == $currentProduct['name']):
$findOrders = true ;
?>
<td class="align-center">
<div <?= $tooltip ?> ><?= $product['total'] ?></div>
<div <?= $tooltip ?> ><?= (int) $product['total'] ?></div>
</td>
<?php endif; ?>
<?php endforeach; ?>
@@ -115,35 +121,42 @@ $this->params['breadcrumbs'][] = 'Statistiques produits';
<?php else: ?>
<!-- totaux max -->
<?php
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Maximums"' ;
$tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Maximums"' ;
foreach($dataProducts[StatsController::TOTALS]['max'] as $productName => $totalMax):
?>
<?php if($productName == $currentProduct['name']): ?>
<?php
if($productName == $currentProduct['name']):
$findMax = true ;
?>
<td class="align-center">
<div <?= $tooltip ?> ><?= $totalMax ?></div>
<div <?= $tooltip ?> ><?= (int) $totalMax ?></div>
</td>
<?php endif; ?>
<?php endforeach; ?>

<?php if(!$findMax): ?><td class="align-center"><div <?= $tooltip; ?>>0</div></td><?php endif; ?>
<!-- totaux commandés -->
<?php
$tooltip = 'data-toggle="tooltip" data-placement="top" data-original-title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Commandés"' ;
$tooltip = 'data-toggle="tooltip" data-placement="top" title="'.Html::encode($currentProduct['name']).' / Total '. $year .' / Commandés"' ;
foreach($dataProducts[StatsController::TOTALS]['orders'] as $productName => $totalOrders):
?>
<?php if($productName == $currentProduct['name']): ?>
<?php if($productName == $currentProduct['name']):
$findOrders = true ;
?>
<td class="align-center">
<div <?= $tooltip ?> ><?= $totalOrders ?></div>
<div <?= $tooltip ?> ><?= (int) $totalOrders ?></div>
</td>
<?php endif; ?>
<?php endforeach; ?>
<?php if(!$findOrders): ?><td class="align-center"><div <?= $tooltip ?> >0</div></td><?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>

</div>

+ 4
- 9
backend/views/subscription/create.php View File

@@ -38,20 +38,15 @@ termes.

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model app\models\Produit */
$this->setTitle('Ajouter un abonnement') ;
$this->addBreadcrumb(['label' => 'Abonnements', 'url' => ['index']]) ;
$this->addBreadcrumb('Ajouter') ;

$this->title = 'Ajouter un abonnement';
$this->params['breadcrumbs'][] = ['label' => 'Abonnements', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Ajouter';
?>
<div class="subscription-create">
<h1><?= Html::encode($this->title) ?></h1>

<div class="subscription-create">
<?= $this->render('_form', [
'model' => $model,
'productsArray' => $productsArray
]) ?>

</div>

+ 77
- 41
backend/views/subscription/index.php View File

@@ -39,21 +39,21 @@ termes.
use yii\helpers\Html;
use yii\grid\GridView;

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

$this->title = 'Abonnements';
$this->params['breadcrumbs'][] = $this->title;
$this->setTitle('Abonnements') ;
$this->addBreadcrumb($this->getTitle()) ;
$this->addButton(['label' => '+', 'url' => 'subscription/create', 'class' => 'btn btn-success']) ;

?>
<div class="subscription-index">

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

<?= GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_user',
'attribute' => 'username',
'label' => 'Utilisateur',
'format' => 'raw',
'value' => function($model) {
if(strlen($model->username))
@@ -68,20 +68,19 @@ $this->params['breadcrumbs'][] = $this->title;
}
],
[
'attribute' => 'id_point_sale',
'format' => 'raw',
'value' => function($model) {
return Html::encode($model->pointSale->name) ;
}
],
[
'attribute' => 'products',
'attribute' => 'product_name',
'label' => 'Produits',
'format' => 'raw',
'value' => function($model) {
$html = '' ;
foreach($model->productSubscription as $productSubscription)
{
$html .= $productSubscription->quantity . ' x '.Html::encode($productSubscription->product->name).'<br />' ;
if(isset($productSubscription->product)) {
$html .= $productSubscription->quantity . '&nbsp;x&nbsp;'.Html::encode($productSubscription->product->name).'<br />' ;
}
else {
$html .= 'Produit non défini<br />' ;
}
}
// aucun produit
@@ -94,78 +93,115 @@ $this->params['breadcrumbs'][] = $this->title;
}
],
[
'attribute' => 'date_begin',
'attribute' => 'id_point_sale',
'label' => 'Point de vente',
'format' => 'raw',
'filter' => ArrayHelper::map(PointSale::find()->where(['id_producer' => Producer::getId()])->asArray()->all(), 'id', 'name'),
'value' => function($model) {
return date('d/m/Y',strtotime($model->date_begin)) ;
return Html::encode($model->pointSale->name) ;
}
],
[
'attribute' => 'date_end',
'attribute' => 'date_begin',
'label' => 'Date de début',
'format' => 'raw',
'value' => function($model) {
if($model->date_end)
return date('d/m/Y',strtotime($model->date_end)) ;
else
return 'indéterminée' ;
$html = date('d/m/Y',strtotime($model->date_begin)) ;
return $html ;
}
],
[
'attribute' => 'monday',
'attribute' => 'day',
'label' => 'Jours',
'format' => 'raw',
'filter' => [
'monday' => 'Lundi',
'tuesday' => 'Mardi',
'wednesday' => 'Mercredi',
'thursday' => 'Jeudi',
'friday' => 'Vendredi',
'saterday' => 'Samedi',
'sunday' => 'Dimanche',
],
'contentOptions' => ['class' => 'text-small'],
'value' => function($model) {
$html = '' ;
if($model->monday)
if($model->monday) {
$html .= 'lundi, ' ;
if($model->tuesday)
}
if($model->tuesday) {
$html .= 'mardi, ' ;
if($model->wednesday)
}
if($model->wednesday) {
$html .= 'mercredi, ' ;
if($model->thursday)
}
if($model->thursday) {
$html .= 'jeudi, ' ;
if($model->friday)
}
if($model->friday) {
$html .= 'vendredi, ' ;
if($model->saturday)
}
if($model->saturday) {
$html .= 'samedi, ' ;
if($model->sunday)
}
if($model->sunday) {
$html .= 'dimanche, ' ;
}
if(strlen($html))
if(strlen($html)) {
return substr ($html, 0, strlen($html) - 2) ;
else
}
else {
return '<span class="glyphicon glyphicon-warning-sign"></span> Aucun jour' ;
}
}
],
[
'attribute' => 'week_frequency',
'filter' => [
1 => 'Toutes les semaines',
2 => 'Toutes les 2 semaines',
3 => 'Toutes les 3 semaines',
4 => 'Tous les mois'],
'value' => function($model) {
if($model->week_frequency == 1)
if($model->week_frequency == 1) {
return 'Toutes les semaines' ;
else
}
else {
return 'Toutes les '.$model->week_frequency.' semaines' ;
}
}
],
[
'attribute' => 'auto_payment',
'format' => 'raw',
'label' => 'Paiement automatique',
'headerOptions' => ['class' => 'column-auto-payment'],
'contentOptions' => ['class' => 'column-auto-payment'],
'filter' => [0 => 'Non', 1 => 'Oui'],
'value' => function($model) {
if($model->auto_payment)
if($model->auto_payment) {
return '<span class="label label-success">Oui</span>' ;
else
}
else {
return '<span class="label label-danger">Non</span>' ;
}
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'actions'],
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'update' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}

+ 4
- 8
backend/views/subscription/update.php View File

@@ -38,16 +38,12 @@ termes.

use yii\helpers\Html;

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

$this->title = 'Modifier un abonnement';
$this->params['breadcrumbs'][] = ['label' => 'Abonnements', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Modifier';
$this->setTitle('Modifier un abonnement') ;
$this->addBreadcrumb(['label' => 'Abonnements', 'url' => ['index']]) ;
$this->addBreadcrumb('Modifier') ;
?>
<div class="subscription-update">
<h1><?= Html::encode($this->title) ?></h1>

<div class="subscription-update">
<?= $this->render('_form', [
'model' => $model,
'productsArray' => $productsArray

+ 4
- 7
backend/views/user/create.php View File

@@ -38,19 +38,16 @@ termes.

use yii\helpers\Html;

$this->setTitle('Ajouter un client') ;
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]) ;
$this->addBreadcrumb('Ajouter') ;

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

$this->title = 'Ajouter un client';
$this->params['breadcrumbs'][] = ['label' => 'Clients', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Ajouter' ;
?>

<div class="user-create">
<?php if(YII_ENV == 'demo'): ?>
<div class="alert alert-warning">Vous ne pouvez pas ajouter de client dans l'espace Démo.</div>
<?php else: ?>
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>

+ 10
- 11
backend/views/user/credit.php View File

@@ -41,10 +41,10 @@ use yii\widgets\ActiveForm;
use common\models\CreditHistory;
use common\models\Producer;

$this->title = 'Créditer <small>'.Html::encode($user->lastname.' '.$user->name).'</small>';
$this->params['breadcrumbs'][] = ['label' => 'Clients', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Html::encode($user->lastname.' '.$user->name)];
$this->params['breadcrumbs'][] = 'Créditer';
$this->setTitle('Créditer <small>'.Html::encode($user->lastname.' '.$user->name).'</small>', 'Créditer '.Html::encode($user->lastname.' '.$user->name)) ;
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]) ;
$this->addBreadcrumb(['label' => Html::encode($user->lastname.' '.$user->name)]) ;
$this->addBreadcrumb('Créditer') ;

?>

@@ -58,12 +58,11 @@ $this->params['breadcrumbs'][] = 'Créditer';
if(!$producer->credit)
{
echo '<div class="alert alert-warning">Attention, la fonctionnalité <strong>Crédit</strong> est désactivée dans vos <a href="'.Yii::$app->urlManager->createurl(['producer/update']).'">paramètres</a>.'
. ' Pensez à l\'activer si vous souhaitez qu\'elle soit visible de vos clients.</div>' ;
. ' Pensez à l\'activer si vous souhaitez qu\'elle soit visible de vos utilisateurs.</div>' ;
}
?>
<div class="col-md-12">
<h1><?= $this->title ?></h1>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($creditForm, 'type')->dropDownList([
CreditHistory::TYPE_CREDIT => 'Crédit',
@@ -71,13 +70,13 @@ $this->params['breadcrumbs'][] = 'Créditer';
]) ?>
<?= $form->field($creditForm, 'amount')->textInput() ?>
<?= $form->field($creditForm, 'mean_payment')->dropDownList([
CreditHistory::MEAN_PAYMENT_MONEYS => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_MONEYS),
CreditHistory::MOYEN_CB => CreditHistory::getStrMeanPaymentBy(CreditHistory::MOYEN_CB),
CreditHistory::MOYEN_CHEQUE => CreditHistory::getStrMeanPaymentBy(CreditHistory::MOYEN_CHEQUE),
CreditHistory::MOYEN_AUTRE => CreditHistory::getStrMeanPaymentBy(CreditHistory::MOYEN_AUTRE),
CreditHistory::MEAN_PAYMENT_MONEY => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_MONEY),
CreditHistory::MEAN_PAYMENT_CREDIT_CARD => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_CREDIT_CARD),
CreditHistory::MEAN_PAYMENT_CHEQUE => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_CHEQUE),
CreditHistory::MEAN_PAYMENT_OTHER => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_OTHER),
]) ?>
<?= $form->field($creditForm, 'comment')->textarea() ?>
<?= $form->field($creditForm, 'sendMail')->checkbox() ?>
<?= $form->field($creditForm, 'send_mail')->checkbox() ?>
<div class="form-group">
<?= Html::submitButton( 'Créditer', ['class' => 'btn btn-primary']) ?>

+ 7
- 9
backend/views/user/emails.php View File

@@ -38,22 +38,20 @@ termes.

use yii\helpers\Html ;

$this->title = 'Liste des emails';
$this->params['breadcrumbs'][] = ['label' => 'Utilisateurs',
'url' => ['user/index']] ;
$this->params['breadcrumbs'][] = $this->title;
$this->setTitle('Liste des emails') ;
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['user/index']]) ;
$this->addBreadcrumb($this->getTitle()) ;

?>

<h1><?php if(isset($pointSale) && $pointSale): echo Html::encode($pointSale->name).' : '; endif; ?><?= count($usersArray); ?> utilisateurs</h1>

<h3><?= count($usersArray); ?> utilisateurs</h3>
<ul id="tabs-points-sale" class="nav nav-tabs" role="tablist">
<li class="<?php if(!isset($pointSale)): ?>active<?php endif; ?>">
<a href="<?= Yii::$app->urlManager->createUrl(['user/mail']); ?>">Tous</a>
</li>
<?php foreach($pointsSaleArray as $pointSale): ?>
<li class="<?php if(isset($pointSale) && $pointSale->id == $pointSale->id): ?>active<?php endif; ?>">
<a href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale'=>$pointSale->id]); ?>"><?= Html::encode($pointSale->name) ?></a>
<?php foreach($pointsSaleArray as $thePointSale): ?>
<li class="<?php if(isset($pointSale) && $pointSale->id == $thePointSale->id): ?>active<?php endif; ?>">
<a href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale'=>$thePointSale->id]); ?>"><?= Html::encode($thePointSale->name) ?></a>
</li>
<?php endforeach; ?>
</ul>

+ 42
- 73
backend/views/user/index.php View File

@@ -41,20 +41,13 @@ use yii\grid\GridView;
use common\models\User ;
use common\models\Order ;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->setTitle('Utilisateurs') ;
$this->addBreadcrumb($this->getTitle()) ;
$this->addButton(['label' => '+', 'url' => 'user/create', 'class' => 'btn btn-primary']) ;

$this->title = 'Utilisateurs';
$this->params['breadcrumbs'][] = $this->title;
?>


<div class="user-index">
<h1>
<?= Html::encode($this->title) ?>
<?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-primary']) ?>
</h1>
<ul id="tabs-points-vente" class="nav nav-tabs" role="tablist">
<li class="<?php if(!$idPointSaleActive && !$sectionInactiveUsers): ?>active<?php endif; ?>">
<a href="<?= Yii::$app->urlManager->createUrl(['user/index']); ?>">Tous</a>
@@ -73,43 +66,32 @@ $this->params['breadcrumbs'][] = $this->title;
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => true,
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'lastname',
'filter' => Html::input(
'string',
'lastname',
isset(Yii::$app->request->queryParams['lastname']) ? Html::encode(Yii::$app->request->queryParams['lastname']) : '',
[ 'class' => 'form-control']
)
],
[
'attribute' => 'name',
'filter' => Html::input(
'string',
'name',
isset(Yii::$app->request->queryParams['name']) ? Html::encode(Yii::$app->request->queryParams['name']) : '',
['class' => 'form-control']
)
],
[
'attribute' => 'phone',
'filter' => Html::input(
'string',
'phone',
isset(Yii::$app->request->queryParams['phone']) ? Html::encode(Yii::$app->request->queryParams['phone']) : '',
['class' => 'form-control']
)
'attribute' => 'username',
'label' => 'Nom',
'value' => function($model) {
return $model['lastname'].' '.$model['name'] ;
}
],
[
'attribute' => 'email',
'filter' => Html::input(
'string',
'email',
isset(Yii::$app->request->queryParams['email']) ? Html::encode(Yii::$app->request->queryParams['email']) : '',
['class' => 'form-control']
)
'attribute' => 'contacts',
'header' => 'Contacts',
'format' => 'raw',
'value' => function($model) {
$html = '' ;
if(strlen($model['phone'])) {
$html .= $model['phone'] ;
}
if(strlen($model['phone']) && strlen($model['email'])) {
$html .= '<br />' ;
}
if(strlen($model['email'])) {
$html .= $model['email'] ;
}
return $html ;
}
],
[
'attribute' => 'created_at',
@@ -119,32 +101,21 @@ $this->params['breadcrumbs'][] = $this->title;
return date('m/d/Y à H:i', $model['created_at']);
}
],
[
'attribute' => 'date_last_connection',
'label' => 'Dernière connexion',
'value' => function($model) {
if(isset($model['date_last_connection']))
return date('d/m/Y à H:i', strtotime($model['date_last_connection']));
else
return '' ;
}
],
[
'class' => 'yii\grid\ActionColumn',
'header' => 'Commandes',
'template' => '{orders}',
'headerOptions' => ['class' => 'actions'],
'buttons' => [
'orders' => function ($url, $model) {
$url = Yii::$app->urlManager->createUrl(['user/orders','id' => $model['user_id']]) ;
$url = Yii::$app->urlManager->createUrl(['user/orders','id' => $model['id']]) ;
$countOrders = Order::searchCount([
'id_user' => $model['user_id']
'id_user' => $model['id']
], ['conditions' => 'date_delete IS NULL']) ;
$html = '' ;
if($countOrders) {
$s = '' ;
if($countOrders > 1) $s = 's' ;
$html .= Html::a('<span class="glyphicon glyphicon-eye-open"></span> '.$countOrders.' commande'.$s, $url, [
$html .= Html::a('<span class="glyphicon glyphicon-eye-open"></span> '.$countOrders, $url, [
'title' => Yii::t('app', 'Commandes'), 'class' => 'btn btn-default '
]); ;
}
@@ -160,14 +131,13 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'credit',
'format' => 'raw',
'value' => function($model) use($producer) {
if(!isset($model['credit'])) $model['credit'] = 0 ;
$user = User::findOne($model['user_id']) ;
$user = User::findOne($model->id) ;
$html = '<div class="input-group">
<input type="text" class="form-control input-credit" readonly="readonly" value="'.number_format($user->getCredit($producer->id),2).' €" placeholder="">
<span class="input-group-btn">
'.Html::a(
'<span class="glyphicon glyphicon-euro"></span> Crédit',
Yii::$app->urlManager->createUrl(['user/credit','id' => $model['user_id']]),
'<span class="glyphicon glyphicon-euro"></span>',
Yii::$app->urlManager->createUrl(['user/credit','id' => $model->id]),
[
'title' => 'Crédit',
'class' => 'btn btn-default'
@@ -181,27 +151,26 @@ $this->params['breadcrumbs'][] = $this->title;
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'actions'],
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'update' => function ($url, $model) {
$url = Yii::$app->urlManager->createUrl(['user/update','id' => $model['user_id']]) ;
$user = User::find()->with('userProducer')->where(['id' => $model['user_id']])->one() ;
$url = Yii::$app->urlManager->createUrl(['user/update','id' => $model->id]) ;
$user = User::find()->with('userProducer')->where(['id' => $model->id])->one() ;
if(count($user->userProducer) <= 1)
{
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
}
else {
return '<span data-toggle="tooltip" data-placement="top" title="Vous ne pouvez pas modifier les clients qui sont liés à plusieurs producteurs."><span class="glyphicon glyphicon-remove-sign"></span> Non modifiable</span>' ;
return '<span data-toggle="tooltip" data-placement="top" title="Vous ne pouvez pas modifier les utilisateurs qui sont liés à plusieurs producteurs."><span class="glyphicon glyphicon-remove-sign"></span> Non modifiable</span>' ;
}
},
'delete' => function($url, $model) {
if($model['active']) {
return Html::a('<span class="glyphicon glyphicon-trash"></span> Supprimer', Yii::$app->urlManager->createUrl(array_merge(['user/delete','id' => $model['user_id']], Yii::$app->getRequest()->getQueryParams())), [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}
'delete' => function($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Yii::$app->urlManager->createUrl(array_merge(['user/delete','id' => $model->id], Yii::$app->getRequest()->getQueryParams())), [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}
],
],

+ 13
- 16
backend/views/user/orders.php View File

@@ -42,36 +42,33 @@ use common\models\CreditHistory;
use common\models\Producer;
use common\models\Order;

$this->title = 'Commandes <small>'.Html::encode($user->lastname.' '.$user->name).'</small>';
$this->params['breadcrumbs'][] = ['label' => 'Clients', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Html::encode($user->lastname.' '.$user->name)];
$this->params['breadcrumbs'][] = 'Créditer';
$this->setTitle('Commandes <small>'.Html::encode($user->lastname.' '.$user->name).'</small>', 'Commandes de '.Html::encode($user->lastname.' '.$user->name)) ;
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]) ;
$this->addBreadcrumb(['label' => Html::encode($user->lastname.' '.$user->name)]) ;
$this->addBreadcrumb('Commandes') ;

?>

<div class="user-orders">
<h1><?= $this->title ?> </h1>
<?php if(count($commandes)): ?>
<?php if(count($ordersArray)): ?>
<table id="historique-commandes" class="table table-striped table-bordered">
<thead>
<tr>
<th>Historique</th>
<th>Date livraison</th>
<th>Historique</th>
<th>Résumé</th>
<th>Point de vente</th>
<th class="montant">Montant</th>
</tr>
</thead>
<tbody>
<?php foreach($commandes as $c): ?>
<tr class="<?= $c->getClassHistorique() ; ?>">
<td class="historique"><?= $c->getStrHistorique() ; ?></td>
<td><?php echo date('d/m/Y',strtotime($c->production->date)); ?></td>
<td class="resume"><?= $c->getResumePanier() ; ?></td>
<td><?= $c->getResumePointVente(); ?></td>
<td class="montant"><?= $c->getResumeMontant(); ?></td>
<?php foreach($ordersArray as $order): ?>
<tr class="<?= $order->getClassHistory() ; ?>">
<td><?php echo date('d/m/Y',strtotime($order->distribution->date)); ?></td>
<td class="historique"><?= $order->getStrHistory() ; ?></td>
<td class="resume"><?= $order->getCartSummary() ; ?></td>
<td><?= $order->getPointSaleSummary(); ?></td>
<td class="montant"><?= $order->getAmountSummary(); ?></td>
</tr>
<?php endforeach; ?>
</tbody>

+ 5
- 10
backend/views/user/update.php View File

@@ -38,20 +38,15 @@ termes.

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model common\models\User */
$this->setTitle('Modifier un client') ;
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]) ;
$this->addBreadcrumb(['label' => Html::encode($model->lastname.' '.$model->name)]) ;
$this->addBreadcrumb('Modifier') ;

$this->title = 'Modifier un client' ;
$this->params['breadcrumbs'][] = ['label' => 'Clients', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Html::encode($model->lastname.' '.$model->name)];
$this->params['breadcrumbs'][] = 'Modifier';
?>
<div class="user-update">

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

<div class="user-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

BIN
backend/web/.sass-cache/2a0ffb00578c9d5a537db16d14c734a22b18f35c/screen.scssc View File


+ 439
- 237
backend/web/css/screen.css
File diff suppressed because it is too large
View File


+ 4
- 4
backend/web/js/lechatdesnoisettes.js View File

@@ -628,7 +628,7 @@ function chat_ordre_produits() {
return ui;
};
$(".produit-index table tbody").sortable({
$(".product-index table tbody").sortable({
items: "> tr",
appendTo: "parent",
cursor: "move",
@@ -640,14 +640,14 @@ function chat_ordre_produits() {
var tab_ordre = {} ;
var ordre = 1 ;
$(".produit-index table tbody tr").each(function() {
$(".product-index table tbody tr").each(function() {
tab_ordre[$(this).attr('data-key')] = ordre ;
ordre++ ;
}) ;
console.log(tab_ordre) ;
$.get(UrlManager.getBaseUrl()+'produit/ordre',{
tab: JSON.stringify(tab_ordre)
$.get(UrlManager.getBaseUrl()+'product/order',{
array: JSON.stringify(tab_ordre)
}) ;
}
}).disableSelection();

+ 197
- 0
backend/web/sass/_adminlte.scss View File

@@ -0,0 +1,197 @@

body.skin-black {
.main-header {
.logo {
background-color: darken($color1,5) ;
&:hover {
background-color: $color1 ;
}
.logo-lg {
img {
width: 30px ;
height: 30px ;
}
}
.logo-mini {
img {
width: 30px ;
height: 30px ;
}
}
}
.navbar {
background-color: $color1 ;
.sidebar-toggle {
color: white ;
}
.navbar-custom-menu .navbar-nav > li > a,
.navbar-right > li > a {
border-left: solid 1px lighten($color1, 15) ;
color: white ;
}
.nav > li > a:hover, .nav > li > a:active, .nav > li > a:focus,
.nav .open > a, .nav .open > a:hover, .nav .open > a:focus,
.nav > .active > a {
color: white ;
background-color: darken($color1, 4) ;
}
.dropdown-menu {
@include box-shadow(0px 0px 4px gray) ;
}
}
.logo, .navbar .sidebar-toggle {
border-right: solid 1px lighten($color1, 15) ;
}
.link-control-sidebar {
display: none ;
}
.notifications-menu {
ul.menu {
max-height: 300px ;
li {
a {
padding-top: 4px ;
padding-bottom: 4px ;
h5 {
margin-bottom: 2px ;
small {
float: right ;
}
}
p {
margin-left: 10px ;
}
}
}
}
}
}

.sidebar-menu > li.active > a {
border-color: $color1 ;
}
.content-wrapper {
background-color: #f5f5f5 ;
.content-header {
//background-color: $color2 ;
background-color: #eeeeee ;
padding-bottom: 15px ;
border-bottom: solid 1px #e0e0e0 ;
.btn {
padding: 3px 6px ;
font-size: 13px ;
}
}
a {
color: $color1 ;
}
.btn {
color: white ;
}
.btn-default {
color: #333 ;
}
.btn-primary, .btn-success {
background-color: $color1 ;
color: white ;
border-color: $color1 ;
}
.alert {
a {
color: white ;
}
}
.callout {
a {
color: white ;
}
.btn {
color: #333 ;
text-decoration: none ;
}
}
.table {
th {
font-size: 13px ;
}
th.column-actions, td.column-actions {
width: 150px ;
text-align: right ;
}
td.text-small, th.text-small {
font-size: 12px ;
}
}
.pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus {
background-color: $color1 ;
border: solid 1px $color1 ;
color: white ;
}
.pagination > li > a, .pagination > li > span {
color: $color1 ;
&:hover {
color: darken($color1, 10) ;
}
}
}
.main-footer {
a {
color: $color1 ;
}
}
}

body.login-page {
background: none ;
background-color: $color2 ;
.login-box {
.login-logo {
text-align: center ;
font-family: 'comfortaalight' ;
img {
width: 50px ;
}
}
.login-box-body {
.btn-primary {
background-color: $color1 ;
border-color: $color1 ;
padding: 5px 10px ;

&:active {
background-color: lighten($color1, 5) ;
border-color: $color1 ;
}
}

a {
color: $color1 ;
&:hover {
color: lighten($color1, 5) ;
}
}
}
}
}

+ 15
- 0
backend/web/sass/product/_index.scss View File

@@ -0,0 +1,15 @@

.product-index {
.td-photo {
max-width: 100px ;
width: 100px ;
}
.photo-product {
max-width: 100px ;
}
.ui-state-highlight {
height: 75px;
background-color: $color2 ;
}
}

+ 8
- 27
backend/web/sass/screen.scss View File

@@ -84,17 +84,6 @@ a {
z-index: 1031 ;
}

.pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus {
background-color: $color1 ;
border: solid 1px $color1 ;
}
.pagination > li > a, .pagination > li > span {
color: $color1 ;
&:hover {
color: darken($color1, 10) ;
}
}

.wrap {
.btn-primary,
.btn-success {
@@ -1000,20 +989,6 @@ a {
background-color: white ;
}

.wrap .product-index {
.td-photo {
max-width: 100px ;
width: 100px ;
}
.photo-product {
max-width: 100px ;
}
.ui-state-highlight {
height: 75px;
background-color: $color2 ;
}
}

/* communiquer */

@@ -1230,7 +1205,7 @@ a {
.btn-liste-emails {
float: right ;
position: relative ;
top: -8px ;
top: 6px ;
}
}

@@ -1366,4 +1341,10 @@ a {
td.align-center {
text-align: center ;
}
}
}

@import "_adminlte.scss" ;
@import "site/_index.scss" ;
@import "subscription/_index.scss" ;
@import "product/_index.scss" ;
@import "stats/_products.scss" ;

+ 34
- 0
backend/web/sass/site/_index.scss View File

@@ -0,0 +1,34 @@

.site-index {
#distributions {
.info-box {
.date {
text-transform: uppercase ;
font-size: 12px ;
line-height: 20px ;
padding-top: 10px ;
span {
display: block ;
}
.day {
}
.num {
font-size: 30px ;
padding-top: 5px ;
padding-bottom: 5px ;
}
.month {
}
}
}
.info-box-content {
.buttons {
margin-top: 10px ;
}
}
}
}

+ 5
- 0
backend/web/sass/stats/_products.scss View File

@@ -0,0 +1,5 @@

.stats-products {
//width: 100% ;
//overflow-x: scroll ;
}

+ 8
- 0
backend/web/sass/subscription/_index.scss View File

@@ -0,0 +1,8 @@

.subscription-index {
.table {
.column-auto-payment {
width: 50px ;
}
}
}

+ 2
- 2
common/components/ActiveRecordCommon.php View File

@@ -53,7 +53,7 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord
* @return mixed
* @throws NotFoundHttpException
*/
public static function search($params = [], $options = [])
public static function searchBy($params = [], $options = [])
{
$class = get_called_class() ;
@@ -208,7 +208,7 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord
public static function searchDispatch($params = [], $options = [])
{
$class = get_called_class() ;
return $class::search($params, $options) ;
return $class::searchBy($params, $options) ;
}
}

+ 15
- 3
common/components/MyView.php View File

@@ -40,17 +40,19 @@ namespace common\components ;

class MyView extends \yii\web\View
{
var $title ;
var $page_title ;
var $buttons ;
public function setTitle($title, $page_title = '')
{
$this->title = $title ;
if(strlen($page_title))
if(strlen($page_title)) {
$this->page_title = $page_title ;
else
}
else {
$this->page_title = $title ;
}
}
public function getTitle()
@@ -73,4 +75,14 @@ class MyView extends \yii\web\View
return Yii::$app->controller->id.'/'.Yii::$app->controller->action->id ;
}
public function addBreadcrumb($breadcrumb)
{
$this->params['breadcrumbs'][] = $breadcrumb ;
}
public function addButton($button)
{
$this->buttons[] = $button ;
}
}

+ 4
- 2
common/config/main.php View File

@@ -36,6 +36,8 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

$serverName = $_SERVER['SERVER_NAME'] ;

return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
@@ -45,7 +47,7 @@ return [
'enableAutoLogin' => true,
'identityCookie' => [
'name' => 'laboiteapain',
'domain' => '.'.Yii::getAlias('@domainName'),
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'path' => '/',
]
],
@@ -53,7 +55,7 @@ return [
'class' => 'yii\web\Session',
'name' => 'PHPLABOITEAPAINSESSID',
'cookieParams' => [
'domain' => '.'.Yii::getAlias('@domainName'),
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'httpOnly' => true,
],
],

+ 2
- 2
common/models/CreditHistory.php View File

@@ -55,7 +55,7 @@ use yii\helpers\Html;
* @property double $amount
* @property string $type
* @property integer $id_producer
* @property string $mean_payement
* @property string $mean_payment
*/
class CreditHistory extends ActiveRecordCommon
{
@@ -325,7 +325,7 @@ class CreditHistory extends ActiveRecordCommon
*/
public function getStrMeanPayment()
{
self::getStrMeanPaymentBy($this->mean_payement) ;
self::getStrMeanPaymentBy($this->mean_payment) ;
}
/**

+ 3
- 3
common/models/Distribution.php View File

@@ -152,9 +152,9 @@ class Distribution extends ActiveRecordCommon
{
$distribution = null ;
if ($date != '') {
$distribution = Distribution::find()
->where(['date' => $date])
->one() ;
$distribution = Distribution::searchOne([
'date' => $date
]) ;
if (!$distribution) {
$distribution = new Distribution;

+ 3
- 3
common/models/Order.php View File

@@ -394,7 +394,7 @@ class Order extends ActiveRecordCommon
$html .= '<span class="label label-success">Payée</span>';
} elseif ($this->getPaymentStatus() == Order::PAYMENT_UNPAID) {
$html .= '<span class="label label-danger">Non payée</span><br />
Reste <strong>' . $this->getRemainingAmount(true) . '</strong> à payer';
Reste <strong>' . $this->getAmount(Order::AMOUNT_REMAINING, true) . '</strong> à payer';
} elseif ($this->getPaymentStatus() == Order::PAYMENT_SURPLUS) {
$html .= '<span class="label label-success">Payée</span>';
}
@@ -585,9 +585,9 @@ class Order extends ActiveRecordCommon
* @param integer $limit
* @return array
*/
public static function search($params = [], $options = [])
public static function searchBy($params = [], $options = [])
{
$orders = parent::search($params, $options) ;
$orders = parent::searchBy($params, $options) ;
/*
* Initialisation des commandes

+ 121
- 0
common/models/PointSaleSearch.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

namespace common\models ;

use common\models\PointSale ;

class PointSaleSearch extends PointSale
{
var $delivery ;
var $access_type ;
public function rules()
{
return [
[['restricted_access'], 'boolean'],
[['name', 'code'], 'string', 'max' => 255],
[['address', 'locality', 'infos_monday', 'infos_tuesday',
'infos_wednesday', 'infos_thursday', 'infos_friday',
'infos_saturday', 'infos_sunday'], 'string'],
[['point_production', 'credit', 'delivery_monday', 'delivery_tuesday',
'delivery_wednesday', 'delivery_thursday', 'delivery_friday',
'delivery_saturday', 'delivery_sunday'], 'boolean'],
['id_producer', 'integer'],
[['users', 'users_comment', 'code','name', 'delivery', 'access_type'], 'safe']
];
}
public function search($params)
{
$optionsSearch = self::defaultOptionsSearch() ;
$query = PointSale::find()
->with($optionsSearch['with'])
->innerJoinWith($optionsSearch['join_with'], true)
->where(['point_sale.id_producer' => Producer::getId()])
;
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['name', 'locality','point_production','credit']],
'pagination' => [
'pageSize' => 20,
],
]);
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}

if(isset($this->point_production) && is_numeric($this->point_production)) {
$query->andWhere([
'point_sale.point_production' => $this->point_production
]) ;
}
if(isset($this->delivery) && strlen($this->delivery)) {
$query->andWhere([
'point_sale.delivery_'.$this->delivery => 1
]) ;
}
if(isset($this->access_type) && strlen($this->access_type)) {
if($this->access_type == 'open') {
$query->andWhere(['or',
['=','point_sale.code',''],
['IS','point_sale.code',null],
]) ;
$query->andWhere(['point_sale.restricted_access' => 0]) ;
}
elseif($this->access_type == 'code') {
$query->andWhere(['!=','point_sale.code','']) ;
}
elseif($this->access_type == 'restricted_access') {
$query->andWhere(['point_sale.restricted_access' => 1]) ;
}
}
$query->andFilterWhere(['like', 'point_sale.name', $this->name]) ;
$query->andFilterWhere(['like', 'point_sale.locality', $this->locality]) ;
return $dataProvider;
}
}

+ 1
- 1
common/models/Producer.php View File

@@ -366,7 +366,7 @@ class Producer extends ActiveRecordCommon
*
* @return Producer|boolean
*/
public static function get()
public static function getCurrent()
{
if(self::getId()) {
return self::searchOne() ;

+ 91
- 0
common/models/ProductSearch.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

namespace common\models ;

use common\models\Product ;

class ProductSearch extends Product
{
public function rules()
{
return [
[['active', 'order', 'quantity_max', 'id_producer'], 'integer'],
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'unavailable'], 'boolean'],
[['price', 'weight'], 'number'],
[[ 'photo'], 'file'],
[['name', 'description', 'photo'], 'string', 'max' => 255],
[['recipe'], 'string', 'max' => 1000],
];
}
public function search($params)
{
$optionsSearch = self::defaultOptionsSearch() ;
$query = Product::find()
->with($optionsSearch['with'])
->innerJoinWith($optionsSearch['join_with'], true)
->where(['product.id_producer' => Producer::getId()])
;
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['order', 'photo', 'name', 'description','active']],
'pagination' => [
'pageSize' => 20,
],
]);
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}

$query->andFilterWhere(['like', 'product.name', $this->name]) ;
$query->andFilterWhere(['like', 'product.description', $this->description]) ;
if(isset($this->active) && is_numeric($this->active)) {
$query->andWhere([
'product.active' => $this->active
]) ;
}
return $dataProvider;
}
}

+ 4
- 3
common/models/Subscription.php View File

@@ -152,10 +152,11 @@ class Subscription extends ActiveRecordCommon
*
* @return array
*/
public static function defaultOptionsSearch() {
public static function defaultOptionsSearch()
{
return [
'with' => ['producer', 'pointSale', 'productSubscription'],
'join_with' => ['user'],
'with' => ['producer'],
'join_with' => ['user', 'productSubscription', 'productSubscription.product', 'pointSale'],
'orderby' => 'user.name ASC',
'attribute_id_producer' => 'subscription.id_producer'
] ;

+ 139
- 0
common/models/SubscriptionSearch.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

namespace common\models;

use common\models\Subscription ;

class SubscriptionSearch extends Subscription
{
var $username;
var $product_name;
var $day ;
public function rules()
{
return [
[['id_point_sale', 'week_frequency'], 'integer'],
[['auto_payment'], 'boolean'],
[['date_begin', 'username','product_name', 'day'], 'safe'],
];
}
public function search($params) {
$optionsSearch = self::defaultOptionsSearch() ;
$query = Subscription::find()
->with($optionsSearch['with'])
->innerJoinWith($optionsSearch['join_with'], true)
->where(['subscription.id_producer' => Producer::getId()])
;
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['username']],
'pagination' => [
'pageSize' => 20,
],
]);

$dataProvider->sort->attributes['username'] = [
'asc' => ['user.lastname' => SORT_ASC, 'user.name' => SORT_ASC],
'desc' => ['user.lastname' => SORT_DESC, 'user.name' => SORT_DESC],
];
$dataProvider->sort->attributes['id_point_sale'] = [
'asc' => ['point_sale.name' => SORT_ASC],
'desc' => ['point_sale.name' => SORT_DESC],
];

$dataProvider->sort->attributes['auto_payment'] = [
'asc' => ['subscription.auto_payment' => SORT_ASC],
'desc' => ['subscription.auto_payment' => SORT_DESC],
];
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}

if(isset($this->id_point_sale) && is_numeric($this->id_point_sale)) {
$query->andWhere([
'subscription.id_point_sale' => $this->id_point_sale
]) ;
}
if(isset($this->auto_payment) && is_numeric($this->auto_payment)) {
$query->andWhere([
'subscription.auto_payment' => $this->auto_payment
]) ;
}
if(isset($this->week_frequency) && is_numeric($this->week_frequency)) {
$query->andWhere([
'subscription.week_frequency' => $this->week_frequency
]) ;
}
if(isset($this->day) && strlen($this->day)) {
$query->andWhere([
'subscription.'.$this->day => 1
]) ;
}
if(strlen($this->date_begin)) {
$date = \DateTime::createFromFormat('d/m/Y', $this->date_begin);
$query->andWhere([
'subscription.date_begin' => date('Y-m-d',$date->format('U'))
]) ;
}
$query->andFilterWhere([
'or',
['like', 'user.lastname', $this->username],
['like', 'user.name', $this->username]
]);
$query->andFilterWhere(['like', 'product.name', $this->product_name]) ;
return $dataProvider;
}
}

+ 66
- 2
common/models/User.php View File

@@ -113,6 +113,8 @@ class User extends ActiveRecordCommon implements IdentityInterface
{
return [
'id' => 'ID',
'name' => 'Prénom',
'lastname' => 'Nom',
'username' => 'Identifiant',
'password' => 'Mot de passe',
'rememberMe' => 'Se souvenir de moi',
@@ -285,12 +287,13 @@ class User extends ActiveRecordCommon implements IdentityInterface
*/
public static function findBy($params = [])
{
if (!isset($params['id_producer'])) {
$params['id_producer'] = Producer::getId() ;
}
$query = (new Query())
->select(['user.id AS user_id', 'user.name', 'user.lastname', 'user.phone', 'user.email', 'user.created_at', 'user.date_last_connection', 'user_producer.*'])
->select(['user.id AS user_id', 'user.name', 'user.lastname', 'user.phone', 'user.email', 'user.created_at','user.date_last_connection', 'user_producer.*'])
->from('user');
$active = (isset($params['inactive']) && $params['inactive']) ? 0 : 1 ;
@@ -424,7 +427,31 @@ class User extends ActiveRecordCommon implements IdentityInterface
}

/**
* Retourne si l'utilisateur est un boulanger ou non.
* Retourne l'utilisateur courant.
*
* @return User
*/
public static function getCurrent()
{
if(!Yii::$app->user->isGuest) {
return Yii::$app->user->identity ;
}
return false ;
}
/**
* Retourne si l'utilisateur courant est connecté ou non.
*
* @return boolean
*/
public static function isCurrentConnected()
{
return !Yii::$app->user->isGuest ;
}
/**
* Retourne si l'utilisateur est un producteur ou non.
*
* @return boolean
*/
@@ -432,6 +459,43 @@ class User extends ActiveRecordCommon implements IdentityInterface
{
return ($this->status == User::STATUS_ADMIN || $this->status == User::STATUS_PRODUCER) && $this->id_producer;
}
/**
* Retourne si l'utilisateur courant est un producteur ou non.
*
* @return boolean
*/
public static function isCurrentProducer()
{
$user = User::getCurrent() ;
if($user) {
return $user->isProducer() ;
}
return false ;
}
/**
* Retourne si l'utilisateur est un admin ou non.
*
* @return boolean
*/
public function isAdmin() {
return $this->status == User::STATUS_ADMIN ;
}
/**
* Retourne si l'utilisateur courant est un admin ou non.
*
* @return boolean
*/
public static function isCurrentAdmin()
{
$user = User::getCurrent() ;
if($user) {
return $user->isAdmin() ;
}
return false ;
}

/**
* Retourne le nom du producteur.

+ 123
- 0
common/models/UserSearch.php View File

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

/**
Copyright La boîte à pain (2018)

contact@laboiteapain.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

namespace common\models ;

use common\models\User ;

class UserSearch extends User
{
var $id_point_sale ;
var $inactive ;
var $username ;
public function rules()
{
return [
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday', 'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday', 'mail_distribution_sunday'], 'boolean'],
[['lastname', 'name', 'phone', 'address'], 'string'],
[['id_point_sale', 'inactive'],'integer'],
[['date_last_connection', 'id_point_sale', 'username'], 'safe'],
];
}

public function search($params)
{
$optionsSearch = self::defaultOptionsSearch() ;
$query = User::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['username','credit','orders']],
'pagination' => [
'pageSize' => 20,
],
]);
$dataProvider->sort->attributes['username'] = [
'asc' => ['user.lastname' => SORT_ASC, 'user.name' => SORT_ASC],
'desc' => ['user.lastname' => SORT_DESC, 'user.name' => SORT_DESC],
];
$dataProvider->sort->attributes['credit'] = [
'asc' => ['user_producer.credit' => SORT_ASC],
'desc' => ['user_producer.credit' => SORT_DESC],
];
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}
$active = (isset($this->inactive) && $this->inactive) ? 0 : 1 ;
$query->innerJoin('user_producer','user.id = user_producer.id_user AND user_producer.active = '.$active.' AND user_producer.id_producer = :id_producer', [':id_producer' => Producer::getId()]) ;
if(isset($this->id_point_sale) && $this->id_point_sale) {
$pointSale = PointSale::findOne(['id' => $this->id_point_sale]) ;
if($pointSale->restricted_access) {
$query->innerJoin('user_point_sale','user.id = user_point_sale.id_user AND user_point_sale.id_point_sale = :id_point_sale',[':id_point_sale' => $this->id_point_sale]) ;
}
else {
$query->innerJoin(
'order',
'user.id = order.id_user AND order.id_point_sale = :id_point_sale',
[':id_point_sale' => $this->id_point_sale]
)->groupBy('user.id') ;
}
}
if(isset($this->inactive) && $this->inactive) {
$query->innerJoin(
'order',
'user.id = order.id_user'
)
->groupBy('user.id');
}
$query->andFilterWhere([
'or',
['like', 'user.lastname', $this->username],
['like', 'user.name', $this->username]
]);
return $dataProvider;
}
}

+ 2
- 1
composer.json View File

@@ -22,7 +22,8 @@
"2amigos/yii2-leaflet-extension" : "*",
"kartik-v/yii2-mpdf": "dev-master",
"c006/yii2-paypal-ipn": "dev-master",
"yurkinx/yii2-image": "dev-master"
"yurkinx/yii2-image": "dev-master",
"dmstr/yii2-adminlte-asset": "^2.1"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",

+ 370
- 3
composer.lock View File

@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "46cc589f605c139a6a51351333713a31",
"content-hash": "82e078c37024338d837d4b3156a19b19",
"hash": "2e9a6a86294d914308fbf7224eb6353e",
"content-hash": "05a859eb0741bf9a3b81242b85b777c6",
"packages": [
{
"name": "2amigos/yii2-chartjs-widget",
@@ -127,6 +127,50 @@
],
"time": "2016-12-06 14:54:20"
},
{
"name": "almasaeed2010/adminlte",
"version": "v2.4.8",
"source": {
"type": "git",
"url": "https://github.com/almasaeed2010/AdminLTE.git",
"reference": "d9e68301848a95dff2e2dbef6569e617a9b3fa30"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/almasaeed2010/AdminLTE/zipball/d9e68301848a95dff2e2dbef6569e617a9b3fa30",
"reference": "d9e68301848a95dff2e2dbef6569e617a9b3fa30",
"shasum": ""
},
"require": {
"bower-asset/jquery": ">=1.9.0 <4.0.0",
"composer/installers": "1.*"
},
"type": "template",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Abdullah Almsaeed",
"email": "abdullah@almsaeedstudio.com"
}
],
"description": "AdminLTE - admin control panel and dashboard that's based on Bootstrap 3",
"homepage": "https://adminlte.io/",
"keywords": [
"JS",
"admin",
"back-end",
"css",
"less",
"responsive",
"template",
"theme",
"web"
],
"time": "2018-07-15 18:48:11"
},
{
"name": "bower-asset/bootstrap",
"version": "v3.3.7",
@@ -477,6 +521,229 @@
],
"time": "2016-09-14 20:40:20"
},
{
"name": "cebe/yii2-gravatar",
"version": "1.1",
"target-dir": "cebe/gravatar",
"source": {
"type": "git",
"url": "https://github.com/cebe/yii2-gravatar.git",
"reference": "c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cebe/yii2-gravatar/zipball/c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057",
"reference": "c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057",
"shasum": ""
},
"require": {
"yiisoft/yii2": "*"
},
"type": "yii2-extension",
"autoload": {
"psr-0": {
"cebe\\gravatar\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Carsten Brandt",
"email": "mail@cebe.cc",
"homepage": "http://cebe.cc/",
"role": "Core framework development"
}
],
"description": "Gravatar Widget for Yii 2",
"keywords": [
"gravatar",
"yii"
],
"time": "2013-12-10 17:49:58"
},
{
"name": "composer/installers",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "^4.8.36"
},
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Installers\\": "src/Composer/Installers"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/",
"keywords": [
"Craft",
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"Lan Management System",
"MODX Evo",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Thelia",
"WolfCMS",
"agl",
"aimeos",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"eZ Platform",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"joomla",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"majima",
"mako",
"mediawiki",
"modulework",
"modx",
"moodle",
"osclass",
"phpbb",
"piwik",
"ppi",
"puppet",
"pxcms",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"symfony",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
],
"time": "2018-08-27 06:10:37"
},
{
"name": "dmstr/yii2-adminlte-asset",
"version": "2.6.2",
"source": {
"type": "git",
"url": "https://github.com/dmstr/yii2-adminlte-asset.git",
"reference": "c96336e1960ebc6c1e72487a7c6ca1a1589519fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/c96336e1960ebc6c1e72487a7c6ca1a1589519fe",
"reference": "c96336e1960ebc6c1e72487a7c6ca1a1589519fe",
"shasum": ""
},
"require": {
"almasaeed2010/adminlte": "^2.4.0",
"cebe/yii2-gravatar": "1.*",
"rmrevin/yii2-fontawesome": "~2.9",
"yiisoft/yii2": "2.*",
"yiisoft/yii2-bootstrap": "~2.0.0"
},
"type": "yii2-extension",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"dmstr\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Tobias Munk",
"email": "tobias@diemeisterei.de"
},
{
"name": "Evgeniy Tkachenko",
"email": "et.coder@gmail.com"
}
],
"description": "AdminLTE backend theme asset bundle for Yii 2.0 Framework",
"keywords": [
"AdminLTE",
"admin",
"asset",
"backend",
"css",
"extension",
"less",
"theme",
"yii2"
],
"time": "2018-07-24 14:47:13"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.8.0",
@@ -521,6 +788,54 @@
],
"time": "2016-07-16 12:58:58"
},
{
"name": "fortawesome/font-awesome",
"version": "v4.7.0",
"source": {
"type": "git",
"url": "https://github.com/FortAwesome/Font-Awesome.git",
"reference": "a8386aae19e200ddb0f6845b5feeee5eb7013687"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FortAwesome/Font-Awesome/zipball/a8386aae19e200ddb0f6845b5feeee5eb7013687",
"reference": "a8386aae19e200ddb0f6845b5feeee5eb7013687",
"shasum": ""
},
"require-dev": {
"jekyll": "1.0.2",
"lessc": "1.4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.6.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"OFL-1.1",
"MIT"
],
"authors": [
{
"name": "Dave Gandy",
"email": "dave@fontawesome.io",
"homepage": "http://twitter.com/davegandy",
"role": "Developer"
}
],
"description": "The iconic font and CSS framework",
"homepage": "http://fontawesome.io/",
"keywords": [
"FontAwesome",
"awesome",
"bootstrap",
"font",
"icon"
],
"time": "2016-10-24 15:52:54"
},
{
"name": "kartik-v/yii2-mpdf",
"version": "dev-master",
@@ -531,7 +846,7 @@
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kartik-v/yii2-mpdf/zipball/67980ab7861ae9541b1a1784be8938dbeba13045",
"url": "https://api.github.com/repos/kartik-v/yii2-mpdf/zipball/beecfa00d5debfef1ccac6ff7b1abe8560b6ffd1",
"reference": "17fda1cb084c58fee6014026d35af5faf73316ef",
"shasum": ""
},
@@ -624,6 +939,58 @@
],
"time": "2016-12-12 10:42:18"
},
{
"name": "rmrevin/yii2-fontawesome",
"version": "2.17.1",
"source": {
"type": "git",
"url": "https://github.com/rmrevin/yii2-fontawesome.git",
"reference": "65ce306da864f4d558348aeba040ed7876878090"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/65ce306da864f4d558348aeba040ed7876878090",
"reference": "65ce306da864f4d558348aeba040ed7876878090",
"shasum": ""
},
"require": {
"fortawesome/font-awesome": "~4.7",
"php": ">=5.4.0",
"yiisoft/yii2": "2.0.*"
},
"type": "yii2-extension",
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"autoload": {
"psr-4": {
"rmrevin\\yii\\fontawesome\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Revin Roman",
"email": "roman@rmrevin.com",
"homepage": "https://rmrevin.com/"
}
],
"description": "Asset Bundle for Yii2 with Font Awesome",
"keywords": [
"asset",
"awesome",
"bundle",
"font",
"yii"
],
"time": "2017-01-11 14:05:47"
},
{
"name": "setasign/fpdi",
"version": "1.6.1",

+ 2
- 2
frontend/controllers/SiteController.php View File

@@ -65,7 +65,7 @@ use dosamigos\leaflet\widgets\Map;
*/
class SiteController extends FrontendController
{
/**
* @inheritdoc
*/
@@ -179,7 +179,7 @@ class SiteController extends FrontendController
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
return Yii::$app->getResponse()->redirect(['order/index']);
return Yii::$app->getResponse()->redirect(['site/index']);
}

$model = new LoginForm();

+ 21
- 30
frontend/models/SignupForm.php View File

@@ -220,7 +220,7 @@ class SignupForm extends Model
$user->phone = $this->phone;

if ($this->option_user_producer == 'producer') {
// etablissement
// producteur
$producer = new Producer;
$producer->name = $this->name_producer;
$producer->type = $this->type;
@@ -260,42 +260,33 @@ class SignupForm extends Model

$user->setPassword($this->password);
$user->generateAuthKey();
if ($user->save()) {

// on ajoute l'établissement sélectionnée par l'user en favoris
if ($this->option_user_producer == 'producer') {
if ($this->id_producer) {
$producer = Producer::find()->where(['id' => $this->id_producer])->one();
if ($producer) {
Producer::addUser($user->id, $this->id_producer) ;
if ($this->option_user_producer == 'user' && $this->id_producer) {
$producer = Producer::find()->where(['id' => $this->id_producer])->one();

// envoi d'un email à l'utilisateur
Yii::$app->mailer->compose(
[
'html' => 'signup-html',
'text' => 'signup-text'
],
[
'user' => $user,
'producer' => $producer
])
->setTo($user->email)
->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain'])
->setSubject('[La boîte à pain] Inscription')
->send();
}
if ($producer) {
Producer::addUser($user->id, $this->id_producer) ;

// envoi d'un email à l'utilisateur
Yii::$app->mailer->compose(
[
'html' => 'signup-html',
'text' => 'signup-text'
],
[
'user' => $user,
'producer' => $producer
])
->setTo($user->email)
->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain'])
->setSubject('[La boîte à pain] Inscription')
->send();
}
}

if ($this->option_user_producer == 'producer') {
$userProducer = new UserProducer;
$userProducer->id_producer = $producer->id;
$userProducer->id_user = $user->id;
$userProducer->credit = 0;
$userProducer->active = 1;
$userProducer->save();
}

return $user;
}
}

+ 1
- 0
vendor/composer/autoload_namespaces.php View File

@@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);

return array(
'yii\\image\\' => array($vendorDir . '/yurkinx/yii2-image'),
'cebe\\gravatar\\' => array($vendorDir . '/cebe/yii2-gravatar'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src'),
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
'Diff' => array($vendorDir . '/phpspec/php-diff/lib'),

+ 3
- 0
vendor/composer/autoload_psr4.php View File

@@ -14,10 +14,12 @@ return array(
'yii\\codeception\\' => array($vendorDir . '/yiisoft/yii2-codeception'),
'yii\\bootstrap\\' => array($vendorDir . '/yiisoft/yii2-bootstrap'),
'yii\\' => array($vendorDir . '/yiisoft/yii2'),
'rmrevin\\yii\\fontawesome\\' => array($vendorDir . '/rmrevin/yii2-fontawesome'),
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'),
'kartik\\mpdf\\' => array($vendorDir . '/kartik-v/yii2-mpdf'),
'dosamigos\\leaflet\\' => array($vendorDir . '/2amigos/yii2-leaflet-extension/src'),
'dosamigos\\chartjs\\' => array($vendorDir . '/2amigos/yii2-chartjs-widget/src'),
'dmstr\\' => array($vendorDir . '/dmstr/yii2-adminlte-asset'),
'cebe\\markdown\\' => array($vendorDir . '/cebe/markdown'),
'c006\\paypal_ipn\\' => array($vendorDir . '/c006/yii2-paypal-ipn'),
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
@@ -40,6 +42,7 @@ return array(
'Facebook\\WebDriver\\' => array($vendorDir . '/facebook/webdriver/lib'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
'Codeception\\Extension\\' => array($vendorDir . '/codeception/codeception/ext'),
'Codeception\\' => array($vendorDir . '/codeception/codeception/src/Codeception'),
);

+ 380
- 1
vendor/composer/installed.json View File

@@ -1325,7 +1325,7 @@
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kartik-v/yii2-mpdf/zipball/67980ab7861ae9541b1a1784be8938dbeba13045",
"url": "https://api.github.com/repos/kartik-v/yii2-mpdf/zipball/beecfa00d5debfef1ccac6ff7b1abe8560b6ffd1",
"reference": "17fda1cb084c58fee6014026d35af5faf73316ef",
"shasum": ""
},
@@ -3973,5 +3973,384 @@
"functional testing",
"unit testing"
]
},
{
"name": "composer/installers",
"version": "v1.6.0",
"version_normalized": "1.6.0.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "^4.8.36"
},
"time": "2018-08-27 06:10:37",
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Composer\\Installers\\": "src/Composer/Installers"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/",
"keywords": [
"Craft",
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"Lan Management System",
"MODX Evo",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Thelia",
"WolfCMS",
"agl",
"aimeos",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"eZ Platform",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"joomla",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"majima",
"mako",
"mediawiki",
"modulework",
"modx",
"moodle",
"osclass",
"phpbb",
"piwik",
"ppi",
"puppet",
"pxcms",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"symfony",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
]
},
{
"name": "fortawesome/font-awesome",
"version": "v4.7.0",
"version_normalized": "4.7.0.0",
"source": {
"type": "git",
"url": "https://github.com/FortAwesome/Font-Awesome.git",
"reference": "a8386aae19e200ddb0f6845b5feeee5eb7013687"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FortAwesome/Font-Awesome/zipball/a8386aae19e200ddb0f6845b5feeee5eb7013687",
"reference": "a8386aae19e200ddb0f6845b5feeee5eb7013687",
"shasum": ""
},
"require-dev": {
"jekyll": "1.0.2",
"lessc": "1.4.2"
},
"time": "2016-10-24 15:52:54",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.6.x-dev"
}
},
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
"license": [
"OFL-1.1",
"MIT"
],
"authors": [
{
"name": "Dave Gandy",
"email": "dave@fontawesome.io",
"homepage": "http://twitter.com/davegandy",
"role": "Developer"
}
],
"description": "The iconic font and CSS framework",
"homepage": "http://fontawesome.io/",
"keywords": [
"FontAwesome",
"awesome",
"bootstrap",
"font",
"icon"
]
},
{
"name": "rmrevin/yii2-fontawesome",
"version": "2.17.1",
"version_normalized": "2.17.1.0",
"source": {
"type": "git",
"url": "https://github.com/rmrevin/yii2-fontawesome.git",
"reference": "65ce306da864f4d558348aeba040ed7876878090"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/65ce306da864f4d558348aeba040ed7876878090",
"reference": "65ce306da864f4d558348aeba040ed7876878090",
"shasum": ""
},
"require": {
"fortawesome/font-awesome": "~4.7",
"php": ">=5.4.0",
"yiisoft/yii2": "2.0.*"
},
"time": "2017-01-11 14:05:47",
"type": "yii2-extension",
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"rmrevin\\yii\\fontawesome\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Revin Roman",
"email": "roman@rmrevin.com",
"homepage": "https://rmrevin.com/"
}
],
"description": "Asset Bundle for Yii2 with Font Awesome",
"keywords": [
"asset",
"awesome",
"bundle",
"font",
"yii"
]
},
{
"name": "almasaeed2010/adminlte",
"version": "v2.4.8",
"version_normalized": "2.4.8.0",
"source": {
"type": "git",
"url": "https://github.com/almasaeed2010/AdminLTE.git",
"reference": "d9e68301848a95dff2e2dbef6569e617a9b3fa30"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/almasaeed2010/AdminLTE/zipball/d9e68301848a95dff2e2dbef6569e617a9b3fa30",
"reference": "d9e68301848a95dff2e2dbef6569e617a9b3fa30",
"shasum": ""
},
"require": {
"bower-asset/jquery": ">=1.9.0 <4.0.0",
"composer/installers": "1.*"
},
"time": "2018-07-15 18:48:11",
"type": "template",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Abdullah Almsaeed",
"email": "abdullah@almsaeedstudio.com"
}
],
"description": "AdminLTE - admin control panel and dashboard that's based on Bootstrap 3",
"homepage": "https://adminlte.io/",
"keywords": [
"JS",
"admin",
"back-end",
"css",
"less",
"responsive",
"template",
"theme",
"web"
]
},
{
"name": "cebe/yii2-gravatar",
"version": "1.1",
"version_normalized": "1.1.0.0",
"target-dir": "cebe/gravatar",
"source": {
"type": "git",
"url": "https://github.com/cebe/yii2-gravatar.git",
"reference": "c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cebe/yii2-gravatar/zipball/c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057",
"reference": "c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057",
"shasum": ""
},
"require": {
"yiisoft/yii2": "*"
},
"time": "2013-12-10 17:49:58",
"type": "yii2-extension",
"installation-source": "dist",
"autoload": {
"psr-0": {
"cebe\\gravatar\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Carsten Brandt",
"email": "mail@cebe.cc",
"homepage": "http://cebe.cc/",
"role": "Core framework development"
}
],
"description": "Gravatar Widget for Yii 2",
"keywords": [
"gravatar",
"yii"
]
},
{
"name": "dmstr/yii2-adminlte-asset",
"version": "2.6.2",
"version_normalized": "2.6.2.0",
"source": {
"type": "git",
"url": "https://github.com/dmstr/yii2-adminlte-asset.git",
"reference": "c96336e1960ebc6c1e72487a7c6ca1a1589519fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/c96336e1960ebc6c1e72487a7c6ca1a1589519fe",
"reference": "c96336e1960ebc6c1e72487a7c6ca1a1589519fe",
"shasum": ""
},
"require": {
"almasaeed2010/adminlte": "^2.4.0",
"cebe/yii2-gravatar": "1.*",
"rmrevin/yii2-fontawesome": "~2.9",
"yiisoft/yii2": "2.*",
"yiisoft/yii2-bootstrap": "~2.0.0"
},
"time": "2018-07-24 14:47:13",
"type": "yii2-extension",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"dmstr\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Tobias Munk",
"email": "tobias@diemeisterei.de"
},
{
"name": "Evgeniy Tkachenko",
"email": "et.coder@gmail.com"
}
],
"description": "AdminLTE backend theme asset bundle for Yii 2.0 Framework",
"keywords": [
"AdminLTE",
"admin",
"asset",
"backend",
"css",
"extension",
"less",
"theme",
"yii2"
]
}
]

+ 27
- 0
vendor/yiisoft/extensions.php View File

@@ -102,4 +102,31 @@ return array (
'@kartik/mpdf' => $vendorDir . '/kartik-v/yii2-mpdf',
),
),
'rmrevin/yii2-fontawesome' =>
array (
'name' => 'rmrevin/yii2-fontawesome',
'version' => '2.17.1.0',
'alias' =>
array (
'@rmrevin/yii/fontawesome' => $vendorDir . '/rmrevin/yii2-fontawesome',
),
),
'cebe/yii2-gravatar' =>
array (
'name' => 'cebe/yii2-gravatar',
'version' => '1.1.0.0',
'alias' =>
array (
'@cebe/gravatar' => $vendorDir . '/cebe/yii2-gravatar/cebe/gravatar',
),
),
'dmstr/yii2-adminlte-asset' =>
array (
'name' => 'dmstr/yii2-adminlte-asset',
'version' => '2.6.2.0',
'alias' =>
array (
'@dmstr' => $vendorDir . '/dmstr/yii2-adminlte-asset',
),
),
);

+ 1
- 1
vendor/yiisoft/yii2/web/User.php View File

@@ -256,7 +256,7 @@ class User extends Component
Yii::info($log, __METHOD__);
$this->afterLogin($identity, false, $duration);
}
return !$this->getIsGuest();
}


Loading…
Cancel
Save