- <?php
-
-
-
- use yii\helpers\Html;
- use yii\grid\GridView;
- use common\models\PointVenteUser ;
-
- $this->setTitle('Points de vente') ;
- $this->addBreadcrumb($this->getTitle()) ;
- $this->addButton(['label' => '+', 'url' => 'point-sale/create', 'class' => 'btn btn-primary']) ;
-
- ?>
-
- <div class="point-sale-index">
- <?= GridView::widget([
- 'filterModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- 'columns' => [
- 'name',
- 'locality',
- [
- 'attribute' => 'point_production',
- 'format' => 'raw',
- 'filter' => [0 => 'Non',1 => 'Oui'],
- 'value' => function($model) {
- if($model->point_production)
- {
- return '<span class="label label-success">Oui</span>' ;
- }
- else {
- return '<span class="label label-danger">Non</span>' ;
- }
-
- }
- ],
- [
- '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' => '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();
- $html = '' ;
- if($model->restricted_access)
- {
- $html .= '<span class="glyphicon glyphicon-lock"></span> ' ;
- if($count == 1)
- {
- $html .= '1 utilisateur' ;
- }
- else {
- $html .= $count.' utilisateurs' ;
- }
- }
-
- if(strlen($model->code))
- {
- if(strlen($html)) $html .= '<br />' ;
- $html .= 'Code : <strong>'.Html::encode($model->code).'</strong>' ;
- }
-
- return $html ;
-
- }
- ],
- [
- 'attribute' => 'credit',
- 'label' => 'Crédit',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->credit) {
- return '<span class="glyphicon glyphicon-euro"></span>' ;
- }
-
- return '' ;
- }
- ],
- [
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{update} {delete}',
- 'headerOptions' => ['class' => 'column-actions'],
- 'contentOptions' => ['class' => 'column-actions'],
- 'buttons' => [
- 'update' => function ($url, $model) {
- 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>', $url, [
- 'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
- ]);
- }
- ],
- ],
- ],
- ]); ?>
- </div>
|