{block name='account-orders'}
    {block name='heading'}
        <h1>{lang key='myOrders'}</h1>
    {/block}
    {block name='account-orders-content'}
        {if isset($Bestellungen) && count($Bestellungen) > 0}
            {block name='account-orders-orders'}
                {get_static_route id='jtl.php' assign='ordersURL'}
                {if isset($Einstellungen.global.global_rma_enabled) && $Einstellungen.global.global_rma_enabled === 'Y'}
                    {$returnableProducts = $rmaService->getReturnableProducts()}
                {/if}
                <div class="table-responsive">
                    <table class="table table-vertical-middle">
                        <tbody>
                        {foreach $orderPagination->getPageItems() as $order}
                            <tr title="{lang key='showOrder' section='login'}: {lang key='orderNo' section='login'} {$order->cBestellNr}"
                                class="clickable-row cursor-pointer account-orders-item"
                                data-toggle="tooltip"
                                data-placement="top"
                                data-boundary="window"
                                data-href="{$ordersURL}?bestellung={$order->kBestellung}">
                                <td><i class="{et_getIcon key="orderCreationDate"}"></i> {$order->dBestelldatum}</td>
                                <td class="text-right-util">{$order->cBestellwertLocalized}</td>
                                <td class="text-right-util">
                                    {$order->Status}
                                </td>
                                <td class="text-right-util d-none d-md-block">
                                    <a href="{$ordersURL}?bestellung={$order->kBestellung}" title="{lang key='showOrder' section='login'}: {lang key='orderNo' section='login'} {$order->cBestellNr}" aria-label="{lang key='showOrder' section='login'}: {lang key='orderNo' section='login'} {$order->cBestellNr}" class="link-discreet">
                                        <i class="{et_getIcon key="view"}"></i>
                                    </a>
                                    {if isset($Einstellungen.global.global_rma_enabled) && $Einstellungen.global.global_rma_enabled === 'Y' && $rmaService->isOrderReturnable($order->kBestellung, $returnableProducts)}
                                        <a href="{$cCanonicalURL}?newRMA={$order->kBestellung}" class="ml-2 link-discreet" aria-label="{lang key='rma' section='rma'}: {lang key='rma_artikelwahl' section='rma'}" title="{lang key='rma' section='rma'}: {lang key='rma_artikelwahl' section='rma'}">
                                            <i class="{et_getIcon key="redo"}"></i>
                                        </a>
                                    {/if}
                                </td>
                            </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div>
            {/block}
            {block name='account-orders-include-pagination'}
                {include file='snippets/pagination.tpl' oPagination=$orderPagination cThisUrl='jtl.php' cParam_arr=['bestellungen' => 1] parts=['pagi', 'label']}
            {/block}
        {else}
            {block name='account-orders-alert'}
                <div role="alert" class="alert alert-info">{lang key='noEntriesAvailable'}</div>
            {/block}
        {/if}
        {block name='account-orders-actions'}
            <div class="row">
                <div class="col col-md-3 col-12">
                    {include file="widgets/base/button.tpl" variant="secondary" classes="btn-back btn-block" href="{get_static_route id='jtl.php'}" title="{lang key='back'}" label="{lang key='back'}" iconPosition="left" icon="{et_getIcon key="navigationPrevious"}"}
                </div>
            </div>
        {/block}
    {/block}
{/block}
