@using PantheonRA.WebApi.Contracts
@using PantheonRA.BackOffice.Models

@model PaWoEx

@{
    var _isMobile = Request.Browser.IsMobileDevice;
    List<SetIdentLookup> idents = ViewBag.Idents ?? new List<SetIdentLookup>();
    List<DropdownModel> warehouses = ViewBag.Warehouses ?? new List<DropdownModel>();
}
@Html.Hidden("GetNewMaterialPositionUrl", @Url.Action("GetNewMaterialPosition", "Service"))
@Html.Hidden("GetIdentStockOnWarehouseUrl", @Url.Action("GetIdentStockOnWarehouse", "Service"))
@Html.Hidden("GetDefaultWarehouseUrl", @Url.Action("GetDefaultWarehouse", "Service"))
@Html.Hidden("AddNewMaterialUrl", @Url.Action("AddNewWoExItem", "Service"))

<div class="modal" id="add-material-modal" role="dialog" aria-hidden="true">
    <div class="modal-dialog" style="@(_isMobile ? "width: 100%; margin: 10px auto;" : "width: 70%")">
        <div class="modal-content">
            <div class="modal-header">
                <div class="row" style="padding:0px 15px">
                    <div>
                        <button type="button" class="close" data-dismiss="modal" aria-label="@Loc.Close"><span aria-hidden="true">&times;</span></button>
                        <h3>@Loc.NewMaterial</h3>
                    </div>

                    <div class="card-work-reg-card">
                        <div class="card card-work-reg">
                            <div class="card-header">
                                <h3 class="card-title">@Loc.Position</h3>
                            </div>
                            <div class="card-body">
                                <input type="number" id="position" name="Position" required class="form-control input-lg input-border" autocomplete="off" min="0" readonly />
                            </div>
                        </div>
                    </div>

                    <div class="card-work-reg-card">
                        <div class="card card-work-reg">
                            <div class="card-header">
                                <h3 class="card-title title-2">@Loc.Ident</h3>
                                <h3 class="card-title title-2">@Loc.Description</h3>
                            </div>
                            <div class="card-body">
                                <div class="input2-selectpicker-wrapper input-2">
                                    <select id="selected-ident" name="Ident" class="form-control input-lg input-border selectpicker" data-live-search="true">
                                        <option selected disabled>@Loc.Select</option>
                                        @foreach (var ident in idents)
                                        {
                                            <option value="@ident.Ident" data-um="@ident.UM" data-name="@ident.Name">@ident.Ident</option>
                                        }
                                    </select>
                                </div>
                                <input type="text" id="description" name="Description" required class="form-control input-lg input-border input-2" autocomplete="off" readonly />
                            </div>
                        </div>
                    </div>

                    <div class="card-work-reg-card">
                        <div class="card card-work-reg">
                            <div class="card-header">
                                <h3 class="card-title title-2">@Loc.Quantity</h3>
                                <h3 class="card-title title-2">@Loc.MeasUnit</h3>
                            </div>
                            <div class="card-body">
                                <div class="input-2">
                                    <div class="input-group input-group-lg">
                                        <span class="input-group-btn">
                                            <button id="b_dQuantity" type="button" class="btn btn-plus-minus"><i class="fa fa-minus fa-lg text-primary"></i></button>
                                        </span>
                                        <input type="number" id="quantity" name="Quantity" value="0" required class="form-control col-md-8 text-center input-lg input-border" autocomplete="off" min="0" />
                                        <span class="input-group-btn">
                                            <button id="b_iQuantity" type="button" class="btn btn-plus-minus"><i class="fa fa-plus fa-lg text-primary"></i></button>
                                        </span>
                                    </div>
                                </div>
                                <input type="text" id="measurementUnit" name="MeasurementUnit" required class="form-control input-lg input-border input-2" autocomplete="off" readonly />
                            </div>
                        </div>
                    </div>

                    <input id="parentPlanQuantity" value="@Model.PlanQty" hidden />

                    <br />
                    <button type="button" id="save-material-btn" class="btn btn-primary pull-right @(_isMobile ? "btn-rounded" : string.Empty)">
                        <i class="fa fa-check m-r-xs" id="submit-btn-icon"></i>@Loc.Add
                    </button>
                    <button type="button" data-dismiss="modal" class="btn btn-link pull-right @(_isMobile ? "btn-rounded" : string.Empty)">
                        <i class="fa fa-times m-r-xs text-primary"></i>@Loc.Cancel
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="~/Scripts/custom/manufacturing/addMaterialModal.js"></script>