<?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.0
 */
 
?>

<div class="callout">
    <?php 
    $text = 'This report shows all the subscribers that did not get your email.<br />
    These subscribers are not removed from the list, but at a certain point the delivery for them will be denied by the system.<br />
    This report is a good start point to clean up your list of subscribers.';
    echo Yii::t('campaign_reports', StringHelper::normalizeTranslationString($text));
    ?>
    
</div>

<div class="panel panel-default">
    <div class="panel-heading">
        <div class="pull-left">
            <h3 class="panel-title">
                <span class="glyphicon glyphicon-list-alt"></span> <?php echo Yii::t('campaign_reports', 'Bounce report');?>
            </h3>
        </div>
        <div class="pull-right">
            <?php echo CHtml::link(Yii::t('campaign_reports', 'Campaign overview'), array('campaigns/overview', 'campaign_uid' => $campaign->campaign_uid), array('class' => 'btn btn-default btn-xs', 'title' => Yii::t('campaign_reports', 'Back to campaign overview')));?>
        </div>
        <div class="clearfix"><!-- --></div>
    </div>
    <div class="panel-body">
        
        <div class="table-responsive">
        <div class="pull-left bulk-selected-options" style="display:none; margin-bottom: 5px;">
            <?php echo CHtml::dropDownList('bulk_action', null, CMap::mergeArray(array('' => Yii::t('list_subscribers', 'With selected:')), $bulkActions), array(
                'class'         => 'form-control bulk-action', 
                'data-bulkurl'  => $this->createUrl('list_subscribers/bulk_action', array('list_uid' => $campaign->list->list_uid)),
                'data-delete'   => Yii::t('app', 'Are you sure you want to delete this item? There is no way coming back after you do it.'), 
            ));?>
        </div>
        <?php 
        $this->widget('zii.widgets.grid.CGridView', array(
            'id'                => $bounceLogs->modelName.'-grid',
            'dataProvider'      => $bounceLogs->customerSearch(),
            'filter'            => $bounceLogs,
            'filterPosition'    => 'body',
            'filterCssClass'    => 'grid-filter-cell',
            'itemsCssClass'     => 'table table-bordered table-hover table-striped',
            'selectableRows'    => 0,
            'enableSorting'     => false,
            'cssFile'           => false,
            'pagerCssClass'     => 'pagination pull-right',
            'pager'             => array(
                'class'         => 'CLinkPager',
                'cssFile'       => false,
                'header'        => false,
                'htmlOptions'   => array('class' => 'pagination')
            ),
            'columns'=>array(
                
                array(
                    'class'                 => 'CCheckBoxColumn',
                    'header'                => '',
                    'footer'                => '',
                    'name'                  => 'bulk_select[]',
                    'id'                    => 'bulk_select',
                    'selectableRows'        => 2,
                    'value'                 => '$data->subscriber->subscriber_id',
                    'checkBoxHtmlOptions'   => array('class' => 'bulk-select'),
                ),
                
                array(
                    'name'  => 'subscriber.email',
                    'value' => 'CHtml::link($data->subscriber->email, Yii::app()->createUrl("list_subscribers/update", array("list_uid" => $data->subscriber->list->list_uid, "subscriber_uid" => $data->subscriber->subscriber_uid)))',
                    'filter'=> false,
                    'type'  => 'raw',
                ),
                
                array(
                    'name'  => 'bounce_type',
                    'value' => 'strtoupper($data->bounce_type)',
                    'filter'=> $bounceLogs->getBounceTypesArray(),
                ),
                
                array(
                    'name'  => 'date_added',
                    'value' => '$data->dateAdded',
                    'filter'=> false,
                ),
                
                array(
                    'class'     => 'CButtonColumn',
                    'header'    => Yii::t('app', 'Options'),
                    'buttons'   => array(
                        'update' => array(
                            'label'     => ' &nbsp; <span class="glyphicon glyphicon-pencil"></span> &nbsp;', 
                            'url'       => 'Yii::app()->createUrl("list_subscribers/update", array("list_uid" => $data->subscriber->list->list_uid, "subscriber_uid" => $data->subscriber->subscriber_uid))',
                            'imageUrl'  => null,
                            'options'   => array('title' => Yii::t('campaign_reports', 'Update subscriber'), 'class' => ''),
                        ),
                        'delete' => array(
                            'label'     => ' &nbsp; <span class="glyphicon glyphicon-remove-circle"></span> &nbsp; ', 
                            'url'       => 'Yii::app()->createUrl("list_subscribers/delete", array("list_uid" => $data->subscriber->list->list_uid, "subscriber_uid" => $data->subscriber->subscriber_uid))',
                            'imageUrl'  => null,
                            'options'   => array('title' => Yii::t('campaign_reports', 'Delete subscriber'), 'class' => 'delete'),
                        ),    
                    ),
                    'htmlOptions' => array(
                        'style' => 'width:110px;',
                    ),
                    'template'=>'{update} {delete}'
                ),
            ),
        )); ?>
        </div>    
    </div>
</div>