@model IEnumerable<SMS_MVCDTO.Models.DTOs.ProductDTOs.ProductResponseModel>

<partial name="_Notification" />



<main class="main">
    <!-- <div class="dashboard"> -->
    <div class="form-container">

        <h1>Product Index</h1>

        <p>
            <a asp-action="Create">Add Product</a>
        </p>

        <table class="table table-info col-md-4">
            <thead>
                <tr>
                    <th>S/N</th>


                    <th>
                        @Html.DisplayNameFor(model => model.Data.Barcode)
                    </th>

                    <th>
                        @Html.DisplayNameFor(model => model.Data.Name)
                    </th>

                    <th>
                        @Html.DisplayNameFor(model => model.Data.Quantity)
                    </th>

                    <th>
                        @Html.DisplayNameFor(model => model.Data.ReorderLevel)
                    </th>

                    <th>
                        @Html.DisplayNameFor(model => model.Data.SellingPrice)
                    </th>
                    @*
                    <th>
                    @Html.DisplayNameFor(model => model.Data.IsAvailable)
                    </th>*@
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @{
                    int serialNumber = 1;
                }
                @foreach (var item in Model)
                {
                    <tr>

                        <td>
                            @serialNumber
                        </td>

                        <td>
                            @Html.DisplayFor(modelItem => item.Data.Barcode)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Data.Name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Data.Quantity)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Data.ReorderLevel)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Data.SellingPrice)
                        </td>
                        @*
                    <td>
                    @Html.DisplayFor(modelItem => item.Data.IsAvailable)
                    </td>
                    *@

                        <td>
                            <a asp-action="Edit" asp-route-Id="@item.Data.Id">Edit</a> |
                            <a asp-action="Details" asp-route-Id="@item.Data.Id">Details</a> |
                            <a asp-action="DeletePreview" asp-route-Id="@item.Data.Id">Delete</a> |
                            <a asp-controller="Cart" asp-action="Create" asp-route-Barcode="@item.Data.Barcode"><i class="fa fa-cart-circle-plus"></i></a>
                        </td>
                    </tr>
                    serialNumber++;
                }
            </tbody>
        </table>


    </div>


    <!-- search box  -->

    <div class="search-container-side">
        <div class="search-container">
            <form asp-controller="Product" asp-action="GetByName">
                <input type="text" placeholder="Search by Name.." name="name">
                <button type="submit">Search</button>
            </form>
        </div>

        <div class="search-container">
            <form asp-action="GetById">
                <input type="search" placeholder="Barcode.." aria-label="Search" name="barCode">
                <button type="submit">Search</button>
            </form>
        </div>

    </div>


</main>


