<?php
$this->widget('ext.PlGrid.PlGridView', array(
    'id' => 'job-grid',
    'headerTitle' => 'Header_title', // optional
    'itemsCssClass' => 'plTable items',
    'enableAddButton' => false,
    'enableSearchButton' => false,
    'dataProvider' => $model->search(),
    'filter' => $model,
    'afterAjaxUpdate' => 'function(){
            $(".label-important").each(function(i,e) {
                $(e).tooltip();
            });
        }',
    'customButtons' => $customButtons,
    'columns' => array(
        array(
            'name' => 'phone_id',
            'header' => $model->getAttributeLabel('phone_id'),
            'headerHtmlOptions' => array('data-translation-target' => 'JOB_MODEL_IDS',
                'data-translation-id' => 'JOB_MODEL_PHONE_ID'
            ),
            'value' => array($model, 'getFormattedPhoneIp'),
            'disableSearchField' => true
        ),
        array(
            'name' => 'type',
            'type' => 'raw',
            'header' => $model->getAttributeLabel('type'),
            'headerHtmlOptions' => array('data-translation-target' => 'JOB_MODEL_TYPES',
                'data-translation-id' => 'JOB_MODEL_TYPE',
            ),
            'value' => array($model, 'getTypeAsString'),
            'filter' => $model->getTypeFilterData(),
            'enableCustomDropdownFilter' => true
        ),
        array(
            'name' => 'status',
            'header' => $model->getAttributeLabel('status'),
            'headerHtmlOptions' => array('data-translation-target' => 'JOB_MODEL_STATUSES',
                'data-translation-id' => 'JOB_MODEL_STATUS',
            ),
            'value' => array($this, 'renderStatus'),
            'filter' => $model->getStatusFilterData(),
            'enableCustomDropdownFilter' => true
        ),
        array(
            'class' => 'ext.PlGrid.PlCButtonColumn',
            'template' => '{delete}',
        ),
    ),
        )
);

if (Yii::app()->user->translateMode) {
    echo '<i data-translation-target="SYSTEM_JOBS_REMOVE_BUTTON" data-translation-id="SYSTEM_JOBS_REMOVE_JOBS"></i>';
    echo '<i data-translation-target="SYSTEM_JOBS_REMOVE_BUTTON" data-translation-id="SYSTEM_JOBS_CONFIRM_REMOVE_JOBS"></i>';


    echo '<i data-translation-target="JOB_MODEL_IDS" data-translation-id="PHONE_NOT_FOUND"></i>';

    echo '<i data-translation-target="JOB_MODEL_STATUSES" data-translation-id="JOB_STATUS_INSERTED"></i>';
    echo '<i data-translation-target="JOB_MODEL_STATUSES" data-translation-id="JOB_STATUS_TRIGGERED"></i>';
    echo '<i data-translation-target="JOB_MODEL_STATUSES" data-translation-id="JOB_STATUS_RUNNING"></i>';
    echo '<i data-translation-target="JOB_MODEL_STATUSES" data-translation-id="JOB_STATUS_FINNISHED"></i>';
    echo '<i data-translation-target="JOB_MODEL_STATUSES" data-translation-id="JOB_STATUS_NEED_TO_TRIGGER_AGAIN"></i>';
    echo '<i data-translation-target="JOB_MODEL_STATUSES" data-translation-id="JOB_STATUS_FAILED"></i>';

    echo '<i data-translation-target="JOB_MODEL_TYPES" data-translation-id="JOB_TYPE_NOSET"></i>';
    echo '<i data-translation-target="JOB_MODEL_TYPES" data-translation-id="JOB_TYPE_PROVISIONING"></i>';
    echo '<i data-translation-target="JOB_MODEL_TYPES" data-translation-id="JOB_TYPE_NETWORKSCAN"></i>';
    echo '<i data-translation-target="JOB_MODEL_TYPES" data-translation-id="JOB_TYPE_ADD_TO_PROVISIONING"></i>';
    echo '<i data-translation-target="JOB_MODEL_TYPES" data-translation-id="JOB_TYPE_ADDRESS_IMPORT"></i>';
    echo '<i data-translation-target="JOB_MODEL_TYPES" data-translation-id="JOB_TYPE_CLEANUP"></i>';
}
?>
<script>
    $(".label-important").each(function (i, e) {
        $(e).tooltip();
    });
</script>