@using SharpConnector.Constants;
@using SharpConnector.Models;
@model List<CoverPage>

@{ 
    var docs = (List<Document>)Session[Const.Documents] ?? new List<Document>();
    var coverPage = docs.Where(d => d.IsMerge).Select(d => d.Name).FirstOrDefault();
}

@using (Html.BeginForm("Add", "CoverPage", FormMethod.Post))
{
    <div id="btn_wrapper">
        <div class="left">
            <input type="button" value="Back" onclick="navigateTo('@Url.Action("Index", "Home")');" />
        </div>
        <div id="title">
            <h3 class="text-center">Cover Page</h3>
        </div>
        <div class="right">
            <input type="submit" value="Save" id="btn_save" />
        </div>
    </div>

    <div class="inner_wrapper stretch_to_bottom">
        <table id="table_coverpage" cellpadding="10" align="center">
            <tbody>
                <tr>
                    <td>
                        <input type="radio" name="coverPage" id="none" value="" @(string.IsNullOrEmpty(coverPage) ? "checked=\"checked\"" : "") />
                        <label for="none">None</label>
                    </td>
                </tr>

                @if (Model != null)
                {
                    foreach (var c in Model)
                    {
                        <tr>
                            <td>
                                <input type="radio" name="coverPage" id="@c.DocumentID" value="@c.DocumentName" @(string.Equals(c.DocumentName, coverPage) ? "checked=\"checked\"" : "") />
                                <label for="@c.DocumentID">@c.DocumentName</label>
                            </td>
                        </tr>
                    }
                }
            </tbody>
        </table>
    </div>
}

@section Scripts
{
    <script type="text/javascript">

    </script>
}