From dcbb606ff97e96ab9c203f25989f93a47d868909 Mon Sep 17 00:00:00 2001 From: Shahed <125728402+dev-shahed@users.noreply.github.com> Date: Thu, 9 Jul 2026 11:33:21 +0600 Subject: [PATCH] feat: add pending badges for vendors and withdraw menu items --- assets/src/less/global-admin.less | 11 +++++++++++ includes/Admin/Dashboard/Pages/Vendors.php | 13 ++++++++++++- includes/Admin/Dashboard/Pages/Withdraw.php | 13 ++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/assets/src/less/global-admin.less b/assets/src/less/global-admin.less index f814c9f902..ac9caac743 100644 --- a/assets/src/less/global-admin.less +++ b/assets/src/less/global-admin.less @@ -414,3 +414,14 @@ padding-bottom: 0.5rem; font-size: 13px; } + +/** + * Keep the Dokan admin menu pending-count badges readable in every state. + */ +#adminmenu #toplevel_page_dokan .wp-submenu .awaiting-mod, +#adminmenu #toplevel_page_dokan .wp-submenu li a:hover .awaiting-mod, +#adminmenu #toplevel_page_dokan .wp-submenu li a:focus .awaiting-mod, +#adminmenu #toplevel_page_dokan .wp-submenu li.current a .awaiting-mod { + background-color: #3858e9; + color: #fff; +} diff --git a/includes/Admin/Dashboard/Pages/Vendors.php b/includes/Admin/Dashboard/Pages/Vendors.php index c9536287c2..92af865d9c 100644 --- a/includes/Admin/Dashboard/Pages/Vendors.php +++ b/includes/Admin/Dashboard/Pages/Vendors.php @@ -8,9 +8,20 @@ public function get_id(): string { } public function menu( string $capability, string $position ): array { + $status_count = dokan_get_seller_status_count(); + $pending_count = absint( $status_count['inactive'] ?? 0 ); + + $menu_title = $pending_count ? sprintf( + /* translators: %s: Inactive vendor count badge */ + __( 'Vendors %s', 'dokan-lite' ), + '' + . number_format_i18n( $pending_count ) + . '' + ) : __( 'Vendors', 'dokan-lite' ); + return [ 'page_title' => __( 'Vendors', 'dokan-lite' ), - 'menu_title' => __( 'Vendors', 'dokan-lite' ), + 'menu_title' => $menu_title, 'route' => 'vendors', 'capability' => $capability, 'position' => 100, diff --git a/includes/Admin/Dashboard/Pages/Withdraw.php b/includes/Admin/Dashboard/Pages/Withdraw.php index 4fc959f2f0..19a8eaa7f4 100644 --- a/includes/Admin/Dashboard/Pages/Withdraw.php +++ b/includes/Admin/Dashboard/Pages/Withdraw.php @@ -19,9 +19,20 @@ public function get_id(): string { * @inheritDoc */ public function menu( string $capability, string $position ): array { + $withdraw_count = dokan_get_withdraw_count(); + $pending_count = absint( $withdraw_count['pending'] ?? 0 ); + + $menu_title = $pending_count ? sprintf( + /* translators: %s: Pending withdraw request count badge */ + __( 'Withdraw %s', 'dokan-lite' ), + '' + . number_format_i18n( $pending_count ) + . '' + ) : __( 'Withdraw', 'dokan-lite' ); + return [ 'page_title' => __( 'Withdraw Management', 'dokan-lite' ), - 'menu_title' => __( 'Withdraw', 'dokan-lite' ), + 'menu_title' => $menu_title, 'route' => 'withdraw', 'capability' => $capability, 'position' => 10,