<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'phonesettings-user',
    'enableAjaxValidation' => false,
    'action' => array('update'),
    ));
?>
<?php
$this->widget('ext.PlNavbar', array(
    'brand' => __('PHONESETTINGS_USER_NAVBAR_TITLE'),
    'htmlOptions' => array(
        'data-translation-id' => 'PHONESETTINGS_USER_NAVBAR_TITLE',
    ),
));
?>
<div class="form">
    <?php
    $this->widget(
        'bootstrap.widgets.TbGridView',
        array(
            'id' => 'phonesettings-user-grid',
            'type' => 'striped bordered condensed',
            'itemsCssClass' => 'plTable',
            'dataProvider' => $this->phonesettingsUserSearch(),
            'summaryText' => false,
            'hideHeader' => true,
            'columns' => array(
                array(
                    'name' => 'short',
                    'type' => 'raw',
                    'header' => $model->getAttributeLabel('short'),
                    'headerHtmlOptions' => array('data-translation-id' => 'PHONESETTINGS_USER_MODEL_SHORT'),
                ),
                array(
                    'name' => 'value',
                    'type' => 'raw',
                    'value' => array($this, 'renderValue'),
                    'header' => $model->getAttributeLabel('value'),
                    'headerHtmlOptions' => array('data-translation-id' => 'PHONESETTINGS_USER_MODEL_VALUE')
                ),
                array(
                    'name' => 'descr',
                    'type' => 'raw',
                    'header' => $model->getAttributeLabel('descr'),
                    'headerHtmlOptions' => array('data-translation-id' => 'PHONESETTINGS_USER_MODEL_DESCRIPTION')
                ),
            ),
        )
    );
    echo CHtml::submitButton('save', array('id' => 'phonesettingsUserAction', 'style' => 'display:none'));

    $this->widget('bootstrap.widgets.TbButton', array(
        'buttonType' => 'button',
        'type' => 'primary',
        'label' => __('GLOBAL_SAVE_BUTTON'),
        'loadingText' => 'loading...',
        'htmlOptions' => array(
            'id' => 'savePhonesettingsUserButton',
            'data-translation-id' => 'GLOBAL_SAVE_BUTTON',
        ),
    ));
    ?>
    <script>
        $('#savePhonesettingsUserButton').click(function() {
            var btn = $(this);
            btn.button('loading'); // call the loading function
            $("#phonesettingsUserAction").click();
        });
    </script>

    <?php echo CHtml::endForm(); ?>

    <?php
    $this->endWidget();
    ?>
</div>
