File: /var/www/html/orbidirectory.com/storage/framework/views/178d6d161ef15eb786b1bda9d0e6b7ea.php
<?php $__env->startSection('title', 'ORBI Dashboard'); ?>
<?php $__env->startSection('content_header'); ?>
<h1>Transporters</h1>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="card card-dark">
<div class="card-header">
<h3 class="card-title"></h3>
<div class="card-tools">
<a href="<?php echo e(route('users.create')); ?>" class="btn btn-dark"><i class="fas fa-plus"></i> Add Transporters</a>
</div>
</div>
<div class="card-body">
<form method="POST" id="search-form" role="form">
<?php echo csrf_field(); ?>
<div class="form-group row">
<div class="col-md-3">
<label for="search">Search</label>
<?php if (isset($component)) { $__componentOriginale5d826ae10df3aa87f8449f474c11664 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale5d826ae10df3aa87f8449f474c11664 = $attributes; } ?>
<?php $component = JeroenNoten\LaravelAdminLte\View\Components\Form\Input::resolve(['id' => 'search_keyword','name' => 'search_keyword'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('adminlte-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\JeroenNoten\LaravelAdminLte\View\Components\Form\Input::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'form-control','placeholder' => 'Enter Name']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale5d826ae10df3aa87f8449f474c11664)): ?>
<?php $attributes = $__attributesOriginale5d826ae10df3aa87f8449f474c11664; ?>
<?php unset($__attributesOriginale5d826ae10df3aa87f8449f474c11664); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale5d826ae10df3aa87f8449f474c11664)): ?>
<?php $component = $__componentOriginale5d826ae10df3aa87f8449f474c11664; ?>
<?php unset($__componentOriginale5d826ae10df3aa87f8449f474c11664); ?>
<?php endif; ?>
</div>
<div class="col-md-3">
<label for="status">Status</label>
<?php
$options = [
'all' => 'All',
App\Models\Transporter::STATUS_ACTIVE => 'Active',
App\Models\Transporter::STATUS_INACTIVE => 'Inactive',
App\Models\Transporter::STATUS_BANNED => 'Banned',
];
?>
<?php if (isset($component)) { $__componentOriginal377f5828c1076ae12e071b1688061877 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal377f5828c1076ae12e071b1688061877 = $attributes; } ?>
<?php $component = JeroenNoten\LaravelAdminLte\View\Components\Form\Select::resolve(['name' => 'status_filter','id' => 'status_filter'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('adminlte-select'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\JeroenNoten\LaravelAdminLte\View\Components\Form\Select::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php if (isset($component)) { $__componentOriginal1e9af52466c1670f554542c6e6d1a065 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal1e9af52466c1670f554542c6e6d1a065 = $attributes; } ?>
<?php $component = JeroenNoten\LaravelAdminLte\View\Components\Form\Options::resolve(['options' => $options,'emptyOption' => 'Select status...'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('adminlte-options'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\JeroenNoten\LaravelAdminLte\View\Components\Form\Options::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal1e9af52466c1670f554542c6e6d1a065)): ?>
<?php $attributes = $__attributesOriginal1e9af52466c1670f554542c6e6d1a065; ?>
<?php unset($__attributesOriginal1e9af52466c1670f554542c6e6d1a065); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal1e9af52466c1670f554542c6e6d1a065)): ?>
<?php $component = $__componentOriginal1e9af52466c1670f554542c6e6d1a065; ?>
<?php unset($__componentOriginal1e9af52466c1670f554542c6e6d1a065); ?>
<?php endif; ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal377f5828c1076ae12e071b1688061877)): ?>
<?php $attributes = $__attributesOriginal377f5828c1076ae12e071b1688061877; ?>
<?php unset($__attributesOriginal377f5828c1076ae12e071b1688061877); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal377f5828c1076ae12e071b1688061877)): ?>
<?php $component = $__componentOriginal377f5828c1076ae12e071b1688061877; ?>
<?php unset($__componentOriginal377f5828c1076ae12e071b1688061877); ?>
<?php endif; ?>
</div>
<div class="col-md-3">
<?php
$config = [
'showDropdowns' => true,
'cancelButtonClasses' => 'btn-danger',
'locale' => ['format' => 'YYYY/MM/DD'],
];
?>
<?php if (isset($component)) { $__componentOriginal5b443f27b4cfa4aecd210c5dc80c0c63 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal5b443f27b4cfa4aecd210c5dc80c0c63 = $attributes; } ?>
<?php $component = JeroenNoten\LaravelAdminLte\View\Components\Form\DateRange::resolve(['name' => 'date_range_filter','id' => 'date_range_filter','label' => 'Date Range','config' => $config] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('adminlte-date-range'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\JeroenNoten\LaravelAdminLte\View\Components\Form\DateRange::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['placeholder' => 'Select a date range...','autocomplete' => 'off']); ?>
<?php $__env->slot('prependSlot', null, []); ?>
<?php $__env->endSlot(); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal5b443f27b4cfa4aecd210c5dc80c0c63)): ?>
<?php $attributes = $__attributesOriginal5b443f27b4cfa4aecd210c5dc80c0c63; ?>
<?php unset($__attributesOriginal5b443f27b4cfa4aecd210c5dc80c0c63); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal5b443f27b4cfa4aecd210c5dc80c0c63)): ?>
<?php $component = $__componentOriginal5b443f27b4cfa4aecd210c5dc80c0c63; ?>
<?php unset($__componentOriginal5b443f27b4cfa4aecd210c5dc80c0c63); ?>
<?php endif; ?>
</div>
<div class="col-md-3 mt-4 pt-2" id="bulk-delete-wrapper" style="display: none;">
<button id="delete-selected" class="btn btn-danger mb-3">Delete Selected</button>
</div>
</div>
</form>
<table class="table table-bordered yajra-datatable">
<thead>
<tr>
<th>All<br><input type="checkbox" id="select-all"></th>
<th>Name</th>
<th>Email</th>
<th>City</th>
<th>Status</th>
<th>Verification</th>
<th>Created Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<script type="text/javascript">
$(function() {
var dataTable = $('.yajra-datatable').DataTable({
processing: true,
serverSide: true,
pageLength: 10,
searching: false,
'ajax': {
'url': "<?php echo e(url('/admin/users')); ?>",
'data': function(data) {
data.search_keyword = $('#search_keyword').val();
// data.status_filter = $('#status_filter option:selected').val();
data.status_filter = $('#status_filter option:selected').val();
var dateRange = $('#date_range_filter').val();
if (dateRange) {
data.date_range_filter = dateRange;
}
}
},
columns: [
/*{data: 'checkbox', name: 'checkbox', orderable: false, searchable: false},*/
/* {data: 'id', name: 'ID'}, */
{
data: 'id',
name: 'id',
render: function(data, type, row) {
return '<input type="checkbox" class="row-checkbox" value="' + data +
'">';
},
orderable: false,
searchable: false
},
{
data: 'name',
name: 'name'
},
{
data: 'email',
name: 'email'
},
{
data: 'city',
name: 'city'
},
{
data: 'status',
name: 'status'
},
{
data: 'verification',
name: 'verification'
},
{
data: 'created_at',
name: 'created_at'
},
{
data: 'action',
name: 'action',
orderable: false,
searchable: false
},
]
});
var table = $('.yajra-datatable').DataTable();
// Handle 'Select All' checkbox
$('#select-all').on('click', function() {
var rows = table.rows({
'search': 'applied'
}).nodes();
$('input[type="checkbox"].row-checkbox', rows).prop('checked', this.checked);
});
// Uncheck 'Select All' if any row is manually unchecked
$('.yajra-datatable tbody').on('change', '.row-checkbox', function() {
if (!this.checked) {
$('#select-all').prop('checked', false);
}
});
// Handle Delete Selected
$('#delete-selected').on('click', function() {
var selectedIds = [];
$('.row-checkbox:checked').each(function() {
selectedIds.push($(this).val());
});
if (selectedIds.length === 0) {
// alert("Please select at least one user to delete.");
return;
}
if (!confirm("Are you sure you want to delete the selected users?")) {
return;
}
$.ajax({
url: "<?php echo e(route('admin.users.bulk-delete')); ?>",
type: "POST",
data: {
ids: selectedIds,
_token: "<?php echo e(csrf_token()); ?>"
},
success: function(response) {
alert(response.message);
table.ajax.reload();
$('#select-all').prop('checked', false);
$('#bulk-delete-wrapper').hide();
},
error: function(xhr) {
alert("An error occurred while deleting.");
}
});
});
function toggleDeleteButton() {
var anyChecked = $('.row-checkbox:checked').length > 0;
$('#bulk-delete-wrapper').toggle(anyChecked);
}
$('#select-all').on('click', function() {
var rows = table.rows({
'search': 'applied'
}).nodes();
$('input[type="checkbox"].row-checkbox', rows).prop('checked', this.checked);
toggleDeleteButton();
});
$('.yajra-datatable tbody').on('change', '.row-checkbox', function() {
if (!this.checked) {
$('#select-all').prop('checked', false);
}
toggleDeleteButton();
});
$('#search_keyword').keyup(function() {
dataTable.draw();
});
$('#status_filter').on('change', function() {
dataTable.draw();
});
$('#date_range_filter').on('apply.daterangepicker', function(ev, picker) {
//console.log(picker.startDate.format('YYYY-MM-DD'));
//console.log(picker.endDate.format('YYYY-MM-DD'));
dataTable.draw();
});
$(document).on('click', '.update_status', function(e) {
e.preventDefault();
var $statusLink = $(this);
var current_status = $statusLink.data('current-status');
var new_status = current_status == 0 ? 1 : 0;
var new_status_label = new_status == 1 ? 'Active' : 'Inactive';
var url = $statusLink.data('update-url');
axios.put(url, {
new_status: new_status
})
.then(response => {
// Handle success response
if (response.data.status === 'success') {
$statusLink.hide();
$statusLink.siblings('.update_status').show();
$statusLink.data('current-status', new_status);
$('#success-container').html(response.data.message).show('slow');
// Hide success message after 5 seconds
setTimeout(function() {
$('#success-container').hide('slow');
}, 5000);
} else {
$('#error-container').html(response.data.message).show('slow');
// Hide error message after 5 seconds
setTimeout(function() {
$('#error-container').hide('slow');
}, 5000);
}
})
.catch(error => {
console.error(error);
});
});
$('#search-form').on('submit', function(e) {
e.preventDefault(); // prevent default form submission
$('.yajra-datatable').DataTable().draw(); // trigger datatable filter
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/orbidirectory.com/resources/views/admin/users/index.blade.php ENDPATH**/ ?>