File: /var/www/html/orbidirectory.com/storage/framework/views/07ad5ae464a8f5050c036b23925081f5.php
<?php $__env->startSection('title', 'Dashboard'); ?>
<?php $__env->startSection('content_header'); ?>
<h1>Vehicle</h1>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="card card-dark">
<div class="card-header">
<h3 class="card-title">Edit City</h3>
</div>
<form method="POST" id="edit_vehicle" action="<?php echo e(route('vehicle.update', $vehicle->id)); ?>"
enctype="multipart/form-data" class="jqueryValidation">
<?php echo csrf_field(); ?>
<?php echo method_field('PATCH'); ?>
<div class="card-body editCard_body">
<div class="form-group row">
<div class="col-md-6">
<label for="group">Transporter</label>
<select class="form-control select2" name="transporter_id" required>
<?php $__currentLoopData = $transporters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($key->id); ?>"
<?php echo e($vehicle->transporter_id == $key->id ? 'Selected' : ''); ?>>
<?php echo e(optional($key->get_user)->name); ?> <?php echo e(optional($key->get_user)->last_name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="col-md-6">
<label for="vehicle_image">Image</label>
<?php if (isset($component)) { $__componentOriginale5d826ae10df3aa87f8449f474c11664 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale5d826ae10df3aa87f8449f474c11664 = $attributes; } ?>
<?php $component = JeroenNoten\LaravelAdminLte\View\Components\Form\Input::resolve(['id' => 'vehicle_image','name' => 'vehicle_image'] + (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','type' => 'file','placeholder' => 'Upload new Image']); ?>
<?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; ?>
<?php if($vehicle->getFirstMedia('vehicle_image')): ?>
<div>
<img src="<?php echo e($vehicle->getFirstMediaUrl('vehicle_image')); ?>" alt="Image" width="100">
</div>
<?php endif; ?>
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label for="make_id">Brand</label>
<select class="form-control select2" name="make_id" id="make_id" required>
<option value="">--Select Brand--</option>
<?php $__currentLoopData = $vehicle_makes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vehicle_make): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($vehicle_make->id); ?>"
<?php echo e($vehicle->make_id == $vehicle_make->id ? 'selected' : ''); ?>>
<?php echo e($vehicle_make->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="col-md-6">
<label for="model_id">Model</label>
<select class="form-control select2" name="model_id" id="model_id" required>
<option value="">--Select Model--</option>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label for="group">Type</label>
<select class="form-control select2" name="vehicle_type_id" id="" required>
<?php $__currentLoopData = $vehicle_types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vehicle_type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($vehicle_type->id); ?>"
<?php echo e($vehicle->vehicle_type_id == $vehicle_type->id ? 'Selected' : ''); ?>>
<?php echo e($vehicle_type->name); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="col-md-6">
<label for="model_year">Model Year</label>
<select id="model_year" name="model_year" class="form-control select2" required>
<option value="">--Select--</option>
<?php
$currentYear = isset($vehicle->model_year) ? $vehicle->model_year : null;
?>
<?php for($year = date('Y'); $year >= 1900; $year--): ?>
<option value="<?php echo e($year); ?>" <?php echo e($year == $currentYear ? 'selected' : ''); ?>>
<?php echo e($year); ?></option>
<?php endfor; ?>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label for="fuel_type">Fuel Type</label>
<select name="fuel_type" id="fuel_type" class="form-control" required>
<?php $__currentLoopData = App\Models\Vehicles::fuel_type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $fuel_type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($key); ?>"
<?php echo e($vehicle->fuel_type == $fuel_type ? 'selected' : ''); ?>>
<?php echo e($fuel_type); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="col-md-6">
<label for="transmission_type">Transmission Type</label>
<select name="transmission_type" id="transmission_type" class="form-control" required>
<?php $__currentLoopData = App\Models\Vehicles::transmission_type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $transmission_type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($key); ?>"
<?php echo e($vehicle->transmission_type == $transmission_type ? 'selected' : ''); ?>>
<?php echo e($transmission_type); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label for="license_plate">License Plate (e.g., UP32AB1234)</label>
<input type="text" class="form-control" id="license_plate" name="license_plate"
placeholder="Enter License Plate" value="<?php echo e($vehicle->license_plate ?? ''); ?>" required />
</div>
<div class="col-md-6">
<label for="service_type">Service Type</label>
<select name="service_type" id="service_type" class="form-control" required>
<option value="" disabled>--Select--</option>
<?php $__currentLoopData = App\Models\Vehicles::options(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $service_type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($key); ?>"
<?php echo e($vehicle->service_type == $key ? 'selected' : ''); ?>>
<?php echo e($service_type); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label for="description">Description</label>
<?php if (isset($component)) { $__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7 = $attributes; } ?>
<?php $component = JeroenNoten\LaravelAdminLte\View\Components\Form\Textarea::resolve(['id' => 'description','name' => 'description'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('adminlte-textarea'); ?>
<?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\Textarea::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'form-control','placeholder' => 'Enter Description','required' => true]); ?><?php echo e(old('description', $vehicle->description ?? '')); ?> <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7)): ?>
<?php $attributes = $__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7; ?>
<?php unset($__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7); ?>
<?php endif; ?>
<?php if (isset($__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7)): ?>
<?php $component = $__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7; ?>
<?php unset($__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7); ?>
<?php endif; ?>
</div>
<div class="col-md-6" id="seating_quantity_wrapper">
<label for="seating_capacity">Seating Capacity</label>
<select class="form-control" id="seating_capacity" name="seating_capacity">
<option value="">--Select--</option>
<?php $__currentLoopData = \App\Models\Vehicles::passengerSeatingCapacityOptions(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($key); ?>"
<?php echo e(old('seating_capacity', $vehicle->seating_capacity ?? '') == $key ? 'selected' : ''); ?>>
<?php echo e($value); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label for="status">Status</label>
<select name="status" id="status" class="form-control">
<?php $__currentLoopData = App\Models\Vehicles::status; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($key); ?>"
<?php echo e(old('status', $vehicle->status ?? '') == $key ? 'selected' : ''); ?>>
<?php echo e($status); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="col-md-2 mt-4 pt-2">
<input type="hidden" name="is_verified" value="0">
<input type="checkbox" id="is_verified" name="is_verified" value="1"
<?php echo e(old('is_verified') == '1' || (isset($vehicle) && $vehicle->is_verified) ? 'checked' : ''); ?>>
<label for="is_verified">Is Verified</label>
</div>
<div class="col-md-6" id="inactive_reason_group" style="display: none;">
<label for="inactive_reason">Inactive Reason</label>
<?php if (isset($component)) { $__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7 = $attributes; } ?>
<?php $component = JeroenNoten\LaravelAdminLte\View\Components\Form\Textarea::resolve(['id' => 'inactive_reason','name' => 'inactive_reason'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('adminlte-textarea'); ?>
<?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\Textarea::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'form-control','placeholder' => 'Enter Inactive or Banned Reason']); ?><?php echo e(old('inactive_reason', $vehicle->inactive_reason ?? '')); ?> <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7)): ?>
<?php $attributes = $__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7; ?>
<?php unset($__attributesOriginala47f947a90f7125ced2d0aa2e9c7c7d7); ?>
<?php endif; ?>
<?php if (isset($__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7)): ?>
<?php $component = $__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7; ?>
<?php unset($__componentOriginala47f947a90f7125ced2d0aa2e9c7c7d7); ?>
<?php endif; ?>
</div>
</div>
<div class="card-footer d-flex justify-content-end">
<a href="<?php echo e(route('vehicle.index')); ?>" class="btn btn-danger mx-1">Cancel</a>
<button type="submit" class="btn btn-dark mx-1">Update</button>
</div>
</div>
</form>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<script>
$(document).ready(function() {
const selectedMakeId = "<?php echo e($selectedMakeId); ?>";
const selectedModelId = "<?php echo e($selectedModelId); ?>";
function loadModels(makeId, selectedModelId = null) {
if (makeId) {
$.ajax({
url: "<?php echo e(route('get.models.by.make', ':make_id')); ?>".replace(':make_id', makeId),
type: 'GET',
success: function(data) {
$('#model_id').empty().append('<option value="">--Select Model--</option>');
$.each(data, function(key, model) {
let selected = (model.id == selectedModelId) ? 'selected' : '';
$('#model_id').append('<option value="' + model.id + '" ' +
selected + '>' + model.name + '</option>');
});
}
});
} else {
$('#model_id').html('<option value="">--Select Model--</option>');
}
}
// When brand is changed
$('#make_id').on('change', function() {
const makeId = $(this).val();
loadModels(makeId); // Load without preselect
});
// On page load (edit case)
if (selectedMakeId) {
loadModels(selectedMakeId, selectedModelId); // Pre-load and select current model
}
$('.select2').select2({
placeholder: "--Select--",
width: '100%'
});
function toggleInactiveReason() {
const value = $('#status').val();
// Show the inactive reason group for "Inactive" (0) and "Banned" (2) status
if (value == "0" || value == "2") {
$('#inactive_reason_group').show();
} else {
$('#inactive_reason_group').hide();
}
}
$('#status').on('change', toggleInactiveReason);
// Trigger on page load
toggleInactiveReason();
const seatingOptions = JSON.parse($('#seating_options_data').val());
const finalInput = $('#seating_capacity_final');
const quantityInput = $('#seating_quantity_input');
const dropdown = $('#seating_capacity_select');
const quantityWrapper = $('#seating_quantity_wrapper');
const dropdownWrapper = $('#seating_capacity_select_wrapper');
function toggleInputs(type) {
dropdownWrapper.hide();
quantityWrapper.hide();
if (type === 'Passenger') {
quantityWrapper.show();
let qty = parseInt(finalInput.val());
if (isNaN(qty) || qty < 2 || qty > 12) {
qty = 2; // fallback default
}
quantityInput.val(qty);
finalInput.val(qty);
} else if (type === 'Goods Transport') {
dropdown.empty().append('<option value="">--Select--</option>');
const savedCapacity = finalInput.val();
if (seatingOptions[type]) {
$.each(seatingOptions[type], function(key, value) {
const selected = (savedCapacity == key) ? 'selected' : '';
dropdown.append(`<option value="${key}" ${selected}>${value}</option>`);
});
}
dropdownWrapper.show();
finalInput.val(dropdown.val());
}
}
// Trigger on load
if (serviceType.length && serviceType.val()) {
toggleInputs(serviceType.val());
}
// On change of service type
serviceType.on('change', function() {
toggleInputs($(this).val());
});
// Update final hidden value on change
quantityInput.on('input change', function() {
finalInput.val($(this).val());
});
dropdown.on('change', function() {
finalInput.val($(this).val());
});
// + / - buttons
$('.qty-input').each(function() {
const $input = $(this).find(".product-qty");
const $btnMinus = $(this).find(".qty-count--minus");
const $btnAdd = $(this).find(".qty-count--add");
const qtyMin = parseInt($input.attr("min")) || 1;
const qtyMax = parseInt($input.attr("max")) || 999;
function updateBtns(val) {
$btnMinus.prop("disabled", val <= qtyMin);
$btnAdd.prop("disabled", val >= qtyMax);
}
updateBtns(parseInt($input.val()));
$btnMinus.on("click", function() {
let val = parseInt($input.val());
if (val > qtyMin) {
$input.val(val - 1).trigger('change');
}
});
$btnAdd.on("click", function() {
let val = parseInt($input.val());
if (val < qtyMax) {
$input.val(val + 1).trigger('change');
}
});
$input.on("change", function() {
let val = parseInt($input.val()) || qtyMin;
if (val < qtyMin) val = qtyMin;
if (val > qtyMax) val = qtyMax;
$input.val(val);
updateBtns(val);
});
});
// On submit, ensure correct value is set
$('#edit_vehicle').on('submit', function() {
const type = serviceType.val();
if (type === 'Passenger') {
finalInput.val(quantityInput.val());
} else if (type === 'Goods Transport') {
finalInput.val(dropdown.val());
}
console.log("Submitting seating_capacity:", finalInput.val());
});
});
</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/vehicles/edit.blade.php ENDPATH**/ ?>