/** * Creates a new Sales model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($store) { $model = new Sales(); $model->date = date('Y-m-d H:i:s'); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['stores/view', 'id' => $model->fkstore_id]); } else { return $this->render('create', ['model' => $model, 'store' => Stores::findOne($store), 'fruit' => Fruit::find()->asArray()->all()]); } }
/** * Finds the Stores model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Stores the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Stores::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
} ?> <div class="col-md-4 col-md-offset-4"> <?php echo $form->field($filterForm, 'product_id')->dropDownList($allProducts, ['prompt' => Yii::t('easyii', 'Product'), 'class' => 'btn btn-findUs dropdown-toggle'])->label(''); ?> </div> <div class="clearfix"></div> <div class="col-md-4"> <?php echo $form->field($filterForm, 'country')->dropDownList(\app\models\Stores::FetchCountries(), ['prompt' => Yii::t('easyii', 'Country'), 'class' => 'btn btn-findUs dropdown-toggle', 'onchange' => ' $.post( "' . Yii::$app->urlManager->createUrl('stores/government?code=') . '"+$(this).val(), function( data ) { $( "select#gadgetsstoresfilterform-government" ).html( data ); })'])->label(''); ?> </div> <div class="col-md-4"> <?php if (isset($filterForm->country) and $filterForm->country != '') { $government = \app\models\Govenment::find()->where('country_code="' . $filterForm->country . '"')->all(); $listData = \yii\helpers\ArrayHelper::map($government, 'government_code', 'title');
/** * @return \yii\db\ActiveQuery */ public function getStore() { return $this->hasOne(Stores::className(), ['store_id' => 'fkstore_id']); }
echo $form->field($filterForm, 'country')->dropDownList(\app\models\Stores::FetchCountries(), ['prompt' => Yii::t('easyii', 'Country'), 'class' => 'btn btn-findUs dropdown-toggle'])->label(''); ?> </div></div> <div class="col-md-4"><div class="dropdown"> <?php echo $form->field($filterForm, 'government')->dropDownList(\app\models\Stores::FetchGovernment(), ['prompt' => Yii::t('easyii', 'Government'), 'class' => 'btn btn-findUs dropdown-toggle'])->label(''); ?> </div></div> <div class="col-md-4 col-md-offset-2"><div class="dropdown"> <?php echo $form->field($filterForm, 'city')->dropDownList(\app\models\Stores::FetchCity(), ['prompt' => Yii::t('easyii', 'City'), 'class' => 'btn btn-findUs dropdown-toggle'])->label(''); ?> </div></div> <div class="col-md-4"><div class="dropdown"> <?php echo $form->field($filterForm, 'district')->dropDownList(\app\models\Stores::FetchDistrict(), ['prompt' => Yii::t('easyii', 'District'), 'class' => 'btn btn-findUs dropdown-toggle'])->label(''); ?> </div></div> <div class="row"> <div class="col-md-12"> <a href="#"> <input type="image" name="submit" src="<?php echo Yii::$app->getUrlManager()->getBaseUrl(); ?> /theme/images/search-icon.png" border="0" class="center-block margin-top20" /> </a> </div> </div> <?php