Ignore:
Timestamp:
09/01/26 06:11:34 (4 weeks ago)
Author:
mmilevski <markomilevski3@…>
Branches:
main
Children:
d2eccb3
Parents:
08aefc6
Message:

Added major improvements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • KernelRecordsMVC.Web/Views/Order/Cart.cshtml

    r08aefc6 rfa0fbaf  
    11@model KernelRecordsMVC.Application.ViewModels.CartViewModel
    22
    3 <div class="d-flex justify-content-between align-items-center mb-4">
    4 
    5     <h1>Your Cart</h1>
    6 
    7     <a asp-controller="Release"
    8        asp-action="Index"
    9        class="btn btn-outline-primary">
    10 
    11         Continue Shopping
    12 
    13     </a>
    14 
    15 </div>
    16 
    17 
    18 @if (TempData["Error"] != null)
    19 {
    20     <div class="alert alert-danger">
    21 
    22         @TempData["Error"]
    23 
    24     </div>
     3@{
     4    ViewData["Title"] = "Cart";
    255}
    266
    27 
    28 @if (!Model.Items.Any())
    29 {
    30     <div class="text-center py-5">
    31 
    32         <h3>Your cart is empty.</h3>
    33 
    34         <p class="text-muted">
    35             Browse our releases and add something to your order.
    36         </p>
     7<div class="cart-page">
     8
     9    <div class="cart-header">
     10
     11        <div>
     12
     13            <span class="page-eyebrow">
     14                YOUR ORDER
     15            </span>
     16
     17            <h1>Your Cart</h1>
     18
     19            <p>
     20                Review your selected physical releases.
     21            </p>
     22
     23        </div>
    3724
    3825        <a asp-controller="Release"
    3926           asp-action="Index"
    40            class="btn btn-primary">
    41 
    42             Browse Releases
     27           class="store-button secondary">
     28
     29            Continue Shopping
    4330
    4431        </a>
    … …  
    4633    </div>
    4734
    48     return;
    49 }
    50 
    51 
    52 <div class="table-responsive">
    53 
    54     <table class="table align-middle">
    55 
    56         <thead>
    57 
    58         <tr>
    59 
    60             <th>Release</th>
    61 
    62             <th>Format</th>
    63 
    64             <th>Price</th>
    65 
    66             <th>Quantity</th>
    67 
    68             <th>Total</th>
    69 
    70             <th></th>
    71 
    72         </tr>
    73 
    74         </thead>
    75 
    76 
    77         <tbody>
    78 
    79         @foreach (var item in Model.Items)
    80         {
    81             <tr>
    82 
    83                 <td>
    84 
    85                     <a asp-controller="Release"
    86                        asp-action="Details"
    87                        asp-route-id="@item.ReleaseId">
    88 
    89                         @item.ReleaseTitle
    90 
    91                     </a>
    92 
    93                 </td>
    94 
    95 
    96                 <td>
    97 
    98                     <span class="badge bg-secondary">
    99 
    100                         @item.Format
    101 
     35
     36    @if (TempData["Error"] != null)
     37    {
     38        <div class="profile-alert"
     39             style="background:#f9e8e8;color:#a33;">
     40            @TempData["Error"]
     41        </div>
     42    }
     43
     44
     45    @if (!Model.Items.Any())
     46    {
     47        <div class="empty-store">
     48
     49            <div class="empty-store-icon">
     50                🛒
     51            </div>
     52
     53            <h2>Your cart is empty</h2>
     54
     55            <p>
     56                Browse our releases and add something to your order.
     57            </p>
     58
     59            <a asp-controller="Release"
     60               asp-action="Index"
     61               class="store-button primary">
     62
     63                Browse Releases
     64
     65            </a>
     66
     67        </div>
     68    }
     69    else
     70    {
     71        <div class="cart-layout">
     72
     73            <div class="cart-items">
     74
     75                <div class="cart-items-header">
     76                    @Model.Items.Count item(s) in your cart
     77                </div>
     78
     79
     80                @foreach (var item in Model.Items)
     81                {
     82                    <div class="cart-item">
     83
     84                        <a asp-controller="Release"
     85                           asp-action="Details"
     86                           asp-route-id="@item.ReleaseId"
     87                           class="cart-item-cover">
     88
     89                            @if (!string.IsNullOrWhiteSpace(item.CoverPhoto))
     90                            {
     91                                <img src="@item.CoverPhoto"
     92                                     alt="@item.ReleaseTitle" />
     93                            }
     94                            else
     95                            {
     96                                <div class="cart-cover-placeholder">
     97                                    ♪
     98                                </div>
     99                            }
     100
     101                        </a>
     102
     103
     104                        <div class="cart-item-info">
     105
     106                            <span class="cart-item-type">
     107                                @item.Format
     108                            </span>
     109
     110                            <h2>
     111
     112                                <a asp-controller="Release"
     113                                   asp-action="Details"
     114                                   asp-route-id="@item.ReleaseId">
     115
     116                                    @item.ReleaseTitle
     117
     118                                </a>
     119
     120                            </h2>
     121
     122                            <div class="cart-item-price">
     123
     124                                @item.Price.ToString("C")
     125                                each
     126
     127                            </div>
     128
     129                        </div>
     130
     131
     132                        <div class="cart-item-quantity">
     133
     134                            <form asp-action="UpdateQuantity"
     135                                  method="post">
     136
     137                                @Html.AntiForgeryToken()
     138
     139                                <input type="hidden"
     140                                       name="id"
     141                                       value="@item.ProductId" />
     142
     143                                <input type="number"
     144                                       name="quantity"
     145                                       value="@item.Quantity"
     146                                       min="1"
     147                                       max="@item.Stock" />
     148
     149                                <button type="submit">
     150                                    Update
     151                                </button>
     152
     153                            </form>
     154
     155                        </div>
     156
     157
     158                        <div class="cart-item-total">
     159
     160                            @item.Total.ToString("C")
     161
     162                        </div>
     163
     164
     165                        <form asp-action="RemoveProduct"
     166                              method="post">
     167
     168                            @Html.AntiForgeryToken()
     169
     170                            <input type="hidden"
     171                                   name="id"
     172                                   value="@item.ProductId" />
     173
     174                            <button type="submit"
     175                                    class="cart-remove"
     176                                    title="Remove">
     177
     178                                ×
     179
     180                            </button>
     181
     182                        </form>
     183
     184                    </div>
     185                }
     186
     187            </div>
     188
     189
     190            <aside class="cart-summary">
     191
     192                <span class="section-label">
     193                    ORDER SUMMARY
     194                </span>
     195
     196                <h2>
     197                    Your Order
     198                </h2>
     199
     200
     201                <div class="summary-line">
     202
     203                    <span>
     204                        Items
    102205                    </span>
    103206
    104                 </td>
    105 
    106 
    107                 <td>
    108 
    109                     $@item.Price.ToString("0.00")
    110 
    111                 </td>
    112 
    113 
    114                 <td>
    115 
    116                     <form asp-action="UpdateQuantity"
    117                           method="post"
    118                           class="d-flex">
    119 
    120                         @Html.AntiForgeryToken()
    121 
    122                         <input type="hidden"
    123                                name="id"
    124                                value="@item.ProductId" />
    125 
    126                         <input type="number"
    127                                name="quantity"
    128                                value="@item.Quantity"
    129                                min="1"
    130                                max="@item.Stock"
    131                                class="form-control"
    132                                style="width:90px;" />
    133 
    134                         <button type="submit"
    135                                 class="btn btn-outline-secondary ms-2">
    136 
    137                             Update
    138 
    139                         </button>
    140 
    141                     </form>
    142 
    143                 </td>
    144 
    145 
    146                 <td>
    147 
    148207                    <strong>
    149 
    150                         $@item.Total.ToString("0.00")
    151 
     208                        @Model.Items.Sum(x => x.Quantity)
    152209                    </strong>
    153210
    154                 </td>
    155 
    156 
    157                 <td>
    158 
    159                     <form asp-action="RemoveProduct"
    160                           method="post">
    161 
    162                         @Html.AntiForgeryToken()
    163 
    164                         <input type="hidden"
    165                                name="id"
    166                                value="@item.ProductId" />
    167 
    168                         <button type="submit"
    169                                 class="btn btn-outline-danger">
    170 
    171                             Remove
    172 
    173                         </button>
    174 
    175                     </form>
    176 
    177                 </td>
    178 
    179             </tr>
    180         }
    181 
    182         </tbody>
    183 
    184     </table>
     211                </div>
     212
     213
     214                <div class="summary-line total">
     215
     216                    <span>
     217                        Total
     218                    </span>
     219
     220                    <strong>
     221                        @Model.Total.ToString("C")
     222                    </strong>
     223
     224                </div>
     225
     226
     227                <a asp-action="Checkout"
     228                   class="store-button primary full">
     229
     230                    Proceed to Checkout
     231
     232                </a>
     233
     234            </aside>
     235
     236        </div>
     237    }
    185238
    186239</div>
    187 
    188 
    189 <div class="row justify-content-end">
    190 
    191     <div class="col-md-4">
    192 
    193         <div class="card">
    194 
    195             <div class="card-body">
    196 
    197                 <h4>Order Summary</h4>
    198 
    199                 <hr />
    200 
    201                 <div class="d-flex justify-content-between">
    202 
    203                     <span>Total</span>
    204 
    205                     <strong>
    206                         $@Model.Total.ToString("0.00")
    207                     </strong>
    208 
    209                 </div>
    210 
    211 
    212                 <a asp-action="Checkout"
    213                    class="btn btn-success w-100 mt-3">
    214 
    215                     Proceed to Checkout
    216 
    217                 </a>
    218 
    219             </div>
    220 
    221         </div>
    222 
    223     </div>
    224 
    225 </div>
Note: See TracChangeset for help on using the changeset viewer.