Files
Chad Whitacre 5618a82efc Update fraud dashboard for new design; #598
I actually dodged the new design entirely. Gives us more real estate
this way.
2013-02-07 06:52:53 -05:00

90 lines
2.0 KiB
HTML

from aspen import Response
from gittip import db
title = "Fraud Review Dashboard"
^L
if not user.ADMIN:
raise Response(404)
unreviewed = db.fetchall("""
SELECT id
, balance
FROM participants
WHERE is_suspicious IS NULL
AND ( last_bill_result IS NOT NULL
OR last_ach_result IS NOT NULL
)
ORDER BY claimed_time
""")
if unreviewed is None:
unreviewed = []
unreviewed = list(unreviewed)
^L
<script src="/assets/jquery-1.8.3.min.js"></script>
<script src="/assets/-/gittip.js"></script>
<style>
TABLE {
width: auto;
}
TD, TH {
text-align: left;
vertical-align: top;
}
IFRAME {
width: 70%;
height: 100%;
position: fixed;
top: 0;
right: 0;
background: white;
}
</style>
<script>
$(document).ready(function()
{
Gittip.initCSRF();
function error(a,b,c)
{
console.log(a,b,c);
alert("Failed!");
}
$('BUTTON').click(function()
{
var row = $(this).parent();
var to = $(this).text() !== 'Good';
var participant_id = row.attr('participant_id');
var url = "/" + participant_id + "/toggle-is-suspicious.json";
function success()
{
row.remove();
$('iframe').attr('src', '');
}
jQuery.ajax({ url: url
, type: "POST"
, dataType: "json"
, data: {to: to}
, success: success
, error: error
})
});
});
</script>
<h3>Unreviewed Accounts (N = {{ len(unreviewed) }})</h3>
{% for account in unreviewed %}
<div participant_id="{{ account['id'] }}">
<button class="good small selected">Good</button>
<button class="bad small">Bad</button>
&nbsp;
<a href="/{{ account['id'] }}/" target="drill-down">{{ account['id'] }}</a>
</div>
{% end %}
<iframe name="drill-down"></iframe>