init
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
<?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_CustomerMessage::css/admin-messages.css"/></head><body><referenceContainer name="content"><block class="Esun\CustomerMessage\Block\Adminhtml\Message\Index" name="esun.customer.message.admin" template="Esun_CustomerMessage::message/index.phtml" cacheable="false"/></referenceContainer></body></page>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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_CustomerMessage::css/admin-order-unread.css"/>
|
||||
</head>
|
||||
</page>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/** @var \Esun\CustomerMessage\Block\Adminhtml\Message\Index $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
$threads = $block->getThreads();
|
||||
$thread = $block->getSelectedThread();
|
||||
$entries = $block->getMessages($thread);
|
||||
$order = $block->getOrder();
|
||||
$orderId = $order ? (int)$order->getEntityId() : (int)($thread['order_id'] ?? 0);
|
||||
$customerName = trim(implode(' ', array_filter([
|
||||
(string)($thread['customer_firstname'] ?? ($order ? $order->getCustomerFirstname() : '')),
|
||||
(string)($thread['customer_lastname'] ?? ($order ? $order->getCustomerLastname() : '')),
|
||||
])));
|
||||
$customerName = $customerName
|
||||
?: (string)($thread['customer_email'] ?? ($order ? $order->getCustomerEmail() : ''))
|
||||
?: (string)__('Customer');
|
||||
?>
|
||||
<div class="esun-admin-inbox">
|
||||
<aside class="esun-admin-inbox__threads">
|
||||
<div class="esun-admin-inbox__search"><input class="admin__control-text" type="search" placeholder="<?= $escaper->escapeHtmlAttr(__('Search conversations')) ?>" data-role="thread-search"></div>
|
||||
<?php foreach ($threads as $item): ?>
|
||||
<a class="esun-admin-thread <?= $thread && (int)$thread['thread_id'] === (int)$item['thread_id'] ? 'is-active' : '' ?>" data-search="<?= $escaper->escapeHtmlAttr(strtolower($item['customer_email'] . ' ' . $item['subject'] . ' ' . ($item['order_increment_id'] ?? ''))) ?>" href="<?= $escaper->escapeUrl($block->getUrl('esun_customer_message/message/index', ['thread_id' => (int)$item['thread_id']])) ?>">
|
||||
<strong><?= $escaper->escapeHtml($item['customer_email']) ?></strong>
|
||||
<span><?= $escaper->escapeHtml($item['subject']) ?></span>
|
||||
<small><?= $escaper->escapeHtml(mb_substr((string)$item['last_content'], 0, 70)) ?></small>
|
||||
<?php if ((int)$item['admin_unread_count']): ?><b><?= (int)$item['admin_unread_count'] ?></b><?php endif; ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</aside>
|
||||
<section class="esun-admin-inbox__conversation">
|
||||
<?php if ($thread || $order): ?>
|
||||
<header><div><h1><?= $escaper->escapeHtml($thread['subject'] ?? __('Order #%1', $order->getIncrementId())) ?></h1><span><?= $escaper->escapeHtml($thread['customer_email'] ?? $order->getCustomerEmail()) ?></span></div><?php if ($orderId): ?><a href="<?= $escaper->escapeUrl($block->getUrl('sales/order/view', ['order_id' => $orderId])) ?>"><?= $escaper->escapeHtml(__('View Order')) ?></a><?php endif; ?></header>
|
||||
<div class="esun-admin-inbox__entries">
|
||||
<?php if ($entries): foreach ($entries as $entry): ?>
|
||||
<article class="esun-admin-entry is-<?= $escaper->escapeHtmlAttr($entry['sender_type']) ?>">
|
||||
<small><?= $escaper->escapeHtml($entry['sender_type'] === 'admin' ? __('Manager') : $customerName) ?> · <?= $escaper->escapeHtml($block->formatDate($entry['created_at'], \IntlDateFormatter::MEDIUM, true)) ?></small>
|
||||
<div><?= nl2br($escaper->escapeHtml($entry['content'])) ?><?php if ($entry['attachments']): ?><div class="esun-admin-entry__images"><?php foreach ($entry['attachments'] as $attachment): ?><a href="<?= $escaper->escapeUrl($block->getUrl('esun_customer_message/attachment/view', ['id' => (int)$attachment['attachment_id']])) ?>" target="_blank" rel="noopener"><img src="<?= $escaper->escapeUrl($block->getUrl('esun_customer_message/attachment/view', ['id' => (int)$attachment['attachment_id']])) ?>" alt="<?= $escaper->escapeHtmlAttr($attachment['original_name']) ?>"></a><?php endforeach; ?></div><?php endif; ?></div>
|
||||
</article>
|
||||
<?php endforeach; else: ?><p class="esun-admin-inbox__empty"><?= $escaper->escapeHtml(__('Start an order conversation with this customer.')) ?></p><?php endif; ?>
|
||||
</div>
|
||||
<form class="esun-admin-reply" method="post" enctype="multipart/form-data" action="<?= $escaper->escapeUrl($block->getUrl('esun_customer_message/thread/reply')) ?>">
|
||||
<?= $block->getBlockHtml('formkey') ?>
|
||||
<?php if ($thread): ?><input type="hidden" name="thread_id" value="<?= (int)$thread['thread_id'] ?>"><?php endif; ?>
|
||||
<?php if ($orderId): ?><input type="hidden" name="order_id" value="<?= $orderId ?>"><?php endif; ?>
|
||||
<textarea class="admin__control-textarea" name="content" rows="4" placeholder="<?= $escaper->escapeHtmlAttr(__('Enter a reply...')) ?>"></textarea>
|
||||
<div><label class="action-secondary"><span><?= $escaper->escapeHtml(__('Add Images')) ?></span><input type="file" name="images[]" accept="image/jpeg,image/png,image/webp" multiple hidden></label><small><?= $escaper->escapeHtml(__('Up to 5 JPG, PNG or WebP images, 5 MB each.')) ?></small><button class="action-primary" type="submit"><?= $escaper->escapeHtml(__('Send')) ?></button></div>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<div class="esun-admin-inbox__placeholder"><h2><?= $escaper->escapeHtml(__('Customer Messages')) ?></h2><p><?= $escaper->escapeHtml(__('Select a conversation to view and reply.')) ?></p></div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
<script>
|
||||
require(['jquery'], function ($) {
|
||||
'use strict';
|
||||
$('[data-role=thread-search]').on('input', function () {
|
||||
var query = this.value.toLowerCase();
|
||||
$('.esun-admin-thread').each(function () { $(this).toggle($(this).data('search').indexOf(query) !== -1); });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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">
|
||||
<columns name="sales_order_columns">
|
||||
<column name="esun_message_unread"
|
||||
class="Esun\CustomerMessage\Ui\Component\Listing\Column\AdminUnread"
|
||||
component="Esun_CustomerMessage/js/grid/columns/admin-unread"
|
||||
sortOrder="85">
|
||||
<settings>
|
||||
<bodyTmpl>ui/grid/cells/html</bodyTmpl>
|
||||
<disableAction>true</disableAction>
|
||||
<label translate="true">Unread Messages</label>
|
||||
<sortable>false</sortable>
|
||||
<filter>false</filter>
|
||||
<visible>true</visible>
|
||||
</settings>
|
||||
</column>
|
||||
</columns>
|
||||
</listing>
|
||||
@@ -0,0 +1 @@
|
||||
.esun-admin-inbox{background:#fff;border:1px solid #ddd;display:grid;grid-template-columns:360px minmax(0,1fr);height:calc(100vh - 180px);min-height:620px}.esun-admin-inbox__threads{border-right:1px solid #ddd;overflow-y:auto}.esun-admin-inbox__search{border-bottom:1px solid #ddd;padding:18px}.esun-admin-thread{border-bottom:1px solid #eee;color:#333;display:block;min-height:76px;padding:15px 45px 15px 18px;position:relative;text-decoration:none}.esun-admin-thread:hover,.esun-admin-thread.is-active{background:#f4faf7;color:#111;text-decoration:none}.esun-admin-thread strong,.esun-admin-thread span,.esun-admin-thread small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.esun-admin-thread span{margin-top:5px}.esun-admin-thread small{color:#999;margin-top:4px}.esun-admin-thread b{background:#18aa59;border-radius:99px;color:#fff;min-width:20px;padding:2px 6px;position:absolute;right:15px;text-align:center;top:18px}.esun-admin-inbox__conversation{display:flex;flex-direction:column;min-width:0}.esun-admin-inbox__conversation>header{align-items:center;border-bottom:1px solid #ddd;display:flex;justify-content:space-between;padding:18px 24px}.esun-admin-inbox__conversation h1{font-size:22px;margin:0 0 5px}.esun-admin-inbox__entries{flex:1;overflow-y:auto;padding:25px}.esun-admin-entry{margin:0 0 24px;max-width:70%}.esun-admin-entry.is-admin{margin-left:auto}.esun-admin-entry>small{color:#888;display:block;margin-bottom:7px}.esun-admin-entry.is-admin>small{text-align:right}.esun-admin-entry>div{background:#f5f5f5;border-radius:20px;padding:16px 20px}.esun-admin-entry.is-admin>div{background:#dff5ea}.esun-admin-entry__images{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}.esun-admin-entry__images img{background:#fff;height:100px;object-fit:cover;width:100px}.esun-admin-reply{border-top:1px solid #ddd;padding:18px 24px}.esun-admin-reply>.admin__control-textarea{box-sizing:border-box;display:block;min-height:120px;width:100%}.esun-admin-reply>div{align-items:center;display:flex;gap:14px;margin-top:12px}.esun-admin-reply button{margin-left:auto}.esun-admin-inbox__placeholder{color:#999;margin:auto;text-align:center}@media(max-width:900px){.esun-admin-inbox{grid-template-columns:280px minmax(0,1fr)}.esun-admin-entry{max-width:90%}}
|
||||
@@ -0,0 +1,26 @@
|
||||
.esun-admin-order-unread {
|
||||
align-items: center;
|
||||
display: inline-flex;
|
||||
gap: 7px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.esun-admin-order-unread__badge {
|
||||
align-items: center;
|
||||
background: #e22626;
|
||||
border-radius: 999px;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
display: inline-flex;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
height: 22px;
|
||||
justify-content: center;
|
||||
line-height: 22px;
|
||||
min-width: 22px;
|
||||
padding: 0 7px;
|
||||
}
|
||||
|
||||
.esun-admin-order-unread-empty {
|
||||
color: #adadad;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
define([
|
||||
'Magento_Ui/js/grid/columns/column'
|
||||
], function (Column) {
|
||||
'use strict';
|
||||
|
||||
return Column.extend({
|
||||
/**
|
||||
* Keep the order grid's default cell action away from message links.
|
||||
*
|
||||
* @returns {undefined}
|
||||
*/
|
||||
getFieldHandler: function () {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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_CustomerMessage::css/unread-badges.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<referenceBlock name="customer_account_navigation">
|
||||
<block class="Esun\CustomerMessage\Block\Account\NavigationLink"
|
||||
name="customer-account-navigation-messages"
|
||||
template="Esun_CustomerMessage::account/navigation-link.phtml">
|
||||
<arguments>
|
||||
<argument name="path" xsi:type="string">customer-message/account/index</argument>
|
||||
<argument name="label" xsi:type="string" translate="true">Message</argument>
|
||||
<argument name="sortOrder" xsi:type="number">230</argument>
|
||||
</arguments>
|
||||
</block>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?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><referenceBlock name="esun.customer.dashboard"><block class="Esun\CustomerMessage\Block\Account\Messages" name="esun.customer.dashboard.messages" as="messages" template="Esun_CustomerMessage::account/preview.phtml" cacheable="false"><arguments><argument name="limit" xsi:type="number">3</argument></arguments></block></referenceBlock></body></page>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"><update handle="customer_account"/><head><css src="Esun_CustomerMessage::css/messages.css"/></head><body><referenceBlock name="page.main.title" remove="true"/><referenceContainer name="content"><block class="Esun\CustomerMessage\Block\Account\Messages" name="customer.messages.list" template="Esun_CustomerMessage::account/messages.phtml" cacheable="false"/></referenceContainer></body></page>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="customer_account"/>
|
||||
<head><css src="Esun_CustomerMessage::css/messages.css"/></head>
|
||||
<body>
|
||||
<referenceBlock name="page.main.title" remove="true"/>
|
||||
<referenceContainer name="content"><block class="Esun\CustomerMessage\Block\Account\Messages" name="customer.order.messages" template="Esun_CustomerMessage::account/messages.phtml" cacheable="false"/></referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?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>
|
||||
<referenceBlock name="esun.sales.order.history">
|
||||
<arguments>
|
||||
<argument name="message_unread_view_model" xsi:type="object">Esun\CustomerMessage\ViewModel\OrderUnread</argument>
|
||||
</arguments>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/** @var \Esun\CustomerMessage\Block\Account\Messages $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
$threads = $block->getThreads();
|
||||
$thread = $block->getSelectedThread();
|
||||
$entries = $block->getConversationMessages($thread);
|
||||
$orderId = $block->getOrderId();
|
||||
$conversationOrderId = $orderId ?: (int)($thread['order_id'] ?? 0);
|
||||
$orderIncrementId = (string)($thread['order_increment_id'] ?? $block->getOrderIncrementId());
|
||||
$isNewGeneral = !$orderId && !$thread;
|
||||
?>
|
||||
<div class="esun-conversation-layout <?= $orderId ? 'is-order-conversation' : '' ?>">
|
||||
<?php if (!$orderId): ?>
|
||||
<aside class="esun-conversation-sidebar">
|
||||
<a class="action primary esun-conversation-new" href="<?= $escaper->escapeUrl($block->getUrl('customer-message/account/index', ['new' => 1])) ?>"><?= $escaper->escapeHtml(__('New Message')) ?></a>
|
||||
<div class="esun-conversation-thread-list">
|
||||
<?php foreach ($threads as $item): ?>
|
||||
<a class="esun-conversation-thread <?= $thread && (int)$thread['thread_id'] === (int)$item['thread_id'] ? 'is-active' : '' ?>" href="<?= $escaper->escapeUrl($block->getUrl('customer-message/account/index', ['thread_id' => (int)$item['thread_id']])) ?>">
|
||||
<strong><?= $escaper->escapeHtml($item['subject']) ?></strong>
|
||||
<?php if ($item['thread_type'] === 'order' && $item['order_increment_id']): ?><small>#<?= $escaper->escapeHtml($item['order_increment_id']) ?></small><?php endif; ?>
|
||||
<span><?= $escaper->escapeHtml(mb_substr((string)$item['last_content'], 0, 70)) ?></span>
|
||||
<?php if ((int)$item['customer_unread_count']): ?><b><?= (int)$item['customer_unread_count'] ?></b><?php endif; ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
<section class="esun-conversation-main">
|
||||
<header>
|
||||
<h1><?= $escaper->escapeHtml($thread ? $thread['subject'] : ($orderId ? __('Order Messages') : __('New Message'))) ?></h1>
|
||||
<?php if ($conversationOrderId && $orderIncrementId): ?><a href="<?= $escaper->escapeUrl($block->getUrl('sales/order/view', ['order_id' => $conversationOrderId])) ?>"><?= $escaper->escapeHtml(__('Order Number: %1', $orderIncrementId)) ?></a><?php endif; ?>
|
||||
</header>
|
||||
<div class="esun-conversation-messages">
|
||||
<?php if ($entries): foreach ($entries as $entry): ?>
|
||||
<article class="esun-conversation-entry is-<?= $escaper->escapeHtmlAttr($entry['sender_type']) ?>">
|
||||
<small><?= $escaper->escapeHtml($entry['sender_type'] === 'customer' ? __('You') : __('Manager')) ?> · <?= $escaper->escapeHtml($block->formatDate($entry['created_at'], \IntlDateFormatter::MEDIUM, true)) ?></small>
|
||||
<div class="esun-conversation-bubble"><?= nl2br($escaper->escapeHtml($entry['content'])) ?>
|
||||
<?php if ($entry['attachments']): ?><div class="esun-conversation-images"><?php foreach ($entry['attachments'] as $attachment): ?><a href="<?= $escaper->escapeUrl($block->getUrl('customer-message/attachment/view', ['id' => (int)$attachment['attachment_id']])) ?>" target="_blank" rel="noopener"><img src="<?= $escaper->escapeUrl($block->getUrl('customer-message/attachment/view', ['id' => (int)$attachment['attachment_id']])) ?>" alt="<?= $escaper->escapeHtmlAttr($attachment['original_name']) ?>" loading="lazy"></a><?php endforeach; ?></div><?php endif; ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; elseif (!$isNewGeneral): ?>
|
||||
<p class="esun-conversation-empty"><?= $escaper->escapeHtml(__('No messages have been sent for this order yet.')) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<form class="esun-conversation-compose" method="post" enctype="multipart/form-data" action="<?= $escaper->escapeUrl($block->getUrl('customer-message/thread/send')) ?>">
|
||||
<?= $block->getBlockHtml('formkey') ?>
|
||||
<?php if ($thread): ?><input type="hidden" name="thread_id" value="<?= (int)$thread['thread_id'] ?>"><?php endif; ?>
|
||||
<?php if ($orderId): ?><input type="hidden" name="order_id" value="<?= $orderId ?>"><?php endif; ?>
|
||||
<?php if ($isNewGeneral): ?><label><span><?= $escaper->escapeHtml(__('Subject')) ?></span><input class="input-text" type="text" name="subject" maxlength="255" required></label><?php endif; ?>
|
||||
<label><span><?= $escaper->escapeHtml(__('Message')) ?></span><textarea name="content" rows="4" placeholder="<?= $escaper->escapeHtmlAttr(__('Please enter your message...')) ?>"></textarea></label>
|
||||
<div class="esun-conversation-compose__actions">
|
||||
<label class="esun-conversation-upload"><i class="iconfont icon-picture1" aria-hidden="true"></i><span><?= $escaper->escapeHtml(__('Add Images')) ?></span><input type="file" name="images[]" accept="image/jpeg,image/png,image/webp" multiple></label>
|
||||
<small><?= $escaper->escapeHtml(__('JPG, PNG or WebP. Up to 5 images, 5 MB each.')) ?></small>
|
||||
<button class="action primary" type="submit"><?= $escaper->escapeHtml(__('Send')) ?></button>
|
||||
</div>
|
||||
<div class="esun-conversation-preview" aria-live="polite"></div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
<script>
|
||||
require(['jquery'], function ($) {
|
||||
'use strict';
|
||||
$('.esun-conversation-compose input[type=file]').on('change', function () {
|
||||
var preview = $(this).closest('form').find('.esun-conversation-preview').empty();
|
||||
Array.prototype.slice.call(this.files, 0, 5).forEach(function (file) {
|
||||
if (!file.type.match(/^image\/(jpeg|png|webp)$/)) { return; }
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (event) { $('<img>').attr('src', event.target.result).attr('alt', file.name).appendTo(preview); };
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/** @var \Esun\CustomerMessage\Block\Account\NavigationLink $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
$unreadCount = $block->getUnreadCount();
|
||||
$label = __((string)$block->getLabel());
|
||||
?>
|
||||
<li class="nav item<?= $block->isCurrent() ? ' current' : '' ?>">
|
||||
<?php if ($block->isCurrent()): ?>
|
||||
<strong aria-current="page">
|
||||
<?php else: ?>
|
||||
<a href="<?= $escaper->escapeUrl($block->getHref()) ?>"<?= $block->getTitle() ? ' title="' . $escaper->escapeHtmlAttr(__((string)$block->getTitle())) . '"' : '' ?>>
|
||||
<?php endif; ?>
|
||||
<span><?= $escaper->escapeHtml($label) ?></span>
|
||||
<?php if ($unreadCount): ?>
|
||||
<b class="esun-unread-badge" aria-label="<?= $escaper->escapeHtmlAttr(__('%1 unread messages', $unreadCount)) ?>"><?= (int)$unreadCount ?></b>
|
||||
<?php endif; ?>
|
||||
<?= $block->isCurrent() ? '</strong>' : '</a>' ?>
|
||||
</li>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/** @var \Esun\CustomerMessage\Block\Account\Messages $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
$threads = $block->getThreads();
|
||||
$notices = $block->getMessages();
|
||||
$unreadCount = $block->getUnreadCount();
|
||||
?>
|
||||
<article class="esun-service-card">
|
||||
<a class="esun-service-card__link" href="<?= $escaper->escapeUrl($block->getUrl('customer-message/account/index')) ?>"><i class="iconfont icon-chat1" aria-hidden="true"></i><span><?= $escaper->escapeHtml(__('Messages')) ?></span><?php if ($unreadCount): ?><b class="esun-unread-badge" aria-label="<?= $escaper->escapeHtmlAttr(__('%1 unread messages', $unreadCount)) ?>"><?= (int)$unreadCount ?></b><?php endif; ?></a>
|
||||
<?php if ($threads): foreach (array_slice($threads, 0, 3) as $thread): ?>
|
||||
<a class="esun-dashboard-row <?= (int)$thread['customer_unread_count'] ? 'is-unread' : 'is-read' ?>" href="<?= $escaper->escapeUrl($block->getUrl('customer-message/account/index', ['thread_id' => (int)$thread['thread_id']])) ?>"><strong><?= $escaper->escapeHtml($thread['subject']) ?></strong><span><?= $escaper->escapeHtml($block->formatDate($thread['last_message_at'])) ?></span></a>
|
||||
<?php endforeach; elseif ($notices): foreach ($notices as $message): ?>
|
||||
<a class="esun-dashboard-row <?= $message['is_read'] ? 'is-read' : 'is-unread' ?>" href="<?= $escaper->escapeUrl($block->getUrl('customer-message/account/index')) ?>"><strong><?= $escaper->escapeHtml($message['title']) ?></strong><span><?= $escaper->escapeHtml($block->formatDate($message['created_at'])) ?></span></a>
|
||||
<?php endforeach; else: ?>
|
||||
<p class="esun-empty-note"><?= $escaper->escapeHtml(__('You have no messages.')) ?></p>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
@@ -0,0 +1,233 @@
|
||||
.account.customer-message-account-index .column.main,
|
||||
.account.customer-message-order-contact .column.main {
|
||||
background: transparent;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.esun-conversation-layout {
|
||||
background: #fff;
|
||||
border-radius: 7px;
|
||||
display: grid;
|
||||
grid-template-columns: 330px minmax(0, 1fr);
|
||||
min-height: 720px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.esun-conversation-layout.is-order-conversation {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.esun-conversation-sidebar {
|
||||
border-right: 1px solid #e1e1e1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-conversation-new {
|
||||
display: block;
|
||||
margin: 22px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.esun-conversation-thread {
|
||||
border-top: 1px solid #ededed;
|
||||
color: #333;
|
||||
display: block;
|
||||
min-height: 78px;
|
||||
padding: 17px 48px 17px 22px;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.esun-conversation-thread:hover,
|
||||
.esun-conversation-thread.is-active {
|
||||
background: #f3faf6;
|
||||
color: #222;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.esun-conversation-thread strong,
|
||||
.esun-conversation-thread span,
|
||||
.esun-conversation-thread small {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.esun-conversation-thread span,
|
||||
.esun-conversation-thread small {
|
||||
color: #999;
|
||||
font-size: 13px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.esun-conversation-thread b {
|
||||
background: #18aa59;
|
||||
border-radius: 99px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
min-width: 19px;
|
||||
padding: 2px 6px;
|
||||
position: absolute;
|
||||
right: 17px;
|
||||
text-align: center;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.esun-conversation-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-conversation-main > header {
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #e1e1e1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 24px 30px;
|
||||
}
|
||||
|
||||
.esun-conversation-main > header h1 {
|
||||
font-size: 27px;
|
||||
font-weight: 500;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.esun-conversation-main > header a {
|
||||
color: #18aa59;
|
||||
}
|
||||
|
||||
.esun-conversation-messages {
|
||||
flex: 1;
|
||||
max-height: 650px;
|
||||
min-height: 420px;
|
||||
overflow-y: auto;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.esun-conversation-entry {
|
||||
margin-bottom: 27px;
|
||||
max-width: 72%;
|
||||
}
|
||||
|
||||
.esun-conversation-entry.is-customer {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.esun-conversation-entry > small {
|
||||
color: #888;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.esun-conversation-entry.is-customer > small {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.esun-conversation-bubble {
|
||||
background: #f5f5f5;
|
||||
border-radius: 26px;
|
||||
line-height: 1.6;
|
||||
min-height: 24px;
|
||||
padding: 18px 23px;
|
||||
}
|
||||
|
||||
.esun-conversation-entry.is-customer .esun-conversation-bubble {
|
||||
background: #e4f6ed;
|
||||
}
|
||||
|
||||
.esun-conversation-images {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-top: 13px;
|
||||
}
|
||||
|
||||
.esun-conversation-images img {
|
||||
background: #fff;
|
||||
border-radius: 7px;
|
||||
height: 110px;
|
||||
object-fit: cover;
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.esun-conversation-empty {
|
||||
color: #999;
|
||||
padding: 80px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.esun-conversation-compose {
|
||||
border-top: 1px solid #e1e1e1;
|
||||
padding: 22px 30px 25px;
|
||||
}
|
||||
|
||||
.esun-conversation-compose > label > span {
|
||||
display: block;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
.esun-conversation-compose input.input-text,
|
||||
.esun-conversation-compose textarea {
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-conversation-compose__actions {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 13px;
|
||||
}
|
||||
|
||||
.esun-conversation-compose__actions > button {
|
||||
margin-left: auto;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.esun-conversation-upload {
|
||||
align-items: center;
|
||||
color: #18aa59;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.esun-conversation-upload input {
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.esun-conversation-preview {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.esun-conversation-preview img {
|
||||
border-radius: 5px;
|
||||
height: 72px;
|
||||
object-fit: cover;
|
||||
width: 72px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.esun-conversation-layout { grid-template-columns: 260px minmax(0, 1fr); }
|
||||
.esun-conversation-entry { max-width: 88%; }
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.esun-conversation-layout { display: block; min-height: 0; }
|
||||
.esun-conversation-sidebar { border-bottom: 1px solid #ddd; border-right: 0; max-height: 300px; overflow-y: auto; }
|
||||
.esun-conversation-main > header { padding: 20px; }
|
||||
.esun-conversation-main > header h1 { font-size: 22px; }
|
||||
.esun-conversation-messages { min-height: 330px; padding: 20px; }
|
||||
.esun-conversation-compose { padding: 20px; }
|
||||
.esun-conversation-compose__actions { align-items: flex-start; flex-wrap: wrap; }
|
||||
.esun-conversation-compose__actions > button { width: 100%; }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
.esun-unread-badge {
|
||||
align-items: center;
|
||||
background: #f45f5a;
|
||||
border-radius: 999px;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
height: 20px;
|
||||
justify-content: center;
|
||||
line-height: 20px;
|
||||
min-width: 20px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
.account-nav .nav.item > a,
|
||||
.account-nav .nav.item > strong {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.account-nav .esun-unread-badge {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.esun-service-card__link .esun-unread-badge {
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.esun-order-contact-link {
|
||||
align-items: center;
|
||||
display: flex !important;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.esun-order-more > summary .esun-unread-badge {
|
||||
margin-left: 8px;
|
||||
}
|
||||
Reference in New Issue
Block a user