<commit_before>{% extends "base-admin.html" %}
{% block title %}Accounts{% endblock %}
{% block content %}

<ol class="breadcrumb">
  <li><a href="../accounts/homepage">Home</a></li>
  <li class="active">Accounts</li>
</ol>

<div class="panel panel-default">
<div class="panel-heading"><h3>New Account</h3></div>
<form id="new_admin" method="post" action="update" role="form" class="form-inline">
<input type="hidden" name="id" value="None" />
{% csrf_token %}
<div class="form-group">
    <label for="attendee_id" class="sr-only">Attendee</label>
    <select class="form-control" id="attendee_id" name="attendee_id">
        {% options all_attendees %}
    </select>
</div>
<div class="form-group">
    <div class="input-group input-group-sm">
    <label for="password" class="sr-only">Password</label>
    <input type="password" class="form-control" id="password" name="password" placeholder="Password" 
       {% if not c.AT_THE_CON %}disabled{% endif %}>
       {% if not c.AT_THE_CON %}
           <span class="input-group-addon glyphicon glyphicon-ban-circle">
           </span>
       {% endif %}
    </div>
</div>
<div class="form-group">
    {% checkgroup AdminAccount.access %}
</div>
<button type="submit" class="btn btn-default">Create Account</button>
</form>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3>Existing Accounts</h3></div>

<div class="table-responsive">
<table class="table table-striped datatable">
<thead><tr>
    <th></th>
    <th>Name</th>
    <th>Email</th>
    <th data-hide="phone">Access</th>
</tr></thead>
<tbody>
{% for account in accounts %}
    <tr id="{{ account.email|idize }}">
        <td>
            <div class="btn-group-vertical">
                <button type="submit" class="btn btn-primary update-button"><span class="glyphicon glyphicon-floppy-disk"></span></button>
                <form method="post" action="delete">
                    <input type="hidden" name="id" value="{{ account.id }}" />
                    <button type="submit" type="button" class="btn btn-danger delete-button"><span class="glyphicon glyphicon-trash"></span></button>
                </form>
            </div>
        </td>
        <td> <nobr><a href="../registration/form?id={{ account.attendee.id }}">{{ account.attendee.full_name }}</a></nobr> </td>
        <td> <a href="mailto:{{ account.attendee.email }}">{{ account.attendee.email }}</a> </td>
        <td>
            <form class="form update-form" method="post" action="update">
                <input type="hidden" name="id" value="{{ account.id }}" />
                {% csrf_token %}
                <div class="form-group">{% checkgroup account.access %}</div>
            </form>
        </td>
    </tr>
{% endfor %}
</tbody>
</table>
</div>

<script>
$(function() {
    $('.delete-button').click(function (event) {
        event.preventDefault();
        $.confirm({
            text: 'Are you sure you want to delete that account?',
            confirm: function () {
                $(event.target).parents('form').submit();
            },
            cancel: function () { }
        });
    });
    $('.update-button').click(function (event) {
        $(event.target).parents('tr').find('.update-form').submit();
    });
});
</script>

</div>
{% endblock %}
<commit_msg>changed click handler to be a 'live' handler for admin form<commit_after>{% extends "base-admin.html" %}
{% block title %}Accounts{% endblock %}
{% block content %}

<ol class="breadcrumb">
  <li><a href="../accounts/homepage">Home</a></li>
  <li class="active">Accounts</li>
</ol>

<div class="panel panel-default">
<div class="panel-heading"><h3>New Account</h3></div>
<form id="new_admin" method="post" action="update" role="form" class="form-inline">
<input type="hidden" name="id" value="None" />
{% csrf_token %}
<div class="form-group">
    <label for="attendee_id" class="sr-only">Attendee</label>
    <select class="form-control" id="attendee_id" name="attendee_id">
        {% options all_attendees %}
    </select>
</div>
<div class="form-group">
    <div class="input-group input-group-sm">
    <label for="password" class="sr-only">Password</label>
    <input type="password" class="form-control" id="password" name="password" placeholder="Password" 
       {% if not c.AT_THE_CON %}disabled{% endif %}>
       {% if not c.AT_THE_CON %}
           <span class="input-group-addon glyphicon glyphicon-ban-circle">
           </span>
       {% endif %}
    </div>
</div>
<div class="form-group">
    {% checkgroup AdminAccount.access %}
</div>
<button type="submit" class="btn btn-default">Create Account</button>
</form>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h3>Existing Accounts</h3></div>

<div class="table-responsive">
<table class="table table-striped datatable">
<thead><tr>
    <th></th>
    <th>Name</th>
    <th>Email</th>
    <th data-hide="phone">Access</th>
</tr></thead>
<tbody>
{% for account in accounts %}
    <tr id="{{ account.email|idize }}">
        <td>
            <div class="btn-group-vertical">
                <button type="submit" class="btn btn-primary update-button"><span class="glyphicon glyphicon-floppy-disk"></span></button>
                <form method="post" action="delete">
                    <input type="hidden" name="id" value="{{ account.id }}" />
                    <button type="submit" type="button" class="btn btn-danger delete-button"><span class="glyphicon glyphicon-trash"></span></button>
                </form>
            </div>
        </td>
        <td> <nobr><a href="../registration/form?id={{ account.attendee.id }}">{{ account.attendee.full_name }}</a></nobr> </td>
        <td> <a href="mailto:{{ account.attendee.email }}">{{ account.attendee.email }}</a> </td>
        <td>
            <form class="form update-form" method="post" action="update">
                <input type="hidden" name="id" value="{{ account.id }}" />
                {% csrf_token %}
                <div class="form-group">{% checkgroup account.access %}</div>
            </form>
        </td>
    </tr>
{% endfor %}
</tbody>
</table>
</div>

<script>
$(function() {
    $(document.body).on('click', '.delete-button', function (event) {
        event.preventDefault();
        $.confirm({
            text: 'Are you sure you want to delete that account?',
            confirm: function () {
                $(event.target).parents('form').submit();
            },
            cancel: function () { }
        });
    });
    $(document.body).on('click', '.update-button', function (event) {
        $(event.target).parents('tr').find('.update-form').submit();
    });
});
</script>

</div>
{% endblock %}

{'fraction_non_alphanumeric': 0.20502843460041903, 'fraction_numerical': 0.001197246333433104, 'mean_word_length': 2.9288653733098178, 'pattern_counts': {'":': 0, '<': 195, '<?xml version=': 0, '>': 195, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7230028', 'n_tokens_mistral': 2187, 'n_tokens_neox': 2088, 'n_words': 432}