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

@model PantheonRA.WebApi.Contracts.WorkOrderOperation

@{
    ViewBag.Title = Loc.WOEditOperation;
}

@using (Html.BeginForm(null, null, FormMethod.Post, new { @id = "workOrderDailyPlan", enctype = "multipart/form-data" }))
{

    <div class="wrapper wrapper-content">
        <div class="tabs-container">

            @Html.Partial("~/Views/Shared/_TabNavigation.cshtml", new TabNavigationViewModel
            {
                Tabs = new List<NavigationtabViewModel>
                    {
                        new NavigationtabViewModel(Loc.WOProcessing_CompletedWork, null, Html.IsActive("DailyPlanItems", "Manufacturing"),
                            !PantheonRA.BackOffice.CurrentUser.CanAccess(PantheonRA.WebApi.Contracts.Enums.Permissions.PRODUCTION))
                    }
            })

            <div class="tab-content">
                <div class="row buttons-tabbed">
                    @Html.Partial("_FormButtons", new FormButtonsViewModel
                    {
                        BackUrl = Url.Action("Index", "Manufacturing", new { type = ProductionType.MF })
                    })
                    <a href="@Url.Action("Receive", "Manufacturing", new { @id = Model.WOKey, type = ViewBag.ProdType, dailyPlan = "true" })" id="receiveButton" class="btn btn-success  pull-right" title="@Loc.Receive">
                        <i class="fa fa-dolly"></i><span class="bold hidden-xs m-l-xs">@Loc.Receive</span>
                    </a>
                </div>

                <div class="row document-head">

                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-6 document-head-disabled-input">
                        <div class="form-group">
                            @Html.LabelFor(model => model.WOKey, Loc.Number, new { @class = "control-label m-t-xs" })
                            <input class="form-control text-center" id="acKeyDisplay" disabled="disabled" type="text" value=" @Model.WOKeyView">
                        </div>
                    </div>
                    <div class="col-lg-2 col-sm-3 col-xs-6 dateFilter">
                        <div class="form-group">
                            <label class="control-label">@Loc.Date</label>
                            <div class="input-group">
                                <span class="input-group-addon"><i class="far fa-calendar alt"></i></span>
                                @Html.TextBoxFor(model => model.Date, new { @id = "date", @class = "form-control datepicker", @type = "text", @Value = @Model.Date.ToString(Loc.DateFormat) })
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-2 col-sm-4 col-xs-12">

                        <div class="form-group">
                            <label class="control-label">@Loc.Worker</label>
                            <select id="selectWorker"
                                    name="Worker"
                                    required
                                    class="form-control"
                                    allow-clear="true"
                                    data-placeholder="@Loc.Worker"
                                    data-dropdown-height="300">
                                <option value="" selected="selected"></option>
                                @foreach (var item in ViewBag.Workers)
                                {
                                    <option value="@item.Value" data-name="@item.Text" @(item.Selected ? "selected" : string.Empty)>
                                        @item.Text
                                    </option>
                                }
                            </select>
                        </div>
                    </div>
                </div>

                <div class="project-list">
                    <table id="mainGridDailyPlanItems" data-grid-id="daily-plan-items" data-url="@Url.Action("DailyPlanItemsList", "Manufacturing")" class="cards cardsDailyPlan">
                        <thead style="display:none">
                            <tr>
                                <th width="3%"></th>
                                <th width="15%"></th>
                                <th width="8%"></th>
                                <th width="8%"></th>
                                <th width="8%"></th>
                                <th width="8%"></th>
                                <th width="8%"></th>
                            </tr>
                        </thead>
                    </table>
                </div>

            </div>

        </div>

    </div>
};
<input type="hidden" id="url" value="@Url.Action("WorkReg", "Manufacturing")" />
<input type="hidden" id="AcKey" value="@Model.WOKey" />
<input type="hidden" id="receiveURL" value="@Url.Action("ConfirmOper", "Manufacturing")" />
<input type="hidden" id="buttonText" value="@Loc.OK" />
<input type="hidden" id="succesText" value="@Loc.SuccessWorkMsg" />
<input type="hidden" id="requiedQty" value="@Loc.RequiredInput @Loc.Quantity" />
<input type="hidden" id="requiedWorker" value="@Loc.RequiredInput @Loc.Worker" />

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

    <script>
        $(document).ready(function () {
            initializeDailyPlanItems();
        });
    </script>
}
