init
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"><body><referenceContainer name="content"><block class="Esun\LegacyOrder\Block\Adminhtml\Import\Form" name="legacy.order.import"/></referenceContainer></body></page>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head><css src="Esun_LegacyOrder::css/order-view.css"/></head>
|
||||
<body><referenceContainer name="content"><uiComponent name="esun_legacy_order_listing"/></referenceContainer></body>
|
||||
</page>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<css src="Esun_LegacyOrder::css/order-view.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<block class="Esun\LegacyOrder\Block\Adminhtml\Order\View" name="legacy.order.view"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/** @var \Esun\LegacyOrder\Block\Adminhtml\Customer\Edit\Tab\LegacyOrders $block */
|
||||
$orders = $block->getLegacyOrders();
|
||||
?>
|
||||
<div class="admin__page-section">
|
||||
<div class="admin__page-section-title">
|
||||
<span class="title"><?= $block->escapeHtml(__('Legacy Orders')) ?></span>
|
||||
</div>
|
||||
<div class="admin__page-section-content">
|
||||
<?php if (!$orders): ?>
|
||||
<div class="message message-info info">
|
||||
<div><?= $block->escapeHtml(__('No legacy orders are linked to this customer.')) ?></div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="admin__data-grid-wrap">
|
||||
<table class="data-grid">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="data-grid-th"><?= $block->escapeHtml(__('Legacy Order #')) ?></th>
|
||||
<th class="data-grid-th"><?= $block->escapeHtml(__('Order Date')) ?></th>
|
||||
<th class="data-grid-th"><?= $block->escapeHtml(__('Order Status')) ?></th>
|
||||
<th class="data-grid-th"><?= $block->escapeHtml(__('Payment Status')) ?></th>
|
||||
<th class="data-grid-th"><?= $block->escapeHtml(__('Shipping Status')) ?></th>
|
||||
<th class="data-grid-th"><?= $block->escapeHtml(__('Grand Total')) ?></th>
|
||||
<th class="data-grid-th"><?= $block->escapeHtml(__('Action')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($orders as $order): ?>
|
||||
<tr class="data-row">
|
||||
<td><a href="<?= $block->escapeUrl($block->getLegacyOrderUrl((int)$order['legacy_order_id'])) ?>"><?= $block->escapeHtml($order['source_order_number']) ?></a></td>
|
||||
<td><?= $block->escapeHtml($order['ordered_at'] ?: '-') ?></td>
|
||||
<td><?= $block->escapeHtml($order['order_status'] ?: '-') ?></td>
|
||||
<td><?= $block->escapeHtml($order['payment_status'] ?: '-') ?></td>
|
||||
<td><?= $block->escapeHtml($order['shipping_status'] ?: '-') ?></td>
|
||||
<td><?= $block->escapeHtml(($order['currency'] ?: '') . ' ' . $order['grand_total']) ?></td>
|
||||
<td><a href="<?= $block->escapeUrl($block->getLegacyOrderUrl((int)$order['legacy_order_id'])) ?>"><?= $block->escapeHtml(__('View')) ?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php /** @var \Esun\LegacyOrder\Block\Adminhtml\Import\Form $block */ ?>
|
||||
<div class="admin__fieldset-wrapper-content"><form action="<?= $block->escapeUrl($block->getUrl('esun_legacy_order/import/validate')) ?>" method="post" enctype="multipart/form-data"><input name="form_key" type="hidden" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>"/><fieldset class="admin__fieldset"><div class="admin__field required"><label class="admin__field-label"><span><?= $block->escapeHtml(__('CSV File')) ?></span></label><div class="admin__field-control"><input class="admin__control-file" type="file" name="csv_file" accept=".csv" required/></div></div><div class="admin__field required"><label class="admin__field-label"><span><?= $block->escapeHtml(__('Source Code')) ?></span></label><div class="admin__field-control"><input class="admin__control-text" name="source_code" value="old_us_site" required/><div class="note"><?= $block->escapeHtml(__('Used with the legacy order number as the unique key.')) ?></div></div></div><div class="admin__field required"><label class="admin__field-label"><span><?= $block->escapeHtml(__('Target Website')) ?></span></label><div class="admin__field-control"><select class="admin__control-select" name="website_id" required><?php foreach($block->getWebsites() as $w): ?><option value="<?= $block->escapeHtmlAttr($w['value']) ?>"><?= $block->escapeHtml($w['label']) ?></option><?php endforeach; ?></select></div></div><div class="admin__field required"><label class="admin__field-label"><span><?= $block->escapeHtml(__('Currency')) ?></span></label><div class="admin__field-control"><input class="admin__control-text" name="currency" value="USD" maxlength="3" required/></div></div><div class="admin__actions"><button class="action-primary" type="submit"><span><?= $block->escapeHtml(__('Check Data')) ?></span></button></div></fieldset></form><?php if($block->hasValidatedFile()): ?><form action="<?= $block->escapeUrl($block->getUrl('esun_legacy_order/import/run')) ?>" method="post"><input name="form_key" type="hidden" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>"/><button class="action-primary" type="submit"><span><?= $block->escapeHtml(__('Import Validated File')) ?></span></button></form><?php endif; ?></div>
|
||||
@@ -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; ?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
|
||||
<argument name="data" xsi:type="array"><item name="js_config" xsi:type="array"><item name="provider" xsi:type="string">esun_legacy_order_listing.esun_legacy_order_listing_data_source</item></item></argument>
|
||||
<settings><buttons><button name="relink"><url path="esun_legacy_order/order/relink"/><class>secondary</class><label translate="true">Relink Customers</label></button><button name="import"><url path="esun_legacy_order/import/index"/><class>primary</class><label translate="true">Import Legacy Orders</label></button></buttons><spinner>legacy_order_columns</spinner><deps><dep>esun_legacy_order_listing.esun_legacy_order_listing_data_source</dep></deps></settings>
|
||||
<dataSource name="esun_legacy_order_listing_data_source" component="Magento_Ui/js/grid/provider"><settings><storageConfig><param name="indexField" xsi:type="string">legacy_order_id</param></storageConfig><updateUrl path="mui/index/render"/></settings><aclResource>Esun_LegacyOrder::orders</aclResource><dataProvider class="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider" name="esun_legacy_order_listing_data_source"><settings><requestFieldName>id</requestFieldName><primaryFieldName>legacy_order_id</primaryFieldName></settings></dataProvider></dataSource>
|
||||
<listingToolbar name="listing_top"><settings><sticky>true</sticky></settings><bookmark name="bookmarks"/><columnsControls name="columns_controls"/><filters name="listing_filters"/><massaction name="listing_massaction" component="Esun_LegacyOrder/js/grid/massactions"><action name="bind_customer"><settings><url path="esun_legacy_order/order/massLink"/><type>bind_customer</type><label translate="true">Bind Customer</label></settings></action><action name="unbind_customer"><settings><confirm><message translate="true">Unbind the selected legacy orders from their customers? The historical order data will not be deleted.</message><title translate="true">Unbind Customer</title></confirm><url path="esun_legacy_order/order/massUnlink"/><type>unbind_customer</type><label translate="true">Unbind Customer</label></settings></action><action name="delete"><settings><confirm><message translate="true">Delete the selected legacy orders? Their archived item rows will also be deleted.</message><title translate="true">Delete Legacy Orders</title></confirm><url path="esun_legacy_order/order/massDelete"/><type>delete</type><label translate="true">Delete</label></settings></action></massaction><paging name="listing_paging"/></listingToolbar>
|
||||
<columns name="legacy_order_columns">
|
||||
<selectionsColumn name="ids" sortOrder="0"><settings><indexField>legacy_order_id</indexField></settings></selectionsColumn>
|
||||
<column name="legacy_order_id" sortOrder="10"><settings><filter>textRange</filter><label>ID</label><sorting>desc</sorting></settings></column>
|
||||
<column name="source_order_number"><settings><filter>text</filter><label translate="true">Legacy Order #</label></settings></column>
|
||||
<column name="source_code"><settings><filter>text</filter><label translate="true">Source</label></settings></column>
|
||||
<column name="customer_email"><settings><filter>text</filter><label translate="true">Customer Email</label></settings></column>
|
||||
<column name="website_id"><settings><filter>textRange</filter><label translate="true">Website ID</label></settings></column>
|
||||
<column name="website_name" class="Esun\LegacyOrder\Ui\Component\Listing\Column\WebsiteName"><settings><label translate="true">Website Name</label><sortable>false</sortable></settings></column>
|
||||
<column name="link_status"><settings><filter>select</filter><options class="Esun\LegacyOrder\Model\Source\LinkStatus"/><label translate="true">Customer Link</label></settings></column>
|
||||
<column name="payment_status"><settings><filter>text</filter><label translate="true">Payment Status</label></settings></column>
|
||||
<column name="order_status"><settings><filter>text</filter><label translate="true">Order Status</label></settings></column>
|
||||
<column name="grand_total"><settings><filter>textRange</filter><dataType>text</dataType><label translate="true">Grand Total</label></settings></column>
|
||||
<column name="currency"><settings><filter>text</filter><label translate="true">Currency</label></settings></column>
|
||||
<column name="ordered_at" class="Magento\Ui\Component\Listing\Columns\Date"><settings><filter>dateRange</filter><dataType>date</dataType><label translate="true">Order Date</label></settings></column>
|
||||
<actionsColumn name="actions" class="Esun\LegacyOrder\Ui\Component\Listing\Column\Actions" component="Esun_LegacyOrder/js/grid/columns/actions"><settings><indexField>legacy_order_id</indexField></settings></actionsColumn>
|
||||
</columns>
|
||||
</listing>
|
||||
@@ -0,0 +1,329 @@
|
||||
.legacy-order-bind-customer-modal .modal-inner-wrap {
|
||||
max-width: 560px;
|
||||
}
|
||||
|
||||
.legacy-order-bind-customer-modal .admin__control-text {
|
||||
margin-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.legacy-order-bind-customer-modal .note {
|
||||
color: #777;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.legacy-order-view-modal .modal-inner-wrap {
|
||||
max-width: 1100px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.legacy-order-view-modal .modal-content {
|
||||
background: #f5f6f7;
|
||||
padding: 20px 24px 28px;
|
||||
}
|
||||
|
||||
.legacy-order-modal-loading {
|
||||
color: #777;
|
||||
padding: 60px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.legacy-order-summary {
|
||||
background: linear-gradient(135deg, #282d32 0%, #3b4248 100%);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 8px 24px rgba(25, 31, 36, .14);
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
margin-bottom: 16px;
|
||||
padding: 20px 24px;
|
||||
}
|
||||
|
||||
.legacy-order-summary__header {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.legacy-order-summary__header > div:first-child > span,
|
||||
.legacy-order-summary__total > span {
|
||||
color: #ffb175;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.legacy-order-summary__header h2 {
|
||||
color: #fff;
|
||||
font-size: 22px;
|
||||
margin: 5px 0 0;
|
||||
}
|
||||
|
||||
.legacy-order-summary__total {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.legacy-order-summary__total strong {
|
||||
display: block;
|
||||
font-size: 22px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.legacy-order-summary__grid,
|
||||
.legacy-order-summary__statuses {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.legacy-order-summary__grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.legacy-order-summary__statuses {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.legacy-order-summary__grid > div,
|
||||
.legacy-order-summary__statuses > div {
|
||||
background: rgba(255, 255, 255, .08);
|
||||
border: 1px solid rgba(255, 255, 255, .1);
|
||||
border-radius: 6px;
|
||||
min-width: 0;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.legacy-order-summary__grid span,
|
||||
.legacy-order-summary__statuses span {
|
||||
color: rgba(255, 255, 255, .6);
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
margin-bottom: 6px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.legacy-order-summary__grid strong,
|
||||
.legacy-order-summary__statuses strong {
|
||||
color: #fff;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.legacy-order-summary__link-status {
|
||||
color: #82dcaa !important;
|
||||
}
|
||||
|
||||
.legacy-order-panel {
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 3px 14px rgba(25, 31, 36, .05);
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 16px;
|
||||
padding: 16px 20px 18px;
|
||||
}
|
||||
|
||||
.legacy-order-panel > .admin__page-section-title {
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
display: flex;
|
||||
margin-bottom: 13px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.legacy-order-customer-link__actions,
|
||||
.legacy-order-customer-link__form {
|
||||
align-items: flex-end;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.legacy-order-customer-link__form {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.legacy-order-customer-link__form > div {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.legacy-order-customer-link__form label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.legacy-order-customer-link__form input {
|
||||
height: 38px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.legacy-order-customer-link__form button,
|
||||
.legacy-order-customer-link__actions > form button {
|
||||
min-height: 38px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.legacy-order-items__count {
|
||||
align-items: center;
|
||||
background: #fff0e8;
|
||||
border-radius: 50%;
|
||||
color: #eb5202;
|
||||
display: inline-flex;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
height: 25px;
|
||||
justify-content: center;
|
||||
margin-left: 10px;
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
.legacy-order-items table thead th {
|
||||
background: #f7f8f8;
|
||||
color: #777;
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.legacy-order-items table td,
|
||||
.legacy-order-items table th {
|
||||
padding: 9px 12px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.legacy-order-items table th:nth-child(n+2),
|
||||
.legacy-order-items table td:nth-child(n+2) {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.legacy-order-items__qty {
|
||||
background: #f0f1f1;
|
||||
border-radius: 14px;
|
||||
display: inline-block;
|
||||
min-width: 22px;
|
||||
padding: 3px 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.legacy-order-totals table {
|
||||
margin-left: auto;
|
||||
max-width: 480px;
|
||||
}
|
||||
|
||||
.legacy-order-totals th,
|
||||
.legacy-order-totals td {
|
||||
padding: 5px 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.legacy-order-totals__discount th,
|
||||
.legacy-order-totals__discount td {
|
||||
color: #16894b;
|
||||
}
|
||||
|
||||
.legacy-order-totals__discount small {
|
||||
background: #eaf8f0;
|
||||
border-radius: 3px;
|
||||
margin-left: 6px;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
||||
.legacy-order-totals__grand th,
|
||||
.legacy-order-totals__grand td {
|
||||
border-top: 2px solid #333;
|
||||
color: #222;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.legacy-order-information {
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 16px;
|
||||
padding: 16px 20px 20px;
|
||||
}
|
||||
|
||||
.legacy-order-information .admin__page-section-title {
|
||||
border-bottom: 1px solid #e3e3e3;
|
||||
margin-bottom: 14px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.legacy-order-information__grid {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.legacy-order-information__card {
|
||||
background: #f7f8f8;
|
||||
border: 1px solid #e2e4e4;
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
min-height: 120px;
|
||||
padding: 16px 18px;
|
||||
}
|
||||
|
||||
.legacy-order-information__card h3 {
|
||||
color: #262626;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 9px;
|
||||
}
|
||||
|
||||
.legacy-order-information__card address,
|
||||
.legacy-order-information__card p {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
line-height: 1.45;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.legacy-order-information__card small {
|
||||
color: #999;
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
margin-top: 5px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.legacy-order-view-modal .modal-inner-wrap {
|
||||
width: 94%;
|
||||
}
|
||||
|
||||
.legacy-order-summary__grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.legacy-order-customer-link__actions,
|
||||
.legacy-order-customer-link__form {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.legacy-order-information__grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.legacy-order-summary__header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.legacy-order-summary__total {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.legacy-order-summary__grid,
|
||||
.legacy-order-summary__statuses {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
define([
|
||||
'jquery',
|
||||
'Magento_Ui/js/grid/columns/actions',
|
||||
'Magento_Ui/js/modal/modal',
|
||||
'mage/translate'
|
||||
], function ($, Actions, modal, $t) {
|
||||
'use strict';
|
||||
|
||||
return Actions.extend({
|
||||
getActionHandler: function (action) {
|
||||
if (action.modal) {
|
||||
return this.openLegacyOrderModal.bind(this, action);
|
||||
}
|
||||
|
||||
return this._super(action);
|
||||
},
|
||||
|
||||
openLegacyOrderModal: function (action) {
|
||||
var $dialog = $('#legacy-order-view-modal');
|
||||
|
||||
if (!$dialog.length) {
|
||||
$dialog = $('<div id="legacy-order-view-modal"/>').appendTo('body');
|
||||
modal({
|
||||
type: 'popup',
|
||||
title: $t('Legacy Order Details'),
|
||||
responsive: true,
|
||||
innerScroll: true,
|
||||
modalClass: 'legacy-order-view-modal',
|
||||
buttons: []
|
||||
}, $dialog);
|
||||
}
|
||||
|
||||
$dialog.html('<div class="legacy-order-modal-loading">' + $t('Loading...') + '</div>');
|
||||
$dialog.modal('openModal');
|
||||
|
||||
$.ajax({
|
||||
url: action.href,
|
||||
type: 'GET',
|
||||
dataType: 'html',
|
||||
showLoader: true
|
||||
}).done(function (html) {
|
||||
$dialog.html(html);
|
||||
}).fail(function () {
|
||||
$dialog.html('<div class="message message-error error"><div>' +
|
||||
$t('Unable to load the legacy order details.') +
|
||||
'</div></div>');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,98 @@
|
||||
define([
|
||||
'jquery',
|
||||
'Magento_Ui/js/grid/massactions',
|
||||
'Magento_Ui/js/modal/modal',
|
||||
'Magento_Ui/js/modal/alert',
|
||||
'mageUtils',
|
||||
'mage/translate'
|
||||
], function ($, Massactions, modal, alert, utils, $t) {
|
||||
'use strict';
|
||||
|
||||
return Massactions.extend({
|
||||
applyAction: function (actionIndex) {
|
||||
if (actionIndex === 'bind_customer') {
|
||||
this.openBindCustomerModal();
|
||||
this.close();
|
||||
return this;
|
||||
}
|
||||
|
||||
return this._super(actionIndex);
|
||||
},
|
||||
|
||||
openBindCustomerModal: function () {
|
||||
var data = this.getSelections(),
|
||||
action = this.getAction('bind_customer'),
|
||||
$dialog = $('#legacy-order-bind-customer-modal'),
|
||||
self = this;
|
||||
|
||||
if (!data || !data.total) {
|
||||
alert({content: this.noItemsMsg});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$dialog.length) {
|
||||
$dialog = $(
|
||||
'<div id="legacy-order-bind-customer-modal">' +
|
||||
'<label class="admin__field-label" for="legacy-order-mass-customer"><span>' +
|
||||
$t('Customer ID or Email') +
|
||||
'</span></label>' +
|
||||
'<input id="legacy-order-mass-customer" class="admin__control-text" type="text" />' +
|
||||
'<p class="note">' +
|
||||
$t('All selected orders will be linked to the matching customer in each order website.') +
|
||||
'</p></div>'
|
||||
).appendTo('body');
|
||||
|
||||
modal({
|
||||
type: 'popup',
|
||||
title: $t('Bind Customer'),
|
||||
responsive: true,
|
||||
modalClass: 'legacy-order-bind-customer-modal',
|
||||
buttons: [{
|
||||
text: $t('Cancel'),
|
||||
class: 'action-secondary',
|
||||
click: function () {
|
||||
this.closeModal();
|
||||
}
|
||||
}, {
|
||||
text: $t('Bind Customer'),
|
||||
class: 'action-primary',
|
||||
click: function () {
|
||||
self.submitCustomerBinding(
|
||||
$dialog.data('action'),
|
||||
$dialog.data('selections'),
|
||||
$dialog,
|
||||
this
|
||||
);
|
||||
}
|
||||
}]
|
||||
}, $dialog);
|
||||
}
|
||||
|
||||
$dialog.data('action', action).data('selections', data);
|
||||
$dialog.find('input').val('');
|
||||
$dialog.modal('openModal');
|
||||
window.setTimeout(function () {
|
||||
$dialog.find('input').trigger('focus');
|
||||
}, 100);
|
||||
},
|
||||
|
||||
submitCustomerBinding: function (action, data, $dialog, modalInstance) {
|
||||
var customer = $.trim($dialog.find('input').val()),
|
||||
itemsType,
|
||||
params = {};
|
||||
|
||||
if (!customer) {
|
||||
alert({content: $t('Enter a customer ID or email.')});
|
||||
return;
|
||||
}
|
||||
|
||||
itemsType = data.excludeMode ? 'excluded' : 'selected';
|
||||
params[itemsType] = Array.isArray(data[itemsType]) && data[itemsType].length ?
|
||||
data[itemsType] : false;
|
||||
$.extend(params, data.params || {});
|
||||
params.customer = customer;
|
||||
modalInstance.closeModal();
|
||||
utils.submit({url: action.url, data: params});
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user