@using PantheonRA.BackOffice.Enums
@using PantheonRA.WebApi.Contracts.Enums

@model PantheonRA.BackOffice.Models.WorkOrdersGridFilterModel

<div class="wrapper wrapper-content">
    <div class="tabs-container">
        @Html.Partial("_ManufacturingTabNavigation")
        <div class="tab-content">
            @Html.HiddenFor(model => model.DefaultDecimalPlacesPrice)
            @Html.HiddenFor(model => model.DefaultDecimalPlacesQuantity)
            @Html.HiddenFor(model => model.DefaultDecimalPlacesValue)
            @Html.HiddenFor(model => model.ProductionType)
            @Html.Hidden((string)ViewBag.ProdType)
            <div class="row document-head">

                <div class="col-md-2 col-sm-4 col-xs-6">
                    <div class="form-group">
                        @Html.LabelFor(model => model.DocType, Loc.DocumentType, new { @class = "control-label" })
                        @Html.DropDownListFor(model => model.DocType, new SelectList(ViewBag.DocumentTypes != null ? ViewBag.DocumentTypes : new List<string>(), "Id", "Value"), Loc.All,
                                                                    HtmlAttributesHelper.CreateInputAttributes("form-control custom-select", "DocType", false, Loc.TypeOfView))
                        @Html.ValidationMessageFor(model => model.DocType, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
                    <div class="form-group">
                        <label class="control-label">@Loc.WorkOrderStatus</label>

                        <select id="Status" name="Status" class="form-control search-addon custom-select">
                            @if (Model.ProductionType == ProductionType.MF)
                            {
                                <option value="@WorkOrderMFStatus.All">@Loc.All</option>
                                <option value="@WorkOrderMFStatus.Planned">@Loc.WOStatus_Planned</option>
                                <option value="@WorkOrderMFStatus.Opened">@Loc.WOStatus_Opened</option>
                                <option value="@WorkOrderMFStatus.Reserved">@Loc.WOStatus_Reserved</option>
                                <option value="@WorkOrderMFStatus.Released">@Loc.WOStatus_Released</option>
                                <option value="@WorkOrderMFStatus.InProgress">@Loc.WOStatus_InProgress</option>
                                <option value="@WorkOrderMFStatus.PartiallyFinished">@Loc.WOStatus_PartialyFinished</option>
                                <option value="@WorkOrderMFStatus.Finished">@Loc.WOStatus_Finished</option>
                            }
                            else
                            {
                                <option value="@WorkOrderSEStatus.All">@Loc.All</option>
                                <option value="@WorkOrderSEStatus.UnFinishedSE">@Loc.WOStatusSE_UnFinished</option>
                                <option value="@WorkOrderSEStatus.LanchedSE">@Loc.WOStatusSE_Lanched</option>
                                <option value="@WorkOrderSEStatus.InProgress">@Loc.WOStatus_InProgress</option>
                                <option value="@WorkOrderSEStatus.FinishedSE">@Loc.WOStatusSE_Finished</option>
                            }
                        </select>
                    </div>
                </div>

                <div class="col-lg-2 col-md-3 col-sm-4 col-xs-12">
                    <div class="form-group typeahead-ident-filter">
                        @Html.Label(Loc.Product, new { @class = "control-label" })
                        <input type="text" class="typeahead_3 form-control" id="IdentFilterSearch" dataUrl="@Url.Action("SearchIdents", "SetItem")"
                               placeholder="@Loc.EnterIdentProduct" autocomplete="off" />
                    </div>
                </div>
                <div class="col-md-2 col-xs-6 dateFilter">
                    <div class="form-group">
                        <label class="control-label">@Loc.DateFrom</label>
                        <div class="input-group">
                            <span class="input-group-addon"><i class="far fa-calendar alt"></i></span>
                            <input class="form-control datepicker" id="Filter_DateFrom" name="Filter.DateFrom" type="text" value="@DateTime.Now.Date.AddYears(-1).ToString(Loc.DateFormat)">
                        </div>
                    </div>
                </div>
                <div class="col-md-2 col-xs-6 dateFilter">
                    <div class="form-group">
                        <label class="control-label">@Loc.DateTo</label>
                        <div class="input-group">
                            <span class="input-group-addon"><i class="far fa-calendar alt"></i></span>
                            <input class="form-control datepicker" id="Filter_DateTo" name="Filter.DateTo" type="text" value="@DateTime.Now.Date.ToString(Loc.DateFormat)">
                        </div>
                    </div>
                </div>
            </div>

            <div class="project-list">
                <table id="mainGrid" data-grid-id="work-orders" data-url="@Url.Action("WorkOrderList", "Manufacturing")" class="cards">
                    <thead>
                        <tr>
                            <th width="3%"></th>
                            <th width="15%"></th>
                            <th width="10%"></th>
                            <th width="6%"></th>
                            <th width="8%"></th>
                            <th width="8%"></th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>

<input type="hidden" id="customDateEnum" value="@PantheonRA.BackOffice.Enums.ItemsDisplayFilterType.CustomDate" />
<input type="hidden" id="identFilterItem" value="@Loc.Item" />
<input type="hidden" id="identFilterName" value="@Loc.Name" />

@section pageScripts{
    @Scripts.Render("~/bundles/manufacturing")
    @Scripts.Render("~/bundles/custom")
}