Example #1
0
 /**
  * @return ActiveQuery
  */
 public function getTour()
 {
     return $this->hasOne(TourRecord::className(), ['id' => 'tour_id']);
 }
Example #2
0
        <?php 
echo $form->field($hotelFilterForm, 'country_id')->dropDownList(CountryRecord::getCountries())->label(false);
?>
        <?php 
echo $form->field($search, 'hotel_id')->dropDownList(HotelRecord::getHotels())->label(false);
?>
        <?php 
echo $form->field($hotelFilterForm, 'stars')->dropDownList(HotelRecord::stars())->label(false);
?>
        <?php 
echo $form->field($hotelFilterForm, 'type')->dropDownList(HotelRecord::types())->label(false);
?>
        <?php 
echo $form->field($search, 'adults')->dropDownList(TourRecord::adults())->label(false);
?>
        <?php 
echo $form->field($search, 'children')->dropDownList(TourRecord::children())->label(false);
?>

        <div class="form-group">
            <div class="input-group">
                <?php 
echo \yii\helpers\Html::submitButton('Применить', array('class' => 'btn btn-warning', 'style' => 'margin-bottom: 9px'));
?>
            </div>
        </div>
    </div>
    <?php 
\yii\widgets\ActiveForm::end();
?>
</div>
Example #3
0
<?php

use app\models\tour\TourRecord;
use app\models\hotel\HotelRecord;
use yii\bootstrap\ActiveForm;
use app\widgets\DateTimePicker;
$form = ActiveForm::begin(['layout' => 'horizontal']);
echo $form->field($model, 'name');
echo $form->field($model, 'hotel_id')->dropDownList(HotelRecord::getHotels());
echo $form->field($model, 'children')->dropDownList(TourRecord::children());
echo $form->field($model, 'adults')->dropDownList(TourRecord::adults());
$clientOptions = ['format' => 'DD.MM.YYYY HH:mm:ss'];
$clientOptions['minDate'] = new \yii\web\JsExpression('moment().format("MM.DD.YYYY")');
$options = ['placeholder' => 'дд.мм.гггг ЧЧ:ММ'];
if ($model->isNewRecord) {
    $options['value'] = Yii::$app->formatter->datetimeFormat;
    $clientOptions['minDate'] = new \yii\web\JsExpression('moment().format("MM.DD.YYYY")');
}
echo $form->field($model, 'flyAt')->widget(DateTimePicker::className(), ['options' => $options, 'language' => 'ru', 'clientOptions' => $clientOptions]);
?>

    <div class="clearfix form-actions">
        <div class="col-md-offset-3 col-md-9">
            <?php 
echo \yii\bootstrap\Html::submitButton('Применить', ['class' => 'btn btn-success']);
?>
        </div>
    </div>

<?php 
ActiveForm::end();
Example #4
0
 /**
  * @return array|string
  */
 public function actionAvailableTours()
 {
     $app = \Yii::$app;
     $request = $app->request;
     $search = new TourRecord();
     $search->setScenario('search');
     $hotelFilterForm = new HotelFilterForm();
     if (Yii::$app->request->isAjax && $hotelFilterForm->load($request->get())) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($hotelFilterForm);
     }
     $hotelFilterForm->load($request->get());
     $hotelFilterForm->validate();
     $params = ArrayHelper::merge($request->getQueryParams(), [$search->formName()]);
     $options = ['country_id' => $hotelFilterForm->country_id, 'stars' => $hotelFilterForm->stars, 'type' => $hotelFilterForm->type];
     $dataProvider = $search->getFilterDataProvider($options, $params);
     $viewData = ['dataProvider' => $dataProvider, 'totalCount' => $dataProvider->totalCount, 'hotelFilterForm' => $hotelFilterForm, 'search' => $search];
     return $this->render('available-tours', $viewData);
 }