選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

79 行
2.7KB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. use common\models\PointVenteUser ;
  5. /* @var $this yii\web\View */
  6. /* @var $dataProvider yii\data\ActiveDataProvider */
  7. $this->title = 'Points de vente';
  8. $this->params['breadcrumbs'][] = $this->title;
  9. ?>
  10. <div class="point-vente-index">
  11. <h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>
  12. <?= GridView::widget([
  13. 'dataProvider' => $dataProvider,
  14. 'columns' => [
  15. 'nom',
  16. 'localite',
  17. [
  18. 'attribute' => 'point_fabrication',
  19. 'format' => 'raw',
  20. 'value' => function($model) {
  21. if($model->point_fabrication)
  22. {
  23. return '<span class="label label-success">Oui</span>' ;
  24. }
  25. else {
  26. return '<span class="label label-danger">Non</span>' ;
  27. }
  28. }
  29. ],
  30. [
  31. 'attribute' => 'acces_restreint',
  32. 'format' => 'raw',
  33. 'value' => function($model) {
  34. $count = PointVenteUser::find()->where(['id_point_vente' => $model->id])->count();
  35. if($model->acces_restreint)
  36. {
  37. $html = '<span class="glyphicon glyphicon-lock"></span> ' ;
  38. if($count == 1)
  39. {
  40. $html .= '1 utilisateur' ;
  41. }
  42. else {
  43. $html .= $count.' utilisateurs' ;
  44. }
  45. return $html ;
  46. }
  47. else {
  48. return '' ;
  49. }
  50. }
  51. ],
  52. [
  53. 'class' => 'yii\grid\ActionColumn',
  54. 'template' => '{update} {delete}',
  55. 'headerOptions' => ['class' => 'actions'],
  56. 'buttons' => [
  57. 'update' => function ($url, $model) {
  58. return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
  59. 'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
  60. ]);
  61. },
  62. 'delete' => function ($url, $model) {
  63. return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
  64. 'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
  65. ]);
  66. }
  67. ],
  68. ],
  69. ],
  70. ]); ?>
  71. </div>