|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
-
-
-
- use common\components\View;
- use yii\helpers\Html;
- use yii\grid\GridView;
-
-
-
- $this->setTitle('Accessoires');
- $this->addBreadcrumb($this->getTitle());
- $this->addButton(['label' => 'Nouvel accessoire <span class="glyphicon glyphicon-plus"></span>', 'url' => 'accessory/create', 'class' => 'btn btn-primary']);
-
- ?>
-
- <div class="accessory-index">
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'columns' => [
- 'name',
- 'quantity',
- [
- 'label' => 'Produits',
- 'format' => 'raw',
- 'value' => function($accessory) {
- $html = '';
- foreach($accessory->getProductAccessories() as $productAccessory) {
- $html .= '<span class="label label-default">'.Html::encode($productAccessory->getProduct()->name).'</span> ';
- }
-
- return $html;
- }
- ],
- [
- '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' => 'Modifier', 'class' => 'btn btn-default'
- ]);
- },
- 'delete' => function ($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
- 'title' => 'Supprimer', 'class' => 'btn btn-default'
- ]);
- }
- ],
- ],
- ],
- ]); ?>
- </div>
|