public function actionAjaxDropDownListByCustomerId($customer_id)
 {
     $output = '';
     $items = Reservation::findAll(['customer_id' => $customer_id]);
     foreach ($items as $item) {
         $content = sprintf('reservation #%s at %s', $item->id, date('Y-m-d H:i:s', strtotime($item->reservation_date)));
         $output .= \yii\helpers\Html::tag('option', $content, ['value' => $item->id]);
     }
     return $output;
 }
    \$(document).on('change', '#reservation-id', function(ev) {
        \$(this).parents('form').submit();
        ev.preventDefault();
    });
EOT_JS
);
?>
<div class="customer-form">
<?php 
$form = ActiveForm::begin(['enableAjaxValidation' => true, 'enableClientValidation' => true, 'options' => ['data-pjax' => '']]);
?>

<?php 
$customers = Customer::find()->all();
echo $form->field($model, 'customer_id')->dropDownList(ArrayHelper::map($customers, 'id', 'nameAndSurname'), ['prompt' => '--- choose']);
$reservations = Reservation::findAll(['customer_id' => $model->customer_id]);
?>

<?php 
echo $form->field($model, 'id')->label('Reservation ID')->dropDownList(ArrayHelper::map($reservations, 'id', function ($temp, $defaultValue) {
    $content = sprintf('reservation #%s at %s', $temp->id, date('Y-m-d H:i:s', strtotime($temp->reservation_date)));
    return $content;
}), ['prompt' => '--- choose']);
?>
<div id="detail">
    <?php 
if ($showDetail) {
    ?>
    <hr />
    <h2>Reservation Detail:</h2>
    <table>