<?php
/* @var $this RelativeController */
/* @var $model Relative */
/* @var $form CActiveForm */
//Yii::app()->clientScript->registerCoreScript('jquery', CClientScript::POS_HEAD);

$this->beginWidget('bootstrap.widgets.TbModal', array(
    'id' => 'item-detail-form',
    'htmlOptions' => array('class' => 'hide'),
));
?>


<div class="modal-header" style="height: 18px">
    <button class="close" data-dismiss="modal">&times;</button>
    <h4 style="margin: 0 !important"><?php echo Yii::t('default', 'Add Item'); ?></h4>
</div>
<div class="modal-body">
    <?php
//
//
    echo'<label style="width: 50px;">';
    echo Yii::t('default', 'Item');
    echo'</label>';
    $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
	'name' => 'item_name',
	'source' => 'js: function(request, response) {
                                $.ajax({
				   type: "POST",
                                    url: "' . $this->createUrl('itemRequestHeader/getItems') . '",
                                    dataType: "json",
                                    data: {
                                        location_id: $("#ItemRequestHeader_location_id").val(),
					item_name: $("#modal_item_name").val(),
                                    },
                                    success: function (data) {
                                            response(data);
                                    }
                                })
                             }',
	//'source' => array_values(Item::getNameLists($location_id)),
	'options' => array(
	    'minLength' => '0',
	    'id' => 'modal_item_name'
	),
	'htmlOptions' => array('id' => 'modal_item_name', 'placeholder' => Yii::t('default', 'Start typing the item name')
	    )));
    echo'</br>';
    echo'</br>';
    echo'<label style="width: 50px;">';
    echo Yii::t('default', 'Quantity');
    echo'</label>';
    echo CHtml::textField('quantity', '', array('size' => 60, 'maxlength' => 70, 'id' => 'modal_quantity'));
    ?>

</div>
<div class="modal-footer">
    <?php
    echo CHtml::button(Yii::t('default', 'Save'), array("onClick" => 'save_changes_and_update_grid();', 'class' => 'btn primary'));
    echo "";
    echo CHtml::button(Yii::t('default', 'Close'), array('data-dismiss' => 'modal', 'class' => 'btn primary'));
    ?>
</div>
<?php $this->endWidget(); ?><!-- End the modal widget -->
