@extends('layouts.app')
@section('title')编辑-车辆@endsection

@section('content')
    <div id="nav2">
        @component('maintenance.menu')
        @endcomponent
        @component('maintenance.carType.menu')
                <li class="nav-item">
                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">修改</a>
                </li>
        @endcomponent
    </div>
    <div class="container-fluid">
        <div class="card">
            <div class="card-body">
                <form method="POST" action='{{url("maintenance/carType/{$carType->id}")}}'>
                    @csrf
                    @method('PUT')
                    <div class="form-group row">
                        <label for="name" class="col-2 col-form-label text-right">车辆名称</label>
                        <div class="col-8">
                            <input type="text" class="form-control @error('CarType.name') is-invalid @enderror"
                                   name="CarType[name]" autocomplete="off" value="{{old('CarType')['name']?old('CarType')['name']:$carType->name}}">
                            @error('CarType.name')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $errors->first('CarType.name') }}</strong>
                            </span>
                            @enderror
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="model" class="col-2 col-form-label text-right">车辆型号</label>
                        <div class="col-8">
                            <input type="text" class="form-control @error('CarType.model') is-invalid @enderror"
                                   name="CarType[model]" autocomplete="off" value="{{old('CarType')['model']?old('CarType')['model']:$carType->model}}">
                            @error('CarType.model')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $errors->first('CarType.model') }}</strong>
                            </span>
                            @enderror
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="length" class="col-2 col-form-label text-right">车辆长度</label>
                        <div class="col-8">
                            <input type="text" class="form-control @error('CarType.length') is-invalid @enderror"
                                   name="CarType[length]" autocomplete="off" value="{{old('CarType')['length']?old('CarType')['length']:$carType->length}}">
                            @error('CarType.length')
                            <span class="invalid-feedback" role="alert">
                               <strong>{{ $errors->first('CarType.length') }}</strong>
                            </span>
                            @enderror
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="load" class="col-2 col-form-label text-right">车辆载重</label>
                        <div class="col-8">
                            <input type="text" class="form-control @error('CarType.load') is-invalid @enderror"
                                   name="CarType[load]" autocomplete="off" value="{{old('CarType')['load']?old('CarType')['load']:$carType->load}}">
                            @error('CarType.load')
                            <span class="invalid-feedback" role="alert">
                                 <strong>{{ $errors->first('CarType.load') }}</strong>
                            </span>
                            @enderror
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="remark" class="col-2 col-form-label text-right">备注</label>
                        <div class="col-8">
                            <textarea  class="form-control "
                                       name="CarType[remark]" autocomplete="off" >{{old('CarType')['remark']?old('CarType')['remark']:$carType->remark}}</textarea>
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-8 offset-2">
                            <input type="submit" class="btn btn-outline-dark form-control">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection
