<?php
/**
 * Maho
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2022 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)
 */
?>
<?= $this->helper('core/js')->includeScript('mage/adminhtml/giftmessage.js') ?>
<?php if(!$this->getSaveMode()): ?>
<form action="<?= $this->getSaveUrl() ?>" id="message-form" method="post" class="a-left">
    <?= $this->getBlockHtml('formkey') ?>
    <?= $this->getFormHtml() ?>
    <?= $this->getSaveButtonHtml() ?>
    <?= $this->getCancelButtonHtml() ?>
    <?php if($this->getMessage()->getGiftMessageId()): ?>
    <?= $this->getRemoveButtonHtml() ?>
    <?php endif ?>
</form>
<?php elseif($this->getSaveMode()=='save'): ?>
<h3><?= Mage::helper('giftmessage')->__('The gift message has been saved') ?></h3>
<br /><?= $this->getCloseButtonHtml() ?>
<?php else: ?>
<h3><?= Mage::helper('giftmessage')->__('The gift message has been removed') ?></h3>
<br /><?= $this->getCloseButtonHtml() ?>
<?php endif ?>
<script type="text/javascript">
<!--
<?php if(!$this->getSaveMode()): ?>
    var giftMessageWindowObject = new GiftMessageWindow('<?= $this->getUniqueId() ?>','message-form', '<?= $this->getRemoveUrl() ?>');
    giftMessageWindowObject.confirmMessage = '<?= $this->getEscapedForJs(Mage::helper('giftmessage')->__('Are you sure?')) ?>';
<?php else: ?>
    var giftMessageWindowObject = new GiftMessageWindow('<?= $this->getUniqueId() ?>', null, '<?= $this->getRemoveUrl() ?>');
    Event.observe(window, 'load', function(evt) {
        giftMessageWindowObject.updateParent('<?= $this->getEditUrl() ?>', '<?= $this->getButtonUrl() ?>');
    });
<?php endif ?>
//-->
</script>
