@Master['admin/admin-layout']

@Section['Content']
  <div class="row">
    <p><a class="btn btn-primary" href="/category/new/edit"><i class="fa fa-plus"></i> @Translate.AddNew</a></p>
  </div>
  <div class="row">
    <table class="table table-hover">
      <tr>
        <th>@Translate.Action</th>
        <th>@Translate.Category</th>
        <th>@Translate.Description</th>
      </tr>
      @Each.Categories
        <tr>
          <td>
            <a href="/category/@Current.Category.Id/edit">@Translate.Edit</a> &nbsp;
            <a href="javascript:void(0)" onclick="deleteCategory('@Current.Category.Id', '@Current.Category.Name')">
              @Translate.Delete
            </a>
          </td>
          <td>@Current.ListName</td>
          <td>
            @If.HasDescription
              @Current.Category.Description.Value
            @EndIf
            @IfNot.HasDescription
              &nbsp;
            @EndIf
          </td>
        </tr>
      @EndEach
    </table>
  </div>
  <form method="post" id="deleteForm">
    @AntiForgeryToken
  </form>
@EndSection

@Section['Scripts']
  <script type="text/javascript">
    /* <![CDATA[ */
    function deleteCategory(id, title) {
      if (confirm('@Translate.CategoryDeleteWarning "' + title + '"?')) {
        document.getElementById("deleteForm").action = "/category/" + id + "/delete"
        document.getElementById("deleteForm").submit()
      }
    }
    /* ]] */
  </script>
@EndSection