/**
* The Player Reports page: reports players sent from the game, newest first, filtered by status (and by the account
* they're about with ?account=). Staff who may handle them act on one (with the usual reject dialog, which can add a
* strike) or dismiss it. Kinds and statuses are named by the server.
*/
(function () {
'use strict';
var PAGE = 50;
var params = new URLSearchParams(location.search);
var state = { status: params.has('status') ? params.get('status') : '0', account: params.get('account') || '', offset: 0, statuses: null };
var STATUS_STYLE = { OPEN: 'warning', ACTIONED: 'success', DISMISSED: 'secondary' };
var reports = {};
function renderStatuses(statuses) {
if (state.statuses) return;
state.statuses = statuses;
var options = statuses.concat([{ value: '', name: 'All' }]);
document.getElementById('statusFilter').innerHTML = options.map(function (s) {
var id = 'status' + (s.value === '' ? 'All' : s.value);
return '' +
'';
}).join('');
}
function about(r) {
var parts = [];
if (r.target_character_id !== '0') parts.push(fmt.character(r.target_character_id, r.target_name));
if (r.target_account_id) parts.push('' + esc(r.target_account_name || ('Account ' + r.target_account_id)) + '');
if (r.property_id !== '0') parts.push('' + esc(r.property_name || 'Property') + '');
if (r.kind !== 'PLAYER' && r.object_lot) parts.push('' + esc(r.object_name || ('LOT ' + r.object_lot)) + ' (' + esc(r.object_id) + ')');
return parts.join(' ') || 'Unknown';
}
function row(r, canManage) {
reports[r.id] = r;
var status = fmt.badge(r.status_name, STATUS_STYLE[r.status_key] || 'secondary');
var handled = r.handled_at ? '