[{d3modcfgcheck modid="d3printorder"}][{/d3modcfgcheck}]

[{if $mod_d3printorder}]
    [{if $oModCfg_d3printorder->isThemeIdMappedTo('azure')}]
        [{if count($oOrders) > 0}]
            [{assign var=oArticleList value=$oView->getOrderArticleList()}]
            <ul class="orderList">
                [{foreach from=$oOrders item=order}]
                    <li>
                        <table class="orderitems">
                            <tr>
                                <td>
                                    <dl>
                                        <dt title="[{oxmultilang ident="ORDER_DATE" suffix="COLON"}]">
                                            <strong id="accOrderDate_[{$order->oxorder__oxordernr->value}]">[{$order->oxorder__oxorderdate->value|date_format:"%d.%m.%Y"}]</strong>
                                            <span>[{$order->oxorder__oxorderdate->value|date_format:"%H:%M:%S"}]</span>
                                        </dt>
                                        <dd>
                                            <strong>[{oxmultilang ident="STATUS" suffix="COLON"}]</strong>
                                            <span id="accOrderStatus_[{$order->oxorder__oxordernr->value}]">
                                            [{if $order->oxorder__oxstorno->value}]
                                                <span class="note">[{oxmultilang ident="ORDER_IS_CANCELED"}]</span>
                                            [{elseif $order->oxorder__oxsenddate->value !="-"}]
                                                <span>[{oxmultilang ident="SHIPPED"}]</span>
                                            [{else}]
                                                <span class="note">[{oxmultilang ident="NOT_SHIPPED_YET"}]</span>
                                            [{/if}]
                                        </span>
                                        </dd>
                                        <dd>
                                            <strong>[{oxmultilang ident="ORDER_NUMBER" suffix="COLON"}]</strong>
                                            <span id="accOrderNo_[{$order->oxorder__oxordernr->value}]">[{$order->oxorder__oxordernr->value}]</span>
                                        </dd>
                                        [{if $order->getShipmentTrackingUrl()}]
                                            <dd>
                                                <strong>[{oxmultilang ident="TRACKING_ID" suffix="COLON"}]</strong>
                                                <span id="accOrderTrack_[{$order->oxorder__oxordernr->value}]">
                                                <a href="[{$order->getShipmentTrackingUrl()}]">[{oxmultilang ident="TRACK_SHIPMENT"}]</a>
                                            </span>
                                            </dd>
                                        [{/if}]
                                        <dd>
                                            <strong>[{oxmultilang ident="SHIPMENT_TO" suffix="COLON"}]</strong>
                                            <span id="accOrderName_[{$order->oxorder__oxordernr->value}]">
                                        [{if $order->oxorder__oxdellname->value}]
                                            [{$order->oxorder__oxdelfname->value}]
                                            [{$order->oxorder__oxdellname->value}]
                                        [{else}]
                                            [{$order->oxorder__oxbillfname->value}]
                                            [{$order->oxorder__oxbilllname->value}]
                                        [{/if}]
                                        </span>
                                        </dd>
                                    </dl>
                                </td>
                                <td>
                                    <h3>[{oxmultilang ident="CART" suffix="COLON"}]</h3>
                                    <table class="orderhistory">
                                        [{*D3 ADD BLOCK*}]
                                        [{block name="account_order_history_cart_items"}]
                                            [{foreach from=$order->getOrderArticles(true) item=orderitem name=testOrderItem}]
                                                [{assign var=sArticleId value=$orderitem->oxorderarticles__oxartid->value}]
                                                [{assign var=oArticle value=$oArticleList[$sArticleId]}]
                                                <tr id="accOrderAmount_[{$order->oxorder__oxordernr->value}]_[{$smarty.foreach.testOrderItem.iteration}]">
                                                    <td>
                                                        [{if $oArticle->oxarticles__oxid->value && $oArticle->isVisible()}]
                                                        <a  id="accOrderLink_[{$order->oxorder__oxordernr->value}]_[{$smarty.foreach.testOrderItem.iteration}]" href="[{$oArticle->getLink()}]">
                                                            [{/if}]
                                                            [{$orderitem->oxorderarticles__oxtitle->value}] [{$orderitem->oxorderarticles__oxselvariant->value}] <span class="amount"> - [{$orderitem->oxorderarticles__oxamount->value}] [{oxmultilang ident="QNT"}]</span>
                                                            [{if $oArticle->oxarticles__oxid->value && $oArticle->isVisible()}]</a>[{/if}]
                                                        [{block name="account_order_persparams"}]
                                                            [{foreach key=persParamKey from=$orderitem->getPersParams() item=persParamValue}]
                                                                <br />
                                                                [{include file="page/persparams/persparam.tpl" count=$persParams|@count key=$persParamKey value=$persParamValue}]
                                                            [{/foreach}]
                                                        [{/block}]
                                                    </td>
                                                    <td class="small">
                                                        [{* Commented due to Trusted Shops precertification. Enable if needed *}]
                                                        [{*
                                                        [{oxhasrights ident="TOBASKET"}]
                                                        [{if $oArticle->oxarticles__oxid->value && $oArticle->isBuyable()}]
                                                            <a id="accOrderToBasket_[{$order->oxorder__oxordernr->value}]_[{$smarty.foreach.testOrderItem.iteration}]" href="[{oxgetseourl ident=$oViewConf->getSelfLink()|cat:"cl=account_order" params="fnc=tobasket&amp;aid=`$oArticle->oxarticles__oxid->value`&amp;am=1"}]" rel="nofollow">[{oxmultilang ident="TO_CART"}]</a>
                                                        [{/if}]
                                                        [{/oxhasrights}]
                                                        *}]
                                                    </td>
                                                </tr>
                                                [{include file="page/account/inc/order_article_status.tpl"}]
                                            [{/foreach}]
                                        [{/block}]
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </li>
                [{/foreach}]
            </ul>
            [{include file="widget/locator/listlocator.tpl" locator=$oView->getPageNavigation() place="bottom"}]
        [{else}]
            [{oxmultilang ident="ORDER_EMPTY_HISTORY"}]
        [{/if}]

    [{else}]
        [{$smarty.block.parent}]
    [{/if}]
[{else}]
    [{$smarty.block.parent}]
[{/if}]