@using MrCMS.Helpers
@model System.Collections.Generic.List<MrCMS.Web.Areas.Admin.Models.MessageTemplateInfo>
@{
    ViewBag.Title = "Message Templates";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

<h1 class="page-header">@Resource("Admin Message Templates Title", "Message Templates")</h1>
<table class="table table-condensed table-striped">
    <thead>
        <tr>
            <th>
                @Resource("Message template index - Template Type", "Template Type")
            </th>
            <th>
                @Resource("Message template index - System/Site", "System/Site")
            </th>
            <th>
                @Resource("Message template index - Enabled?", "Enabled?")
            </th>
            <th>
                @Resource("Message template index - Actions", "Actions")
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @item.Type.Name.BreakUpString()
                </td>
                <td>
                    @(item.IsOverride ? Resource("Site Override") : Resource("System Default"))
                </td>
                <td>
                    @(item.IsEnabled ? Resource("Message Template Enabled", "Enabled") : Resource("Message Template Disabled", "Disabled"))
                </td>
                <td>
                    <div class="btn-group">
                        @*@Html.ActionLink(Resource("Edit"), "Edit", new { type = item.TypeName }, new { @class = "btn btn-default btn-xs" })*@
                        @if (item.LegacyTemplateExists)
                        {
                            @Html.ActionLink(Resource("Import legacy template"), "ImportLegacyTemplate", "MessageTemplate", new { type = item.TypeName }, new { @class = "btn btn-default btn-xs", data_toggle = "fb-modal" })
                        }
                        @if (!item.IsOverride)
                        {
                            @Html.ActionLink(Resource("Add site override"), "AddSiteOverride", "MessageTemplate", new { type = item.TypeName }, new { @class = "btn btn-default btn-xs" })
                        }
                        else
                        {
                            @Html.ActionLink(Resource("Delete site override"), "DeleteSiteOverride", "MessageTemplate", new { type = item.TypeName }, new { @class = "btn btn-default btn-xs", data_toggle = "fb-modal" })
                        }
                        @Html.ActionLink(Resource("Edit"), "Edit", new { type = item.TypeName }, new { @class = "btn btn-default btn-xs" })
                        @if (item.CanPreview)
                        {
                            @Html.ActionLink(Resource("Preview"), "Get", "MessageTemplatePreview", new { type = item.TypeName }, new { @class = "btn btn-xs btn-default" })
                        }
                    </div>
                </td>
            </tr>
        }
    </tbody>
</table>
