130 lines
3.3 KiB
Plaintext
130 lines
3.3 KiB
Plaintext
|
|
|
|
<br><br><br><br>
|
|
<div class="card" id="secondary-card" style="display:none;">
|
|
<div class="card-header ui-sortable-handle" style="cursor: move;">
|
|
<h3 class="card-title">Users</h3>
|
|
<div class="card-tools"></div>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<table id="User_list_table">
|
|
<thead>
|
|
<tr>
|
|
<th>Number /<br>Nickname</th>
|
|
<th>Total Balance</th>
|
|
<th>Type</th>
|
|
<th><center>Active</center></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<br><br><br>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
function GenerateUserRow(Number,Total_Balance,Type,Active,Hashkey){
|
|
let activecheckbox='';
|
|
|
|
if (Active==='1' || Active===1 ){
|
|
Active= 'checked';
|
|
} else { Active= '';}
|
|
|
|
activecheckbox='<div class="input-group mb-3" id="NewPropertyPropertyName-div-mb3" style=""><input class="" type="checkbox" '+Active+' disabled></div>';
|
|
const actionbutton =`<button class="btn btn-warning" onclick="gotoPage('UserModify','${Hashkey}')">View User</button>`;
|
|
let numandnick = Number;
|
|
numandnick = numandnick.replace('----','<br>');
|
|
numandnick = numandnick.replace('----','<br>');
|
|
numandnick =`<a href="#" onclick="gotoPage('UserModify','${Hashkey}');return false;">${numandnick}</a>`;
|
|
if (Type=='user'){Type='Player';}
|
|
if (Type=='usher'){Type='Leader';}
|
|
if (Type=='coordinator'){Type='Team Leader';}
|
|
return `<tr>
|
|
<td>${numandnick}</td>
|
|
<td>${Total_Balance}</td>
|
|
<td>${Type}</td>
|
|
<td>${activecheckbox}</td>
|
|
</tr>`;
|
|
}
|
|
|
|
|
|
|
|
|
|
async function GenerateUserRows(responsearray) {
|
|
//console.log(responsearray);
|
|
let newhtmltable = '';
|
|
|
|
for (let i = 0; i < responsearray.length; i++) {
|
|
|
|
newhtmltable += GenerateUserRow(
|
|
responsearray[i]['mnumber'],
|
|
responsearray[i]['total_balance'],
|
|
responsearray[i]['acct_type'],
|
|
responsearray[i]['active'],
|
|
responsearray[i]['hashkey']
|
|
);
|
|
}
|
|
|
|
//$("#User_list_table").find("tbody").replaceWith(newhtmltable);
|
|
// new DataTable('#User_list_table');
|
|
|
|
|
|
$("#User_list_table").find("tbody").html(newhtmltable);
|
|
|
|
|
|
|
|
let userlist = $("#User_list_table").DataTable({
|
|
"destroy": true,
|
|
order: [[0, 'desc']],
|
|
pageLength: 5,
|
|
lengthMenu: [[5], [5]]
|
|
});
|
|
|
|
|
|
|
|
userlist.on('click', 'tbody tr', function () {
|
|
let data = userlist.row(this).data();
|
|
if (typeof data==='undefined'){return false;}
|
|
let targettranshash = data[0];
|
|
console.log(targettranshash);
|
|
$(targettranshash).find('a').trigger('click');
|
|
|
|
|
|
});
|
|
|
|
$('#secondary-card').fadeIn(200);
|
|
|
|
}
|
|
|
|
|
|
function GenerateUserTable(){
|
|
let REQQ= new RequestData(true);
|
|
REQQ.url('/admin/users/list').type('POST').success((response)=>{
|
|
GenerateUserRows(response);
|
|
}).go();
|
|
// AjaxDo('?/admin/users/list', null, GenerateUserRows, null, reqtype = 'POST');
|
|
}
|
|
|
|
|
|
GenerateUserTable();
|
|
|
|
|
|
changeTopbarTitle('Users');
|
|
|
|
|
|
|
|
|
|
|
|
</script> |