<?php
/*
 * @author     M2E Pro Developers Team
 * @copyright  M2E LTD
 * @license    Commercial use is forbidden
 */

// @codingStandardsIgnoreFile

/** @var $this Ess_M2ePro_Block_Adminhtml_Ebay_Listing_View_Fee_Errors */

$errors = $this->getErrors();

$showWarnings = false;
foreach ($errors as $error) {
    if ($error['type'] == Ess_M2ePro_Model_Log_Abstract::TYPE_WARNING) {
        $showWarnings = true;
        break;
    }
}

?>

<style type="text/css">
    #errors-buttons {
        padding: 10px 0 !important;
        text-align: right;
    }
</style>
<div class="entry-edit" style="padding-top: 10px;">

    <div><?php echo Mage::helper('M2ePro')->__('Fee cannot be estimated because of next error(s)') ?>:</div>

    <div class="hor-scroll" style="padding-top: 10px;">
        <ul class="messages">
            <li class="error-msg">
                <ul>
                    <?php foreach ($errors as $error): ?>
                        <?php if ($error['type'] != Ess_M2ePro_Model_Log_Abstract::TYPE_ERROR) continue; ?>
                        <li>
                            <span>
                                <?php echo Mage::helper('M2ePro')->escapeHtml($error['text']) ?>
                            </span>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </li>
        </ul>
        <?php if ($showWarnings) {?>
        <ul class="messages">
            <li class="warning-msg">
                <ul>
                    <?php foreach ($errors as $error): ?>
                        <?php if ($error['type'] != Ess_M2ePro_Model_Log_Abstract::TYPE_WARNING) continue; ?>
                        <li>
                            <span>
                                <?php echo Mage::helper('M2ePro')->escapeHtml($error['text']) ?>
                            </span>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </li>
        </ul>
        <?php } ?>
    </div>
</div>
<div id="errors-buttons">
    <?php echo $this->getChildHtml('close_button') ?>
</div>