@extends('layout.app')
@section('title', 'Add Lifespan Entry')
@push('header_script')
@endpush
@section('content')
{!! Form::open([
'route' => 'vms.lifespan.store',
'method' => 'POST',
'class' => 'needs-validation',
'autocomplete' => 'off',
'id' => 'lifespanForm',
]) !!}
{{-- ── SECTION 1: Vehicle & Component ─────────────────── --}}
Vehicle & Component Details
{!! Form::select('vehicle_id', ['' => '-- Select Vehicle --'] + $vehicles, old('vehicle_id'), [
'class' => 'form-control select2 ' . ($errors->has('vehicle_id') ? 'is-invalid' : ''),
'id' => 'vehicle_id',
'required' => true,
]) !!}
{{ $errors->first('vehicle_id') }}
{!! Form::select('product_id', ['' => '-- Select Product --'] + $products, old('product_id'), [
'class' => 'form-control select2 ' . ($errors->has('product_id') ? 'is-invalid' : ''),
'id' => 'product_id',
'required' => true,
]) !!}
{{ $errors->first('product_id') }}
{!! Form::select('brand_id', ['' => '-- Select Brand --'] + $brands, old('brand_id'), [
'class' => 'form-control select2 ' . ($errors->has('brand_id') ? 'is-invalid' : ''),
'id' => 'brand_id',
]) !!}
{{ $errors->first('brand_id') }}
{{-- ── SECTION 2: Dates & KM ───── --}}
Fitting & Removal Details
{{-- Fitted Date --}}
{{-- Fitted KM --}}
{{-- Removed Date --}}
{{-- Removed KM --}}
{{-- Reason --}}
{!! Form::select(
'reason',
[
'' => '-- Select Reason --',
'fully_used' => 'Fully Used',
'driver_irresponsibility' => "Driver's Irresponsibility / Careless",
'maintenance_problem' => 'Maintenance Problem',
'manufacturing_defect' => 'Manufacturing Defect',
'rotation' => 'Rotation / Position Change',
'still_using' => 'Still Using',
],
old('reason'),
[
'class' => 'form-control select2',
'id' => 'reason',
],
) !!}
{{ $errors->first('reason') }}
{{-- Status --}}
{!! Form::select(
'status',
[
'active' => 'Active (Still Fitted)',
'removed' => 'Removed',
],
old('status', 'active'),
[
'class' => 'form-control select2',
'id' => 'status',
'required' => true,
],
) !!}
{{ $errors->first('status') }}
{{-- Reusable --}}
{{-- Remark --}}
{{-- ── SECTION 3: Auto Calculated Lifespan ────────────── --}}
{{-- Days --}}
{{-- KM --}}
Auto-calculated when both dates and KM are entered.
{{-- ── Submit Buttons -------- --}}
{!! Form::close() !!}
@endsection
@push('footer_script')
@endpush