Skip to content

Commit

Permalink
Simple Invoice Detail View Cleanup (#3100)
Browse files Browse the repository at this point in the history
* changes copy to "unarchive", more clear

* adds semibold custom class

* adds class to TH elements & uppercases labels

* whitespace and padding patches

* uppercase patches

* removes class in site.css + updates class name

* Fix test

Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
  • Loading branch information
dstrukt and dennisreimann committed Nov 22, 2021
1 parent 6ff659f commit ead0f28
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 71 deletions.
4 changes: 2 additions & 2 deletions BTCPayServer.Tests/SeleniumTests.cs
Expand Up @@ -411,7 +411,7 @@ public async Task CanCreateStores()
//let's test archiving an invoice
Assert.DoesNotContain("Archived", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
s.Driver.FindElement(By.Id("btn-archive-toggle")).Click();
Assert.Contains("Archived", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
Assert.Contains("Unarchive", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
//check that it no longer appears in list
s.GoToInvoices();

Expand All @@ -420,7 +420,7 @@ public async Task CanCreateStores()
s.Driver.Navigate().GoToUrl(invoiceUrl);
s.Driver.FindElement(By.Id("btn-archive-toggle")).Click();
s.FindAlertMessage();
Assert.DoesNotContain("Archived", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
Assert.DoesNotContain("Unarchive", s.Driver.FindElement(By.Id("btn-archive-toggle")).Text);
s.GoToInvoices();
Assert.Contains(invoiceId, s.Driver.PageSource);

Expand Down
136 changes: 67 additions & 69 deletions BTCPayServer/Views/Invoice/Invoice.cshtml
Expand Up @@ -46,8 +46,7 @@
<section class="invoice-details">
<div class="container">
<partial name="_StatusMessage" />

<div class="row mb-4">
<div class="row mb-5">
<h2 class="col-xs-12 col-lg-6 mb-4 mb-lg-0">@ViewData["Title"]</h2>
<div class="col-xs-12 col-lg-6 mb-2 mb-lg-0 text-lg-end">
<div class="d-inline-flex">
Expand All @@ -58,45 +57,44 @@
Checkout
</a>
}

@if (Model.CanRefund)
{
<a id="refundlink" class="btn btn-success text-nowrap ms-2" asp-action="Refund" asp-route-invoiceId="@Context.GetRouteValue("invoiceId")"><span class="fa fa-undo"></span> Issue refund</a>
<a id="refundlink" class="btn btn-success text-nowrap" asp-action="Refund" asp-route-invoiceId="@Context.GetRouteValue("invoiceId")"><span class="fa fa-undo"></span> Issue Refund</a>
}
else
{
<button href="#" class="btn btn-secondary text-nowrap ms-2" data-bs-toggle="tooltip" title="You can only issue refunds on invoices with confirmed payments" disabled><span class="fa fa-undo"></span> Issue refund</button>
<button href="#" class="btn btn-secondary text-nowrap" data-bs-toggle="tooltip" title="You can only issue refunds on invoices with confirmed payments" disabled><span class="fa fa-undo me-1"></span> Issue Refund</button>
}
<form class="p-0 ms-2" asp-action="ToggleArchive" asp-route-invoiceId="@Model.Id" method="post">
<form class="p-0 ms-3" asp-action="ToggleArchive" asp-route-invoiceId="@Model.Id" method="post">
<button type="submit" class="btn @(Model.Archived ? "btn-warning" : "btn btn-danger")" id="btn-archive-toggle">
@if (Model.Archived)
{
<span class="text-nowrap" data-bs-toggle="tooltip" title="Unarchive this invoice"><i class="ms-1 fa fa-close"></i> Archived</span>
<span class="text-nowrap" data-bs-toggle="tooltip" title="Unarchive this invoice">Unarchive</span>
}
else
{
<span class="text-nowrap" data-bs-toggle="tooltip" title="Archive this invoice so that it does not appear in the invoice list by default"><i class="ms-1 fa fa-archive"></i> Archive</span>
<span class="text-nowrap" data-bs-toggle="tooltip" title="Archive this invoice so that it does not appear in the invoice list by default"><i class="fa fa-archive me-1"></i> Archive</span>
}
</button>
</form>
</div>
</div>
</div>

<div class="row">
<div class="col-md-6 mb-4">
<div class="row justify-content-between">
<div class="col-md-5">
<h3 class="mb-3">Invoice Information</h3>
<table class="table table-responsive-md">
<table class="table table-responsive-md mb-5">
<tr>
<th>Store</th>
<th class="fw-semibold">Store</th>
<td><a href="@Model.StoreLink" rel="noreferrer noopener">@Model.StoreName</a></td>
</tr>
<tr>
<th>Invoice Id</th>
<th class="fw-semibold">Invoice Id</th>
<td>@Model.Id</td>
</tr>
<tr>
<th>Order Id</th>
<th class="fw-semibold">Order Id</th>
<td>
@if (string.IsNullOrEmpty(Model.TypedMetadata.OrderUrl))
{
Expand All @@ -118,11 +116,11 @@
</td>
</tr>
<tr>
<th>Payment Request Id</th>
<th class="fw-semibold">Payment Request Id</th>
<td><a href="@Model.PaymentRequestLink" rel="noreferrer noopener">@Model.TypedMetadata.PaymentRequestId</a></td>
</tr>
<tr>
<th>State</th>
<th class="fw-semibold">State</th>
<td>
@if (Model.CanMarkStatus)
{
Expand All @@ -145,132 +143,133 @@
}
</div>
</div>
}
else {
}
else
{
@Model.State
}
</td>
</tr>
<tr>
<th>Created date</th>
<th class="fw-semibold">Created Date</th>
<td>@Model.CreatedDate.ToBrowserDate()</td>
</tr>
<tr>
<th>Expiration date</th>
<th class="fw-semibold">Expiration Date</th>
<td>@Model.ExpirationDate.ToBrowserDate()</td>
</tr>
<tr>
<th>Monitoring date</th>
<th class="fw-semibold">Monitoring Date</th>
<td>@Model.MonitoringDate.ToBrowserDate()</td>
</tr>
<tr>
<th>Transaction speed</th>
<th class="fw-semibold">Transaction Speed</th>
<td>@Model.TransactionSpeed</td>
</tr>
<tr>
<th>Total fiat due</th>
<th class="fw-semibold">Total Fiat Due</th>
<td>@Model.Fiat</td>
</tr>
@if (!string.IsNullOrEmpty(Model.RefundEmail))
{
<tr>
<th>Refund email</th>
<th class="fw-semibold">Refund Email</th>
<td><a href="mailto:@Model.RefundEmail">@Model.RefundEmail</a></td>
</tr>
}
@if (!string.IsNullOrEmpty(Model.NotificationUrl))
{
<tr>
<th>Notification Url</th>
<th class="fw-semibold">Notification Url</th>
<td>@Model.NotificationUrl</td>
</tr>
}
@if (!string.IsNullOrEmpty(Model.RedirectUrl))
{
<tr>
<th>Redirect Url</th>
<th class="fw-semibold">Redirect Url</th>
<td><a href="@Model.RedirectUrl" rel="noreferrer noopener">@Model.RedirectUrl</a></td>
</tr>
}
</table>
@if (Model.PosData.Count == 0)
{
<h3 class="mb-3">Product Information</h3>
<table class="table table-responsive-md mb-5">
@if (!string.IsNullOrEmpty(Model.TypedMetadata.ItemCode))
{
<tr>
<th class="fw-semibold">Item code</th>
<td>@Model.TypedMetadata.ItemCode</td>
</tr>
}
@if (!string.IsNullOrEmpty(Model.TypedMetadata.ItemDesc))
{
<tr>
<th class="fw-semibold">Item Description</th>
<td>@Model.TypedMetadata.ItemDesc</td>
</tr>
}
<tr>
<th class="fw-semibold">Price</th>
<td>@Model.Fiat</td>
</tr>
<tr>
<th class="fw-semibold">Tax Included</th>
<td>@Model.TaxIncluded</td>
</tr>
</table>
}
</div>
<div class="col-md-6 mb-4">
<div class="col-md-5">
<h3 class="mb-3">Buyer Information</h3>
<table class="table table-responsive-md">
<table class="table table-responsive-md mb-5">
<tr>
<th>Name</th>
<th class="fw-semibold">Name</th>
<td>@Model.TypedMetadata.BuyerName</td>
</tr>
<tr>
<th>Email</th>
<th class="fw-semibold">Email</th>
<td><a href="mailto:@Model.TypedMetadata.BuyerEmail">@Model.TypedMetadata.BuyerEmail</a></td>
</tr>
<tr>
<th>Phone</th>
<th class="fw-semibold">Phone</th>
<td>@Model.TypedMetadata.BuyerPhone</td>
</tr>
<tr>
<th>Address 1</th>
<th class="fw-semibold">Address 1</th>
<td>@Model.TypedMetadata.BuyerAddress1</td>
</tr>
<tr>
<th>Address 2</th>
<th class="fw-semibold">Address 2</th>
<td>@Model.TypedMetadata.BuyerAddress2</td>
</tr>
<tr>
<th>City</th>
<th class="fw-semibold">City</th>
<td>@Model.TypedMetadata.BuyerCity</td>
</tr>
<tr>
<th>State</th>
<th class="fw-semibold">State</th>
<td>@Model.TypedMetadata.BuyerState</td>
</tr>
<tr>
<th>Country</th>
<th class="fw-semibold">Country</th>
<td>@Model.TypedMetadata.BuyerCountry</td>
</tr>
<tr>
<th>Zip</th>
<th class="fw-semibold">Zip</th>
<td>@Model.TypedMetadata.BuyerZip</td>
</tr>
</table>
@if (Model.PosData.Count == 0)
{
<h3 class="mb-3">Product Information</h3>
<table class="table table-responsive-md">
@if (!string.IsNullOrEmpty(Model.TypedMetadata.ItemCode))
{
<tr>
<th>Item code</th>
<td>@Model.TypedMetadata.ItemCode</td>
</tr>
}
@if (!string.IsNullOrEmpty(Model.TypedMetadata.ItemDesc))
{
<tr>
<th>Item Description</th>
<td>@Model.TypedMetadata.ItemDesc</td>
</tr>
}
<tr>
<th>Price</th>
<td>@Model.Fiat</td>
</tr>
<tr>
<th>Tax included</th>
<td>@Model.TaxIncluded</td>
</tr>
</table>
}
</div>
</div>

@if (Model.PosData.Count != 0)
{
<div class="row">
<div class="col-md-6 mb-4">
<div class="col-md-6">
<h3 class="mb-3">Product information</h3>
<table class="table table-responsive-md">
<table class="table table-responsive-md mb-5">
@if (!string.IsNullOrEmpty(Model.TypedMetadata.ItemCode))
{
<tr>
Expand Down Expand Up @@ -362,7 +361,6 @@
}
</ul>
}

<div class="row">
<div class="col-md-12">
<h3 class="mb-0">Events</h3>
Expand All @@ -386,4 +384,4 @@
</div>
</div>
</div>
</section>
</section>

0 comments on commit ead0f28

Please sign in to comment.