예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $id = Yii::$app->user->id;
     $query = EntpProduct::find();
     $query->joinWith(['entrepreneur', 'product'])->where('entp_product.entrepreneur_user_id=' . $id);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['product'] = ['asc' => ['product.product' => SORT_ASC], 'desc' => ['product.product' => SORT_DESC]];
     $dataProvider->sort->attributes['code'] = ['asc' => ['product.code' => SORT_ASC], 'desc' => ['product.code' => SORT_DESC]];
     $dataProvider->sort->attributes['qty'] = ['asc' => ['product.qty' => SORT_ASC], 'desc' => ['product.qty' => SORT_DESC]];
     $dataProvider->sort->attributes['created_at'] = ['asc' => ['product.created_at' => SORT_ASC], 'desc' => ['product.created_at' => SORT_DESC]];
     $dataProvider->sort->attributes['updated_at'] = ['asc' => ['product.updated_at' => SORT_ASC], 'desc' => ['product.updated_at' => SORT_DESC]];
     $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(['entrepreneur_user_id' => $this->entrepreneur_user_id, 'product_id' => $this->product_id]);
     $query->andFilterWhere(['like', 'product.code', $this->code])->andFilterWhere(['like', 'product.qty', $this->qty])->andFilterWhere(['like', 'product.product', $this->product])->andFilterWhere(['like', 'product.created_at', $this->created_at])->andFilterWhere(['like', 'product.updated_at', $this->updated_at]);
     return $dataProvider;
 }
예제 #2
0
파일: view.php 프로젝트: azruljamil/smev3
?>

            <?php 
echo $form->field($model, 'item')->hiddenInput(['id' => 'item'])->label(false);
?>
            <?php 
echo $form->field($model, 'code')->hiddenInput(['id' => 'code'])->label(false);
?>
            <?php 
echo $form->field($model, 'price')->hiddenInput(['id' => 'price'])->label(false);
?>

            <div class="row">
                <div class="col-lg-5">
                    <?php 
echo $form->field($model, 'productSelect')->label('Select Product')->dropDownList(ArrayHelper::map(EntpProduct::find()->joinWith('product')->where('entp_product.entrepreneur_user_id=' . $id)->all(), 'product.id', 'product.product'), ['style' => 'width:230px;', 'tabindex' => '3', 'prompt' => '', 'id' => 'productSelect']);
?>

                    <div id="hehe">

                    </div>
                </div>
                <div class="col-lg-2">
                    <?php 
echo $form->field($model, 'qty')->textInput(['id' => 'qty', 'style' => 'width:50px;'])->label('Qty');
?>
                </div>
                <br>
                <div class="col-lg-3">
                    <div class="form-group">
                        <?php