/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Distributor::find()->where('d0001.STATUS <> 3'); $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, 'TLP1' => $this->TLP1, 'TLP2' => $this->TLP2, 'FAX' => $this->FAX, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'KD_DISTRIBUTOR', $this->KD_DISTRIBUTOR])->andFilterWhere(['like', 'NM_DISTRIBUTOR', $this->NM_DISTRIBUTOR])->andFilterWhere(['like', 'ALAMAT', $this->ALAMAT])->andFilterWhere(['like', 'PIC', $this->PIC])->andFilterWhere(['like', 'EMAIL', $this->EMAIL])->andFilterWhere(['like', 'WEBSITE', $this->WEBSITE])->andFilterWhere(['like', 'NOTE', $this->NOTE])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'CREATED_AT', $this->CREATED_AT])->andFilterWhere(['like', 'UPDATED_AT', $this->UPDATED_AT])->andFilterWhere(['like', 'DATA_ALL', $this->DATA_ALL]); return $dataProvider; }
/** * Deletes an existing Distributor model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionDelete($id) { $model = Distributor::find()->where(['ID' => $id])->one(); $model->STATUS = '3'; $model->UPDATED_BY = Yii::$app->user->identity->username; $model->save(); return $this->redirect(['index']); }
$drop = ArrayHelper::map(Kategori::find()->where(['STATUS' => 1])->all(), 'KD_KATEGORI', 'NM_KATEGORI'); ?> <?php echo $form->field($model, 'KD_KATEGORI')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --'])->label('Kategori'); ?> <?php $drop = ArrayHelper::map(Unitbarang::find()->all(), 'KD_UNIT', 'NM_UNIT'); ?> <?php echo $form->field($model, 'KD_UNIT')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --']); ?> <?php $drop = ArrayHelper::map(Distributor::find()->all(), 'KD_DISTRIBUTOR', 'NM_DISTRIBUTOR'); ?> <?php echo $form->field($model, 'KD_DISTRIBUTOR')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --']); ?> <?php echo $form->field($model, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]); ?> <?php echo $form->field($model, 'HPP')->textInput(['maxlength' => true]); ?> <?php