315 lines
9.8 KiB
Text
315 lines
9.8 KiB
Text
@model IEnumerable<Model.SentNewsletterEamil>
|
|
|
|
@{
|
|
ViewData["Title"] = "EmailStats";
|
|
|
|
}
|
|
|
|
<style>
|
|
.badge-Sent{
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #6831c5;
|
|
;
|
|
}
|
|
|
|
.badge-Deliverd{
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #44aebd;
|
|
}
|
|
|
|
.badge-Opend {
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #22a877;
|
|
}
|
|
|
|
.badge-Clicked {
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #3b76cb;
|
|
}
|
|
|
|
.badge-Bounced {
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #9585f4;
|
|
}
|
|
|
|
.badge-Spam {
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #f06b66;
|
|
}
|
|
|
|
.badge-Blocked {
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #98712d;
|
|
}
|
|
|
|
.badge-Unsubscribed {
|
|
display: inline-block;
|
|
padding: 0.25em 0.4em;
|
|
font-size: 75%;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: baseline;
|
|
border-radius: 0.25rem;
|
|
color: #fff;
|
|
background-color: #cb4a49;
|
|
}
|
|
</style>
|
|
<div class="container-fluid mt-4 mb-5">
|
|
<div class="col-10 offset-1">
|
|
<p>
|
|
<a asp-action="Index" class="btn btn-primary btn-sm">Back to list</a>
|
|
</p>
|
|
<h3 class="text-primary p-3">Real-Time Email Event</h3>
|
|
|
|
<table class="table table-responsive w-100 d-block d-md-table table-bordered table-hover shadow-lg rounded-2">
|
|
<thead>
|
|
<tr>
|
|
<th>Recipient</th>
|
|
<th>Activity Date</th>
|
|
<th>Subject</th>
|
|
<th>Sent</th>
|
|
<th>Delivered</th>
|
|
<th>Opened</th>
|
|
<th>Clicked</th>
|
|
<th>Bounced</th>
|
|
<th>Spam</th>
|
|
<th>Blocked</th>
|
|
<th>Unsubscribed</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in Model)
|
|
{
|
|
<tr>
|
|
<td>@item.RecipientEmail</td>
|
|
<td>@item.ReceivedActivity</td>
|
|
<td>@item.Subject</td>
|
|
<td>
|
|
@if (item.IsSent)
|
|
{
|
|
<span class="badge-Sent">Sent</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Pending</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (item.IsDelivered)
|
|
{
|
|
<span class="badge-Deliverd">Delivered</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Pending</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (item.IsOpened)
|
|
{
|
|
<span class="badge-Opend">Opened</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Pending</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (item.IsClicked)
|
|
{
|
|
<span class="badge-Clicked">Clicked</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Pending</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (item.IsBounced)
|
|
{
|
|
<span class="badge-Bounced">Bounced</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Normal</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (item.IsSpam)
|
|
{
|
|
<span class="badge-Spam">Spam</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Normal</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (item.IsBlocked)
|
|
{
|
|
<span class="badge-Blocked">Blocked</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Normal</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (item.IsUnsubscribed)
|
|
{
|
|
<span class="badge-Unsubscribed">Unsubscribed</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge badge-secondary">Normal</span>
|
|
}
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="card shadow-lg rounded-2 p-3">
|
|
<div class="row p-3">
|
|
|
|
<div class="col-5 m-2">
|
|
<div id="chart_div_percentage" style="width: 500px; height: 300px;"></div>
|
|
</div>
|
|
<div class="col-5 m-2">
|
|
<div id="chart_div_labels" style="width: 500px; height: 300px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
|
<script type="text/javascript">
|
|
google.charts.load('current', { 'packages': ['corechart'] });
|
|
google.charts.setOnLoadCallback(drawCharts);
|
|
|
|
function drawCharts() {
|
|
var data = new google.visualization.DataTable();
|
|
data.addColumn('string', 'Status');
|
|
data.addColumn('number', 'Count');
|
|
data.addRows([
|
|
['Sent', @Model.Count(e => e.IsSent)],
|
|
['Delivered', @Model.Count(e => e.IsDelivered)],
|
|
['Opened', @Model.Count(e => e.IsOpened)],
|
|
['Clicked', @Model.Count(e => e.IsClicked)],
|
|
['Bounced', @Model.Count(e => e.IsBounced)],
|
|
['Spam', @Model.Count(e => e.IsSpam)],
|
|
['Blocked', @Model.Count(e => e.IsBlocked)],
|
|
['Unsubscribed', @Model.Count(e => e.IsUnsubscribed)]
|
|
]);
|
|
|
|
// Chart options for showing percentages
|
|
var optionsPercentage = {
|
|
title: 'Email Interactions (Percentage)',
|
|
width: 500,
|
|
height: 300,
|
|
is3D: true,
|
|
pieSliceText: 'percentage',
|
|
titleTextStyle: { color: '#3b76cb', fontSize: 12, bold: true }
|
|
};
|
|
|
|
// Chart options for showing labels
|
|
var optionsLabels = {
|
|
title: 'Email Interactions (Labels)',
|
|
width: 500,
|
|
height: 300,
|
|
is3D: true,
|
|
pieSliceText: 'label',
|
|
titleTextStyle: { color: '#3b76cb', fontSize: 12, bold: true }
|
|
};
|
|
|
|
// Draw the first chart
|
|
var chartPercentage = new google.visualization.PieChart(document.getElementById('chart_div_percentage'));
|
|
chartPercentage.draw(data, optionsPercentage);
|
|
|
|
// Draw the second chart
|
|
var chartLabels = new google.visualization.PieChart(document.getElementById('chart_div_labels'));
|
|
chartLabels.draw(data, optionsLabels);
|
|
}
|
|
</script>
|
|
}
|
|
|