2021-01-19 17:55:21 +01:00
<main class="container-xl">
2020-05-28 10:42:36 +02:00
<div id="organizations-block" class="my-3 p-3 bg-white rounded shadow">
2020-09-19 22:19:55 +02:00
<h6 class="border-bottom pb-2 mb-3">Organizations</h6>
2020-05-28 10:42:36 +02:00
2020-06-03 20:37:31 +02:00
<div class="table-responsive-xl small">
2020-09-19 22:19:55 +02:00
<table id="orgs-table" class="table table-sm table-striped table-hover">
2020-06-03 20:37:31 +02:00
<thead>
<tr>
2020-09-19 22:19:55 +02:00
<th>Organization</th>
2020-06-03 20:37:31 +02:00
<th>Users</th>
<th>Items</th>
<th>Attachments</th>
2021-02-03 18:43:54 +01:00
<th style="width: 120px; min-width: 120px;">Actions</th>
2020-06-03 20:37:31 +02:00
</tr>
</thead>
<tbody>
{{ # each organizations }}
<tr>
<td>
2020-09-19 22:19:55 +02:00
<img class="mr-2 float-left rounded identicon" data-src=" {{ Id }} ">
<div class="float-left">
<strong> {{ Name }} </strong>
<span class="mr-2">( {{ BillingEmail }} )</span>
<span class="d-block">
<span class="badge badge-success"> {{ Id }} </span>
</span>
</div>
2020-06-03 20:37:31 +02:00
</td>
<td>
<span class="d-block"> {{ user_count }} </span>
</td>
<td>
<span class="d-block"> {{ cipher_count }} </span>
</td>
<td>
<span class="d-block"><strong>Amount:</strong> {{ attachment_count }} </span>
{{ # if attachment_count }}
<span class="d-block"><strong>Size:</strong> {{ attachment_size }} </span>
2020-05-28 10:42:36 +02:00
{{ / if }}
2020-06-03 20:37:31 +02:00
</td>
2021-02-03 18:43:54 +01:00
<td style="font-size: 90%; text-align: right; padding-right: 15px">
<a class="d-block" href="#" onclick='deleteOrganization( {{ jsesc Id }} , {{ jsesc Name }} , {{ jsesc BillingEmail }} )'>Delete Organization</a>
</td>
2020-06-03 20:37:31 +02:00
</tr>
{{ / each }}
</tbody>
</table>
2020-05-28 10:42:36 +02:00
</div>
2020-09-19 22:19:55 +02:00
2020-05-28 10:42:36 +02:00
</div>
</main>
2020-09-19 22:19:55 +02:00
<link rel="stylesheet" href=" {{ urlpath }} /bwrs_static/datatables.css" />
<script src=" {{ urlpath }} /bwrs_static/jquery-3.5.1.slim.js"></script>
<script src=" {{ urlpath }} /bwrs_static/datatables.js"></script>
2020-05-28 10:42:36 +02:00
<script>
2021-02-03 18:43:54 +01:00
function deleteOrganization(id, name, billing_email) {
// First make sure the user wants to delete this organization
var continueDelete = confirm("WARNING: All data of this organization ("+ name +") will be lost!\nMake sure you have a backup, this cannot be undone!");
if (continueDelete == true) {
var input_org_uuid = prompt("To delete the organization '" + name + " (" + billing_email +")', please type the organization uuid below.")
if (input_org_uuid != null) {
if (input_org_uuid == id) {
_post(" {{ urlpath }} /admin/organizations/" + id + "/delete",
"Organization deleted correctly",
"Error deleting organization");
} else {
alert("Wrong organization uuid, please try again")
}
}
}
return false;
}
2021-02-27 06:48:01 +01:00
(async () => {
for (let e of document.querySelectorAll("img.identicon")) {
e.src = await identicon(e.dataset.src);
}
})();
2020-09-19 22:19:55 +02:00
document.addEventListener("DOMContentLoaded", function(event) {
$('#orgs-table').DataTable( {
"responsive": true,
"lengthMenu": [ [-1, 5, 10, 25, 50], ["All", 5, 10, 25, 50] ],
"pageLength": -1, // Default show all
2021-02-03 18:43:54 +01:00
"columnDefs": [
{ "targets": 4, "searchable": false, "orderable": false }
]
2020-09-19 22:19:55 +02:00
});
});
2021-02-27 06:48:01 +01:00
</script>