/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = KindOfWagon::find();
     $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;
     }
     $query->andFilterWhere(['kind_id' => $this->kind_id]);
     $query->andFilterWhere(['like', 'kind_name', $this->kind_name]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
$this->title = 'Wagons';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="wagon-index">

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

    <p>
        <?php 
echo Html::button('Thêm toa', ['value' => Url::to('wagon/create'), 'class' => 'btn btn-success', 'id' => 'modalButton']);
?>
    </p>

    <?php 
Modal::begin(['header' => '<h4>THÊM TOA XE</h4>', 'id' => 'modal', 'size' => 'modal-lg']);
echo "<div id='modalContent'></div>";
Modal::end();
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'wagon_number', 'created_year', ['attribute' => 'start_date', 'value' => 'start_date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'start_date', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])], ['attribute' => 'wagon_status_id_status', 'value' => 'wagonStatusIdStatus.name_of_status', 'filter' => Html::activeDropDownList($searchModel, 'wagon_status_id_status', ArrayHelper::map(WagonStatus::find()->all(), 'status_id', 'name_of_status'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['attribute' => 'station_station_id', 'value' => 'stationStation.station_name', 'filter' => Html::activeDropDownList($searchModel, 'station_station_id', ArrayHelper::map(\app\models\Station::find()->all(), 'station_id', 'station_name'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['attribute' => 'kind_of_wagon_kind_id', 'value' => 'kindOfWagonKind.kind_name', 'filter' => Html::activeDropDownList($searchModel, 'kind_of_wagon_kind_id', ArrayHelper::map(\app\models\KindOfWagon::find()->all(), 'kind_id', 'kind_name'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Ejemplo n.º 3
0
    <?php 
echo $form->field($model, 'start_date')->widget(DatePicker::className(), ['inline' => false, 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
?>

    <?php 
echo $form->field($model, 'wagon_status_id_status')->dropDownList(ArrayHelper::map(WagonStatus::find()->all(), 'status_id', 'name_of_status'), ['prompt' => 'Trạng thái toa...']);
?>



    <?php 
echo $form->field($model, 'station_station_id')->dropDownList(ArrayHelper::map(Station::find()->all(), 'station_id', 'station_name'), ['prompt' => 'Chọn ga...']);
?>
    <?php 
echo $form->field($model, 'kind_of_wagon_kind_id')->dropDownList(ArrayHelper::map(KindOfWagon::find()->all(), 'kind_id', 'kind_name'), ['prompt' => 'Chọn loại toa...']);
?>



    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>