/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Orderstatuses::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(['id' => $this->id]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
 /**
  * Finds the Orderstatuses model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Orderstatuses the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Orderstatuses::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#3
0
    <?php 
echo $form->field($model, 'company_id')->dropDownList(ArrayHelper::map(Companies::find()->asArray()->all(), 'id', 'name'), ['prompt' => 'Select Company', 'onchange' => '
                $.post("http://orderprocessing/web/admin/affiliates/lists?id=' . '"+$(this).val(), function(data){
                    $("select#orders-affiliate_id").html(data);
                });']);
?>

    <?php 
echo $form->field($model, 'affiliate_id')->dropDownList(ArrayHelper::map(Affiliates::find()->asArray()->all(), 'id', 'name'), ['prompt' => 'Select Affiliate']);
?>



    <?php 
echo $form->field($model, 'order_status_id')->dropDownList(ArrayHelper::map(Orderstatuses::find()->all(), 'id', 'title'), ['prompt' => 'Select Order Status']);
?>
    <?php 
echo $form->field($model, 'assignedto_id')->dropDownList(ArrayHelper::map(Users::find()->where(['user_role_id' => 2])->all(), 'id', 'username'), ['prompt' => 'Select User']);
?>

    <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();
?>