/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Nurse::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['ID' => $this->ID, 'nu_is_meiomenou' => $this->nu_is_meiomenou, 'nu_ores_ergasias' => $this->nu_ores_ergasias, 'nu_is_ekpaideuomanos' => $this->nu_is_ekpaideuomanos, 'ns_is_proistamenos' => $this->ns_is_proistamenos, 'nu_is_apospasmenos' => $this->nu_is_apospasmenos, 'nu_upoloipo_adeias' => $this->nu_upoloipo_adeias, 'nu_upoloipo_repo' => $this->nu_upoloipo_repo]);
     $query->andFilterWhere(['like', 'nu_onoma', $this->nu_onoma])->andFilterWhere(['like', 'nu_epitheto', $this->nu_epitheto])->andFilterWhere(['like', 'nu_bathmida', $this->nu_bathmida])->andFilterWhere(['like', 'nu_apospasmenos_perigafh', $this->nu_apospasmenos_perigafh])->andFilterWhere(['like', 'nu_profile', $this->nu_profile]);
     return $dataProvider;
 }
$nurseModel = new \app\models\Nurse();
?>
<div class="nurseshift-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Nurseshift'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'ns_nurseID', 'label' => 'Όνομα Νοσηλευτή', 'value' => function ($model, $index, $dataColumn) {
    // more optimized than $model->role->name;
    $roleDropdown = \app\models\Nurse::dropdown();
    return $roleDropdown[$model->ns_nurseID];
}, 'filter' => \app\models\Nurse::dropdown()], ['attribute' => 'ns_type', 'label' => 'Τύπος', 'value' => 'nsType.description', 'filter' => \app\models\Types::dropdown()], ['attribute' => 'ns_shiftID', 'label' => 'Ημερομηνία', 'value' => function ($model, $index, $dataColumn) {
    // more optimized than $model->role->name;
    $roleDropdown = \app\models\Shifts::dropdown();
    return $roleDropdown[$model->ns_nurseID];
}, 'filter' => \yii\jui\DatePicker::widget(['language' => 'el', 'dateFormat' => 'dd-MM-yyyy']), 'format' => 'html'], 'ns_hours', ['class' => 'yii\\grid\\ActionColumn']], 'containerOptions' => ['style' => 'overflow: auto'], 'beforeHeader' => [['columns' => [['content' => 'Header Before 1', 'options' => ['colspan' => 3, 'class' => 'text-center warning']], ['content' => 'Header Before 2', 'options' => ['colspan' => 3, 'class' => 'text-center warning']], ['content' => 'Header Before 3', 'options' => ['colspan' => 1, 'class' => 'text-center warning']]], 'options' => ['class' => 'skip-export']]], 'toolbar' => [['content' => Html::button('&lt;i class="glyphicon glyphicon-plus">&lt;/i>', ['type' => 'button', 'title' => Yii::t('kvgrid', 'Add Book'), 'class' => 'btn btn-success', 'onclick' => 'alert("This will launch the book creation form.\\n\\nDisabled for this demo!");']) . ' ' . Html::a('&lt;i class="glyphicon glyphicon-repeat">&lt;/i>', ['grid-demo'], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')])], '{export}', '{toggleData}'], 'pjax' => true, 'bordered' => true, 'striped' => false, 'condensed' => false, 'responsive' => true, 'hover' => true, 'floatHeader' => true]);
?>

</div>
/* @var $model app\models\Nurseshift */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="nurseshift-form">

    <?php 
$form = ActiveForm::begin();
?>

    <!--<?php 
echo $form->field($model, 'ns_nurseID')->textInput();
?>
-->
    <?php 
echo $form->field($model, 'ns_nurseID')->dropDownList(Nurse::dropdown());
?>

    <?php 
echo $form->field($model, 'ns_shiftID')->textInput();
?>

    <?php 
echo $form->field($model, 'ns_type')->dropDownList(Types::dropdown());
?>

    <?php 
echo $form->field($model, 'ns_hours')->textInput();
?>

    <div class="form-group">
 public function getNurse()
 {
     return $this->hasOne(Nurse::className(), ['ID' => 'ns_nurseID']);
 }
 /**
  * Finds the Nurse model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Nurse the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Nurse::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }