<div class="header-Outro">
  <div class="row content single-Col">
    <h1>Account Settings</h1>
    <h3 class="subtitle">Manage the account for your sites</h3>
  </div>
</div>

<div class="content single-Col misc-page txt-Center">
  <article>
    <section>
      <div class="tabbable" style="margin-top: 20px"> <!-- Only required for left/right tabs -->
        <ul class="nav nav-tabs">

          <li class="active"><a href="#sites" data-toggle="tab">Sites</a></li>
          <li><a href="#supporter" data-toggle="tab">Supporter</a></li>
          <li><a href="#password" data-toggle="tab">Password</a></li>
          <li><a href="#email" data-toggle="tab">Email</a></li>
          <% if current_site.stripe_paying_supporter? %>
            <li><a href="#billing" data-toggle="tab">Change Card</a></li>
          <% end %>
          <% if parent_site == current_site && parent_site.children_dataset.count == 0 %>
            <li><a href="#delete" data-toggle="tab">Delete Account</a></li>
          <% end %>
        </ul>
        <div class="tab-content">
          <div class="tab-pane active" id="sites">
            <%== erb :'settings/account/sites' %>
          </div>
          <div class="tab-pane" id="supporter">
            <%== erb :'settings/account/supporter' %>
          </div>
          <div class="tab-pane" id="password">
            <%== erb :'settings/account/password' %>
          </div>
          <div class="tab-pane" id="email">
            <%== erb :'settings/account/email' %>
          </div>
          <% if current_site.stripe_paying_supporter? %>
            <div class="tab-pane" id="billing">
              <%== erb :'settings/account/billing' %>
            </div>
          <% end %>
          <% if parent_site == current_site && parent_site.children_dataset.count == 0 %>
            <div class="tab-pane" id="delete">
              <%== erb :'settings/site/delete' %>
            </div>
          <% end %>
        </div>
      </div>
    </section>
  </article>
</div>

<div class="modal hide" id="deleteSite" tabindex="-1" role="dialog" aria-labelledby="deleteSiteLabel" aria-hidden="true">
  <form method="POST" action="/site/delete">
    <%== csrf_token_input_html %>
    <div class="modal-header">
      <button class="close" type="button" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
      <h3 id="deleteSiteLabel">Permanently Delete Site</h3>
    </div>
    <div class="modal-body">
      <strong style="color: red">WARNING: This will permanently delete your web site and Neocities account. You will not be able to use the same e-mail address to create a new site. There is no undo.</strong>

      <p>Delete Site Name: <strong><%= current_site.username %></strong></p>
      <p>Confirm your site name by typing it here:</p>
      <input class="input-Area" name="username" type="text">
    </div>
    <div class="modal-footer">
      <button class="btn cancel" data-dismiss="modal" aria-hidden="true">Cancel</button>
      <button type="submit" class="btn-Action">Permanently Delete Site</button>
    </div>
  </form>
</div>

<script>
$(document).ready(function() {
    if (location.hash !== '') $('a[href="' + location.hash + '"]').tab('show');
    return $('a[data-toggle="tab"]').on('shown', function(e) {
      return location.hash = $(e.target).attr('href').substr(1);
    });
});
</script>
