@model Com._9pm2.ClientWeb.Models.MyOrders
@{
    ViewBag.Title = "待处理订单";
}

<div class="callout callout-success lead ">提示：只有步骤经办人可以进行流程流转，协作者只能查看不能流转。显示最近50条纪录。</div>

<script src="~/Scripts/ordercommon.js?vn=20180813"></script>
<script src="~/Scripts/orderworkflow.js?vn=20180813"></script>
<script src="../../Scripts/unprocessedorder.js?vn=20180813"></script>


<div class="divSearch">
    <form method="post" action="/MySpace/UnProcessedOrder">
        @Html.DropDownList("sWorkFlow", new SelectList(Model.DdlWorkFlow, "ItemValue", "ItemText"))
        @Html.DropDownList("sStatus", new SelectList(Model.DdlStatus, "ItemValue", "ItemText"))
        <div class="div-search-select2">
            @Html.DropDownList("sCustomerNo", new SelectList(Model.DdlCustomer, "ItemValue", "ItemText"))
        </div>
        <button class="btn btn-default">搜索</button>
        <button id="btnBatch" type="button" onclick="BatchProcess();" class="btn btn-default">批量流转</button>
    </form>
</div>

<div class="list">
    <div class="error-msg"></div>
    <table id="tOrder">
        <thead>
            <tr>
                <th style="width: 40px">
                    <input type="checkbox" id="chkAll" onclick="SelectAll();" />
                </th>
                <th style="width:100px">交易日期</th>
                <th style="min-width:100px">客户</th>
                <th>订单名称</th>
                <th>明细</th>
                <th style="min-width:80px">订单状态</th>
                <th style="min-width:100px">流程</th>
                <th style="min-width:40px" title="距离预完工日期的天数">剩余</th>
                <th style="min-width:60px">经办人</th>
                <th style="min-width:60px">
                    附件
                </th>
                <th style="width:120px">操作</th>
            </tr>
        </thead>
        <tbody class="spanTbody">
            @{
                int j = 0;

                foreach (var item in Model.InProcessingOrders)
                {
                    int i = 0;

                    string className = j % 2 == 0 ? "odd" : "even";

                    foreach (var o in item.Details)
                    {
                        if (i == 0)
                        {
                            <tr id="@item.OrderNo" class="@className">
                                <td style="text-align: center" class="td-checkbox" rowspan="@item.Details.Count">
                                    <input type="checkbox" onclick="SelectOne();" />
                                </td>

                                <td rowspan="@item.Details.Count">
                                    @item.TransactionDate.ToString("yyyy-MM-dd")
                                </td>
                                <td rowspan="@item.Details.Count">
                                    @Html.DisplayFor(modelItem => item.CustomerShortName)
                                </td>

                                <td>@o.OrderName</td>

                                <td>
                                    <b>@o.CategoryName</b>
                                    @o.DetailText@(string.IsNullOrEmpty(o.Memo) ? "" : " 备注: " + o.Memo)
                                </td>

                                <td rowspan="@item.Details.Count">
                                    @item.StatusDescription
                                </td>

                                <td rowspan="@item.Details.Count">
                                    @Html.DisplayFor(modelItem => item.WorkFlowName)
                                    <input type="hidden" value="@item.WorkFlowNo" />
                                </td>

                                <td rowspan="@item.Details.Count" class="due-day" data-due="@item.DueDay"></td>
                                <td rowspan="@item.Details.Count" title="@item.CurrentStepCooperatorsName">@item.CurrentStepUser.UserName</td>
                                <td class="td-img" rowspan="@item.Details.Count">
                                    @if (item.AttachmentNumber > 0)
                                    {
                                        <img src="~/Images/grid/x.png" />
                                    }
                                </td>
                                <td rowspan="@item.Details.Count" class="td-last">

                                    <div class="operation-btns">
                                        <div>
                                            <button id="select">&nbsp;</button>
                                        </div>
                                        <ul>
                                            <li><a href="javascript:void(0);" onclick="ShowAttachment('@item.OrderNo')">附件</a></li>
                                            @if (item.IsMainOperator)
                                            {
                                                <li><a href="javascript:void(0);" onclick="CurrentStep('@item.OrderNo')">协作者</a></li>
                                                <li><a href="javascript:void(0);" onclick="NextStep('@item.OrderNo',false)">流程流转</a></li>
                                            }
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        }
                        else
                        {
                            <tr id="@item.OrderNo" class="@className">
                                <td>@o.OrderName</td>
                                <td>
                                    <b>@o.CategoryName</b>
                                    @o.DetailText@(string.IsNullOrEmpty(o.Memo) ? "" : " 备注: " + o.Memo)
                                </td>

                            </tr>
                        }

                        i++;
                    }

                    j++;

                }
            }

        </tbody>
    </table>
</div>

@Html.Partial("OrderDetail", Session["LoginUser"] as Com._9pm2.ClientWeb.Models.LoginUser)
@Html.Partial("OrderAttachment")
@Html.Partial("OrderTransfer")
@Html.Partial("OrderCurrentStep")
<input type="hidden" id="OrderNo" />