<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php /** @var Mage_Sales_Block_Recurring_Profile_View $this */ ?>

<div class="order-page">

<!-- title 'n' actions -->
<div class="page-title title-buttons">
    <h1><?= $this->__('Recurring Profile # %s', $this->escapeHtml($this->getReferenceId())) ?></h1>
    <?php if ($this->getCanCancel()): ?>
        <button type="button" title="<?= Mage::helper('core')->quoteEscape($this->__('Cancel')) ?>" class="button" onclick="if( confirm('<?= Mage::helper('core')->quoteEscape($this->getConfirmationMessage(),true) ?>') ) { window.location.href = '<?= $this->getCancelUrl() ?>'; } return false;"><?= $this->__('Cancel') ?></button>
    <?php endif ?>
    <?php if ($this->getCanSuspend()): ?>
        <button type="button" title="<?= Mage::helper('core')->quoteEscape($this->__('Suspend')) ?>" class="button" onclick="if( confirm('<?= Mage::helper('core')->quoteEscape($this->getConfirmationMessage(), true) ?>') ) { window.location.href = '<?= $this->getSuspendUrl() ?>'; } return false;"><?= $this->__('Suspend') ?></button>
    <?php endif ?>
    <?php if ($this->getCanActivate()): ?>
        <button type="button" title="<?= Mage::helper('core')->quoteEscape($this->__('Activate')) ?>" class="button" onclick="if( confirm('<?= Mage::helper('core')->quoteEscape($this->getConfirmationMessage(),true) ?>') ) { window.location.href = '<?= $this->getActivateUrl() ?>'; } return false;"><?= $this->__('Activate') ?></button>
    <?php endif ?>
    <?php if ($this->getCanUpdate()):?>
        <button type="button" title="<?= Mage::helper('core')->quoteEscape($this->__('Get Update')) ?>" class="button" onclick="if( confirm('<?= Mage::helper('core')->quoteEscape($this->getConfirmationMessage(), true) ?>') ) { window.location.href = '<?= $this->getUpdateUrl() ?>'; } return false;"><?= $this->__('Get Update') ?></button>
    <?php endif ?>
</div>

<?= $this->getMessagesBlock()->toHtml() ?>

<!-- info tabs -->
<?php $infoTabs = $this->getChildGroup('info_tabs'); ?>
<dl class="order-info">
    <dt><?= $this->__('About This Profile:') ?></dt>
    <dd>
        <ul id="order-info-tabs">
        <?php foreach ($infoTabs as $block): ?>
            <?php if ($this->getObjectData($block, 'is_view_current')): ?>
                <li class="current"><strong><?= $this->escapeHtml($this->getObjectData($block, 'view_label')) ?></strong></li>
            <?php else: ?>
                <li><a href="<?= $this->escapeHtml($this->getObjectData($block, 'view_url')) ?>"><?= $this->escapeHtml($this->getObjectData($block, 'view_label')) ?></a></li>
            <?php endif ?>
        <?php endforeach ?>
        </ul>
    </dd>
</dl>

<!-- info blocks in 2 columns -->
<?php for ($i = 1; $i <= 5; $i++):?>
    <?php $infoBlocks = $this->getChildGroup("info_blocks_row_{$i}"); ?>
    <?php if ($infoBlocks):?>
<div class="col2-set order-info-box">
        <?php for ($j = 1; $j <= 2; $j++):?>
            <?php foreach ($infoBlocks as $alias => $block):?>
<?php if ($j == $this->getObjectData($block, 'view_column')):?>
    <div class="col-<?= $j ?>">
        <div class="info-box">
            <div class="box-title">
                <h2><?= $this->escapeHtml($this->getObjectData($block, 'view_label')) ?></h2>
            </div>
            <div class="box-content">
                <?php $html = $this->getChildHtml($alias) ?>
                <?= ($html ? $html : $this->__('No information available.'))  ?>
            </div>
        </div>
    </div>
<?php endif ?>
            <?php endforeach ?>
        <?php endfor ?>
</div>
    <?php endif ?>
<?php endfor ?>

<!-- table data block -->
<?php $table = $this->getChild('table') ?>
<?php if ($table):?>
<div>
    <h2 class="table-caption"><?= $this->escapeHtml($this->getObjectData($table, 'view_label')) ?></h2>
    <?= $this->getChildHtml('table') ?>
</div>
<?php endif ?>

    <div class="buttons-set">
        <p class="back-link"><a href="<?= $this->getBackUrl() ?>"><small>&laquo; </small><?= $this->__('Back to Recurring Profiles') ?></a></p>
    </div>
</div>
