Skip to content

Commit 22bb74b

Browse files
committed
feat(manager): add tooltip for order statistics in Vue orders grid
Enhanced the Vue orders grid by adding a tooltip for the order statistics, clarifying that only placed orders are counted, excluding drafts. Updated English and Russian lexicons accordingly. Improved the logic in the OrdersController to handle draft visibility more clearly.
1 parent 473078d commit 22bb74b

4 files changed

Lines changed: 17 additions & 11 deletions

File tree

core/components/minishop3/lexicon/en/vue.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@
489489
$_lang['orders_title'] = 'Orders';
490490
$_lang['orders_month'] = 'Orders';
491491
$_lang['orders_month_sum'] = 'Total sum';
492+
$_lang['orders_stat_tooltip'] = 'Count and sum for placed orders only; drafts are not included';
492493
$_lang['ms3_orders_show_drafts'] = 'Show drafts';
493494
$_lang['order_num'] = 'Number';
494495
$_lang['order_customer'] = 'Customer';

core/components/minishop3/lexicon/ru/vue.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@
489489
$_lang['orders_title'] = 'Заказы';
490490
$_lang['orders_month'] = 'Заказов';
491491
$_lang['orders_month_sum'] = 'На сумму';
492+
$_lang['orders_stat_tooltip'] = 'Количество и сумма по оформленным заказам; черновики не учитываются';
492493
$_lang['ms3_orders_show_drafts'] = 'Показывать черновики';
493494
$_lang['order_num'] = 'Номер';
494495
$_lang['order_customer'] = 'Клиент';

core/components/minishop3/src/Controllers/Api/Manager/OrdersController.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,26 +1549,29 @@ protected function getOrdersStats(array $params = []): array
15491549
}
15501550

15511551
/**
1552-
* Whether draft orders should be included in manager list/stats queries.
1552+
* Whether draft orders should be included in the manager orders list query.
15531553
*
1554-
* Request param `show_drafts` overrides the system setting `ms3_order_show_drafts`.
1554+
* When `show_drafts` is present in request params it overrides `ms3_order_show_drafts`.
1555+
* The Vue orders grid always sends this flag (initialized from ms3.config.order_show_drafts).
15551556
*/
15561557
protected function shouldShowDrafts(array $params): bool
15571558
{
1558-
if (array_key_exists('show_drafts', $params)) {
1559-
$value = $params['show_drafts'];
1560-
if ($value === '' || $value === null) {
1561-
return (bool) $this->modx->getOption('ms3_order_show_drafts', null, false);
1562-
}
1559+
$default = (bool) $this->modx->getOption('ms3_order_show_drafts', null, false);
1560+
1561+
if (!array_key_exists('show_drafts', $params)) {
1562+
return $default;
1563+
}
15631564

1564-
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
1565+
$value = $params['show_drafts'];
1566+
if ($value === '' || $value === null) {
1567+
return $default;
15651568
}
15661569

1567-
return (bool) $this->modx->getOption('ms3_order_show_drafts', null, false);
1570+
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
15681571
}
15691572

15701573
/**
1571-
* Exclude draft status from query unless drafts are explicitly shown.
1574+
* Exclude draft status from getList query unless drafts are explicitly shown.
15721575
*/
15731576
protected function applyDraftVisibilityFilter($c, array $params): void
15741577
{

vueManager/src/components/OrdersGrid.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ onMounted(async () => {
569569
@click="createNewOrder"
570570
/>
571571
</div>
572-
<div class="grid-stats">
572+
<div class="grid-stats" :title="_('orders_stat_tooltip')">
573573
<span class="stat-item">
574574
<i class="pi pi-calendar"></i>
575575
{{ _('orders_month') }}: <strong>{{ stats.month_total }}</strong>
@@ -855,6 +855,7 @@ onMounted(async () => {
855855
gap: 1.5rem;
856856
font-size: 0.9rem;
857857
color: var(--ms3-text-muted);
858+
cursor: help;
858859
}
859860
860861
.stat-item {

0 commit comments

Comments
 (0)