This commit is contained in:
jilhanhaura 2023-09-08 13:57:36 +07:00
parent 8fe73b5327
commit af7c67312f
6 changed files with 73 additions and 34 deletions

View File

@ -1,40 +1,40 @@
"use strict"; "use strict";
$("[data-checkboxes]").each(function() { $("[data-checkboxes]").each(function () {
var me = $(this), var me = $(this),
group = me.data('checkboxes'), group = me.data('checkboxes'),
role = me.data('checkbox-role'); role = me.data('checkbox-role');
me.change(function() { me.change(function () {
var all = $('[data-checkboxes="' + group + '"]:not([data-checkbox-role="dad"])'), var all = $('[data-checkboxes="' + group + '"]:not([data-checkbox-role="dad"])'),
checked = $('[data-checkboxes="' + group + '"]:not([data-checkbox-role="dad"]):checked'), checked = $('[data-checkboxes="' + group + '"]:not([data-checkbox-role="dad"]):checked'),
dad = $('[data-checkboxes="' + group + '"][data-checkbox-role="dad"]'), dad = $('[data-checkboxes="' + group + '"][data-checkbox-role="dad"]'),
total = all.length, total = all.length,
checked_length = checked.length; checked_length = checked.length;
if(role == 'dad') { if (role == 'dad') {
if(me.is(':checked')) { if (me.is(':checked')) {
all.prop('checked', true); all.prop('checked', true);
}else{ } else {
all.prop('checked', false); all.prop('checked', false);
} }
}else{ } else {
if(checked_length >= total) { if (checked_length >= total) {
dad.prop('checked', true); dad.prop('checked', true);
}else{ } else {
dad.prop('checked', false); dad.prop('checked', false);
} }
} }
}); });
}); });
$("#table-1").dataTable({ $("#table-1").dataTable({
"columnDefs": [ "columnDefs": [
{ "sortable": false, "targets": [2,3] } { "sortable": false, "targets": [2] }
] ]
}); });
$("#table-2").dataTable({ $("#table-2").dataTable({
"columnDefs": [ "columnDefs": [
{ "sortable": false, "targets": [0,2,3] } { "sortable": false, "targets": [0, 2, 3] }
] ]
}); });

View File

@ -64,6 +64,7 @@
gtag('config', 'UA-94034622-3'); gtag('config', 'UA-94034622-3');
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script> <script>
@ -199,6 +200,45 @@
<!-- Page Specific JS File --> <!-- Page Specific JS File -->
<script src="assets/js/page/modules-sweetalert.js"></script> <script src="assets/js/page/modules-sweetalert.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
});
const swalButton = document.getElementById('Swal');
swalButton.addEventListener('click', function() {
swalWithBootstrapButtons.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, cancel!',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
swalWithBootstrapButtons.fire(
'Deleted!',
'Your file has been deleted.',
'success'
);
} else if (
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
);
}
});
});
});
</script>
</body> </body>

View File

@ -10,7 +10,6 @@
<div class="card-head"> <div class="card-head">
<img id="card_head" src="/assets/images/sampul.jpg"></img> <img id="card_head" src="/assets/images/sampul.jpg"></img>
</div> </div>
{{-- <div class="card-head"></div> --}}
<div class="image-crop"> <div class="image-crop">
<img id="avatar" src="/assets/images/dashboard/img_1.jpg"></img> <img id="avatar" src="/assets/images/dashboard/img_1.jpg"></img>
</div><br> </div><br>

View File

@ -59,7 +59,7 @@
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="/detail_refund">Details</a> <a class="dropdown-item" href="/detail_refund">Details</a>
<a class="dropdown-item" href="#">Delete</a> <a class="dropdown-item" href="#" id="Swal">Delete</a>
</div> </div>
</div> </div>
</td> </td>

View File

@ -61,7 +61,7 @@
<a class="dropdown-item" href="/detail_transaction">Details</a> <a class="dropdown-item" href="/detail_transaction">Details</a>
<a class="dropdown-item" href="#" data-toggle="modal" <a class="dropdown-item" href="#" data-toggle="modal"
data-target="#ModalTransaction">Tracking</a> data-target="#ModalTransaction">Tracking</a>
<a class="dropdown-item" href="#">Delete</a> <a class="dropdown-item" href="#" id="Swal">Delete</a>
</div> </div>
</div> </div>
</td> </td>

View File

@ -60,7 +60,7 @@
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="/detail-user">Details</a> <a class="dropdown-item" href="/detail-user">Details</a>
<a class="dropdown-item" href="#">Delete</a> <a class="dropdown-item" href="#" id="Swal">Delete</a>
</div> </div>
</div> </div>
</td> </td>