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

@{
    ViewData["Title"] = "Dashboard";
}

<partial name="_Notification" />


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

        <h1> Manage Product... </h1>

        <p>
            <button class="btn btn-outline-info"> <a asp-action="Create">Add Product</a></button> || <button class="btn btn-outline-warning"> <a asp-controller="ProductCategory" asp-action="Create">Add New Category</a></button>
        </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.SellingPrice)
                    </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.SellingPrice)
                        </td>

                        <td>
                            @*<a asp-action="Edit" asp-route-Barcode="@item.Data.Barcode">Edit</a> |*@
                            <a asp-action="DetailsBarCode" asp-route-Barcode="@item.Data.Barcode">Details</a> |
                            @*<a asp-action="DeletePreview" asp-route-Barcode="@item.Data.Barcode">Delete</a> |*@
                            <a asp-controller="Cart" asp-action="Create" asp-route-Barcode="@item.Data.Barcode">Buy</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>

