Advertisement
ganryu

muestra

Jul 14th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?php
  2.  
  3. use yii\bootstrap\Html;
  4. use yii\grid\GridView;
  5. use yii\widgets\Pjax;
  6. use app\models\Producto;
  7.  
  8. /* @var $this yii\web\View */
  9. /* @var $searchModel app\models\ProductoSearch */
  10. /* @var $dataProvider yii\data\ActiveDataProvider */
  11.  
  12. $this->title = 'Productos';
  13. $this->params['breadcrumbs'][] = $this->title;
  14.  
  15. $gridOptions = ['class' => 'table table-hover'];
  16. $gridColumns = [
  17.     ['attribute' => '#', 'value' => 'ID'],
  18.     'Descripcion',
  19.     'PrecioVenta:currency',
  20.     'Cantidad',
  21.     //'FechaUltModificacion',
  22. ];
  23.  
  24. array_push($gridColumns, [
  25.     'class' => 'yii\grid\ActionColumn',
  26.     'header' => 'Acciones',
  27.     'template' => '{view} {update}',
  28. ]);
  29.  
  30. $layout = implode("\n", [
  31.     "<div class='panel panel-default'>",
  32.         "{items}",
  33.         "<div class='panel-footer'>{summary}</div>",
  34.     "</div>",
  35.     "{pager}",
  36. ]);
  37.  
  38. $gridView = GridView::widget([
  39.     'dataProvider' => $dataProvider,
  40.     'filterModel' => $searchModel,
  41.     'tableOptions' => $gridOptions,
  42.     'columns' => $gridColumns,
  43.     'layout' => $layout,    
  44. ]);
  45.  
  46. \yii::error(\yii\helpers\VarDumper::dumpAsString(Producto::find()->all()))
  47. ?>
  48. <div class="producto-index">
  49.     <div class="page-header">
  50.         <h1><?= Html::encode($this->title) ?></h1>
  51.     </div>
  52.     <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  53.     <p>
  54.         <?= Html::a('Nuevo Producto', ['nuevo'], ['class' => 'btn btn-success']) ?>
  55.         <?= Html::a('Ingreso de Productos', ['ingreso'], ['class' => 'btn btn-primary']) ?>
  56.     </p>
  57.     <?php Pjax::begin([
  58.         'enablePushState' => false,
  59.     ]); ?>
  60.         <?= $gridView ?>
  61.     <?php Pjax::end(); ?>
  62. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement