@using System.Security.Claims;
@model SMS_MVCDTO.Models.ViewModels.TransactionProductListsViewModel

@{
    ViewData["Title"] = "Sales Manager Dashboard";
}
<partial name="_Notification" />


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

        <!-- Signup Form -->


        <div id="">


            @* <p>
            @if (User?.FindFirst(ClaimTypes.NameIdentifier).Value != null)
            {
            <h1>Welcome @User.FindFirst(ClaimTypes.NameIdentifier).Value; </h1>
            }
            else
            {
            <h1> Welcome Guest </h1>
            }
            </p>*@
            <h1>
                Welcome 
                @if (@User.FindFirst(ClaimTypes.NameIdentifier) != null)
                {
                @(User.FindFirst(ClaimTypes.NameIdentifier).Value)
                }
                <span>Recent Transactions...</span>
            </h1>
@*
            <img src="data:image/jpeg;base64,@Convert.ToBase64String((byte[])ViewData["ImageData"])" />

            <img src="@ViewBag.Image" />
            <img src="@ViewBag.Image" alt="Girl in a jacket" width="500" height="600">
            <img src="data:image/jpeg;base64,@Convert.ToBase64String((byte[])ViewData["ImageData"])" alt="Girl in a jacket" width="500" height="600">
*@
            <table class="table table-info">
                <thead>
                    <tr>
                        <th>S/N</th>

                        <th>
                            <label> Ref. No</label>
                        </th>

                        <th>
                            <label> Date</label>
                        </th>

                        <th>
                            <label> Customer</label>
                        </th>

                        <th>
                            <label> Amount </label>
                        </th>

                        <th></th>

                    </tr>

                </thead>

                <tbody>
                    @{
                        int serialNumber = 1;
                    }
                    @foreach (var item in Model.Transaction)
                    {
                        <tr>
                            <td>
                                @* Numbering *@
                                @serialNumber
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Data.ReferenceNo)
                            </td>

                            <td>
                                @Html.DisplayFor(modelItem => item.Data.Created)
                            </td>

                            <td>
                                @Html.DisplayFor(modelItem =>
                            item.Data.CustomerName)
                            </td>


                            <td>
                                &#x20A6;@Html.DisplayFor(modelItem =>
                            item.Data.TotalAmount)
                            </td>

                            <td>
                                <a asp-controller="Transaction" asp-action="Details"
                               asp-route-ReferenceNo="@item.Data.ReferenceNo">Details</a>
                            </td>
                        </tr>
                        serialNumber++;
                    }
                </tbody>
            </table>

        </div>

        <!-- Signup Form -->


        <div id="">
            <h1>Products below reorder of stock..</h1>

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

                        <th>
                            <label> Barcode</label>
                        </th>

                        <th>
                            <label> Product Name</label>
                        </th>

                        <th>
                            <label> Quantity</label>
                        </th>

                        <th>
                            <label> Amount </label>
                        </th>

                        @* <th>
                        <label> </label>
                        </th>*@

                        @*<th></th>*@

                    </tr>

                </thead>

                <tbody>
                    @{
                        int serialNumber1 = 1;
                    }
                    @foreach (var item in Model.Product)
                    {
                        <tr>
                            <td>
                                @* Numbering *@
                                @serialNumber1
                            </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.Category)
                        </td>
                        *@

                            <td>
                                &#x20A6;@Html.DisplayFor(modelItem =>
                            item.Data.SellingPrice)
                            </td>

                            <td>

                                <a asp-controller="Product" asp-action="Details"
                               asp-route-Barcode="@item.Data.Barcode">More</a>

                            </td>
                        </tr>
                        serialNumber1++;
                    }
                </tbody>
            </table>

        </div>

    </div>

    <!-- search box  -->
    <div class="search-container-side">

        <!-- search box  -->
        <div class="search-container">
            <form asp-controller="Product" asp-action="Details">
                <input type="text" placeholder="Barcode..." name="barCode">
                <button type="submit">
                    <i class="fa fa-search"></i> Search
                </button>
            </form>
        </div>

        <!-- search box  -->
        <div class="search-container">
            <form asp-controller="Transaction" asp-action="Details">
                <input type="text" placeholder="Transaction ref..." name="referenceNo">
                <button type="submit">
                    <i class="fa fa-search"></i> Search
                </button>
            </form>
        </div>

    </div>


</main>

