@using PantheonRA.WebApi.Contracts.Enums

@model PantheonRA.BackOffice.Models.WorkOrdersGridFilterModel

@{
    var hideForSE = ViewBag.ProdType == ProductionType.SE ? "hidden" : String.Empty;
}

<div class="wrapper wrapper-content">
    <div class="tabs-container">
        @Html.Partial("_ManufacturingTabNavigation")
        <div class="tab-content">
            <input id="localStorageFiltersFor" value="workOrdersMobile" hidden />
            <input id="sortColumn" value="AdTimeIns" hidden />
            <input id="sortOrder" value="DESC" hidden />
            @Html.Hidden("ProdType", ((string)ViewBag.ProdType))

            <div class="divided-content">
                <div class="divided-content-main divided-content-full no-padding">

                    <div class="document-list-no-footer">
                        <table id="mainGrid" data-url="@Url.Action("WorkOrderList", "Manufacturing")" class="card">
                        </table>
                    </div>

                </div>

                <div class="divided-content-side">
                    <div class="tabs-container">
                        <ul class="nav nav-tabs horizontal-menu">
                            <li class="active divided-tab-1"><a data-toggle="tab" href="#filters" class="local-tab">@Loc.SearchFilter</a></li>
                        </ul>
                    </div>
                    <div class="tab-content" id="filtersTabs">
                        <div id="filters" class="tab-pane fade in active" style="margin-bottom:100px">
                            <div class="form-horizontal m-t-sm">

                                <div class="col-xs-12 p-xxs">
                                    <a data-toggle="tab" href="#doc-types">
                                        <div class="card card-filter">
                                            <div class="card-header">
                                                <h4 class="card-title text-default">@Loc.DocumentType</h4>
                                            </div>
                                            <div class="card-body p-l-10">
                                                <div class="input-group">
                                                    <input id="DocTypes" class="form-control localStorageFilter" type="text" data-value="" placeholder="@Loc.All">
                                                    <span class="input-group-addon"><i class="far fa-search"></i></span>
                                                </div>

                                            </div>
                                        </div>
                                    </a>
                                </div>

                                <div class="col-xs-12 p-xxs">
                                    <a data-toggle="tab" href="#status">
                                        <div class="card card-filter">
                                            <div class="card-header">
                                                <h4 class="card-title text-default">@Loc.WorkOrderStatus</h4>
                                            </div>
                                            <div class="card-body p-l-10">
                                                <div class="input-group">
                                                    <input id="Status" class="form-control localStorageFilter" data-value="" type="text" placeholder="@Loc.All">
                                                    <span class="input-group-addon"><i class="far fa-search"></i></span>
                                                </div>

                                            </div>
                                        </div>
                                    </a>
                                </div>

                                <div class="col-xs-12 p-xxs @hideForSE">
                                    <a data-toggle="tab" href="#resurs">
                                        <div class="card card-filter">
                                            <div class="card-header">
                                                <h4 class="card-title text-default">@Loc.WOResource</h4>
                                            </div>
                                            <div class="card-body p-l-10">
                                                <div class="input-group">
                                                    <input id="ResursID" class="form-control localStorageFilter" data-value="" type="text" placeholder="@Loc.All">
                                                    <span class="input-group-addon"><i class="far fa-search"></i></span>
                                                </div>

                                            </div>
                                        </div>
                                    </a>
                                </div>

                                <div class="col-xs-6 p-xxs">
                                    <div class="card card-filter">
                                        <div class="card-header">
                                            <h3 class="card-title">@Loc.DateFrom</h3>
                                        </div>
                                        <div class="card-body">
                                            <input class="form-control text-center col-xs-12 localStorageFilter" id="Filter_DateFrom" name="Filter.DateFrom" type="date" value="@DateTime.Now.Date.AddMonths(-1).ToString("yyyy-MM-dd")">
                                        </div>
                                    </div>
                                </div>

                                <div class="col-xs-6 p-xxs">
                                    <div class="card card-filter">
                                        <div class="card-header">
                                            <h3 class="card-title">@Loc.DateTo</h3>
                                        </div>
                                        <div class="card-body">
                                            <input class="form-control text-center col-xs-12 localStorageFilter" id="Filter_DateTo" name="Filter.DateTo" type="date" value="@DateTime.Now.Date.ToString("yyyy-MM-dd")">
                                        </div>
                                    </div>
                                </div>

                                <div class="col-xs-6  p-xxs">
                                    <div class="card card-filter">
                                        <div class="card-header">
                                            <h3 class="card-title">@Loc.Search</h3>
                                        </div>
                                        <div class="card-body">
                                            <input class="form-control search-input" id="Keywords" name="Keywords" type="text" placeholder="@Loc.Search" autocomplete="off">
                                        </div>
                                    </div>
                                </div>

                                <div class="col-xs-6  p-xxs @hideForSE">
                                    <div class="card card-filter">
                                        <div class="card-header">
                                            <h3 class="card-title">@Loc.DataFromDailyPlan</h3>
                                        </div>
                                        <div class="card-body">
                                            <div class="text-center">
                                                <input type="checkbox" class="js-switch timeRecordsSwitch localStorageFilter" id="data-from-daily-plan" />
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>

                        <div id="doc-types" class="tab-pane additonal-options m-l-n-sm m-r-n-sm" data-control="#DocTypes">

                            @foreach (var item in ViewBag.DocumentTypes)
                            {
                                <div class="border-bottom p-l-10 filter-list-item" data-value="@item.Id" data-display="@item.Value">
                                    <a data-toggle="tab">
                                        <h3 class="text-default" data-toggle="tab">
                                            @item.Value
                                            <i class="fa text-primary p-r-sm pull-right"></i>
                                        </h3>
                                    </a>
                                </div>
                            }

                        </div>

                        <div id="status" class="tab-pane additonal-options m-l-n-sm m-r-n-sm" data-control="#Status">
                            @foreach (var item in ViewBag.StatusLookup)
                            {
                                if (!String.IsNullOrEmpty(item.Id))
                                {
                                    <div class="border-bottom p-l-10 filter-list-item" data-value="@item.Id" data-display="@item.Name">
                                        <a data-toggle="tab">
                                            <h3 class="text-default" data-toggle="tab">
                                                @item.Name
                                                <i class="fa text-primary p-r-sm pull-right"></i>
                                            </h3>
                                        </a>
                                    </div>
                                }
                            }
                        </div>

                        <div id="resurs" class="tab-pane additonal-options m-l-n-sm m-r-n-sm @hideForSE" style="padding-bottom:100px" data-control="#ResursID">
                            @foreach (var item in ViewBag.SetResursLookup)
                            {
                                if (!String.IsNullOrEmpty(item.Value))
                                {
                                    <div class="border-bottom p-l-10 filter-list-item" data-value="@item.Value" data-display="@item.Value">
                                        <a data-toggle="tab">
                                            <h3 class="text-default" data-toggle="tab">
                                                @item.Value - @item.Text
                                                <i class="fa text-primary p-r-sm pull-right"></i>
                                            </h3>
                                        </a>
                                    </div>
                                }
                            }
                        </div>

                        <a id="back" role="button" class="btn btn-rounded btn-light btn-back">
                            <i class="fas fa-chevron-left"></i>
                        </a>

                        <div class="cont-right">
                            <button id="apply" type="button" class="btn btn-success pull-right btn-rounded margin-left-10">
                                <i class="fas fa-check"></i><span class="m-l-xs">@Loc.Confirm</span>
                            </button>
                            <button id="clear" type="button" class="btn pull-right btn-rounded localStorageFilter">
                                <i class="fas fa-broom"></i>
                            </button>

                        </div>

                    </div>
                </div>

            </div>

        </div>

    </div>


    <div class="cont-right">
        <button id="filter" type="button" class="btn btn-success pull-right btn-rounded margin-left-10">
            <i class="fas fa-filter"></i><span class="m-l-xs">@Loc.SearchFilter</span>
        </button>
    </div>

</div>

<input type="hidden" id="identFilterItem" value="@Loc.Item" />
<input type="hidden" id="identFilterName" value="@Loc.Name" />
<input type="hidden" id="operationStart" value="@Loc.OperationStart" />
<input type="hidden" id="operationPause" value="@Loc.OperationPause" />
<input type="hidden" id="operationContinue" value="@Loc.OperationContinue" />
<input type="hidden" id="operationEnd" value="@Loc.OperationEnd" />
<input type="hidden" id="workRegistration" value="@Loc.WorkRegistration" />
<input type="hidden" id="materialsForOperation" value="@Loc.MaterialsForOperation" />

<input type="hidden" id="operRegURL" value="@Url.Action("GetActiveWoExRegOper", "Manufacturing")" />

@section pageScripts{
    @Scripts.Render("~/bundles/manufacturing")
    <script>
        $(document).ready(function () {
            initWorkOrdersMobile();
        });
    </script>
}
