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

<?php $form = $this->beginWidget('CActiveForm'); ?>
<div class="panel panel-default">
    <div class="panel-heading">
        <div class="pull-left">
            <h3 class="panel-title">
                <span class="glyphicon glyphicon-envelope"></span> <?php echo $pageHeading;?>
            </h3>
        </div>
        <div class="pull-right">
            <?php echo CHtml::link(Yii::t('app', 'Cancel'), array('dashboard/index'), array('class' => 'btn btn-default btn-xs', 'title' => Yii::t('app', 'Cancel')));?>
        </div>
        <div class="clearfix"><!-- --></div>
    </div>
    <div class="panel-body">
        
        <div class="form-group col-lg-6">
            <?php echo $form->labelEx($campaign, 'name');?>
            <?php echo $form->textField($campaign, 'name', $campaign->getHtmlOptions('name')); ?>
            <?php echo $form->error($campaign, 'name');?>
        </div>
        
        <div class="form-group col-lg-6">
            <?php echo $form->labelEx($campaign, 'list_id');?>
            <?php echo $form->dropDownList($campaign, 'list_id', $listsArray, $campaign->getHtmlOptions('list_id')); ?>
            <?php echo $form->error($campaign, 'list_id');?>
        </div>
        <div class="clearfix"><!-- --></div>    

        <div class="form-group col-lg-6">
            <?php echo $form->labelEx($campaign, 'segment_id');?>
            <?php echo $form->dropDownList($campaign, 'segment_id', $segmentsArray, $campaign->getHtmlOptions('segment_id', array('disabled' => empty($campaign->segment_id) && empty($campaign->list_id), 'data-url' => $this->createUrl('campaigns/list_segments')))); ?>
            <?php echo $form->error($campaign, 'segment_id');?>
        </div>
        
    </div>
    <div class="panel-footer">
        <div class="wizard">
            <?php if ($campaign->isNewRecord) { ?>
            <ul class="steps">
                <li class="active"><?php echo Yii::t('campaigns', 'Name &amp; Recipients');?><span class="chevron"></span></li>
                <li><?php echo Yii::t('campaigns', 'Setup');?><span class="chevron"></span></li>
                <li><?php echo Yii::t('campaigns', 'Template');?><span class="chevron"></span></li>
                <li><?php echo Yii::t('campaigns', 'Confirmation');?><span class="chevron"></span></li>
            </ul>
            <?php } else { ?>
            <ul class="steps">
                <li class="active"><a href="<?php echo $this->createUrl('campaigns/update', array('campaign_uid' => $campaign->campaign_uid));?>"><?php echo Yii::t('campaigns', 'Name &amp; recipients');?></a><span class="chevron"></span></li>
                <li><a href="<?php echo $this->createUrl('campaigns/setup', array('campaign_uid' => $campaign->campaign_uid));?>"><?php echo Yii::t('campaigns', 'Setup');?></a><span class="chevron"></span></li>
                <li><a href="<?php echo $this->createUrl('campaigns/template', array('campaign_uid' => $campaign->campaign_uid));?>"><?php echo Yii::t('campaigns', 'Template');?></a><span class="chevron"></span></li>
                <li><a href="<?php echo $this->createUrl('campaigns/confirm', array('campaign_uid' => $campaign->campaign_uid));?>"><?php echo Yii::t('campaigns', 'Confirmation');?></a><span class="chevron"></span></li>
                <li><a href="javascript:;"><?php echo Yii::t('app', 'Done');?></a><span class="chevron"></span></li>
            </ul>
            <?php } ?>
            <div class="actions">
                <button type="submit" id="is_next" name="is_next" value="1" class="btn btn-default btn-submit btn-go-next" data-loading-text="<?php echo Yii::t('app', 'Please wait, processing...');?>"><?php echo Yii::t('campaigns', 'Save and next');?></button>
            </div>
        </div>
    </div>
</div>    
<?php $this->endWidget();?>