<?php $__env->startSection('content'); ?>
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Transporter Profile</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h2>Transporter Details
<small>
<?php if($transporter->status == 'active'): ?>
<span class="badge badge-success text-white">Active</span>
<?php elseif($transporter->status == 'inactive'): ?>
<span class="badge badge-secondary text-white">Inactive</span>
<?php elseif($transporter->status == 'suspended'): ?>
<span class="badge badge-warning text-white">Suspended</span>
<?php endif; ?>
</small>
</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-md-3 col-sm-3 profile_left">
<div class="profile_img">
<div id="crop-avatar">
<!-- Current avatar -->
<img class="img-responsive avatar-view"
src="<?php echo e($transporter->image ? asset('storage/' . $transporter->image) : asset('images/user_logo.png')); ?>"
alt="Transporter Avatar" title="Transporter Image"
style="width:150px; height:150px; object-fit:cover;">
</div>
</div>
<h3>
<?php echo e($transporter->first_name ?? ''); ?> <?php echo e($transporter->last_name ?? ''); ?>
<?php if($transporter->is_verified): ?>
<img src="<?php echo e(asset('images/Tick.png')); ?>" alt="Verified"
style="width:25px; height:20px;">
<?php endif; ?>
</h3>
<ul class="list-unstyled user_data">
<li>
<i class="fa fa-envelope user-profile-icon"></i>
<strong>Email:</strong>
<?php echo e($transporter->email); ?>
</li>
<li>
<i class="fa fa-phone user-profile-icon"></i>
<strong>Phone:</strong>
<?php echo e($transporter->phone); ?>
</li>
<li>
<i class="fa fa-building user-profile-icon"></i>
<strong>Company Name:</strong>
<?php echo e($transporter->company_name); ?>
</li>
<li>
<i class="fa fa-map-marker user-profile-icon"></i>
<strong>Address:</strong>
<?php echo e($transporter->address); ?>
</li>
<li>
<i class="fa fa-user-tag user-profile-icon"></i>
<strong>Type:</strong>
<?php echo $transporter->transporter_type_badge; ?>
</li>
</ul>
<div class="justify-content-between">
<a href="<?php echo e(route('admin.transporter.edit', $transporter->id)); ?>"
class="btn btn-primary btn-sm"><i class="fa fa-edit m-right-xs"></i> Edit
Profile
</a>
<?php if($transporter->documents->count() > 0): ?>
<button type="button"
class="<?php echo e($transporter->is_verified ? 'btn btn-danger' : 'btn btn-success'); ?> btn-sm verify-transporter"
data-id="<?php echo e($transporter->id); ?>"
data-verified="<?php echo e($transporter->is_verified ? 1 : 0); ?>">
<?php echo e($transporter->is_verified ? 'Unverify Transporter' : 'Verify Transporter'); ?>
</button>
<?php endif; ?>
</div>
<br />
</div>
<div class="col-md-9 col-sm-9 ">
<!-- start of user-activity-graph -->
<!-- end of user-activity-graph -->
<div class="" role="tabpanel" data-example-id="togglable-tabs">
<ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
<li role="presentation" class="active"><a href="#tab_content2" role="tab"
id="profile-tab" data-toggle="tab" aria-expanded="false">Document
Details</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div role="tabpanel" class="tab-pane active table-responsive" id="tab_content2"
aria-labelledby="profile-tab">
<!-- start transporter documents -->
<table class="data table table-striped no-margin">
<thead>
<tr>
<th>#</th>
<th>Document Name</th>
<th>Document Number</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $__empty_1 = true; $__currentLoopData = $transporter->documents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $document): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr>
<td><?php echo e($index + 1); ?></td>
<td><?php echo e(\App\Models\Document::documentTypes($document->doc_type)); ?>
</td>
<td><?php echo e($document->doc_number ?? '-'); ?></td>
<td class="vertical-align-mid">
<?php if($document->is_verified ?? false): ?>
<span class="badge badge-success">Verified</span>
<?php else: ?>
<span class="badge badge-warning">Pending</span>
<?php endif; ?>
</td>
<td class="vertical-align-mid">
<?php if($document->file_url): ?>
<a href="<?php echo e(asset('storage/' . $document->file_url)); ?>"
class="btn btn-primary btn-sm" target="_blank"
title="View file"><i class="fa fa-eye"></i></a>
<?php endif; ?>
<?php if(!$document->is_verified): ?>
<button type="button"
class="btn btn-success btn-sm verify-doc"
data-id="<?php echo e($document->id); ?>"
title="Verify Document">
<i class="fa fa-check"></i>
</button>
<?php endif; ?>
<button type="button"
class="btn btn-danger btn-sm delete-doc"
data-id="<?php echo e($document->id); ?>"
title="Delete Document">
<i class="fa fa-trash"></i>
</button>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<tr>
<td colspan="5" class="text-center text-muted">No
documents
uploaded</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<!-- end transporter documents -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('script'); ?>
<script>
$(document).on('click', '.verify-doc', function() {
let docId = $(this).data('id');
let button = $(this);
Swal.fire({
title: 'Are you sure?',
text: "Mark this document as verified?",
icon: 'question',
showCancelButton: true,
confirmButtonText: 'Yes, verify it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/admin/transporter/document/' + docId + '/verify',
method: 'POST',
data: {
_token: '<?php echo e(csrf_token()); ?>'
},
success: function(res) {
Swal.fire('Verified!', res.message, 'success').then(() => {
location.reload();
});
},
error: function(err) {
Swal.fire('Error', 'Something went wrong', 'error');
}
});
}
});
});
$(document).on('click', '.delete-doc', function() {
let docId = $(this).data('id');
let card = $('#doc-card-' + docId);
Swal.fire({
title: 'Are you sure?',
text: "This document will be permanently deleted!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#6c757d',
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'Cancel'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/admin/transporter/document/delete/' + docId,
type: 'DELETE',
data: {
_token: '<?php echo e(csrf_token()); ?>'
},
success: function(response) {
if (response.success) {
card.remove();
Swal.fire(
'Deleted!',
response.message,
'success'
).then(() => {
location.reload();
});
} else {
Swal.fire(
'Error!',
'Something went wrong.',
'error'
);
}
},
error: function() {
Swal.fire(
'Error!',
'Unable to delete document.',
'error'
);
}
});
}
});
});
$(document).on('click', '.verify-transporter', function() {
const $btn = $(this);
const driverId = $btn.data('id');
const isVerified = $btn.data('verified') == 1;
const actionText = isVerified ? 'unverify' : 'verify';
Swal.fire({
title: 'Are you sure?',
text: `Do you want to ${actionText} this transporter?`,
icon: 'question',
showCancelButton: true,
confirmButtonText: `Yes, ${actionText} it!`
}).then((result) => {
if (!result.isConfirmed) return;
$.ajax({
url: '/admin/transporter/' + driverId + '/verify',
method: 'POST',
headers: {
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>'
},
data: {
status: isVerified ? 0 : 1
},
success: function(res) {
Swal.fire('Success!', res.message || 'Status updated', 'success')
.then(() => {
location.reload();
});
// Toggle status
$btn.data('verified', isVerified ? 0 : 1);
$btn.text(isVerified ? 'Verify Transporter' : 'Unverify Transporter');
$btn.toggleClass('btn-success btn-danger');
},
error: function(xhr) {
let msg = 'Something went wrong';
if (xhr.responseJSON && xhr.responseJSON.message) msg = xhr.responseJSON
.message;
Swal.fire('Error', msg, 'error');
}
});
});
});
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layout.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/dashboard.orbiwheels.com/resources/views/admin/transporter/view.blade.php ENDPATH**/ ?>