first
This commit is contained in:
225
storage2/framework/views/c48715b147693221e7344bda96de705f.php
Normal file
225
storage2/framework/views/c48715b147693221e7344bda96de705f.php
Normal file
@@ -0,0 +1,225 @@
|
||||
<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;
|
||||
|
||||
$__newAttributes = [];
|
||||
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames((['route', 'columns', 'reorder']));
|
||||
|
||||
foreach ($attributes->all() as $__key => $__value) {
|
||||
if (in_array($__key, $__propNames)) {
|
||||
$$__key = $$__key ?? $__value;
|
||||
} else {
|
||||
$__newAttributes[$__key] = $__value;
|
||||
}
|
||||
}
|
||||
|
||||
$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);
|
||||
|
||||
unset($__propNames);
|
||||
unset($__newAttributes);
|
||||
|
||||
foreach (array_filter((['route', 'columns', 'reorder']), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
|
||||
$$__key = $$__key ?? $__value;
|
||||
}
|
||||
|
||||
$__defined_vars = get_defined_vars();
|
||||
|
||||
foreach ($attributes->all() as $__key => $__value) {
|
||||
if (array_key_exists($__key, $__defined_vars)) unset($$__key);
|
||||
}
|
||||
|
||||
unset($__defined_vars); ?>
|
||||
|
||||
<table class="display table table-bordered dt-responsive ajax-datatable table-sm" style="width:100%">
|
||||
<thead class="text-white" style="background-color: var(--vz-primary)">
|
||||
<tr>
|
||||
<?php $__currentLoopData = $columns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $column): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||
<th><?php echo e($column['title']); ?></th>
|
||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table-body">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<?php $__env->startPush('css'); ?>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.2/css/buttons.dataTables.min.css">
|
||||
<?php $__env->stopPush(); ?>
|
||||
|
||||
<?php $__env->startPush('js'); ?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
let table = $('.ajax-datatable').DataTable({
|
||||
processing: true,
|
||||
reordering: true,
|
||||
serverSide: true,
|
||||
dom: "Bfrtip",
|
||||
buttons: ["copy", "csv", "excel", "print"],
|
||||
ajax: "<?php echo e($route); ?>",
|
||||
columns: <?php echo json_encode($columns, 15, 512) ?>,
|
||||
rowCallback: function(row, data) {
|
||||
$(row).attr('data-id', data.id);
|
||||
},
|
||||
initComplete: function() {
|
||||
$('[data-bs-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#table-body").sortable({
|
||||
items: "tr",
|
||||
cursor: 'move',
|
||||
opacity: 0.6,
|
||||
update: function() {
|
||||
sendOrderToServer();
|
||||
}
|
||||
});
|
||||
|
||||
function sendOrderToServer() {
|
||||
|
||||
var order = [];
|
||||
var token = $('meta[name="csrf-token"]').attr('content');
|
||||
|
||||
$('tr.tableRow').each(function(index, element) {
|
||||
order.push({
|
||||
id: $(this).attr('data-id'),
|
||||
position: index + 1
|
||||
});
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo e($reorder); ?>",
|
||||
dataType: "json",
|
||||
data: {
|
||||
order: order,
|
||||
_token: token
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status == true) {
|
||||
console.log(response.message);
|
||||
$('.ajax-datatable').DataTable().ajax.reload();
|
||||
} else {
|
||||
console.log(response);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('body').on('click', '.remove-item', function(e) {
|
||||
e.preventDefault();
|
||||
let url = $(this).data('link');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status == 200) {
|
||||
flasher.success(response.message);
|
||||
$('.ajax-datatable').DataTable().ajax.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '.toggle-item', function(e) {
|
||||
e.preventDefault();
|
||||
let url = $(this).data('link');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Item will be marked as " + $(this).attr('data-status') + "!",
|
||||
icon: 'info',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, toggle it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status == 200) {
|
||||
flasher.success(response.message);
|
||||
$('.ajax-datatable').DataTable().ajax.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '.mark-item', function(e) {
|
||||
e.preventDefault();
|
||||
let url = $(this).data('link');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Item will be marked as " + $(this).attr('data-status') + "!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: 'yellow',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, mark it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status == 200) {
|
||||
flasher.success(response.message);
|
||||
$('.ajax-datatable').DataTable().ajax.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php $__env->stopPush(); ?>
|
||||
<?php /**PATH D:\installed\xampp\htdocs\bib\Consultancy-CCMS\resources\views/components/data-table-script.blade.php ENDPATH**/ ?>
|
||||
Reference in New Issue
Block a user