<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
/**
 * @var \Magento\Dhl\Block\Adminhtml\Unitofmeasure $block
 */
?>
<script>
    //<![CDATA[
    require(["prototype"], function(){
        function changeDimensions() {
            var dimensionUnit = "(<?= $block->escapeHtml($block->getInch()) ?>)";
            var dhlUnitOfMeasureNote = "<?= $block->escapeHtml($block->getDivideOrderWeightNoteLbp()) ?>";
            if ($("carriers_dhl_unit_of_measure").value == "K") {
                dimensionUnit = "(<?= $block->escapeHtml($block->getCm()) ?>)";
                dhlUnitOfMeasureNote = "<?= $block->escapeHtml($block->getDivideOrderWeightNoteKg()) ?>";
            }
            $$('[for="carriers_dhl_height"]')[0].innerHTML = "<?=
                $block->escapeHtml($block->getHeight()); ?> " + dimensionUnit;
            $$('[for="carriers_dhl_depth"]')[0].innerHTML = "<?=
                $block->escapeHtml($block->getDepth()); ?> " + dimensionUnit;
            $$('[for="carriers_dhl_width"]')[0].innerHTML = "<?=
                $block->escapeHtml($block->getWidth()); ?> " + dimensionUnit;

            $("carriers_dhl_divide_order_weight").next().down().innerHTML = dhlUnitOfMeasureNote;
        }
        window.changeDimensions = changeDimensions;
        document.observe("dom:loaded", function() {
            $("carriers_dhl_unit_of_measure").observe("change", changeDimensions);
            changeDimensions();
        });
    });
    //]]>
</script>
