Updated all dashboard pages to display correct information

This commit is contained in:
Ruben Ramirez 2025-03-07 04:37:43 -06:00
parent dc42392180
commit e8e17737fc
8 changed files with 624 additions and 30 deletions

View file

@ -123,7 +123,7 @@ get_header(); ?>
$list = new PostTypeList('campaign', [
'title' => 'My Campaigns',
'no_items' => 'You haven\'t added any campaigns yet.',
'no_items' => '<a href="/dashboard/campaigns/edit-campaign/" class="underlined_link">You haven\'t added any campaigns yet. Click here to create a campaign</a>',
'delete_confirm' => 'Are you sure you want to delete this campaign? This action cannot be undone.'
]);
$list->render();

View file

@ -39,6 +39,72 @@ $email_account_count = count(get_posts([
'status' => 'publish',
'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]]
]));
// Get campaigns for this user
$campaigns = get_posts([
"post_type" => "campaign",
"posts_per_page" => -1,
"status" => "publish",
"meta_query" => [['key' => 'owner_id', 'value' => $current_user_id]]
]);
// Initialize message counters and delivery stats
$messages_today = 0;
$messages_this_week = 0;
$total_sent = 0;
$total_failed = 0;
// Get message counts from database
global $wpdb;
$messages_table = $wpdb->prefix . 'rl_mailwarmer_messages';
// Get campaign IDs
$campaign_ids = array();
foreach ($campaigns as $campaign) {
$campaign_ids[] = $campaign->ID;
}
if (!empty($campaign_ids)) {
// Convert to comma-separated string for SQL
$campaign_ids_str = implode(",", $campaign_ids);
// Messages scheduled today
$today = date("Y-m-d");
$messages_today = $wpdb->get_var(
"SELECT COUNT(*) FROM $messages_table
WHERE campaign_id IN ($campaign_ids_str)
AND (status = 'new' OR status = 'scheduled')
AND DATE(scheduled_for_timestamp) = '$today'"
);
// Messages scheduled this week (next 7 days)
$week_end = date("Y-m-d", strtotime("+7 days"));
$messages_this_week = $wpdb->get_var(
"SELECT COUNT(*) FROM $messages_table
WHERE campaign_id IN ($campaign_ids_str)
AND (status = 'new' OR status = 'scheduled')
AND DATE(scheduled_for_timestamp) BETWEEN '$today' AND '$week_end'"
);
// Get total sent and failed messages
$total_sent = $wpdb->get_var(
"SELECT COUNT(*) FROM $messages_table
WHERE campaign_id IN ($campaign_ids_str)
AND status = 'sent'"
);
$total_failed = $wpdb->get_var(
"SELECT COUNT(*) FROM $messages_table
WHERE campaign_id IN ($campaign_ids_str)
AND status = 'failed'"
);
}
// Calculate delivery rate
$delivery_rate = 0;
if (($total_sent + $total_failed) > 0) {
$delivery_rate = round(($total_sent / ($total_sent + $total_failed)) * 100, 1);
}
if ( ($cloudflare_email || $cloudflare_key) ) {
$onboard_steps[0] = true;
@ -176,9 +242,13 @@ get_header(); ?>
<div class="dash-card header-card"><h3>Campaigns</h3><span class="card_data"><?php echo $campaign_count; ?></span></div>
<div class="dash-card header-card"><h3>Email Accounts</h3><span class="card_data"><?php echo $email_account_count; ?></span></div>
<div class="dash-card header-card"><h3>Domains</h3><span class="card_data"><?php echo $domain_count; ?></span></div>
<div class="dash-card header-card"><h3>Messages Scheduled</h3><span class="card_data"><?php ///echo ; ?></span></div>
<div class="dash-card header-card"><h3>Delivery Rate</h3><span class="card_data"><?php ///echo ; ?></span></div>
<div class="dash-card header-card"><h3>Delivery Errors</h3><span class="card_data"><?php ///echo ; ?></span></div>
<div class="dash-card header-card"><h3>Messages Scheduled</h3>
<span class="card_data">
<span><span>Today: <?php echo esc_html($messages_today); ?><br>This Week: <?php echo esc_html($messages_this_week); ?></span></span>
</span></div>
<div class="dash-card header-card"><h3>Delivery Rate</h3><span class="card_data"><?php echo esc_html($delivery_rate); ?>%</span></div>
<div class="dash-card header-card"><h3>Message Status</h3><span class="card_data">Sent: <?php echo esc_html($total_sent); ?><br>Failed: <?php echo esc_html($total_failed); ?></span></div>
<!-- <div class="dash-card header-card"></div>
<div class="dash-card header-card"></div> -->
</div>
@ -186,7 +256,7 @@ get_header(); ?>
<div class="dash-card">
<?php
if ( ($onboard_steps[0] = false || $onboard_steps[1] = false || $onboard_steps[2] = false || $onboard_steps[3] = false) ) :
if ( ($onboard_steps[0] = false || $onboard_steps[1] = false || $onboard_steps[2] = false || $onboard_steps[3] = false)) :
?>
<h2>Get Started:</h2>

View file

@ -123,7 +123,7 @@ get_header(); ?>
$list = new PostTypeList('domain', [
'title' => 'My Domains',
'no_items' => 'You haven\'t added any domains yet.',
'no_items' => '<a href="/dashboard/domains/edit-domain/" class="underlined_link">You haven\'t added any domains yet. Click here to create a domain</a>',
'delete_confirm' => 'Are you sure you want to delete this domain? This action cannot be undone.'
]);
$list->render();

View file

@ -43,7 +43,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['campaign_submit'])) {
$message = ['status' => 'success', 'message' => 'Campaign updated successfully.'];
$campaign_tracking_id = get_post_meta($post_id, 'campaign_tracking_id', true);
// log_to_file("Campaign Edit template - Campaign Tracking ID: $campaign_tracking_id");
if ($campaign_tracking_id == '') {
if (!$campaign_tracking_id) {
RL_MailWarmer_Campaign_Helper::generate_campaign_tracking_id($post_id);
}
} else {
@ -132,9 +132,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['campaign_submit'])) {
// Calculate a timeline
if ($new_post || $calculate_timeline) {
// log_to_file("Campaign Edit template - Recalculating timeline");
RL_MailWarmer_DB_Helper::delete_all_conversations_messages($post_id);
RL_MailWarmer_Campaign_Helper::calculate_campaign_timeline($post_id);
RL_MailWarmer_Campaign_Helper::fill_campaign_timeline($post_id);
// RL_MailWarmer_Campaign_Helper::fill_campaign_timeline($post_id);
// log_to_file("Campaign Edit template - Campaign timeline: ", $campaign_timeline);
}
@ -222,7 +223,7 @@ if ($post_id > 0) {
}
}
log_to_file("Campaign Edit template - Campaign data: ", $campaign_data);
// log_to_file("Campaign Edit template - Campaign data: ", $campaign_data);
// Get domains for current user
$domains = get_posts([
@ -376,7 +377,7 @@ get_header(); ?>
<td>
<input type="number" id="warmup_period" name="warmup_period"
value="<?php echo esc_attr($campaign_data['warmup_period']); ?>"
class="small-text" min="2" max="52" placeholder="8" required>
class="small-text" min="1" max="52" placeholder="8" required>
</td>
</tr>
<tr>
@ -392,7 +393,7 @@ get_header(); ?>
<td>
<input type="number" id="target_volume" name="target_volume"
value="<?php echo esc_attr($campaign_data['target_volume']); ?>"
class="small-text" min="10" max="1000" placeholder="50" required>
class="small-text" min="5" max="1000" placeholder="50" required>
</td>
</tr>
<tr>

View file

@ -123,7 +123,7 @@ get_header(); ?>
$list = new PostTypeList('email-account', [
'title' => 'Email Accounts',
'no_items' => 'You haven\'t added any email accounts yet.',
'no_items' => '<a href="/dashboard/email-accounts/edit-email-account/" class="underlined_link">You haven\'t added any email accounts yet. Click here to create a email-account</a>',
'delete_confirm' => 'Are you sure you want to delete this email-account? This action cannot be undone.'
]);
$list->render();

View file

@ -1,4 +1,4 @@
<?php
<?php
/**
* The Template for displaying all single campaign posts.
*
@ -98,8 +98,173 @@ get_header(); ?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php
$post = get_post();
$post_id = get_the_ID();
rl_mailwarmer_display_campaign_timeline($post);
the_content();
// Get campaign stats
global $wpdb;
$messages_table = $wpdb->prefix . 'rl_mailwarmer_messages';
$conversations_table = $wpdb->prefix . 'rl_mailwarmer_conversations';
// Total stats
$total_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE campaign_id = %d",
$post_id
));
$sent_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE campaign_id = %d AND status = 'sent'",
$post_id
));
$failed_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE campaign_id = %d AND status = 'failed'",
$post_id
));
$pending_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE campaign_id = %d AND status = 'new'",
$post_id
));
$total_conversations = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $conversations_table WHERE campaign_id = %d",
$post_id
));
// Email accounts used in this campaign
$email_accounts = $wpdb->get_results($wpdb->prepare(
"SELECT DISTINCT email_account_id FROM $conversations_table WHERE campaign_id = %d",
$post_id
));
// Upcoming messages (next 7 days)
$today = current_time('Y-m-d');
$next_week = date('Y-m-d', strtotime('+7 days'));
$upcoming_messages = $wpdb->get_results($wpdb->prepare(
// "SELECT COUNT(*)
"SELECT id, scheduled_for_timestamp, from_email, to_email, subject
FROM $messages_table
WHERE campaign_id = %d
AND (status = 'new' OR status = 'scheduled')
AND scheduled_for_timestamp BETWEEN %s AND %s
ORDER BY scheduled_for_timestamp ASC
LIMIT 20",
$post_id, $today, $next_week
));
// Recently sent messages
$sent_message_list = $wpdb->get_results($wpdb->prepare(
"SELECT id, scheduled_for_timestamp, from_email, to_email, subject, status
FROM $messages_table
WHERE campaign_id = %d
AND (status = 'sent' OR status = 'failed')
ORDER BY scheduled_for_timestamp DESC
LIMIT 20",
$post_id
));
?>
<div class="campaign-stats">
<h3>Campaign Stats</h3>
<table class="wp-list-table widefat fixed striped">
<tr>
<th>Total Messages</th>
<td><?php echo esc_html($total_messages); ?></td>
</tr>
<tr>
<th>Sent Messages</th>
<td><?php echo esc_html($sent_messages); ?></td>
</tr>
<tr>
<th>Failed Messages</th>
<td><?php echo esc_html($failed_messages); ?></td>
</tr>
<tr>
<th>Pending Messages</th>
<td><?php echo esc_html($pending_messages); ?></td>
</tr>
<tr>
<th>Total Conversations</th>
<td><?php echo esc_html($total_conversations); ?></td>
</tr>
</table>
<h3>Email Accounts</h3>
<?php if (empty($email_accounts)) : ?>
<p>No email accounts associated with this campaign.</p>
<?php else : ?>
<ul>
<?php foreach ($email_accounts as $account) :
$email = get_the_title($account->email_account_id);
if (!empty($email)) :
?>
<li><?php echo esc_html($email); ?></li>
<?php endif; endforeach; ?>
</ul>
<?php endif; ?>
<h3>Upcoming Messages (Next 7 Days)</h3>
<?php if (empty($upcoming_messages)) : ?>
<p>No upcoming messages scheduled for the next 7 days.</p>
<?php else : ?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th>Scheduled For</th>
<th>From</th>
<th>To</th>
<th>Subject</th>
</tr>
</thead>
<tbody>
<?php foreach ($upcoming_messages as $message) : ?>
<?php
log_to_file("Message: ", $message);
?>
<tr>
<td><?php echo $message->scheduled_for_timestamp ? esc_html(date('Y-m-d H:i', strtotime($message->scheduled_for_timestamp))) : ''; ?></td>
<td><?php echo $message->from_email ? esc_html($message->from_email) : '[Not Set Yet]'; ?></td>
<td><?php echo $message->to_email ? esc_html($message->to_email) : '[Not Set Yet]'; ?></td>
<td><?php echo $message->subject ? esc_html($message->subject) : '[Not Set Yet]'; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<h3>Recent Messages</h3>
<?php if (empty($sent_message_list)) : ?>
<p>No messages have been sent yet.</p>
<?php else : ?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th>Sent At</th>
<th>From</th>
<th>To</th>
<th>Subject</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($sent_message_list as $message) : ?>
<tr>
<td><?php echo esc_html(date('Y-m-d H:i', strtotime($message->scheduled_for_timestamp))); ?></td>
<td><?php echo esc_html($message->from_email); ?></td>
<td><?php echo esc_html($message->to_email); ?></td>
<td><?php echo esc_html($message->subject); ?></td>
<td><?php echo esc_html(ucfirst($message->status)); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<?php the_content();
wp_link_pages(
array(
@ -155,4 +320,4 @@ get_header(); ?>
generate_construct_sidebars();
get_footer();
get_footer();

View file

@ -93,12 +93,15 @@ get_header(); ?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<div id="domain-tabs">
<ul>
<li><a href="#info_tab">Info</a></li>
<!-- <li><a href="#account_tab">Email Accounts</a></li>
<li><a href="#campaign_tab">Campaigns</a></li> -->
<li><a href="#report_tab">Health Report</a></li>
<li><a href="#account_tab">Email Accounts</a></li>
<li><a href="#campaign_tab">Campaigns</a></li>
<li><a href="#info_tab">Info</a></li>
<li><a href="#tools_tab">Tools</a></li>
</ul>
<div id="report_tab">
<?php rl_mailwarmer_render_domain_metadata_table($post); ?>
</div>
<div id="info_tab">
<table class="credentials-table">
<tr>
@ -115,14 +118,131 @@ get_header(); ?>
</tr>
</table>
</div>
<!-- <div id="account_tab">
<div id="account_tab">
<?php
// Get email accounts for this domain
$email_accounts = get_posts([
'post_type' => 'email-account',
'posts_per_page' => -1,
'meta_query' => [
[
'key' => 'domain',
'value' => $post_id,
'compare' => '='
]
]
]);
if (!empty($email_accounts)) {
echo '<h3>Email Accounts (' . count($email_accounts) . ')</h3>';
echo '<table class="wp-list-table widefat fixed striped">';
echo '<thead><tr>';
echo '<th>Email Address</th>';
echo '<th>Full Name</th>';
echo '<th>SMTP Status</th>';
echo '<th>IMAP Status</th>';
echo '<th>Actions</th>';
echo '</tr></thead>';
echo '<tbody>';
foreach ($email_accounts as $account) {
$full_name = get_post_meta($account->ID, 'full_name', true);
$smtp_status = get_post_meta($account->ID, 'smtp_status', true);
$imap_status = get_post_meta($account->ID, 'imap_status', true);
echo '<tr>';
echo '<td>' . esc_html($account->post_title) . '</td>';
echo '<td>' . esc_html($full_name) . '</td>';
echo '<td>' . esc_html($smtp_status) . '</td>';
echo '<td>' . esc_html($imap_status) . '</td>';
echo '<td>';
echo '<a href="' . esc_url(get_permalink($account->ID)) . '" class="button button-small">View</a> ';
echo '<a href="/dashboard/email-accounts/edit-email-account?edit=' . esc_attr($account->ID) . '" class="button button-small">Edit</a>';
echo '</td>';
echo '</tr>';
}
echo '</tbody></table>';
} else {
echo '<p>No email accounts found for this domain.</p>';
}
echo '<p><a href="/dashboard/email-accounts/edit-email-account?domain=' . esc_attr($post_id) . '" class="button button-primary">Create New Email Account</a></p>';
?>
</div>
<div id="campaign_tab">
</div> -->
<div id="report_tab">
<?php rl_mailwarmer_render_domain_metadata_table($post); ?>
<?php
// Get campaigns that use this domain's email accounts
global $wpdb;
$conversations_table = $wpdb->prefix . 'rl_mailwarmer_conversations';
// First, get all email accounts for this domain
$email_account_ids = array();
if (!empty($email_accounts)) {
foreach ($email_accounts as $account) {
$email_account_ids[] = $account->ID;
}
}
if (!empty($email_account_ids)) {
// Convert to a comma-separated string for SQL
$email_account_ids_str = implode(',', $email_account_ids);
// Find campaign IDs that use these email accounts
$campaign_ids = $wpdb->get_col("
SELECT DISTINCT campaign_id
FROM $conversations_table
WHERE email_account_id IN ($email_account_ids_str)
");
if (!empty($campaign_ids)) {
// Get campaign details
$campaigns = get_posts([
'post_type' => 'campaign',
'posts_per_page' => -1,
'post__in' => $campaign_ids
]);
if (!empty($campaigns)) {
echo '<h3>Campaigns (' . count($campaigns) . ')</h3>';
echo '<table class="wp-list-table widefat fixed striped">';
echo '<thead><tr>';
echo '<th>Campaign Name</th>';
echo '<th>Tracking ID</th>';
echo '<th>Start Date</th>';
echo '<th>Target Volume</th>';
echo '<th>Actions</th>';
echo '</tr></thead>';
echo '<tbody>';
foreach ($campaigns as $campaign) {
$tracking_id = get_post_meta($campaign->ID, 'campaign_tracking_id', true);
$start_date = get_post_meta($campaign->ID, 'start_date', true);
$target_volume = get_post_meta($campaign->ID, 'target_volume', true);
echo '<tr>';
echo '<td>' . esc_html($campaign->post_title) . '</td>';
echo '<td>' . esc_html($tracking_id) . '</td>';
echo '<td>' . esc_html($start_date) . '</td>';
echo '<td>' . esc_html($target_volume) . '</td>';
echo '<td>';
echo '<a href="' . esc_url(get_permalink($campaign->ID)) . '" class="button button-small">View</a> ';
echo '<a href="/dashboard/campaigns/edit-campaign?edit=' . esc_attr($campaign->ID) . '" class="button button-small">Edit</a>';
echo '</td>';
echo '</tr>';
}
echo '</tbody></table>';
}
} else {
echo '<p>No campaigns found that use email accounts from this domain.</p>';
}
} else {
echo '<p>No campaigns found since there are no email accounts for this domain.</p>';
}
echo '<p><a href="/dashboard/campaigns/edit-campaign" class="button button-primary">Create New Campaign</a></p>';
?>
</div>
<div id="tools_tab">
<div>
@ -137,7 +257,7 @@ get_header(); ?>
</div>
</div>
<?php
// the_content();
the_content();
// wp_link_pages(
// array(
@ -231,4 +351,4 @@ get_header(); ?>
generate_construct_sidebars();
get_footer();
get_footer();

View file

@ -25,6 +25,72 @@ get_header(); ?>
while ( have_posts() ) :
the_post();
$post_id = get_the_ID();
$domain_id = get_post_meta($post_id, 'domain', true);
$domain_post = get_post($domain_id);
$full_name = get_post_meta($post_id, 'full_name', true);
$email_signature = get_post_meta($post_id, 'email_signature', true);
$smtp_status = get_post_meta($post_id, 'smtp_status', true);
$imap_status = get_post_meta($post_id, 'imap_status', true);
// Get email messages for this account
global $wpdb;
$messages_table = $wpdb->prefix . 'rl_mailwarmer_messages';
// Count total messages
$total_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d",
$post_id
));
// Count sent messages
$sent_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d AND status = 'sent'",
$post_id
));
// Count failed messages
$failed_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d AND status = 'failed'",
$post_id
));
// Count pending messages
$pending_messages = $wpdb->get_var($wpdb->prepare(
"SELECT COUNT(*) FROM $messages_table WHERE email_account_id = %d AND (status = 'new' OR status = 'scheduled')",
$post_id
));
// Calculate delivery rate
$delivery_rate = 0;
if (($sent_messages + $failed_messages) > 0) {
$delivery_rate = round(($sent_messages / ($sent_messages + $failed_messages)) * 100, 1);
}
// Get upcoming messages (next 7 days)
$today = current_time('Y-m-d');
$next_week = date('Y-m-d', strtotime('+7 days'));
$upcoming_messages = $wpdb->get_results($wpdb->prepare(
"SELECT id, scheduled_for_timestamp, from_email, to_email, subject
FROM $messages_table
WHERE email_account_id = %d
AND (status = 'new' OR status = 'scheduled')
AND scheduled_for_timestamp BETWEEN %s AND %s
ORDER BY scheduled_for_timestamp ASC
LIMIT 20",
$post_id, $today, $next_week
));
// Recently sent or failed messages
$recent_messages = $wpdb->get_results($wpdb->prepare(
"SELECT id, scheduled_for_timestamp, from_email, to_email, subject, status
FROM $messages_table
WHERE email_account_id = %d
AND (status = 'sent' OR status = 'failed')
ORDER BY scheduled_for_timestamp DESC
LIMIT 20",
$post_id
));
?>
@ -53,8 +119,13 @@ get_header(); ?>
if ( generate_show_title() ) {
$params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] );
$edit_url = "/dashboard/email-accounts/edit-email-account?edit={$post_id}";
echo $params['before']; // Output the title before markup
echo '<a href="' . esc_url( $edit_url ) . '">'; // Begin the link
the_title(); // Display the title
echo '</a>'; // Close the link
echo $params['after']; // Output the title after markup
}
/**
@ -87,7 +158,153 @@ get_header(); ?>
?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
Hi, Bob.
<div id="email-account-tabs">
<ul>
<li><a href="#info_tab">Account Info</a></li>
<li><a href="#stats_tab">Stats</a></li>
<li><a href="#upcoming_tab">Upcoming Messages</a></li>
<li><a href="#recent_tab">Recent Messages</a></li>
<li><a href="#tools_tab">Tools</a></li>
</ul>
<div id="info_tab">
<h3>Account Information</h3>
<table class="wp-list-table widefat fixed striped">
<tr>
<th>Email Address</th>
<td><?php echo esc_html(get_the_title()); ?></td>
</tr>
<tr>
<th>Full Name</th>
<td><?php echo esc_html($full_name); ?></td>
</tr>
<tr>
<th>Domain</th>
<td>
<?php if ($domain_post) : ?>
<a href="<?php echo esc_url(get_permalink($domain_post->ID)); ?>">
<?php echo esc_html($domain_post->post_title); ?>
</a>
<?php else : ?>
Not set
<?php endif; ?>
</td>
</tr>
<tr>
<th>SMTP Status</th>
<td><?php echo esc_html($smtp_status); ?></td>
</tr>
<tr>
<th>IMAP Status</th>
<td><?php echo esc_html($imap_status); ?></td>
</tr>
</table>
<?php if (!empty($email_signature)) : ?>
<h3>Email Signature</h3>
<div class="email-signature-preview">
<?php echo wp_kses_post($email_signature); ?>
</div>
<?php endif; ?>
</div>
<div id="stats_tab">
<h3>Email Delivery Statistics</h3>
<table class="wp-list-table widefat fixed striped">
<tr>
<th>Total Messages</th>
<td><?php echo esc_html($total_messages); ?></td>
</tr>
<tr>
<th>Sent Successfully</th>
<td><?php echo esc_html($sent_messages); ?></td>
</tr>
<tr>
<th>Pending Messages</th>
<td><?php echo esc_html($pending_messages); ?></td>
</tr>
<tr>
<th>Failed Messages</th>
<td><?php echo esc_html($failed_messages); ?></td>
</tr>
<tr>
<th>Delivery Rate</th>
<td><?php echo esc_html($delivery_rate); ?>%</td>
</tr>
</table>
</div>
<div id="upcoming_tab">
<h3>Upcoming Messages (Next 7 Days)</h3>
<?php if (empty($upcoming_messages)) : ?>
<p>No upcoming messages scheduled for the next 7 days.</p>
<?php else : ?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th>Scheduled For</th>
<th>From</th>
<th>To</th>
<th>Subject</th>
</tr>
</thead>
<tbody>
<?php foreach ($upcoming_messages as $message) : ?>
<tr>
<td><?php echo $message->scheduled_for_timestamp ? esc_html(date('Y-m-d H:i', strtotime($message->scheduled_for_timestamp))) : ''; ?></td>
<td><?php echo $message->from_email ? esc_html($message->from_email) : '[Not Set Yet]'; ?></td>
<td><?php echo $message->to_email ? esc_html($message->to_email) : '[Not Set Yet]'; ?></td>
<td><?php echo $message->subject ? esc_html($message->subject) : '[Not Set Yet]'; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<div id="recent_tab">
<h3>Recent Messages</h3>
<?php if (empty($recent_messages)) : ?>
<p>No messages have been sent or failed yet.</p>
<?php else : ?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th>Date</th>
<th>From</th>
<th>To</th>
<th>Subject</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_messages as $message) : ?>
<tr>
<td><?php echo esc_html(date('Y-m-d H:i', strtotime($message->scheduled_for_timestamp))); ?></td>
<td><?php echo esc_html($message->from_email); ?></td>
<td><?php echo esc_html($message->to_email); ?></td>
<td><?php echo esc_html($message->subject); ?></td>
<td class="status-<?php echo esc_attr(strtolower($message->status)); ?>">
<?php echo esc_html(ucfirst($message->status)); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<div id="tools_tab">
<div>
<?php //rl_mailwarmer_check_domain_health_box_callback($post); ?>
</div>
<div>
<?php //rl_mailwarmer_render_fix_deliverability_dns_issues_box($post); ?>
</div>
<div>
</div>
</div>
</div>
<?php
the_content();
@ -134,6 +351,27 @@ get_header(); ?>
?>
</main>
</div>
<script>
jQuery(document).ready(function($) {
// Initialize tabs
$('#email-account-tabs').tabs();
// Add color coding for status
$('.status-sent').css('color', 'green');
$('.status-failed').css('color', 'red');
$('.status-pending').css('color', 'orange');
});
</script>
<style>
.email-signature-preview {
border: 1px solid #ddd;
padding: 15px;
background-color: #f9f9f9;
margin-bottom: 20px;
}
</style>
<?php
/**
@ -145,4 +383,4 @@ get_header(); ?>
generate_construct_sidebars();
get_footer();
get_footer();