Skip to content

Commit 0138cfa

Browse files
committed
Admin dashboard
1 parent 1946d10 commit 0138cfa

File tree

1 file changed

+99
-26
lines changed

1 file changed

+99
-26
lines changed

resources/views/admin_dashboard.blade.php

Lines changed: 99 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,27 @@
263263
</div>
264264
</div>
265265
</div>
266+
<div class="modal fade text-center" id="backdrop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel20" aria-hidden="true">
267+
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-xs" role="document">
268+
<div class="modal-content">
269+
<div class="modal-header">
270+
<h4 class="modal-title" id="code_title"></h4>
271+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
272+
<span aria-hidden="true">&times;</span>
273+
</button>
274+
</div>
275+
<div class="modal-body">
276+
<p id="code_url">
277+
278+
</p>
279+
<img id="code_preview" src="" width="200">
280+
</div>
281+
<div class="modal-footer">
282+
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
283+
</div>
284+
</div>
285+
</div>
286+
</div>
266287
<!-- END: Content-->
267288
<div class="sidenav-overlay"></div>
268289
<div class="drag-target"></div>
@@ -451,48 +472,100 @@
451472
})
452473
function lockUser(state, user_id) {
453474
if (state) {
475+
$.ajax({
476+
url: "{{ url('/setlockuser') }}",
477+
data: {state : 1, user_id: user_id},
478+
dataType: "text",
479+
success : function (data) {
480+
toastr.success('That user was locked successfully.', 'Notification', {
481+
"showMethod": "fadeIn",
482+
"hideMethod": "fadeOut",
483+
"closeButton": true,
484+
"progressBar": true,
485+
timeOut: 2000
486+
});
487+
},
488+
failure: function () {
454489
455-
toastr.success('That user was locked successfully.', 'Notification', {
456-
"showMethod": "fadeIn",
457-
"hideMethod": "fadeOut",
458-
"closeButton": true,
459-
"progressBar": true,
460-
timeOut: 2000
490+
}
461491
});
462492
}else{
463-
toastr.success('That user was unlocked successfully.', 'Notification', {
464-
"showMethod": "fadeIn",
465-
"hideMethod": "fadeOut",
466-
"closeButton": true,
467-
"progressBar": true,
468-
timeOut: 2000
493+
$.ajax({
494+
url: "{{ url('/setlockuser') }}",
495+
data: {state : 0, user_id: user_id},
496+
dataType: "text",
497+
success : function (data) {
498+
toastr.success('That user was unlocked successfully.', 'Notification', {
499+
"showMethod": "fadeIn",
500+
"hideMethod": "fadeOut",
501+
"closeButton": true,
502+
"progressBar": true,
503+
timeOut: 2000
504+
});
505+
},
506+
failure: function () {
507+
508+
}
469509
});
470510
}
471511
}
472512
function deleteUser(user_id) {
473513
if(!confirm("Are you really?")) return;
474-
toastr.info('That user was deleted successfully.', 'Notification', {
475-
"showMethod": "fadeIn",
476-
"hideMethod": "fadeOut",
477-
"closeButton": true,
478-
"progressBar": true,
479-
timeOut: 2000
514+
$.ajax({
515+
url: "{{ url('/deleteuser') }}",
516+
data: {user_id: user_id},
517+
dataType: "text",
518+
success : function (data) {
519+
toastr.info('That user was deleted successfully.', 'Notification', {
520+
"showMethod": "fadeIn",
521+
"hideMethod": "fadeOut",
522+
"closeButton": true,
523+
"progressBar": true,
524+
timeOut: 2000
525+
});
526+
user_table.row($("#btn_" + user_id).parents("tr")).remove().draw();
527+
},
528+
failure: function () {
529+
530+
}
480531
});
481-
user_table.row($("#btn_" + user_id).parents("tr")).remove().draw();
482532
}
483533
function deleteCode(id) {
484534
if(!confirm("Are you really?")) return;
485-
toastr.info('That QR Code was deleted successfully.', 'Notification', {
486-
"showMethod": "fadeIn",
487-
"hideMethod": "fadeOut",
488-
"closeButton": true,
489-
"progressBar": true,
490-
timeOut: 2000
535+
$.ajax({
536+
url: "{{ url('/deletecode') }}",
537+
data: {qrcode_id: id},
538+
dataType: "text",
539+
success : function (data) {
540+
toastr.info('That QR Code was deleted successfully.', 'Notification', {
541+
"showMethod": "fadeIn",
542+
"hideMethod": "fadeOut",
543+
"closeButton": true,
544+
"progressBar": true,
545+
timeOut: 2000
546+
});
547+
qrcode_table.row($("#code_delete_" + id).parents("tr")).remove().draw();
548+
},
549+
failure: function () {
550+
551+
}
491552
});
492-
qrcode_table.row($("#code_delete_" + id).parents("tr")).remove().draw();
493553
}
494554
function reviewCode(id) {
555+
$.ajax({
556+
url: "{{ url('/reviewcode') }}",
557+
data: {qrcode_id: id},
558+
dataType: "json",
559+
success : function (data) {
560+
$("#code_url").text(data.url);
561+
$("#code_title").text(data.qrcode);
562+
$("#code_preview").attr("src", "/qrcode/" + data.id);
563+
$("#backdrop").modal();
564+
},
565+
failure: function () {
495566
567+
}
568+
});
496569
}
497570
function initBarChart() {
498571
let campaigns = @php echo $campaigns; @endphp;

0 commit comments

Comments
 (0)