sackey e839d40a99
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
Initial commit
2025-07-30 17:15:50 +00:00

251 lines
16 KiB
PHP

<div class="max-w-4xl mx-auto p-6">
<div class="mb-8">
<h1 class="text-3xl font-bold text-zinc-900 dark:text-white">Create Job Card</h1>
<p class="text-zinc-600 dark:text-zinc-400 mt-2">Register a new vehicle for service</p>
</div>
<div class="bg-white shadow-lg rounded-lg p-6">
<form wire:submit="save">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Customer Selection -->
<div class="md:col-span-2">
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Customer</label>
<select wire:model.live="customer_id" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">Select customer...</option>
@foreach($customers as $customer)
<option value="{{ $customer->id }}">
{{ $customer->first_name }} {{ $customer->last_name }} - {{ $customer->phone }}
</option>
@endforeach
</select>
@error('customer_id') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
</div>
<!-- Vehicle Selection -->
<div class="md:col-span-2">
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Vehicle</label>
<select wire:model="vehicle_id" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">Select vehicle...</option>
@foreach($vehicles as $vehicle)
<option value="{{ $vehicle->id }}">
{{ $vehicle->year }} {{ $vehicle->make }} {{ $vehicle->model }} - {{ $vehicle->license_plate }}
</option>
@endforeach
</select>
@error('vehicle_id') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
</div>
<!-- Service Advisor -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Service Advisor</label>
<select wire:model="service_advisor_id" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">Select service advisor...</option>
@foreach($serviceAdvisors as $advisor)
<option value="{{ $advisor->id }}">{{ $advisor->name }}</option>
@endforeach
</select>
@error('service_advisor_id') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Branch Code -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Branch Code</label>
<input wire:model="branch_code" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
@error('branch_code') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Arrival Date & Time -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Arrival Date & Time</label>
<input
type="datetime-local"
wire:model="arrival_datetime"
class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
@error('arrival_datetime') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Expected Completion Date -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Expected Completion Date</label>
<input type="datetime-local" wire:model="expected_completion_date" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
@error('expected_completion_date') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Priority -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Priority</label>
<select wire:model="priority" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="low">Low</option>
<option value="medium">Medium</option>
<option value="high">High</option>
<option value="urgent">Urgent</option>
</select>
@error('priority') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Mileage In -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Mileage In</label>
<input type="number" wire:model="mileage_in" placeholder="Current mileage" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
@error('mileage_in') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Fuel Level In -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Fuel Level In</label>
<select wire:model="fuel_level_in" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">Select fuel level</option>
<option value="empty">Empty</option>
<option value="1/4">1/4 Tank</option>
<option value="1/2">1/2 Tank</option>
<option value="3/4">3/4 Tank</option>
<option value="full">Full Tank</option>
</select>
@error('fuel_level_in') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Keys Location -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Keys Location</label>
<input wire:model="keys_location" placeholder="Where are the keys?" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
@error('keys_location') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Customer Reported Issues -->
<div class="md:col-span-2 mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Customer Reported Issues</label>
<textarea
wire:model="customer_reported_issues"
placeholder="Describe what the customer has reported..."
rows="3"
class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
></textarea>
@error('customer_reported_issues') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Vehicle Condition Notes -->
<div class="md:col-span-2 mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Vehicle Condition Notes</label>
<textarea
wire:model="vehicle_condition_notes"
placeholder="Note any existing damage, wear, or condition issues..."
rows="3"
class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
></textarea>
@error('vehicle_condition_notes') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Additional Notes -->
<div class="md:col-span-2 mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Additional Notes</label>
<textarea
wire:model="notes"
placeholder="Any additional information..."
rows="2"
class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
></textarea>
@error('notes') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Inspection Section -->
<div class="md:col-span-2 mb-6">
<div class="border rounded-lg p-4">
<div class="mb-4">
<label class="flex items-center">
<input type="checkbox" wire:model="perform_inspection" class="mr-2">
<span class="font-medium">Perform Initial Inspection</span>
</label>
</div>
@if($perform_inspection)
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<!-- Inspector -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Inspector</label>
<select wire:model="inspector_id" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">Select inspector...</option>
@foreach($inspectors as $inspector)
<option value="{{ $inspector->id }}">{{ $inspector->name }}</option>
@endforeach
</select>
@error('inspector_id') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Overall Condition -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Overall Condition</label>
<input wire:model="overall_condition" placeholder="Overall vehicle condition" class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
@error('overall_condition') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
<!-- Inspection Checklist -->
<div class="md:col-span-2">
<label class="block text-sm font-medium text-gray-700 mb-2">Inspection Checklist</label>
<div class="grid grid-cols-2 md:grid-cols-3 gap-3">
@foreach([
'exterior_damage' => 'Exterior Damage Check',
'interior_condition' => 'Interior Condition',
'tire_condition' => 'Tire Condition',
'fluid_levels' => 'Fluid Levels',
'lights_working' => 'Lights Working',
'battery_condition' => 'Battery Condition',
'belts_hoses' => 'Belts & Hoses',
'air_filter' => 'Air Filter',
'brake_condition' => 'Brake Condition',
'suspension' => 'Suspension'
] as $key => $label)
<label class="flex items-center text-sm">
<input type="checkbox" wire:model="inspection_checklist.{{ $key }}" class="mr-2">
{{ $label }}
</label>
@endforeach
</div>
</div>
<!-- Inspection Notes -->
<div class="md:col-span-2 mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Inspection Notes</label>
<textarea
wire:model="inspection_notes"
placeholder="Additional inspection notes..."
rows="3"
class="w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
></textarea>
@error('inspection_notes') <span class="text-red-500 text-sm">{{ $message }}</span> @enderror
</div>
</div>
@endif
</div>
</div>
<!-- Checkboxes -->
<div class="md:col-span-2 space-y-3 mb-6">
<label class="flex items-center">
<input type="checkbox" wire:model="personal_items_removed" class="mr-2">
Personal items removed from vehicle
</label>
<label class="flex items-center">
<input type="checkbox" wire:model="photos_taken" class="mr-2">
Photos taken of vehicle condition
</label>
</div>
</div>
<div class="flex justify-end space-x-3 mt-6">
<a href="{{ route('job-cards.index') }}" class="px-4 py-2 text-zinc-600 dark:text-zinc-400 bg-gray-200 rounded-md hover:bg-gray-300">
Cancel
</a>
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700">
Create Job Card
</button>
</div>
</form>
</div>
</div>