Add All time to the Time filter, PlanB Assignment (#6514)

* Add All time to the Time filter, wip: Clear All funtionality

* Update ListInvoices.cshtml

* Cleanup commented code

* Toggle on 'All Time' if there no startdate selected

---------

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
Jessica Zavaleta
2024-12-23 03:27:49 -06:00
committed by GitHub
parent 76a880a30e
commit 79c5ff9ed0
2 changed files with 9 additions and 0 deletions

View File

@@ -127,6 +127,8 @@ namespace BTCPayServer
return DateTimeOffset.UtcNow.AddDays(-3).AddMinutes(timezoneOffset);
case "-7d":
return DateTimeOffset.UtcNow.AddDays(-7).AddMinutes(timezoneOffset);
case "alltime":
return null; // No filtering by date, so return null
}
// default parsing logic
@@ -155,5 +157,6 @@ namespace BTCPayServer
var value = str.Trim().TrimStart(FilterSeparator).TrimEnd(FilterSeparator);
return string.IsNullOrEmpty(value) ? " " : value;
}
}
}

View File

@@ -250,6 +250,11 @@
{
<span text-translate="true">7 Days</span>
}
else if (HasArrayFilter("startdate", "alltime"))
{
<span text-translate="true">All Time</span>
}
else
{
<span text-translate="true">Custom</span>
@@ -264,6 +269,7 @@
<a asp-action="ListInvoices" asp-route-storeId="@Model.StoreId" asp-route-count="@Model.Count" asp-route-searchTerm="@Model.Search.Toggle("startdate", "-1d")" class="dropdown-item @(HasArrayFilter("startdate", "-1d") ? "custom-active" : "")" text-translate="true">Last 24 hours</a>
<a asp-action="ListInvoices" asp-route-storeId="@Model.StoreId" asp-route-count="@Model.Count" asp-route-searchTerm="@Model.Search.Toggle("startdate", "-3d")" class="dropdown-item @(HasArrayFilter("startdate", "-3d") ? "custom-active" : "")" text-translate="true">Last 3 days</a>
<a asp-action="ListInvoices" asp-route-storeId="@Model.StoreId" asp-route-count="@Model.Count" asp-route-searchTerm="@Model.Search.Toggle("startdate", "-7d")" class="dropdown-item @(HasArrayFilter("startdate", "-7d") ? "custom-active" : "")" text-translate="true">Last 7 days</a>
<a asp-action="ListInvoices" asp-route-storeId="@Model.StoreId" asp-route-count="@Model.Count" asp-route-searchTerm="@Model.Search.Toggle("startdate", "alltime")" class="dropdown-item @(HasArrayFilter("startdate", "alltime") || !Model.Search.ContainsFilter("startdate") ? "custom-active" : "")" text-translate="true">All Time</a>
<button type="button" class="dropdown-item @(HasCustomDateFilter() ? "custom-active" : "")" data-bs-toggle="modal" data-bs-target="#customRangeModal" text-translate="true">Custom Range</button>
</div>
</div>