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/Admin/CreateProduct.cshtml

    r08aefc6 rfa0fbaf  
    11@model KernelRecordsMVC.Application.ViewModels.CreateProductViewModel
    22
    3 <h1>New Product</h1>
    4 
    5 <p class="text-muted">
    6     Add a physical product format for an existing release.
    7 </p>
    8 
    9 <form asp-action="CreateProduct"
    10       method="post">
    11 
    12     @Html.AntiForgeryToken()
    13 
    14     <div asp-validation-summary="ModelOnly"
    15          class="text-danger mb-3">
     3@{
     4    ViewData["Title"] = "New Product";
     5}
     6
     7<div class="admin-page admin-form-page">
     8
     9    <!-- HEADER -->
     10
     11    <div class="admin-header">
     12
     13        <div>
     14
     15            <a asp-action="Products"
     16               class="admin-back-link">
     17
     18                ← Products
     19
     20            </a>
     21
     22            <span class="admin-eyebrow">
     23                INVENTORY
     24            </span>
     25
     26            <h1>New Product</h1>
     27
     28            <p>
     29                Add a new physical format to an existing release.
     30            </p>
     31
     32        </div>
     33
    1634    </div>
    1735
    1836
    19     <!-- RELEASE -->
    20 
    21     <div class="mb-3">
    22 
    23         <label asp-for="ReleaseId"
    24                class="form-label">
    25         </label>
    26 
    27         <select asp-for="ReleaseId"
    28                 class="form-select">
    29 
    30             <option value="">
    31                 -- Select Release --
    32             </option>
    33 
    34             @foreach (var release in ViewBag.Releases)
    35             {
    36                 <option value="@release.ReleaseId">
    37 
    38                     @release.Title
    39                     (@release.ReleaseDate.ToString("yyyy"))
    40 
    41                 </option>
    42             }
    43 
    44         </select>
    45 
    46         <span asp-validation-for="ReleaseId"
    47               class="text-danger">
    48         </span>
     37    <div class="admin-form-layout">
     38
     39
     40        <!-- =================================================
     41             FORM
     42             ================================================= -->
     43
     44        <section class="admin-form-card">
     45
     46            <div class="admin-form-card-header">
     47
     48                <span class="admin-eyebrow">
     49                    PRODUCT INFORMATION
     50                </span>
     51
     52                <h2>Product Details</h2>
     53
     54            </div>
     55
     56
     57            <form asp-action="CreateProduct"
     58                  method="post">
     59
     60                @Html.AntiForgeryToken()
     61
     62
     63                <div asp-validation-summary="ModelOnly"
     64                     class="admin-validation">
     65                </div>
     66
     67
     68                <!-- RELEASE -->
     69
     70                <div class="admin-form-field">
     71
     72                    <label asp-for="ReleaseId">
     73                        Release
     74                    </label>
     75
     76                    <select asp-for="ReleaseId">
     77
     78                        <option value="">
     79                            Select a release
     80                        </option>
     81
     82                        @foreach (var release in ViewBag.Releases)
     83                        {
     84                            <option value="@release.ReleaseId">
     85
     86                                @release.Title
     87                                (@release.ReleaseDate.ToString("yyyy"))
     88
     89                            </option>
     90                        }
     91
     92                    </select>
     93
     94                    <span asp-validation-for="ReleaseId"
     95                          class="admin-field-error">
     96                    </span>
     97
     98                    <small>
     99                        Select the release this physical
     100                        product belongs to.
     101                    </small>
     102
     103                </div>
     104
     105
     106                <div class="admin-form-row">
     107
     108
     109                    <!-- FORMAT -->
     110
     111                    <div class="admin-form-field">
     112
     113                        <label asp-for="Format">
     114                            Format
     115                        </label>
     116
     117                        <select asp-for="Format"
     118                                asp-items="Html.GetEnumSelectList<KernelRecordsMVC.Domain.Enums.ProductFormat>()">
     119
     120                            <option value="">
     121                                Select format
     122                            </option>
     123
     124                        </select>
     125
     126                        <span asp-validation-for="Format"
     127                              class="admin-field-error">
     128                        </span>
     129
     130                    </div>
     131
     132
     133                    <!-- PRICE -->
     134
     135                    <div class="admin-form-field">
     136
     137                        <label asp-for="Price">
     138                            Price
     139                        </label>
     140
     141                        <div class="admin-input-prefix">
     142
     143                            <span>$</span>
     144
     145                            <input asp-for="Price"
     146                                   type="number"
     147                                   min="0"
     148                                   step="0.01"
     149                                   placeholder="0.00" />
     150
     151                        </div>
     152
     153                        <span asp-validation-for="Price"
     154                              class="admin-field-error">
     155                        </span>
     156
     157                    </div>
     158
     159                </div>
     160
     161
     162                <!-- STOCK -->
     163
     164                <div class="admin-form-field">
     165
     166                    <label asp-for="Stock">
     167                        Initial Stock
     168                    </label>
     169
     170                    <input asp-for="Stock"
     171                           type="number"
     172                           min="0"
     173                           placeholder="0" />
     174
     175                    <span asp-validation-for="Stock"
     176                          class="admin-field-error">
     177                    </span>
     178
     179                </div>
     180
     181
     182                <!-- DESCRIPTION -->
     183
     184                <div class="admin-form-field">
     185
     186                    <label asp-for="ProductDescription">
     187                        Product Description
     188                    </label>
     189
     190                    <textarea asp-for="ProductDescription"
     191                              rows="5"
     192                              placeholder="Describe this physical edition..."></textarea>
     193
     194                    <span asp-validation-for="ProductDescription"
     195                          class="admin-field-error">
     196                    </span>
     197
     198                </div>
     199
     200
     201                <!-- ACTIONS -->
     202
     203                <div class="admin-form-actions">
     204
     205                    <button type="submit"
     206                            class="admin-button primary">
     207
     208                        Create Product
     209
     210                    </button>
     211
     212
     213                    <a asp-action="Products"
     214                       class="admin-button secondary">
     215
     216                        Cancel
     217
     218                    </a>
     219
     220                </div>
     221
     222            </form>
     223
     224        </section>
     225
     226
     227        <!-- =================================================
     228             SIDE INFO
     229             ================================================= -->
     230
     231        <aside class="admin-help-card">
     232
     233            <span class="admin-eyebrow">
     234                PRODUCT CREATION
     235            </span>
     236
     237            <h3>Before you create</h3>
     238
     239            <div class="admin-help-item">
     240
     241                <strong>01</strong>
     242
     243                <p>
     244                    A release can only have one product
     245                    for each physical format.
     246                </p>
     247
     248            </div>
     249
     250
     251            <div class="admin-help-item">
     252
     253                <strong>02</strong>
     254
     255                <p>
     256                    Stock can be updated later from
     257                    Product Management.
     258                </p>
     259
     260            </div>
     261
     262
     263            <div class="admin-help-item">
     264
     265                <strong>03</strong>
     266
     267                <p>
     268                    Creating the product will automatically
     269                    create a modification record.
     270                </p>
     271
     272            </div>
     273
     274        </aside>
    49275
    50276    </div>
    51277
    52 
    53     <!-- FORMAT -->
    54 
    55     <div class="mb-3">
    56 
    57         <label asp-for="Format"
    58                class="form-label">
    59         </label>
    60 
    61         <select asp-for="Format"
    62                 asp-items="Html.GetEnumSelectList<KernelRecordsMVC.Domain.Enums.ProductFormat>()"
    63                 class="form-select">
    64 
    65             <option value="">
    66                 -- Select Format --
    67             </option>
    68 
    69         </select>
    70 
    71         <span asp-validation-for="Format"
    72               class="text-danger">
    73         </span>
    74 
    75     </div>
    76 
    77 
    78     <!-- PRICE -->
    79 
    80     <div class="mb-3">
    81 
    82         <label asp-for="Price"
    83                class="form-label">
    84         </label>
    85 
    86         <div class="input-group">
    87 
    88             <span class="input-group-text">
    89                 $
    90             </span>
    91 
    92             <input asp-for="Price"
    93                    class="form-control"
    94                    step="0.01"/>
    95 
    96         </div>
    97 
    98         <span asp-validation-for="Price"
    99               class="text-danger">
    100         </span>
    101 
    102     </div>
    103 
    104 
    105     <!-- DESCRIPTION -->
    106 
    107     <div class="mb-3">
    108 
    109         <label asp-for="ProductDescription"
    110                class="form-label">
    111         </label>
    112 
    113         <textarea asp-for="ProductDescription"
    114                   class="form-control"
    115                   rows="4">
    116         </textarea>
    117 
    118         <span asp-validation-for="ProductDescription"
    119               class="text-danger">
    120         </span>
    121 
    122     </div>
    123 
    124 
    125     <!-- STOCK -->
    126 
    127     <div class="mb-3">
    128 
    129         <label asp-for="Stock"
    130                class="form-label">
    131         </label>
    132 
    133         <input asp-for="Stock"
    134                type="number"
    135                min="0"
    136                class="form-control"/>
    137 
    138         <span asp-validation-for="Stock"
    139               class="text-danger">
    140         </span>
    141 
    142     </div>
    143 
    144 
    145     <div class="d-flex gap-2">
    146 
    147         <button type="submit"
    148                 class="btn btn-success">
    149 
    150             Create Product
    151 
    152         </button>
    153 
    154         <a asp-action="Index"
    155            class="btn btn-secondary">
    156 
    157             Cancel
    158 
    159         </a>
    160 
    161     </div>
    162 
    163 </form>
     278</div>
     279
    164280
    165281@section Scripts
    166282{
    167     <partial name="_ValidationScriptsPartial"/>
     283    <partial name="_ValidationScriptsPartial" />
    168284}
Note: See TracChangeset for help on using the changeset viewer.