2024-07-25 03:52:29 +00:00
|
|
|
<div class="modal fade" id="confirm_delete" tabindex="-1">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header bg-danger">
|
|
|
|
<h5 class="modal-title">WARNING: DELETING record</h5>
|
|
|
|
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">X</button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<p>This action is irreversible. Are you sure, your sure, that you want to delete it?</p>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
2024-07-26 02:26:31 +00:00
|
|
|
<a type="button" class="btn btn-danger btn-ok" data-hide="{{ $hide }}">Delete</a>
|
2024-07-25 03:52:29 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@section('page-scripts')
|
|
|
|
<script type="text/javascript">
|
|
|
|
var confirm_delete = new bootstrap.Modal(document.getElementById('confirm_delete'), {});
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.{{$trigger}}').click(function(e) {
|
|
|
|
confirm_delete.show();
|
2024-07-26 02:26:31 +00:00
|
|
|
|
2024-07-25 03:52:29 +00:00
|
|
|
$('#confirm_delete')
|
|
|
|
.find('.btn-ok')
|
2024-07-26 02:26:31 +00:00
|
|
|
.attr('href',$(this).attr('href'))
|
|
|
|
.attr('data-id',$(this).data('id'));
|
|
|
|
|
2024-07-25 03:52:29 +00:00
|
|
|
return false;
|
|
|
|
});
|
2024-07-26 02:26:31 +00:00
|
|
|
|
|
|
|
$('.btn-ok').click(function(item) {
|
|
|
|
var that = $(this);
|
|
|
|
|
|
|
|
// Delete
|
|
|
|
$.ajax({
|
|
|
|
url: that.attr('href'),
|
|
|
|
method: 'POST',
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
|
|
}).done(function(data) {
|
|
|
|
if (that.data('hide') == 'row')
|
|
|
|
$('a[data-id="'+that.data('id')+'"].{{$trigger}}').closest('tr').hide();
|
|
|
|
|
|
|
|
}).fail(function() {
|
|
|
|
alert('Hmm, that didnt work?');
|
|
|
|
});
|
|
|
|
|
|
|
|
// Clear the data cache
|
|
|
|
that.removeData();
|
|
|
|
confirm_delete.hide();
|
|
|
|
return false;
|
|
|
|
})
|
2024-07-25 03:52:29 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@append
|