Пример #1
0
    <?php 
Pjax::begin(['id' => 'nosGrid']);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'export' => false, 'pjax' => true, 'rowOptions' => function ($model) {
    //tällä värit search kolumneille
    if ($model->nayte_lahetetty == 'Kyllä') {
        return ['class' => 'success'];
        //danger, warning, success
    } else {
        if ($model->nayte_lahetetty == 'Kyllä' && $model->analyysi_tehty == 'Kyllä') {
            return ['class' => 'danger'];
        }
    }
}, 'columns' => [['class' => 'kartik\\grid\\ExpandRowColumn', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    $searchModel = new NosSearch();
    $searchModel->id = $model->id;
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
    return Yii::$app->controller->renderPartial('_expand', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
}], 'luontipvm', 'tuote_id', 'bakteeri_id', ['attribute' => 'analyysi_tehty', 'filter' => Html::activeDropDownList($searchModel, 'analyysi_tehty', array("Kyllä" => "Kyllä", "Ei" => "Ei"), ['class' => 'form-control', 'prompt' => 'Kaikki'])], ['attribute' => 'nayte_lahetetty', 'filter' => Html::activeDropDownList($searchModel, 'nayte_lahetetty', array("Kyllä" => "Kyllä", "Ei" => "Ei"), ['class' => 'form-control', 'prompt' => 'Kaikki'])], ['attribute' => 'naytteenottopvm', 'value' => 'naytteenottopvm', 'format' => 'raw', 'filter' => DatePicker::widget(['model' => $searchModel, 'name' => 'check_issue_date', 'value' => date('d-M-Y', strtotime('+2 days')), 'options' => ['placeholder' => 'Valitse'], 'language' => 'fi', 'pluginOptions' => ['format' => 'dd-M-yyyy', 'todayHighlight' => true]])], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {tulokset}'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{send} {delete}']]]);
?>
    <?php 
Pjax::end();
?>



</div>
Пример #2
0
 /**
  * Lists all Nos models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new NosSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }