Example #1
0
 public function search($params)
 {
     $query = Zone::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere([Zone::tableName() . '.status' => '1']);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'cityId' => $this->cityId, 'createdOn' => $this->createdOn, 'status' => $this->status, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'ip', $this->ip]);
     return $dataProvider;
 }
 /**
  * Finds the Zone model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Zone the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Zone::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Function for locality auto suggestion with zone name
  */
 public function actionLocalityzonesuggest()
 {
     $request = Yii::$app->request->post();
     //var_dump($request);
     list($city, $zone) = $request['depdrop_parents'];
     if ($city == 'Loading ...') {
         $city = '';
     }
     if ($zone == 'Loading ...') {
         $zone = '';
     }
     //$model = new Locality;
     if ($city && $zone) {
         $data = Locality::find()->where(['status' => 1, 'cityId' => $city, 'zoneId' => $zone])->all();
     } else {
         $data = Locality::find()->where(['status' => 1, 'cityId' => $city])->all();
     }
     $dataLoc = array();
     foreach ($data as $value) {
         $obj = new \stdClass();
         $obj->id = $value->Id;
         $obj->zoneId = $value->zoneId;
         $zoneName = \common\models\Zone::findOne(['status' => 1, 'Id' => $obj->zoneId]);
         $obj->name = $value->name . ' (' . $zoneName->name . ')';
         $dataLoc[] = $obj;
     }
     $result = new \stdClass();
     $result->output = $dataLoc;
     $result->selected = "";
     header('Content-Type: application/json');
     echo Json::encode($result);
     \yii::$app->end();
 }
Example #4
0
<div class="locality-form">

    <?php 
$form = ActiveForm::begin();
?>
     <?php 
//echo $form->field($model, 'cityId')->dropDownList(ArrayHelper::merge([''=>'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status'=>1])->All(), 'Id', 'name'))) ;
?>
     <?php 
//echo $form->field($model, 'zoneId')->dropDownList(ArrayHelper::merge([''=>'Select'], ArrayHelper::map(\common\models\Zone::find()->andWhere(['status'=>1])->All(), 'Id', 'name'))) ;
?>
    
    
    <?php 
echo $form->field($model, 'cityId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status' => 1])->All(), 'Id', 'name')));
echo $form->field($model, 'zoneId')->widget(DepDrop::classname(), ['options' => ['id' => strtolower($model->formName()) . '-zoneid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Zone::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid'], 'placeholder' => 'Select Zone', 'url' => Url::to(['/zone/zone/autosuggest'])]]);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
?>

   <?php 
// <?= $form->field($model, 'createdOn')->textInput()
?>

  <?php 
//  <?= $form->field($model, 'status')->textInput()
?>

  <?php 
 /**
  * Function for locality auto suggestion 
  */
 public function actionAutosuggest()
 {
     $request = Yii::$app->request->post();
     //var_dump($request);
     list($city) = $request['depdrop_parents'];
     if ($city == 'Loading ...') {
         $city = '';
     }
     //$model = new Locality;
     $data = Zone::find()->where(['status' => 1, 'cityId' => $city])->all();
     $dataLoc = array();
     foreach ($data as $value) {
         $obj = new \stdClass();
         $obj->id = $value->Id;
         $obj->name = $value->name;
         $dataLoc[] = $obj;
     }
     //echo "<pre>";
     //var_dump($dataLoc);
     $result = new \stdClass();
     $result->output = $dataLoc;
     $result->selected = "";
     header('Content-Type: application/json');
     echo Json::encode($result);
     \yii::$app->end();
 }
Example #6
0
    </ul>
    <?php 
    Callout::end();
    ?>
    
    <?php 
}
?>
    
    <?php 
echo $form->field($model, 'localityId')->widget(DepDrop::classname(), ['options' => ['id' => 'restaurant-localityid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Locality::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid'], 'placeholder' => 'Select Locality', 'url' => Url::to(['/locality/locality/localityzonesuggest'])]]);
?>

    <div style="display:none">
        <?php 
echo $form->field($model, 'zoneId')->widget(DepDrop::classname(), ['options' => ['id' => 'restaurant-zoneid'], 'data' => ArrayHelper::map(\common\models\Zone::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name'), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-localityid'], 'url' => Url::to(['/restaurant/restaurant/zonesuggest'])]]);
?>
    </div>

    <?php 
// $form->field($model, 'zoneId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Zone::find()->andWhere(['status' => 1])->All(), 'Id', 'name')))
?>
 
    <?php 
