@model List<PantheonRA.WebApi.Contracts.PaWoExItemResources>

<div class="row">
    <div class="panel-group" id="resource-list" role="tablist" aria-multiselectable="true">

        @for (int i = 0; i < Model.Count(); i++)
        {
            var resourceId = "WoExItemResources[" + i + "].{0}";
            var UM = ViewBag.UM;
            var finished = Model.ElementAt(i).Finished;
            var remainingTime = @Model.ElementAt(i).CTime - @Model.ElementAt(i).PTime;

            <input type="hidden"
                   id="@string.Format(resourceId, "Qid")"
                   name="@string.Format(resourceId,"Qid")"
                   value=@Model.ElementAt(i).QId />
            <input type="hidden"
                   id="@string.Format(resourceId, "WOExItemQId")"
                   name="@string.Format(resourceId,"WOExItemQId")"
                   value=@Model.ElementAt(i).WOExItemQId />

            <div class="card col-lg-3 col-sm-5 @((finished) ? "hidden" : string.Empty)" style="padding:15px; margin:10px">
                <div class="card-header border-bottom">
                    <label class="control-label">@Loc.WOResource: @Model.ElementAt(i).Priority - @Model.ElementAt(i).PriorityName</label>
                    <h3 class="card-header text-success">
                        @Model.ElementAt(i).ResursID - @Model.ElementAt(i).Name
                    </h3>
                </div>
                <div class="card-body">
                    <div class="margin-top-10">
                        <label class="control-label">@Loc.TaBegin</label>
                        <div>
                            <input type="text"
                                   id="@string.Format("{0}-{1}", "BeginTime", i)"
                                   name="@string.Format(resourceId,"WoExItemWork[0].BeginTime")"
                                   required
                                   class="form-control custom-datetimepicker expense-dt-picker"
                                   placeholder="@Loc.DateAndTime"
                                   value="@DateTime.Now.ToString("dd.MM.yyyy HH:mm")"
                                   autocomplete="off" />

                        </div>
                    </div>
                    <div class="margin-top-10">
                        <label class="control-label">@Loc.UsedTime</label>
                        <div class="input-group">
                            <input type="text"
                                   id="@string.Format("{0}-{1}","Time", i)"
                                   name="@string.Format(resourceId,"WoExItemWork[0].Time")"
                                   required
                                   class="form-control numberInput"
                                   style="padding-left:12px"
                                   placeholder="@Loc.UsedTime"
                                   value="0" />
                            <span class="input-group-addon">/@Decimal.Round((decimal)remainingTime, 2)  @UM</span>
                        </div>
                    </div>
                    <div class="margin-top-10">
                        <label class="control-label">@Loc.WOOperationGoodPcs</label>
                        <div>
                            <input type="text"
                                   id="@string.Format("{0}-{1}","Qty", i)"
                                   name="@string.Format(resourceId,"WoExItemWork[0].Qty")"
                                   required
                                   class="form-control numberInput"
                                   placeholder="@Loc.WOOperationGoodPcs"
                                   value="0" />
                        </div>
                    </div>
                    <div class="margin-top-10">
                        <label class="control-label">@Loc.WOOperationRepairPcs</label>
                        <div>
                            <input type="text"
                                   id="@string.Format("{0}-{1}","RepairQty",i)"
                                   name="@string.Format(resourceId,"WoExItemWork[0].RepairQty")"
                                   required
                                   class="form-control numberInput"
                                   placeholder="@Loc.WOOperationRepairPcs"
                                   value="0" />
                        </div>
                    </div>
                    <div class="margin-top-10">
                        <label class="control-label">@Loc.WOOperationScrapPcs</label>
                        <div>
                            <input type="text"
                                   id="@string.Format("{0}-{1}","ScrapPcs",i)"
                                   name="@string.Format(resourceId,"WoExItemWork[0].ScrapPcs")"
                                   required
                                   class="form-control numberInput"
                                   placeholder="@Loc.WOOperationScrapPcs"
                                   value="0" />
                        </div>
                    </div>
                    <div class="margin-top-10">
                        <label class="control-label">@Loc.Finished</label>
                        <div style="padding-top:10px; padding-left:20px">
                            <input type="checkbox"
                                   class="form-control js-switch timeRecordsSwitch"
                                   id="@string.Format("{0}-{1}","Finished",i)"
                                   name="@string.Format(resourceId,"Finished")"
                                   value="@Model.ElementAt(i).IssueFinished"
                                   checked="@Model.ElementAt(i).Finished"/>

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

        }
    </div>
</div>