- {{--
-
-
-
-
- | --}}
- {{$user->id}}
+
+
+
+
|
-
+ |
+ {{$user->id}}
+ |
+
@if($user->account)
-
+
@endif
{{$user->username}}
@@ -189,5 +196,86 @@
});
})
}
+
+ let app = new Vue({
+ el: '#panel',
+
+ data() {
+ return {
+ selectedAll: false
+ }
+ },
+
+ watch: {
+ selectedAll(val) {
+ if(val) {
+ if(document.querySelectorAll('.action-check').length == 0) {
+ this.selectedAll = false;
+ return;
+ }
+ document.querySelectorAll('.action-check').forEach(v => v.checked = true)
+ } else {
+ document.querySelectorAll('.action-check').forEach(v => v.checked = false)
+ }
+ }
+ },
+
+ methods: {
+ async deleteSelected() {
+ let usernames = [...document.querySelectorAll('.action-check:checked')].map(el => el.dataset.username);
+ let ids = [...document.querySelectorAll('.action-check:checked')].map(el => el.dataset.id);
+
+ swal({
+ title: 'Confirm mass deletion',
+ text: "Are you sure you want to delete the following accounts: \n\n" + usernames.join(" \n"),
+ icon: 'warning',
+ dangerMode: true,
+ buttons: {
+ cancel: {
+ text: "Cancel",
+ value: false,
+ closeModal: true,
+ visible: true,
+ },
+ delete: {
+ text: "Delete",
+ value: "delete",
+ className: "btn-danger"
+ }
+ }
+ })
+ .then(async (res) => {
+ if(res !== 'delete') {
+ swal('Mass delete cancelled', '', 'success');
+ } else {
+ swal({
+ title: 'Processing mass deletes',
+ text: 'Do not close or navigate away from this page while we process this request',
+ icon: 'warning',
+ timer: 4000
+ })
+
+ await axios.all(ids.map((acct) => this.deleteAccountById(acct)))
+ .finally(() => {
+ swal({
+ title: 'Accounts successfully deleted!',
+ text: 'This page will refresh shortly!',
+ icon: 'success',
+ timer: 1000
+ })
+ setTimeout(() => {
+ window.location.reload();
+ }, 10000)
+ })
+ }
+ })
+ },
+
+ async deleteAccountById(id) {
+ await axios.post('/i/admin/users/delete/' + id)
+ }
+ }
+ });
+
@endpush
|