@using Com._9pm2.ClientWeb.Common
@{
    ViewBag.Title = "日程管理";
}
@model System.Collections.Generic.List<Com._9pm2.ClientWeb.Database.ToDo>


<script src="../../Scripts/todolist.js?vn=20180813"></script>

<div style="margin:0 auto;">
    <div class="divSearch">
        <form method="get" action="/MySpace/ToDoList">
            &nbsp;&nbsp;执行日期
            @Html.TextBox("sb", null, new { maxlength = "50", @class = "text-date" }) ~ @Html.TextBox("se", null, new { maxlength = "50", @class = "text-date" })

            关键字

            @Html.TextBox("sk", null, new { maxlength = "50", style = "width:110px" })

            办理状态

            @Html.DropDownList("ss", new SelectList(ViewData["ddlStatus"] as List<SimpleItemList>, "ItemValue", "ItemText"))
            <button type="submit" class="btn btn-default" id="btnSearch">查询</button>

            <div class="btn-group">
                <button type="button" class="btn btn-default" id="btnNew">新增</button>
                <button type="button" class="btn btn-default" onclick="history.go(-1)" id="btnReturn">返回</button>
            </div>

        </form>
    </div>

    <div class="list">
        <div class="callout callout-info lead">提示：仅显示前200条记录。更多记录请通过条件查询。</div>


        <table id="tToDo">
            <thead>
                <tr>
                    <th style="width:120px">执行日期</th>
                    <th>事项</th>
                    <th>备注</th>
                    <th style="width:100px">状态</th>
                    <th style="width:80px"></th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>
                            @item.ExecuteDate.ToString("yyyy-MM-dd")
                        </td>
                        <td>@item.Title</td>
                        <td>@item.Memo</td>
                        <td>@((ToDoStatus)item.Status)</td>
                        <td>

                            <div class="operation-btns">
                                <div>
                                    <button id="select">&nbsp;</button>
                                </div>
                                <ul>
                                    @if (item.Status == 1)
                                    {
                                        <li><a href="javascript:void(0);" onclick="CompleteToDo('@item.Id')">完成</a></li>
                                    }
                                    <li><a href="javascript:void(0);" onclick="EditToDo('@item.Id')">编辑</a></li>
                                    <li><a href="javascript:void(0);" onclick="DeleteToDo('@item.Id')">删除</a></li>
                                </ul>
                            </div>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>

</div>


<div id="divToDo" title="日程信息" style="display:none">
    <div id="divToDoContent" style="overflow-y: auto; height: 240px;">
        @using (Html.BeginForm())
            {
            <table class="font85 tableEdit">

                <tr>
                    <td class="label">事项</td>
                    <td>
                        @Html.TextBox("Title")&nbsp;<span class="redStar">*</span>
                    </td>
                </tr>
                <tr>
                    <td class="label">日期</td>
                    <td>
                        @Html.TextBox("ExecuteDate", null, new { maxlength = "50", @class = "text-date" }) &nbsp;<span class="redStar">*</span>
                        @Html.Hidden("Id")
                    </td>
                </tr>
                <tr>
                    <td class="label">状态</td>
                    <td style="padding:5px 0" class="todo-status">
                        <div>
                            @Html.RadioButton("Status", "1") <span style="color:#f00;font-weight:bold">待办</span>
                        </div>
                        <div>
                            @Html.RadioButton("Status", "2") <span style="color:#00f;font-weight:bold">已完结</span>
                        </div>
                        <div>
                            @Html.RadioButton("Status", "4") <span style="color:#666;font-weight:bold">无效</span>
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="label">备注</td>
                    <td>
                        @Html.TextArea("Memo", null, new { maxlength = "500", @style = "height:80px" })
                    </td>
                </tr>
            </table>
        }
    </div>
    <div style="text-align:right;">
        <span id="errorMessage" class="errorSpan"></span>
        <button class="btn btn-primary" type="button" id="btnSave">保存</button>
        <button type="button" class="btn btn-default" id="btnCancel">取消</button>
    </div>
</div>
