Files
2025-02-23 14:14:55 +01:00

46 lines
1.0 KiB
PHP

<?php
use common\models\Meal;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\ActionColumn;
use yii\grid\GridView;
/** @var yii\web\View $this */
/** @var yii\data\ActiveDataProvider $dataProvider */
$this->title = 'Meals';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="meal-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Capture Meal', ['upload'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'food_name',
'type',
'calories',
'protein',
'fat',
'carbohydrates',
'fiber',
'date:date',
[
'class' => ActionColumn::class,
'urlCreator' => function ($action, Meal $model, $key, $index, $column) {
return Url::toRoute([$action, 'id' => $model->id]);
}
],
],
]); ?>
</div>