| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * Admin page shell: header, state banner, tab bar.
- *
- * @package studiou-wc-mail-queue
- * @copyright 2026 QUADARAX
- * @author Dalibor Votruba <dvotruba@quadarax.com>
- * @license GPL-2.0-or-later
- *
- * @var string $tab Active tab slug.
- */
- defined( 'ABSPATH' ) || exit;
- $wcmq_state = Studiou_WCMQ_State::get();
- $wcmq_counts = Studiou_WCMQ_DB::counts_by_state();
- $wcmq_tabs = array(
- 'settings' => __( 'Settings', 'studiou-wc-mail-queue' ),
- 'queue' => __( 'Queue', 'studiou-wc-mail-queue' ),
- 'log' => __( 'Log', 'studiou-wc-mail-queue' ),
- );
- ?>
- <div class="wrap studiou-wcmq">
- <h1><?php esc_html_e( 'WooCommerce Mail Queue', 'studiou-wc-mail-queue' ); ?></h1>
- <p class="studiou-wcmq-status">
- <?php
- if ( Studiou_WCMQ_Settings::STATE_ENABLED === $wcmq_state ) {
- printf(
- '<span class="studiou-wcmq-badge studiou-wcmq-badge-on">%s</span> ',
- esc_html__( 'Enabled', 'studiou-wc-mail-queue' )
- );
- printf(
- /* translators: 1: mails per minute, 2: seconds between mails */
- esc_html__( 'Sending at most %1$d mail(s) per minute (one every %2$d seconds).', 'studiou-wc-mail-queue' ),
- (int) Studiou_WCMQ_Settings::rate(),
- (int) Studiou_WCMQ_Settings::interval()
- );
- } elseif ( Studiou_WCMQ_Settings::STATE_DRAINING === $wcmq_state ) {
- printf(
- '<span class="studiou-wcmq-badge studiou-wcmq-badge-draining">%s</span> ',
- esc_html__( 'Draining', 'studiou-wc-mail-queue' )
- );
- printf(
- /* translators: %d: rows remaining */
- esc_html__( 'New mail sends immediately. %d queued mail(s) still to send.', 'studiou-wc-mail-queue' ),
- (int) ( $wcmq_counts['pending'] + $wcmq_counts['sending'] )
- );
- } else {
- printf(
- '<span class="studiou-wcmq-badge studiou-wcmq-badge-off">%s</span> ',
- esc_html__( 'Disabled', 'studiou-wc-mail-queue' )
- );
- esc_html_e( 'All mail sends immediately, exactly as stock WooCommerce.', 'studiou-wc-mail-queue' );
- }
- ?>
- </p>
- <ul class="studiou-wcmq-counts">
- <li><strong><?php echo (int) $wcmq_counts['pending']; ?></strong> <?php esc_html_e( 'pending', 'studiou-wc-mail-queue' ); ?></li>
- <li><strong><?php echo (int) $wcmq_counts['sending']; ?></strong> <?php esc_html_e( 'sending', 'studiou-wc-mail-queue' ); ?></li>
- <li><strong><?php echo (int) $wcmq_counts['sent']; ?></strong> <?php esc_html_e( 'sent', 'studiou-wc-mail-queue' ); ?></li>
- <li class="<?php echo $wcmq_counts['failed'] ? 'studiou-wcmq-has-failed' : ''; ?>">
- <strong><?php echo (int) $wcmq_counts['failed']; ?></strong> <?php esc_html_e( 'failed', 'studiou-wc-mail-queue' ); ?>
- </li>
- </ul>
- <h2 class="nav-tab-wrapper">
- <?php foreach ( $wcmq_tabs as $wcmq_slug => $wcmq_label ) : ?>
- <a href="<?php echo esc_url( Studiou_WCMQ_Admin::tab_url( $wcmq_slug ) ); ?>"
- class="nav-tab <?php echo $tab === $wcmq_slug ? 'nav-tab-active' : ''; ?>">
- <?php echo esc_html( $wcmq_label ); ?>
- </a>
- <?php endforeach; ?>
- </h2>
- <?php
- $wcmq_partial = STUDIOU_WCMQ_DIR . 'views/tab-' . $tab . '.php';
- if ( file_exists( $wcmq_partial ) ) {
- include $wcmq_partial;
- }
- ?>
- </div>
|