init
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php /** @var \Esun\LegacyOrder\Block\Adminhtml\Order\View $block */ $o=$block->getOrder();$isModal=(bool)$block->getData('modal'); ?>
|
||||
<?php if(!$o): ?><div class="message error"><?= $block->escapeHtml(__('Legacy order not found.')) ?></div><?php else: $ship=$block->decode($o['shipping_address']);$bill=$block->decode($o['billing_address']);$items=$block->getItems();$money=static fn($value):string=>number_format((float)$value,2,'.',',');$discount=abs((float)($o['discount_amount']??0));$coupon=trim((string)($o['coupon']??''));$hasDiscount=$discount>0.0001||$coupon!== ''; ?>
|
||||
<?php if(!$isModal): ?><div class="page-main-actions"><a class="action-default" href="<?= $block->escapeUrl($block->getUrl('esun_legacy_order/order/index')) ?>"><?= $block->escapeHtml(__('Back')) ?></a></div><?php endif; ?>
|
||||
<div class="admin__page-section legacy-order-summary">
|
||||
<div class="legacy-order-summary__header"><div><span><?= $block->escapeHtml(__('Historical record')) ?></span><h2><?= $block->escapeHtml(__('Legacy Order #%1',$o['source_order_number'])) ?></h2></div><div class="legacy-order-summary__total"><span><?= $block->escapeHtml(__('Grand Total')) ?></span><strong><?= $block->escapeHtml($o['currency'].' '.$money($o['grand_total'])) ?></strong></div></div>
|
||||
<div class="legacy-order-summary__grid">
|
||||
<div><span><?= $block->escapeHtml(__('Customer Email')) ?></span><strong><?= $block->escapeHtml($o['customer_email']) ?></strong></div>
|
||||
<div><span><?= $block->escapeHtml(__('Customer Link')) ?></span><strong class="legacy-order-summary__link-status"><?= $block->escapeHtml(ucfirst((string)$o['link_status'])) ?><?= $o['customer_id']?' (#'.(int)$o['customer_id'].')':'' ?></strong></div>
|
||||
<div><span><?= $block->escapeHtml(__('Order Date')) ?></span><strong><?= $block->escapeHtml($o['ordered_at']?:'-') ?></strong></div>
|
||||
<div><span><?= $block->escapeHtml(__('Website ID')) ?></span><strong><?= (int)$o['website_id'] ?></strong></div>
|
||||
</div>
|
||||
<div class="legacy-order-summary__statuses"><?php foreach([[__('Payment Status'),$o['payment_status']],[__('Order Status'),$o['order_status']],[__('Shipping Status'),$o['shipping_status']]] as$status): ?><div><span><?= $block->escapeHtml($status[0]) ?></span><strong><?= $block->escapeHtml($status[1]?:'-') ?></strong></div><?php endforeach; ?></div>
|
||||
</div>
|
||||
<?php if(!$isModal): ?><div class="admin__page-section legacy-order-panel legacy-order-customer-link"><div class="admin__page-section-title"><span class="title"><?= $block->escapeHtml(__('Customer Link')) ?></span></div><div class="legacy-order-customer-link__actions"><form class="legacy-order-customer-link__form" method="post" action="<?= $block->escapeUrl($block->getUrl('esun_legacy_order/order/link')) ?>"><input type="hidden" name="form_key" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>"/><input type="hidden" name="id" value="<?= (int)$o['legacy_order_id'] ?>"/><div><label for="legacy-customer-link"><?= $block->escapeHtml(__('Customer ID or Email')) ?></label><input id="legacy-customer-link" class="admin__control-text" type="text" name="customer" placeholder="<?= $block->escapeHtmlAttr(__('Customer ID or email in Website ID %1',$o['website_id'])) ?>" required/></div><button class="action-primary" type="submit"><?= $block->escapeHtml(__('Link Customer')) ?></button></form><?php if($o['customer_id']): ?><form method="post" action="<?= $block->escapeUrl($block->getUrl('esun_legacy_order/order/unlink')) ?>"><input type="hidden" name="form_key" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>"/><input type="hidden" name="id" value="<?= (int)$o['legacy_order_id'] ?>"/><button class="action-secondary" type="submit" onclick="return confirm('<?= $block->escapeJs(__('Remove this customer link?')) ?>')"><?= $block->escapeHtml(__('Unlink Customer')) ?></button></form><?php endif; ?></div></div><?php endif; ?>
|
||||
<div class="admin__page-section legacy-order-panel legacy-order-items"><div class="admin__page-section-title"><span class="title"><?= $block->escapeHtml(__('Items')) ?></span><span class="legacy-order-items__count"><?= count($items) ?></span></div><div class="legacy-order-items__table"><table class="data-table admin__table-primary"><thead><tr><th>SKU</th><th><?= $block->escapeHtml(__('Price')) ?></th><th><?= $block->escapeHtml(__('Qty')) ?></th><th><?= $block->escapeHtml(__('Subtotal')) ?></th></tr></thead><tbody><?php foreach($items as$i): ?><tr><td><strong><?= $block->escapeHtml($i['sku']) ?></strong></td><td><?= $block->escapeHtml($o['currency'].' '.$money($i['price'])) ?></td><td><span class="legacy-order-items__qty"><?= (int)round((float)$i['qty']) ?></span></td><td><strong><?= $block->escapeHtml($o['currency'].' '.$money($i['row_total'])) ?></strong></td></tr><?php endforeach; ?></tbody></table></div></div>
|
||||
<div class="admin__page-section legacy-order-panel legacy-order-totals"><div class="admin__page-section-title"><span class="title"><?= $block->escapeHtml(__('Order Totals')) ?></span></div><table class="admin__table-secondary"><tr><th><?= $block->escapeHtml(__('Product Subtotal')) ?></th><td><?= $block->escapeHtml($o['currency'].' '.$money($o['product_total'])) ?></td></tr><?php if($hasDiscount): ?><tr class="legacy-order-totals__discount"><th><?= $block->escapeHtml(__('Discount')) ?><?php if($coupon!==''): ?> <small><?= $block->escapeHtml(__('Coupon: %1',$coupon)) ?></small><?php endif; ?></th><td>-<?= $block->escapeHtml($o['currency'].' '.$money($discount)) ?></td></tr><?php endif; ?><?php if((float)$o['shipping_amount']!==0.0): ?><tr><th><?= $block->escapeHtml(__('Shipping')) ?></th><td><?= $block->escapeHtml($o['currency'].' '.$money($o['shipping_amount'])) ?></td></tr><?php endif; ?><?php if((float)$o['tax_amount']!==0.0): ?><tr><th><?= $block->escapeHtml(__('Tax')) ?></th><td><?= $block->escapeHtml($o['currency'].' '.$money($o['tax_amount'])) ?></td></tr><?php endif; ?><?php if((float)$o['fee_amount']!==0.0): ?><tr><th><?= $block->escapeHtml(__('Fee')) ?></th><td><?= $block->escapeHtml($o['currency'].' '.$money($o['fee_amount'])) ?></td></tr><?php endif; ?><tr class="legacy-order-totals__grand"><th><?= $block->escapeHtml(__('Grand Total')) ?></th><td><?= $block->escapeHtml($o['currency'].' '.$money($o['grand_total'])) ?></td></tr></table></div>
|
||||
<div class="admin__page-section legacy-order-information">
|
||||
<div class="admin__page-section-title"><span class="title"><?= $block->escapeHtml(__('Order Information')) ?></span></div>
|
||||
<div class="legacy-order-information__grid">
|
||||
<?php foreach([[__('Shipping Address'),$ship],[__('Billing Address'),$bill]] as$addressBlock): $label=$addressBlock[0];$a=$addressBlock[1]; ?>
|
||||
<section class="legacy-order-information__card">
|
||||
<h3><?= $block->escapeHtml($label) ?></h3>
|
||||
<address><?= /* @noEscape */ nl2br($block->escapeHtml(implode("\n",array_filter([$a['name']??'',trim(($a['street']??'').' '.($a['unit']??'')),trim(($a['city']??'').' '.($a['region']??'').' '.($a['postcode']??'')),$a['country']??'',$a['telephone']??''])))) ?></address>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
<section class="legacy-order-information__card">
|
||||
<h3><?= $block->escapeHtml(__('Shipping Method')) ?></h3>
|
||||
<p><?= $block->escapeHtml($o['shipping_method']?:'-') ?></p>
|
||||
<?php if(!empty($o['carrier'])): ?><small><?= $block->escapeHtml(__('Carrier: %1',$o['carrier'])) ?></small><?php endif; ?>
|
||||
<?php if(!empty($o['tracking_number'])): ?><small><?= $block->escapeHtml(__('Tracking Number: %1',$o['tracking_number'])) ?></small><?php endif; ?>
|
||||
</section>
|
||||
<section class="legacy-order-information__card">
|
||||
<h3><?= $block->escapeHtml(__('Payment Method')) ?></h3>
|
||||
<p><?= $block->escapeHtml($o['payment_method']?:'-') ?></p>
|
||||
<?php if(!empty($o['payment_transaction_id'])): ?><small><?= $block->escapeHtml(__('Transaction: %1',$o['payment_transaction_id'])) ?></small><?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user