File: /var/www/html/dashboard.orbiwheels.com/storage/framework/views/bbb504a97b7beb0c8d62243d6fa4a92c.php
<?php $__env->startSection('content'); ?>
<div class="right_col" role="main">
<div class="">
<div class="clearfix"></div>
<?php echo $__env->make('alerts', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<div class="row" style="display: block;">
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h2>Vehicle <small>List</small></h2>
<ul class="nav navbar-right panel_toolbox ">
<li><a href="<?php echo e(route('vehicle.create')); ?>" class="addBtn"><i class="fa fa-plus"></i>
Add</a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<div class="row mb-3">
<div class="col-md-2">
<label for="vehicleTypeFilter" class="form-label">Vehicle Type</label>
<select id="vehicleTypeFilter" class="form-control">
<option value="">All</option>
<?php $__currentLoopData = \App\Models\VehicleType::all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($type->id); ?>"><?php echo e($type->name); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="col-md-2">
<label for="statusFilter" class="form-label">Status</label>
<select id="statusFilter" class="form-control">
<option value="">All</option>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</select>
</div>
<div class="col-md-2">
<label for="isVerifiedFilter" class="form-label">Verified</label>
<select id="isVerifiedFilter" class="form-control">
<option value="">All</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
</div>
<div class="card-box table-responsive">
<?php echo e($dataTable->table()); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('script'); ?>
<?php echo e($dataTable->scripts(attributes: ['type' => 'module'])); ?>
<script>
$('#vehicleTypeFilter, #statusFilter, #isVerifiedFilter').change(function() {
$('#vehicle-table').DataTable().ajax.reload();
});
$(document).ready(function() {
$(document).on('click', '.delete', function() {
var url = $(this).data('url');
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({
method: 'DELETE',
url: url,
data: {
_token: '<?php echo e(csrf_token()); ?>'
},
success: function(response) {
if (response.status) {
Swal.fire({
title: "Deleted!",
text: response.message,
icon: "success"
});
$('#vehicle-table').DataTable().ajax.reload();
} else {
Swal.fire({
title: "Error",
text: response.message,
icon: "error"
});
}
},
error: function(xhr, status, error) {
console.log(xhr.responseText);
Swal.fire({
title: "Error",
text: "An error occurred. Please try again later.",
icon: "error"
});
}
});
}
});
});
});
$('#vehicle-table').on('draw.dt', function() {
$('.dt-switch').each(function() {
if (!$(this).next().hasClass('switchery')) {
new Switchery(this, {
size: 'small',
color: '#26B99A'
});
}
});
});
$(document).on('change', '.vehicle-status', function() {
let vehicleId = $(this).data('id');
let status = $(this).prop('checked') ? 'active' : 'inactive';
$.ajax({
url: '/vehicle/update-status/' + vehicleId,
type: 'POST',
data: {
_token: $('meta[name="csrf-token"]').attr('content'),
status: status
},
success: function(res) {
if (res.success) {
toastr.success(res.message);
} else {
toastr.error('Failed to update status');
}
},
error: function() {
toastr.error('Something went wrong!');
}
});
});
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layout.transporter_master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/dashboard.orbiwheels.com/resources/views/transporter/vehicle/index.blade.php ENDPATH**/ ?>