@model SMS_MVCDTO.Models.ViewModels.NewProductViewModel


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

<partial name="_Notification" />


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

        <div id="Data-form">
            @*@using (Html.BeginForm("Create", "Product"))*@
            @using (Html.BeginForm("Create", "Product", FormMethod.Post, new { enctype = "multipart/form-data" }))
            {

                <h1>Add new Product</h1>

                <hr />
                <div class="form-group">
                    @Html.LabelFor(x => x.CreateProduct.Barcode, new {@class = "control-label"})
                    @Html.TextBoxFor(x => x.CreateProduct.Barcode, new {@class = "form-control"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.Barcode,"", new {@class="text-danger"})
                </div>

                <div class="form-group">
                    @Html.LabelFor(x => x.CreateProduct.Name, new {@class = "control-label"})
                    @Html.TextBoxFor(x => x.CreateProduct.Name, new {@class = "form-control"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.Name,"", new {@class="text-danger"})
                </div>

                <div class="form-group">
                    @Html.LabelFor(x => x.CreateProduct.Description, new {@class = "control-label"})
                    @Html.TextBoxFor(x => x.CreateProduct.Description, new {@class = "form-control"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.Description,"", new {@class="text-danger"})
                </div>

                <div class="form-group">
                    @Html.LabelFor(x => x.CreateProduct.SellingPrice, new {@class = "control-label"})
                    @Html.TextBoxFor(x => x.CreateProduct.SellingPrice, new {@class = "form-control"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.SellingPrice,"", new {@class="text-danger"})
                </div>

                <div class="form-group">
                    @Html.LabelFor(x => x.CreateProduct.Quantity, new {@class = "control-label"})
                    @Html.TextBoxFor(x => x.CreateProduct.Quantity, new {@class = "form-control"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.Quantity,"", new {@class="text-danger"})
                </div>

                <div class="form-group">
                    @Html.LabelFor(x => x.CreateProduct.ReorderLevel, new {@class = "control-label"})
                    @Html.TextBoxFor(x => x.CreateProduct.ReorderLevel, new {@class = "form-control"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.ReorderLevel,"", new {@class="text-danger"})
                </div>



                <div class="col-md-6">
                    @*<div asp-validation-summary="ModelOnly" class="text-danger"></div>*@
                    <div class="form-group">
                        <label asp-for="@Model.CreateProduct.PicturePath" style="width: 100%;"></label>

                        <input asp-for="@Model.CreateProduct.PicturePath" type="file" accept=".png,.jpg,.jpeg,.gif,.tif" class="form-control" style="border:0px!important;padding: 0px;padding-top: 10px;padding-bottom: 30px;" onchange="document.getElementById('PicturePath').src = window.URL.createObjectURL(this.files[0])" />
                        <span asp-validation-for="@Model.CreateProduct.PicturePath" class="text-danger"></span>
                    </div>
                </div>

              @*
            
                <div class="form-group">
                    @Html.LabelFor(x => x.CreateProduct.Pictur, new {@class = "control-label"})
                    @Html.TextBoxFor(x => x.CreateProduct.Pictur, new {type="file", accept=".png,.jpg,.jpeg,.gif,.tif", onchange="document.getElementById('Pictur').src = window.URL.createObjectURL(this.files[0])"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.Pictur,"", new {@class="text-danger"})
                </div>
*@

                <div class="form-group">
                    @Html.LabelFor(x => x.PCategory, new {@class = "control-label"})
                    <br />
                    @Html.DropDownListFor(x => x.CreateProduct.CategoryId, new SelectList(Model.PCategory,"Data.CategoryCode","Data.Name"),"Select Category" ,new {@class = "form-control"})
                    @Html.ValidationMessageFor(x => x.CreateProduct.CategoryId,"", new {@class="text-danger"})
                </div>
                

                @* <div class="form-group">
                        <label asp-for="Pictur" style="width: 100%;"></label>

                        <input asp-for="ProfilePicture" type="file" accept=".png,.jpg,.jpeg,.gif,.tif" class="form-control" style="border:0px!important;padding: 0px;padding-top: 10px;padding-bottom: 30px;" onchange="document.getElementById('profilePicture').src = window.URL.createObjectURL(this.files[0])" />
                        <span asp-validation-for="ProfilePicture" class="text-danger"></span>
                    </div> *@

                <div class="form-group">
                    <button type="submit" class="btn btn-success">Add</button>
                </div>
            }

        </div>

    </div>

    <!-- search box  -->
    <div class="search-container">
        <form>
            <input type="text" placeholder="Search...">
            <button type="submit"><i class="fa fa-search"></i> Search </button>
        </form>
    </div>



    @section Scripts {
        @{
            await Html.RenderPartialAsync("_ValidationScriptsPartial");
        }
    }

</main>
@* ends here *@



