Ignore:
Timestamp:
09/02/26 05:22:09 (4 weeks ago)
Author:
mmilevski <markomilevski3@…>
Branches:
main
Children:
1dcdb2c
Parents:
d89d25b
Message:

Various UI bugfixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • KernelRecordsMVC.Web/Views/Release/Details.cshtml

    rd89d25b r595d2e5  
    1 @model KernelRecordsMVC.Models.Release
     1@using KernelRecordsMVC.Domain.Enums
     2@model KernelRecordsMVC.Models.Release
    23
    34@{
    … …  
    172173                    .OrderBy(x => x.Format))
    173174                {
     175                    var latestModification =
     176                        product.ModificationProducts?
     177                            .Select(mp => mp.Modification)
     178                            .OrderByDescending(m => m.DateModified)
     179                            .ThenByDescending(m => m.ModificationId)
     180                            .FirstOrDefault();
     181
     182                    var isDiscounted =
     183                        latestModification != null &&
     184                        latestModification.TypeOfModification ==
     185                            ModificationType.DISCOUNT &&
     186                        latestModification.Discount.HasValue &&
     187                        latestModification.Discount.Value > 0 &&
     188                        latestModification.Discount.Value < 100;
     189
     190                    decimal? originalPrice = null;
     191                    decimal? discountPercentage = null;
     192
     193                    if (isDiscounted)
     194                    {
     195                        discountPercentage =
     196                            latestModification!.Discount!.Value;
     197
     198                        originalPrice =
     199                            Math.Round(
     200                                product.Price /
     201                                (1m -
     202                                 discountPercentage.Value / 100m),
     203                                2,
     204                                MidpointRounding.AwayFromZero);
     205                    }
     206
     207
    174208                    <div class="store-product-card">
    175209
    … …  
    197231
    198232
    199                         <div class="product-price">
    200                             @product.Price.ToString("C")
    201                         </div>
     233                        <!-- PRICE -->
     234
     235                        @if (isDiscounted &&
     236                             originalPrice.HasValue &&
     237                             discountPercentage.HasValue)
     238                        {
     239                            <div class="product-sale-price">
     240
     241                                <div class="product-price-row">
     242
     243                                    <span class="product-original-price">
     244                                        @originalPrice.Value.ToString("C")
     245                                    </span>
     246
     247                                    <span class="product-current-price">
     248                                        @product.Price.ToString("C")
     249                                    </span>
     250
     251                                </div>
     252
     253                                <span class="product-discount-badge">
     254                                    -@discountPercentage.Value.ToString("0.##")%
     255                                </span>
     256
     257                            </div>
     258                        }
     259                        else
     260                        {
     261                            <div class="product-price">
     262                                @product.Price.ToString("C")
     263                            </div>
     264                        }
    202265
    203266
    … …  
    249312                        {
    250313                            <div class="product-actions">
    251 
    252                                 <!-- OUT OF STOCK: WISHLIST ONLY -->
    253314
    254315                                <form asp-controller="Wishlist"
Note: See TracChangeset for help on using the changeset viewer.