Skip to content

Commit

Permalink
Worked on #476.
Browse files Browse the repository at this point in the history
  • Loading branch information
uncheckederror committed Nov 5, 2024
1 parent f194257 commit 5069ea4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task<IActionResult> NumberOrders(Guid? orderId, string dialedNumber
{
var order = await context.PurchasedPhoneNumbers.AsNoTracking().FirstOrDefaultAsync(x => x.DialedNumber == dialedNumber);

return View("NumberOrders", new PurchasedResult { PurchasedPhoneNumber = order ?? new(), Owned = owned });
return View("NumberOrders", new PurchasedResult { PurchasedPhoneNumber = order ?? new(), PurchasedPhoneNumbers = [order ?? new()], Owned = owned });
}
}

Expand Down
63 changes: 29 additions & 34 deletions NumberSearch.Ops/Views/PurchasedPhoneNumbers/NumberOrders.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@
ViewData["Title"] = "Purchased Numbers";
}
<h1 class="display-4 p-3">🧾 Purchased Numbers</h1>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="table">
<thead>
<tr>
<th>Status</th>
<th>Date Ordered</th>
<th>Provider</th>
<th>Number</th>
<th>Raw Response</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@{
if (Model is not null && Model?.PurchasedPhoneNumbers is not null && Model?.PurchasedPhoneNumbers?.Length != 0)
{
foreach (var order in Model.PurchasedPhoneNumbers.Where(x => x?.IngestedFrom != "Test"))
@if (Model is not null && Model.PurchasedPhoneNumbers.Length != 0)
{
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="table">
<thead>
<tr>
<th>Status</th>
<th>Date Ordered</th>
<th>Provider</th>
<th>Number</th>
<th>Raw Response</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach (var order in Model.PurchasedPhoneNumbers.Where(x => x?.IngestedFrom != "Test"))
{
var ingestedBadge = order?.IngestedFrom;
switch (order?.IngestedFrom)
Expand Down Expand Up @@ -66,21 +65,17 @@
</td>
</tr>
}
}
else
{
<tr>
<td colspan="4" class="alert-danger">No purchased phone numbers found. ❓</td>
</tr>
}
}
</tbody>
</table>
</div>
<div class="row">
<div class="col">
<a>
<a asp-controller="Home" asp-action="ExportNumberOrders" target="_blank" class="btn btn-primary">Export as CSV</a>
</a>
</tbody>
</table>
</div>
</div>
} else
{
<p>No purchased numbers found. ❓</p>
}
<div class="row">
<div class="col">
<a>
<a asp-controller="Home" asp-action="ExportNumberOrders" target="_blank" class="btn btn-primary">Export as CSV</a>
</a>
</div>
</div>

0 comments on commit 5069ea4

Please sign in to comment.