<?php
/**
 * Hyvä Themes - https://hyva.io
 * Copyright © Hyvä Themes 2020-present. All rights reserved.
 * This product is licensed per Magento install
 * See https://hyva.io/license
 */

/**
 * The AlpineJS scope of this file is the method `initCartTotals()` in Magento_Checkout::php-cart/totals.phtml
 */
?>
<!-- display shipping including and excluding tax -->
<template x-if="segment.code === 'shipping' && quoteData.is_virtual === 0 && !!shippingMethod && 'both' === checkoutConfig.reviewShippingDisplayMode">
    <div>
        <div class="flex pb-2 my-2 border-b text-md lg:text-sm md:grid md:grid-cols-2 md:w-full border-container">
            <div class="w-7/12 text-left md:w-auto"
                 x-html="`${segment.title} ${excludingTaxMessage}` "
            ></div>
            <div class="w-5/12 text-right md:w-auto"
                 x-text="hyva.formatPrice(totalsData.shipping_amount)"
            ></div>
        </div>

        <div class="flex pb-2 my-2 border-b text-md lg:text-sm md:grid md:grid-cols-2 md:w-full border-container">
            <div class="w-7/12 text-left md:w-auto"
                 x-html="`${segment.title} ${includingTaxMessage}` "
            ></div>
            <div class="w-5/12 text-right md:w-auto"
                 x-text="hyva.formatPrice(totalsData.shipping_incl_tax)"
            ></div>
        </div>
    </div>
</template>

<!-- display shipping excluding tax  -->
<template x-if="segment.code === 'shipping' && quoteData.is_virtual === 0 && !!shippingMethod && 'excluding' === checkoutConfig.reviewShippingDisplayMode">
    <div class="flex pb-2 my-2 border-b text-md lg:text-sm md:grid md:grid-cols-2 md:w-full border-container">
        <div class="w-7/12 text-base text-left md:w-auto"
             x-html="`${segment.title}` "
        ></div>
        <div class="w-5/12 text-right md:w-auto"
             x-text="hyva.formatPrice(segment.value)"
        ></div>
    </div>
</template>

<!-- display shipping including tax -->
<template x-if="segment.code === 'shipping' && quoteData.is_virtual === 0 && !!shippingMethod && 'including' === checkoutConfig.reviewShippingDisplayMode">
    <div class="flex pb-2 my-2 border-b text-md lg:text-sm md:grid md:grid-cols-2 md:w-full border-container">
        <div class="w-7/12 text-left md:w-auto"
             x-html="`${segment.title}`"
        ></div>
        <div class="w-5/12 text-right md:w-auto"
             x-text="hyva.formatPrice(totalsData.shipping_incl_tax)"
        ></div>
    </div>
</template>
