@model TopicModel

@using Telerik.Web.Mvc.UI;

@Html.ValidationSummary(false)

<script type="text/javascript">
    $(document).ready(function () {
        $("#@Html.FieldIdFor(model => model.IsPasswordProtected)").click(togglePassword);
        togglePassword();
    });
    function togglePassword() {
        if (getE('@Html.FieldIdFor(model => model.IsPasswordProtected)').checked) {
            $('#pnlPasswordEnabled').show();
        }
        else {
            $('#pnlPasswordEnabled').hide();
        }
    }       
</script>
@Html.HiddenFor(model => model.Id)
@Html.Telerik().TabStrip().Name("topic-edit").Items(x =>
{
    x.Add().Text(T("Admin.ContentManagement.Topics.Info").Text).Content(TabInfo().ToHtmlString()).Selected(true);
    x.Add().Text(T("Admin.Common.SEO").Text).Content(TabSeo().ToHtmlString());
})
@helper TabInfo()
    { 
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.SystemName):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SystemName)
                @Html.ValidationMessageFor(model => model.SystemName)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.IsPasswordProtected):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.IsPasswordProtected)
                @Html.ValidationMessageFor(model => model.IsPasswordProtected)
            </td>
        </tr>
        <tr id="pnlPasswordEnabled">
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.Password):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Password)
                @Html.ValidationMessageFor(model => model.Password)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.IncludeInSitemap):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.IncludeInSitemap)
                @Html.ValidationMessageFor(model => model.IncludeInSitemap)
            </td>
        </tr>
        @if (Model.Id > 0)
        {
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.Url):
                </td>
                <td class="adminData">
                    <a href="@Model.Url">@Model.Url</a>
                </td>
            </tr>
        }
    </table>
    @(Html.LocalizedEditor<TopicModel, TopicLocalizedModel>("topic-info-localized",
                @<table class="adminContent">
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Locales[item].Title):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(model => Model.Locales[item].Title)
                            @Html.ValidationMessageFor(model => model.Locales[item].Title)
                        </td>
                    </tr>
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Locales[item].Body):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(model => model.Locales[item].Body, "RichEditor")
                            @Html.ValidationMessageFor(model => model.Locales[item].Body)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            @Html.HiddenFor(model => model.Locales[item].LanguageId)
                        </td>
                    </tr>
                </table>
                ,
                @<table class="adminContent">
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Title):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(model => model.Title)
                            @Html.ValidationMessageFor(model => model.Title)
                        </td>
                    </tr>
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Body):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(x => x.Body, "RichEditor")
                            @Html.ValidationMessageFor(model => model.Body)
                        </td>
                    </tr>
                </table>
            ))
}
@helper TabSeo()
    {
    @(Html.LocalizedEditor<TopicModel, TopicLocalizedModel>("topic-seo-localized",
               @<table class="adminContent">
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.Locales[item].MetaKeywords):
                       </td>
                       <td class="adminData">
                           @Html.EditorFor(model => model.Locales[item].MetaKeywords)
                           @Html.ValidationMessageFor(model => model.Locales[item].MetaKeywords)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.Locales[item].MetaDescription):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(model => model.Locales[item].MetaDescription)
                           @Html.ValidationMessageFor(model => model.Locales[item].MetaDescription)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.Locales[item].MetaTitle):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(model => model.Locales[item].MetaTitle)
                           @Html.ValidationMessageFor(model => model.Locales[item].MetaTitle)
                       </td>
                   </tr>
                   <tr>
                       <td colspan="2">
                           @Html.HiddenFor(model => model.Locales[item].LanguageId)
                       </td>
                   </tr>
               </table>
               ,
               @<table class="adminContent">
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.MetaKeywords):
                       </td>
                       <td class="adminData">
                           @Html.EditorFor(x => x.MetaKeywords)
                           @Html.ValidationMessageFor(model => model.MetaKeywords)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.MetaDescription):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(x => x.MetaDescription)
                           @Html.ValidationMessageFor(model => model.MetaDescription)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.MetaTitle):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(x => x.MetaTitle)
                           @Html.ValidationMessageFor(model => model.MetaTitle)
                       </td>
                   </tr>
               </table>))
}