<?php
/**
 * Maho
 *
 * @category    design
 * @package     default_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)
 */

/** @var Mage_Adminhtml_Block_Sales_Order_Create_Totals $this */
?>
<table cellspacing="0" cellpadding="8" width="100%">
    <tbody>
        <?= $this->renderTotals() ?>
        <?= $this->renderTotals('footer') ?>
    </tbody>
</table>
<div class="divider"></div>
<div class="order-totals-bottom">
    <p>
        <label for="notify_customer" class="normal"><?= Mage::helper('sales')->__('Append Comments') ?></label>
        <input type="checkbox" id="notify_customer" name="order[comment][customer_note_notify]" value="1" <?php if($this->getNoteNotify()): ?>checked="true"<?php endif ?>/>
    </p>
    <?php if ($this->canSendNewOrderConfirmationEmail()): ?>
    <p>
        <label for="send_confirmation" class="normal"><?= Mage::helper('sales')->__('Email Order Confirmation') ?></label>
        <input type="checkbox" id="send_confirmation" name="order[send_confirmation]" value="1" checked="checked"/>
    </p>
    <?php endif ?>
    <p><?= $this->getButtonHtml(Mage::helper('sales')->__('Submit Order'),'order.submit()','save') ?></p>
</div>

<script type="text/javascript">
//<![CDATA[
var sendEmailCheckbox = $('send_confirmation');
if (sendEmailCheckbox) {
    Event.observe(sendEmailCheckbox, 'change', notifyCustomerUpdate);
    notifyCustomerUpdate();
}

function notifyCustomerUpdate() {
    var sendEmailCheckbox = $('send_confirmation');
    var notifyCustomerCheckbox = $('notify_customer');
    if (!sendEmailCheckbox || !notifyCustomerCheckbox)
        return;
    notifyCustomerCheckbox.disabled = !sendEmailCheckbox.checked;
}
//]]>
</script>
