@@ -37,10 +37,10 @@ class ProduitController extends Controller | |||
'class' => AccessControl::className(), | |||
'rules' => [ | |||
[ | |||
'allow' => true, | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ; | |||
'matchCallback' => function ($rule, $action) { | |||
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ; | |||
} | |||
] | |||
], | |||
@@ -56,6 +56,9 @@ class ProduitController extends Controller | |||
{ | |||
$dataProvider = new ActiveDataProvider([ | |||
'query' => Produit::find()->where('(vrac IS NULL OR vrac = 0)')->orderBy('order ASC'), | |||
'pagination' => [ | |||
'pageSize' => 1000, | |||
], | |||
]); | |||
return $this->render('index', [ | |||
@@ -85,7 +88,7 @@ class ProduitController extends Controller | |||
$model = new Produit(); | |||
if ($model->load(Yii::$app->request->post()) && $model->save()) { | |||
self::uploadFile($model, 'illustration') ; | |||
self::uploadFile($model, 'illustration') ; | |||
self::uploadFile($model, 'photo') ; | |||
// on ajoute un enregistrement ProductionProduit pour chaque production | |||
@@ -130,10 +133,10 @@ class ProduitController extends Controller | |||
$model->save() ; | |||
} | |||
$delete_photo = $request->post('delete_photo',0) ; | |||
if($delete_photo) { | |||
$model->photo = '' ; | |||
$model->save() ; | |||
$delete_photo = $request->post('delete_photo',0) ; | |||
if($delete_photo) { | |||
$model->photo = '' ; | |||
$model->save() ; | |||
} | |||
return $this->redirect(['index']); | |||
@@ -145,16 +148,16 @@ class ProduitController extends Controller | |||
} | |||
public static function uploadFile($model, $champs, $filename_old = '') { | |||
$file = UploadedFile::getInstance($model, $champs); | |||
if($file) { | |||
$file_name = $file->baseName.'-'.uniqid().'.' . $file->extension ; | |||
$file->saveAs('../../frontend/web/uploads/' . $file_name); | |||
$model->$champs = $file_name ; | |||
} | |||
else { | |||
$model->$champs = $filename_old ; | |||
} | |||
$file = UploadedFile::getInstance($model, $champs); | |||
if($file) { | |||
$file_name = $file->baseName.'-'.uniqid().'.' . $file->extension ; | |||
$file->saveAs('../../frontend/web/uploads/' . $file_name); | |||
$model->$champs = $file_name ; | |||
} | |||
else { | |||
$model->$champs = $filename_old ; | |||
} | |||
$model->save() ; | |||
} | |||
@@ -25,32 +25,36 @@ AppAsset::register($this); | |||
<div class="wrap"> | |||
<?php | |||
NavBar::begin([ | |||
'brandLabel' => 'Le Chat des Noisettes', | |||
'brandLabel' => '<span class="glyphicon glyphicon-home"></span>', | |||
'brandUrl' => Yii::$app->homeUrl, | |||
'options' => [ | |||
'class' => 'navbar-inverse navbar-fixed-top', | |||
'class' => 'navbar-inverse navbar-fixed-top nav-header', | |||
], | |||
]); | |||
$menuItems = [ | |||
['label' => 'Production', 'url' => ['/commande/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => 'Pain', 'url' => ['/produit/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => 'Vrac', 'url' => ['/vrac/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => 'Points de vente', 'url' => ['/point-vente/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => 'Utilisateurs', 'url' => ['/user/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => 'Statistiques', 'url' => ['/stats/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => '<span class="glyphicon glyphicon-calendar"></span> Production', 'url' => ['/commande/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => '<span class="glyphicon glyphicon-grain"></span> Produits', 'url' => ['/produit/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente', 'url' => ['/point-vente/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
['label' => '<span class="glyphicon glyphicon-user"></span> Utilisateurs', 'url' => ['/user/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
//['label' => 'Statistiques', 'url' => ['/stats/index'], 'visible'=> !Yii::$app->user->isGuest], | |||
]; | |||
if (Yii::$app->user->isGuest) { | |||
$menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']]; | |||
} else { | |||
$menuItems[] = [ | |||
'label' => 'Déconnexion (' . Yii::$app->user->identity->username . ')', | |||
'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion', | |||
'url' => ['/site/logout'], | |||
'linkOptions' => ['data-method' => 'post'] | |||
]; | |||
$menuItems[] = [ | |||
'label' => '<span class="retour-site">Retour sur le site</span>', | |||
'url' => '../../frontend/web/', | |||
]; | |||
} | |||
echo Nav::widget([ | |||
'options' => ['class' => 'navbar-nav navbar-right'], | |||
'items' => $menuItems, | |||
'encodeLabels' => false | |||
]); | |||
NavBar::end(); | |||
?> |
@@ -6,29 +6,35 @@ use yii\grid\GridView; | |||
/* @var $this yii\web\View */ | |||
/* @var $dataProvider yii\data\ActiveDataProvider */ | |||
$this->title = 'Point Ventes'; | |||
$this->title = 'Points de vente'; | |||
$this->params['breadcrumbs'][] = $this->title; | |||
?> | |||
<div class="point-vente-index"> | |||
<h1><?= Html::encode($this->title) ?></h1> | |||
<p> | |||
<?= Html::a('Create Point Vente', ['create'], ['class' => 'btn btn-success']) ?> | |||
</p> | |||
<h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1> | |||
<?= GridView::widget([ | |||
'dataProvider' => $dataProvider, | |||
'columns' => [ | |||
//['class' => 'yii\grid\SerialColumn'], | |||
//'id', | |||
'nom', | |||
'localite', | |||
//'point_fabrication', | |||
//'adresse:ntext', | |||
['class' => 'yii\grid\ActionColumn'], | |||
'localite', | |||
[ | |||
'class' => 'yii\grid\ActionColumn', | |||
'template' => '{update} {delete}', | |||
'headerOptions' => ['class' => 'actions'], | |||
'buttons' => [ | |||
'update' => function ($url, $model) { | |||
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [ | |||
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' | |||
]); | |||
}, | |||
'delete' => function ($url, $model) { | |||
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [ | |||
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default' | |||
]); | |||
} | |||
], | |||
], | |||
], | |||
]); ?> | |||
@@ -11,29 +11,54 @@ $this->params['breadcrumbs'][] = $this->title; | |||
?> | |||
<div class="produit-index"> | |||
<h1><?= Html::encode($this->title) ?></h1> | |||
<p> | |||
<?= Html::a('Create Produit', ['create'], ['class' => 'btn btn-success']) ?> | |||
</p> | |||
<h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1> | |||
<?= GridView::widget([ | |||
'dataProvider' => $dataProvider, | |||
'columns' => [ | |||
//['class' => 'yii\grid\SerialColumn'], | |||
'order', | |||
'diminutif', | |||
[ | |||
'attribute' => 'order', | |||
'headerOptions' => ['class' => 'order'], | |||
'format' => 'raw', | |||
'value' => function($model) { | |||
return '<a class="btn-order btn btn-default" href="javascript:void(0);"><span class="glyphicon glyphicon-resize-vertical"></span></a>' ; | |||
} | |||
], | |||
'diminutif', | |||
'nom', | |||
//'description', | |||
//'actif', | |||
//'illustration', | |||
// 'photo', | |||
'saison', | |||
// 'prix', | |||
// 'poids', | |||
'actif', | |||
['class' => 'yii\grid\ActionColumn'], | |||
[ | |||
'attribute' => 'actif', | |||
'headerOptions' => ['class' => 'actif'], | |||
'contentOptions' => ['class' => 'center'], | |||
'format' => 'raw', | |||
'value' => function($model) { | |||
if($model->actif) | |||
{ | |||
return '<span class="label label-success">oui</span>' ; | |||
} | |||
else { | |||
return '<span class="label label-danger">non</span>' ; | |||
} | |||
} | |||
], | |||
[ | |||
'class' => 'yii\grid\ActionColumn', | |||
'template' => '{update} {delete}', | |||
'headerOptions' => ['class' => 'actions'], | |||
'buttons' => [ | |||
'update' => function ($url, $model) { | |||
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [ | |||
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' | |||
]); | |||
}, | |||
'delete' => function ($url, $model) { | |||
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [ | |||
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default' | |||
]); | |||
} | |||
], | |||
], | |||
], | |||
]); ?> | |||
@@ -11,34 +11,32 @@ $this->params['breadcrumbs'][] = $this->title; | |||
?> | |||
<div class="user-index"> | |||
<h1><?= Html::encode($this->title) ?></h1> | |||
<p> | |||
<?= Html::a('Ajouter un utilisateur', ['create'], ['class' => 'btn btn-success']) ?> | |||
<?= Html::a('<span class="glyphicon glyphicon-envelope"></span> Liste des emails', ['mail'], ['class' => 'btn btn-default']) ?> | |||
</p> | |||
<h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?> <?= Html::a('<span class="glyphicon glyphicon-envelope"></span> Liste des emails', ['mail'], ['class' => 'btn btn-default']) ?></h1> | |||
<?= GridView::widget([ | |||
'dataProvider' => $dataProvider, | |||
'columns' => [ | |||
//['class' => 'yii\grid\SerialColumn'], | |||
//'id', | |||
//'username', | |||
//'auth_key', | |||
//'password_hash', | |||
//'password_reset_token', | |||
// 'email:email', | |||
// 'status', | |||
// 'created_at', | |||
// 'updated_at', | |||
'nom', | |||
'prenom', | |||
//'telephone', | |||
//'email', | |||
//'confiance', | |||
['class' => 'yii\grid\ActionColumn'], | |||
'nom', | |||
'prenom', | |||
'telephone', | |||
'email', | |||
[ | |||
'class' => 'yii\grid\ActionColumn', | |||
'template' => '{update} {delete}', | |||
'headerOptions' => ['class' => 'actions'], | |||
'buttons' => [ | |||
'update' => function ($url, $model) { | |||
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [ | |||
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' | |||
]); | |||
}, | |||
'delete' => function ($url, $model) { | |||
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [ | |||
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default' | |||
]); | |||
} | |||
], | |||
], | |||
], | |||
]); ?> | |||
@@ -7,129 +7,153 @@ | |||
clear: both; | |||
} | |||
/* line 14, ../sass/screen.scss */ | |||
/* line 13, ../sass/screen.scss */ | |||
.nav-header .retour-site { | |||
border-left: solid 1px #9d9d9d; | |||
padding: 10px 15px; | |||
} | |||
/* line 23, ../sass/screen.scss */ | |||
.table thead th.actions { | |||
width: 220px; | |||
} | |||
/* line 26, ../sass/screen.scss */ | |||
.table thead th.order { | |||
width: 58px; | |||
} | |||
/* line 29, ../sass/screen.scss */ | |||
.table thead th.actif { | |||
width: 75px; | |||
text-align: center; | |||
} | |||
/* line 35, ../sass/screen.scss */ | |||
.table tbody td.center { | |||
text-align: center; | |||
} | |||
/* line 43, ../sass/screen.scss */ | |||
#page-commande h1 .btn-group { | |||
float: right; | |||
} | |||
/* line 19, ../sass/screen.scss */ | |||
/* line 48, ../sass/screen.scss */ | |||
#page-commande #jours-production { | |||
display: none; | |||
} | |||
/* line 24, ../sass/screen.scss */ | |||
/* line 53, ../sass/screen.scss */ | |||
#page-commande #calendar .fc-header-title { | |||
margin-left: 10px; | |||
} | |||
/* line 30, ../sass/screen.scss */ | |||
/* line 59, ../sass/screen.scss */ | |||
#page-commande #calendar .dayWithEvent { | |||
background-color: #fee48d; | |||
cursor: pointer; | |||
} | |||
/* line 34, ../sass/screen.scss */ | |||
/* line 63, ../sass/screen.scss */ | |||
#page-commande #calendar .fc-event-container { | |||
display: none; | |||
} | |||
/* line 35, ../sass/screen.scss */ | |||
/* line 64, ../sass/screen.scss */ | |||
#page-commande #calendar .fc-today { | |||
border-bottom: solid 1px #C9302C; | |||
background-color: white; | |||
} | |||
/* line 39, ../sass/screen.scss */ | |||
/* line 68, ../sass/screen.scss */ | |||
#page-commande #calendar .fc-today.dayWithEvent { | |||
background-color: #fee48d; | |||
} | |||
/* line 44, ../sass/screen.scss */ | |||
/* line 73, ../sass/screen.scss */ | |||
#page-commande #calendar .fc-day { | |||
cursor: pointer; | |||
text-align: center; | |||
} | |||
/* line 47, ../sass/screen.scss */ | |||
/* line 76, ../sass/screen.scss */ | |||
#page-commande #calendar .fc-day:hover { | |||
-moz-box-shadow: 0px 0px 2px black inset; | |||
-webkit-box-shadow: 0px 0px 2px black inset; | |||
box-shadow: 0px 0px 2px black inset; | |||
} | |||
/* line 52, ../sass/screen.scss */ | |||
/* line 81, ../sass/screen.scss */ | |||
#page-commande #calendar .current-date { | |||
-moz-box-shadow: 0px 0px 2px black inset; | |||
-webkit-box-shadow: 0px 0px 2px black inset; | |||
box-shadow: 0px 0px 2px black inset; | |||
} | |||
/* line 56, ../sass/screen.scss */ | |||
/* line 85, ../sass/screen.scss */ | |||
#page-commande #calendar .fc-day-number { | |||
float: none; | |||
padding-top: 2px; | |||
} | |||
/* line 63, ../sass/screen.scss */ | |||
/* line 92, ../sass/screen.scss */ | |||
#page-commande #produits-production input.quantite-max { | |||
background-color: white; | |||
border: 1px solid #e0e0e0; | |||
text-align: center; | |||
width: 50px; | |||
} | |||
/* line 71, ../sass/screen.scss */ | |||
/* line 100, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente { | |||
margin-top: 20px; | |||
} | |||
/* line 75, ../sass/screen.scss */ | |||
/* line 104, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .title-point-vente { | |||
background-color: #fff8e2; | |||
border-left: solid 3px #fdd44b; | |||
font-weight: bold; | |||
} | |||
/* line 81, ../sass/screen.scss */ | |||
/* line 110, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente input.quantite { | |||
width: 50px; | |||
background-color: white; | |||
border: solid 1px #e0e0e0; | |||
text-align: center; | |||
} | |||
/* line 88, ../sass/screen.scss */ | |||
/* line 117, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .td-produit { | |||
text-align: center; | |||
} | |||
/* line 92, ../sass/screen.scss */ | |||
/* line 121, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .submit-pv { | |||
float: right; | |||
} | |||
/* line 96, ../sass/screen.scss */ | |||
/* line 125, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .select-user { | |||
background-color: #F9F9F9; | |||
border: solid 1px #e0e0e0; | |||
} | |||
/* line 101, ../sass/screen.scss */ | |||
/* line 130, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .date-commande { | |||
font-size: 12px; | |||
} | |||
/* line 105, ../sass/screen.scss */ | |||
/* line 134, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .datepicker, #page-commande .form-commandes-point-vente .text { | |||
background-color: white; | |||
border: solid 1px #e0e0e0; | |||
margin-top: 3px; | |||
width: 100px; | |||
} | |||
/* line 113, ../sass/screen.scss */ | |||
/* line 142, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente td.center { | |||
text-align: center; | |||
} | |||
/* line 117, ../sass/screen.scss */ | |||
/* line 146, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .depasse { | |||
color: #b32815; | |||
} | |||
/* line 121, ../sass/screen.scss */ | |||
/* line 150, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .total strong span { | |||
font-weight: normal; | |||
font-size: 13px; | |||
} | |||
/* line 126, ../sass/screen.scss */ | |||
/* line 155, ../sass/screen.scss */ | |||
#page-commande .form-commandes-point-vente .vrac { | |||
display: none; | |||
} | |||
/* line 138, ../sass/screen.scss */ | |||
/* line 167, ../sass/screen.scss */ | |||
#email-masse-form #ids-users { | |||
line-height: 30px; | |||
} | |||
/* line 140, ../sass/screen.scss */ | |||
/* line 169, ../sass/screen.scss */ | |||
#email-masse-form #ids-users .label { | |||
text-transform: capitalize; | |||
} |
@@ -9,6 +9,35 @@ | |||
clear: both ; | |||
} | |||
.nav-header { | |||
.retour-site { | |||
//color: #9d9d9d ; | |||
border-left : solid 1px #9d9d9d ; | |||
//@include border-radius(5px) ; | |||
padding: 10px 15px ; | |||
} | |||
} | |||
.table { | |||
thead { | |||
th.actions { | |||
width: 220px ; | |||
} | |||
th.order { | |||
width: 58px ; | |||
} | |||
th.actif { | |||
width: 75px ; | |||
text-align: center; | |||
} | |||
} | |||
tbody { | |||
td.center { | |||
text-align: center ; | |||
} | |||
} | |||
} | |||
#page-commande { | |||
h1 { | |||
.btn-group { |
@@ -6,4 +6,5 @@ return [ | |||
'class' => 'yii\caching\FileCache', | |||
], | |||
], | |||
'language' => 'fr-FR', | |||
]; |