diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj b/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj index 2194f8b..2799aac 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj @@ -9,7 +9,7 @@ TicketTailor Allows you to integrate with TicketTailor.com to sell tickets for Bitcoin - 1.0.9 + 1.0.10 diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml index 3bc97eb..f732794 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml @@ -3,7 +3,6 @@ @using Microsoft.AspNetCore.Mvc.TagHelpers @model BTCPayServer.Plugins.TicketTailor.TicketTailorViewModel @{ - Layout = "_LayoutSimple"; var available = Model.Settings.BypassAvailabilityCheck || (Model.Event.Unavailable != "true" && Model.Event.TicketsAvailable == "true"); Model.Settings.SpecificTickets ??= new List(); @@ -26,7 +25,8 @@ footer { @@ -72,8 +73,8 @@ document.addEventListener("DOMContentLoaded", ()=>{
- + pattern="^(\w\w+)\s(\w+)$" title="Please enter your first and last name, separated with a space."> +
@@ -88,103 +89,108 @@ document.addEventListener("DOMContentLoaded", ()=>{ @{ var index = -1; - + var firstPurchaseable = true; + foreach (var groupedTickets in Model.Event.TicketTypes.GroupBy(type => type.GroupId).OrderBy(groupedTickets => Model.Event.TicketGroups.FirstOrDefault(ticketGroup => ticketGroup.Id == groupedTickets.Key)?.SortOrder)) {
- @if (!string.IsNullOrEmpty(groupedTickets.Key)) - { - var group = Model.Event.TicketGroups.First(ticketGroup => ticketGroup.Id == groupedTickets.Key); -

@group.Name

- } - @foreach (var item in groupedTickets) - { - var availableToShow = new[] {"on_sale", "sold_out", "unavailable"}.Contains(item.Status); - if (!string.IsNullOrEmpty(item.AccessCode) && item.AccessCode.Equals(accessCode, StringComparison.InvariantCultureIgnoreCase)) + @if (!string.IsNullOrEmpty(groupedTickets.Key)) { - availableToShow = true; + var group = Model.Event.TicketGroups.First(ticketGroup => ticketGroup.Id == groupedTickets.Key); +

@group.Name

} - var specific = false; - - if (Model.Settings.SpecificTickets?.Any() is true) + @foreach (var item in groupedTickets) { - var matched = Model.Settings.SpecificTickets.FirstOrDefault(ticket => ticket.TicketTypeId == item.Id); - if (matched is null || matched.Hidden) + var availableToShow = new[] {"on_sale", "sold_out", "unavailable"}.Contains(item.Status); + if (!string.IsNullOrEmpty(item.AccessCode) && item.AccessCode.Equals(accessCode, StringComparison.InvariantCultureIgnoreCase)) + { + availableToShow = true; + } + var specific = false; + + if (Model.Settings.SpecificTickets?.Any() is true) + { + var matched = Model.Settings.SpecificTickets.FirstOrDefault(ticket => ticket.TicketTypeId == item.Id); + if (matched is null || matched.Hidden) + { + continue; + } + if (matched.Price is not null) + { + item.Price = matched.Price.Value; + } + if (!string.IsNullOrEmpty(matched.Name)) + { + item.Name = matched.Name; + } + if (!string.IsNullOrEmpty(matched.Description)) + { + item.Description = matched.Description; + } + availableToShow = true; + specific = true; + } + if (!availableToShow) { continue; } - if (matched.Price is not null) - { - item.Price = matched.Price.Value; - } - if (!string.IsNullOrEmpty(matched.Name)) - { - item.Name = matched.Name; - } - if (!string.IsNullOrEmpty(matched.Description)) - { - item.Description = matched.Description; - } - availableToShow = true; - specific = true; - } - if (!availableToShow) - { - continue; - } - index++; + index++; - - var purchasable = available && (specific || new[] {"on_sale", "locked"}.Contains(item.Status)) && item.Quantity > 0; + + var purchasable = available && (specific || new[] {"on_sale", "locked"}.Contains(item.Status)) && item.Quantity > 0; -
-
-
@item.Name
-

@Safe.Raw(item.Description)

-
-
- @if (purchasable) - { -
-
- +
+
+
@item.Name
+

@Safe.Raw(item.Description)

+
+
+ @if (purchasable) + { + + // var value = firstPurchaseable && Model.Items?.Any(requestItem => requestItem.Quantity > 0) is not true? 1: Model.Items?.ElementAtOrDefault(index)?.Quantity??0; +
+
+ - + +
+ + + @(item.Price == 0 ? "FREE" : $"{item.Price} {Model.Event.Currency.ToUpperInvariant()}") + +
- - - @(item.Price == 0 ? "FREE" : $"{item.Price} {Model.Event.Currency.ToUpperInvariant()}") - - -
- } - else - { -
Unavailable
- } + + firstPurchaseable = false; + } + else + { +
Unavailable
+ } +
-
-
- } - +
+ } +
- } + } }
-
- - -
+
+ + +