<?php defined('MW_PATH') || exit('No direct script access allowed');

/**
 * This file is part of the MailWizz EMA application.
 * 
 * @package MailWizz EMA
 * @author Serban George Cristian <cristian.serban@mailwizz.com> 
 * @link http://www.mailwizz.com/
 * @copyright 2013-2014 MailWizz EMA (http://www.mailwizz.com)
 * @license http://www.mailwizz.com/license/
 * @since 1.2
 */
 
?>

<div class="callout">
    <?php echo Yii::t('ip_location', 'Ip location services are used to collect location data(country, zone, city) when subscribers open the email campaigns or when they click on a trackable url, etc.');?>
    <br />   
    <?php echo Yii::t('ip_location', 'This data is then used in campaign reports to show you the exact location where the email campaign has been opened or the location from where the subscriber clicked a link from within the campaign.');?>  
    <br />   
    <?php echo Yii::t('ip_location', 'Please note, data accuracy will vary between the services. You should test the service website before enable.');?>        
</div>
        
<div class="panel panel-default">
    <div class="panel-heading">
        <div class="pull-left">
            <h3 class="panel-title">
                <span class="glyphicon glyphicon-map-marker"></span> <?php echo Yii::t('ip_location', 'Ip location services');?>
            </h3>
        </div>
        <div class="pull-right">
            <?php echo CHtml::link(Yii::t('app', 'Refresh'), array('ip_location_services/index'), array('class' => 'btn btn-default btn-xs', 'title' => Yii::t('app', 'Refresh')));?>
        </div>
        <div class="clearfix"><!-- --></div>
    </div>
    <div class="panel-body">
        
        <div class="table-responsive">
        <?php 
        $this->widget('zii.widgets.grid.CGridView', array(
            'id'                => $model->modelName . '-grid',
            'dataProvider'      => $model->getDataProvider(),
            'filter'            => null,
            'filterPosition'    => 'body',
            'filterCssClass'    => 'grid-filter-cell',
            'itemsCssClass'     => 'table table-bordered table-hover table-striped',
            'selectableRows'    => 0,
            'enableSorting'     => false,
            'cssFile'           => false,
            'pager'             => false,
            'columns' => array(
                array(
                    'name'  => Yii::t('ip_location', 'Name'),
                    'value' => '$data["name"]',
                    'type'  => 'raw',
                ),
                array(
                    'name'  => Yii::t('ip_location', 'Description'),
                    'value' => '$data["description"]',
                ),

                array(
                    'name'  => Yii::t('ip_location', 'Status'),
                    'value' => '$data["status"]',
                ),
                array(
                    'name'  => Yii::t('ip_location', 'Sort order'),
                    'value' => '$data["sort_order"]',
                ),
                array(
                    'class'     => 'CButtonColumn',
                    'header'    => Yii::t('app', 'Options'),
                    'buttons'    => array(
                        'page' => array(
                            'label'     => '<i class="glyphicon glyphicon-eye-open"></i>', 
                            'url'       => '$data["page_url"]',
                            'imageUrl'  => null,
                            'options'   => array('title' => Yii::t('ip_location', 'Service detail page'), 'class'=>'btn btn-xs'),
                            'visible'   => '!empty($data["page_url"])',
                        ),  
                    ),
                    'htmlOptions' => array(
                        'style' => 'width:50px;',
                    ),
                    'template' => '{page}'
                ),
            ),
        )); ?>
        </div>    
    </div>
</div>