{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %}
<div id="pricing">
    <h4 class="ui top attached large header">{{ 'sylius.ui.pricing'|trans }}</h4>
    <div class="ui attached segment">
        <table id="pricing" class="ui very basic celled table">
            <thead>
                <tr>
                    <th><strong class="gray text">{{ 'sylius.ui.channels'|trans }}</strong></th>
                    <th><strong class="gray text">{{ 'sylius.ui.price'|trans }}</strong></th>
                    <th><strong class="gray text">{{ 'sylius.ui.original_price'|trans }}</strong></th>
                    <th><strong class="gray text">{{ 'sylius.ui.lowest_price_before_discount'|trans }}</strong></th>
                    <th><strong class="gray text">{{ 'sylius.ui.discounted_by'|trans }}</strong></th>
                    <th><strong class="gray text">{{ 'sylius.ui.history'|trans }}</strong></th>
                </tr>
            </thead>
            <tbody>
            {% for channelPricing in product.variants.first.channelPricings %}
                {% if product.channels.first != false %}
                    <tr>
                        <td class="five wide gray text">
                            <strong>{{ channelPricing.channelCode|sylius_channel_name }}</strong>
                        </td>
                        <td>{{ money.format(channelPricing.price, product.channels.first.baseCurrency) }}</td>
                        <td>{{ channelPricing.originalPrice ? money.format(channelPricing.originalPrice, product.channels.first.baseCurrency) : '-' }}</td>
                        <td>{{ channelPricing.lowestPriceBeforeDiscount ? money.format(channelPricing.lowestPriceBeforeDiscount, product.channels.first.baseCurrency) : '-' }}</td>
                        {% include '@SyliusAdmin/Product/Show/_appliedPromotions.html.twig' %}
                        <td>
                            <a class="ui blue labeled icon button" href="{{ path('sylius_admin_channel_pricing_log_entry_index', {
                                'productId': product.id,
                                'variantId': product.variants.first.id,
                                'channelPricingId': channelPricing.id
                            }) }}">
                                <i class="icon search"></i>
                                {{ 'sylius.ui.show'|trans }}
                            </a>
                        </td>
                    </tr>
                {% endif %}
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
