public function actionIndex()
 {
     $provinsi = new Provinsi();
     $kota = new Kota();
     $harga = new Harga();
     if ($provinsi->load(Yii::$app->request->post()) && $provinsi->save()) {
         return $this->redirect(['view', 'id' => $model->G_ORDER]);
     } else {
         return $this->render('index', ['provinsi' => $provinsi, 'kota' => $kota, 'model' => $harga]);
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Provinsi::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(['PROVINCE_ID' => $this->PROVINCE_ID]);
     $query->andFilterWhere(['like', 'PROVINCE', $this->PROVINCE]);
     return $dataProvider;
 }
 /**
  * Finds the Provinsi model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Provinsi the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Provinsi::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #4
0
        */
?>
    <?php 
echo "<h2><b>Origin</b></h2>";
?>

    <?php 
echo $form->field($model, 'ORIGIN_PROVINCE')->dropDownList(ArrayHelper::map(Provinsi::find()->asArray()->all(), 'PROVINCE_ID', 'PROVINCE'), ['id' => 'cat-id'], ['prompt' => '-Choose a provinsi-']);
echo $form->field($model, 'ORIGIN_CITY')->widget(\kartik\depdrop\DepDrop::classname(), ['options' => ['id' => 'subcat-id'], 'pluginOptions' => ['depends' => ['cat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/site/get-kota'])]]);
?>
     <?php 
echo "<h2><b>Destination</b></h2>";
?>

    <?php 
$Expired = Provinsi::find()->all();
$listData = ArrayHelper::map($Expired, 'PROVINCE_ID', 'PROVINCE');
echo $form->field($model, 'DES_PROVINCE')->dropDownList($listData, ['prompt' => '-Pilih Provinsi-', 'onchange' => '
                $.post( "index.php?r=site/lists&id=' . '"+$(this).val(), function( data ) {
                  $( "select#harga-des_city" ).html( data );
                });
            '])->label('Des Province');
?>
    <?php 
$dataPost = ArrayHelper::map(Kota::find()->all(), 'CITY_ID', 'CITY_NAME');
echo $form->field($model, 'DES_CITY')->dropDownList($dataPost);
?>
    <?php 
echo $form->field($model, 'HARGA')->textInput();
?>
    <?php