I'm a beginner in Magento and I try to create a page on which I get all orders of a customer payed with a custom payment method.
Now, the page work but I want the page to looks like a real customer admin page, and to display the navigation on the left.
My custom layout (devis_index_index.xml)
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceContainer name="content">
<block class="Opsone\KgAdmin\Block\Index" name="devis_index_index" template="Opsone_KgAdmin::index.phtml" />
</referenceContainer>
</page>
and my template (index.phtml)
<?php $items = $this->getOrderCollection(); ?>
<div class="o-main-box">
<?php if ($items != 'disconnect' && count($items)): ?>
<div class="table-wrapper orders-history">
<table class="data table table-order-items history" id="my-orders-table">
<caption class="table-caption"><?= /* @escapeNotVerified */ __('Orders') ?></caption>
<thead>
<tr>
<th scope="col" class="col id"><?= /* @escapeNotVerified */ __('Devis #') ?></th>
<th scope="col" class="col date"><?= /* @escapeNotVerified */ __('Date') ?></th>
<?= /* @noEscape */ $block->getChildHtml('extra.column.header') ?>
<th scope="col" class="col shipping"><?= /* @escapeNotVerified */ __('Ship To') ?></th>
<th scope="col" class="col total"><?= /* @escapeNotVerified */ __('Total du devis') ?></th>
<th scope="col" class="col status"><?= /* @escapeNotVerified */ __('Status') ?></th>
<th scope="col" class="col actions"><?= /* @escapeNotVerified */ __('Action') ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($items as $_order) : ?>
<tr>
<td data-th="<?= $block->escapeHtml(__('Order #')) ?>" class="col id"><?= /* @escapeNotVerified */ $_order->getRealOrderId() ?></td>
<td data-th="<?= $block->escapeHtml(__('Date')) ?>" class="col date"><?= /* @escapeNotVerified */ $block->formatDate($_order->getCreatedAt()) ?></td>
<td data-th="<?= $block->escapeHtml(__('Ship To')) ?>" class="col shipping"><?= $_order->getShippingAddress() ? $block->escapeHtml($_order->getShippingAddress()->getName()) : ' ' ?></td>
<td data-th="<?= $block->escapeHtml(__('Order Total')) ?>" class="col total"><?= /* @escapeNotVerified */ $_order->formatPrice($_order->getGrandTotal()) ?></td>
<td data-th="<?= $block->escapeHtml(__('Status')) ?>" class="col status"><?= /* @escapeNotVerified */ $_order->getStatusLabel() ?></td>
<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
<a href="<?= $block->getUrl('sales/order/view', ['order_id' => $_order->getRealOrderId()]); ?>" class="action view">
<span><?= /* @escapeNotVerified */ __('Voir le devis') ?></span>
</a>
</td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</div>
<?php elseif ($items != 'disconnect' && !count($items)) : ?>
<div class="message info empty"><span><?= /* @escapeNotVerified */ __('Vous n\'avez aucun devis en cours') ?></span></div>
<?php else: ?>
<div class="message info empty"><span><?= /* @escapeNotVerified */ __('Merci de vous connecter pour accéder à vos devis') ?></span></div>
<?php endif ?>
</div>
Thank you :)