setTitle('Accessoires');
$this->addBreadcrumb($this->getTitle());
$this->addButton(['label' => 'Nouvel accessoire ', 'url' => 'accessory/create', 'class' => 'btn btn-primary']);
?>
= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'name',
'quantity',
[
'label' => 'Produits',
'format' => 'raw',
'value' => function($accessory) {
$html = '';
foreach($accessory->getProductAccessories() as $productAccessory) {
$html .= ''.Html::encode($productAccessory->getProduct()->name).' ';
}
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('', $url, [
'title' => 'Modifier', 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('', $url, [
'title' => 'Supprimer', 'class' => 'btn btn-default'
]);
}
],
],
],
]); ?>