echo $form->field($model, 'address')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'landmark')->textInput(['maxlength' => 255]);
?>
Example #7
0
    }
    
    $mobile_form = '';
    if(is_array($model->venueMap) && count($model->venueMap)){
        foreach($model->venueMap as $mapmodel){
            $mobile_form .= $form->field($mapmodel->venueMap, 'mobile')->textInput(['maxlength' => 255,'name'=>$model->formName().'[mobile][]']);
        }
    }else{
       $mobile_form = $form->field($map, 'mobile')->textInput(['maxlength' => 255,'name'=>$model->formName().'[mobile][]']);
    }
    //*/
//echo "<pre>";
//
//
// var_dump($model);
echo Collapse::widget(['box' => true, 'items' => ['Basic Details' => ['content' => implode("\n", [$form->field($model, 'venueType')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\VenueType::find()->andWhere(['status' => 1])->All(), 'Id', 'name'))), $form->field($model, 'name')->textInput(['maxlength' => 255])]), 'contentOptions' => ['class' => 'in'], 'options' => ['class' => 'box-primary']], 'Contact Details' => ['content' => implode("\n", [$form->field($model, 'contactName')->textInput(['maxlength' => 255]), $form->field($model, 'email')->textInput(['maxlength' => 255]), is_array($model->venueMap) && count($model->venueMap) ? $form->field($model->venueMap[0], 'phone', ['selectors' => ['input' => '.multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'options' => ['class' => 'multiphone', 'model' => $map, 'models' => $model->venueMap]]) : $form->field($map, 'phone', ['selectors' => ['input' => '.multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'options' => ['class' => 'multiphone']]), is_array($model->venueMap) && count($model->venueMap) ? $form->field($model->venueMap[0], 'mobile', ['selectors' => ['input' => '.multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'options' => ['class' => 'multimobile', 'model' => $map, 'models' => $model->venueMap]]) : $form->field($map, 'mobile', ['selectors' => ['input' => '.multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'options' => ['class' => 'multimobile']]), $form->field($model, 'tollfree')->textInput(['maxlength' => 15])]), 'options' => ['class' => 'box-success']], 'Location Details' => ['content' => implode("\n", [$form->field($model, 'cityId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status' => 1])->All(), 'Id', 'name'))), $form->field($model, 'zoneId')->widget(DepDrop::classname(), ['options' => ['id' => strtolower($model->formName()) . '-zoneid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Zone::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid'], 'placeholder' => 'Select Zone', 'url' => Url::to(['/zone/zone/autosuggest'])]]), $form->field($model, 'localityId')->widget(DepDrop::classname(), ['options' => ['id' => 'venue-localityid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Locality::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid', strtolower($model->formName()) . '-zoneid'], 'placeholder' => 'Select Locality', 'url' => Url::to(['/locality/locality/autosuggest'])]]), $form->field($model, 'address')->textInput(['maxlength' => 255]), $form->field($model, 'landmark')->textInput(['maxlength' => 255]), $form->field($model, 'gpsLat')->textInput(), $form->field($model, 'gpsLong')->textInput()]), 'options' => ['class' => 'box-danger']], 'More Details' => ['content' => implode("\n", [$form->field($model, 'description')->textarea(['rows' => 6]), $form->field($model, 'facility')->listBox(ArrayHelper::merge([0 => 'Select'], ArrayHelper::map(\common\models\Features::find()->andWhere(['status' => 1, 'flag' => 1])->All(), 'Id', 'name')), ['id' => 'facility', 'multiple' => 'multiple']), $form->field($model, 'url')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://timescity.com']), $form->field($model, 'facebookUrl')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://facebook.com']), $form->field($model, 'seatType')->textInput(['maxlength' => 100]), $form->field($model, 'capacity')->textInput(), $form->field($model, 'reservationInfo')->textInput(['maxlength' => 100]), $form->field($model, 'startTime')->textInput(), $form->field($model, 'endTime')->textInput(), $model->multipleFormField('tag', $model->getTagData())]), 'options' => ['class' => 'box-info']], 'Images' => ['content' => MediaUpload::widget(['data' => $model->media['images'], 'previewurl' => yii::$app->params['imagepreviewurl'], 'path' => 'venue', 'options' => ['addRemoveLinks' => true, 'inputparam' => $model->formName() . '[media][]']]), 'options' => ['class' => 'box-info']]]]);
echo WorkflowButtons::widget(['view' => $this, 'model' => $model]);
Column::end();
Row::end();
?>

    <?php 
/*/?>
    <?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'cityId')->textInput() ?>

    <?= $form->field($model, 'zoneId')->textInput() ?>

    <?= $form->field($model, 'localityId')->textInput() ?>
Example #8
0
 public function getZone()
 {
     return $this->hasOne(Zone::className(), ['Id' => 'zoneId']);
 }