<?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_Tax_Block_Adminhtml_Notifications $this */
?>
<?php $messageDetails = $this->helper('tax')->__('Please see <a href="%s">source</a> for more details.', $this->getInfoUrl())
    . $this->helper('tax')->__('Click here to go to <a href="%s">Tax configuration</a> and change your settings.', $this->getManageUrl());
?>
<?php $discountStores = $this->getWebsitesWithWrongDiscountSettings() ?>
<?php if (!Mage::helper('tax')->isWrongDiscountSettingsIgnored() && $discountStores): ?>
<div class="notification-global">
    <strong><?= $this->helper('tax')->__('Warning tax discount configuration might result in different discounts than a customer might expect') ?></strong>
    <?php if (is_array($discountStores)): ?><strong><?= $this->helper('tax')->__('for store(s)') ?>
    : </strong><?= implode(', ', $discountStores) ?><?php endif ?>.
    <?= $messageDetails ?>
    <span class="f-right">
        <a href="<?= $this->getIgnoreTaxNotificationUrl('discount') ?>"><?= $this->helper('tax')->__('Ignore this notification') ?></a>
    </span>
</div>
<?php endif ?>

<?php $priceDisplayStores = $this->getStoresWithWrongDisplaySettings() ?>
<?php if (!Mage::helper('tax')->isWrongDisplaySettingsIgnored() && $priceDisplayStores): ?>
<div class="notification-global">
    <strong><?= $this->helper('tax')->__('Warning tax configuration can result in rounding errors') ?></strong>
    <?php if (is_array($priceDisplayStores)): ?><strong><?= $this->helper('tax')->__('for store(s)') ?>
    : </strong><?= implode(', ', $priceDisplayStores) ?><?php endif ?>.
    <?= $messageDetails ?>
    <span class="f-right">
        <a href="<?= $this->getIgnoreTaxNotificationUrl('price_display') ?>"><?= $this->helper('tax')->__('Ignore this notification') ?></a>
    </span>
</div>
<?php endif ?>

<?php $storesWithConflictingFptTaxConfigurationSettings = $this->getStoresWithConflictingFptTaxConfigurationSettings() ?>
<?php $isDefaultStoreConflictingFptTaxConfigurationSettings = $this->isDefaultStoreWithConflictingFptTaxConfigurationSettings() ?>

<?php if (!Mage::helper('tax')->isConflictingFptTaxConfigurationSettingsIgnored() &&
    ($isDefaultStoreConflictingFptTaxConfigurationSettings || $storesWithConflictingFptTaxConfigurationSettings)
): ?>
<div class="notification-global">
    <strong><?= $this->helper('tax')->__('Warning tax configuration can result in unexpected FPT prices on applicable devices') ?></strong>
    <!--        If the default store is fine, but the others aren't, list the ones that have conflicting settings-->
    <?php if (empty($storesWithConflictingFptTaxConfigurationSettings) && !$isDefaultStoreConflictingFptTaxConfigurationSettings): ?>
    <strong><?= $this->helper('tax')->__('for store(s)') ?>
        : </strong><?= implode(', ', $storesWithConflictingFptTaxConfigurationSettings) ?><?php endif ?>.
        <span class="f-right">
        <a href="<?= $this->getIgnoreTaxNotificationUrl('fpt_configuration') ?>"><?= $this->helper('tax')->__('Ignore this notification') ?></a>
    </span>
</div>
<?php endif ?>
