@extends('template.app')

@section('meta')
@endsection

@section('title')
    Car Varient View
@endsection

@section('styles')
@endsection

@section('content')
<div class="page-breadcrumb">
    <div class="row">
        <div class="col-7 align-self-center">
            <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Car Varient Master</h4>
            <div class="d-flex align-items-center">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb m-0 p-0">
                        <li class="breadcrumb-item"><a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a></li>
                        <li class="breadcrumb-item"><a href="{{ route('car_varient') }}" class="text-muted">Car Varient Master</a></li>
                        <li class="breadcrumb-item text-muted active" aria-current="page">View</li>
                    </ol>
                </nav>
            </div>
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <form action="{{ route('car_varient.view') }}" name="form" id="form" method="post" enctype="multipart/form-data">
                        @csrf
                        @method('GET')

                        <div class="row">
                            <div class="form-group col-sm-6">
                                <label for="name">Name</label>
                                <input type="text" name="name" id="name" class="form-control" placeholder="Enter Name" value="{{ $data->name ??'' }}" disabled>
                                <span class="kt-form__help error name"></span>
                            </div>      

                            <div class="form-group col-sm-6">
                                <label for="car_model">Car Model</label>
                                <select class="form-control" name="car_model" id="car_model" disabled>
                                    <option value="">Select Car Model</option>
                                    @if(isset($Carmodel) && $Carmodel->isNotEmpty())
                                        @foreach($Carmodel as $car_model)
                                            <option value="{{ $car_model->id }}" @if($data->car_model == $car_model->id) selected @endif >{{ ucfirst(str_replace('_', ' ', $car_model->name)) }}</option>
                                        @endforeach
                                    @endif
                                </select>
                                <span class="kt-form__help error car_model"></span>
                            </div> 

                            <div class="form-group col-sm-6">
                                <label for="fule_type">Fule Type</label>
                                <select class="form-control" name="fule_type" id="fule_type" disabled>
                                    <option value="">Select Fule Type</option>
                                    @if(isset($Fuletype) && $Fuletype->isNotEmpty())
                                        @foreach($Fuletype as $fule_type)
                                            <option value="{{ $fule_type->id }}" @if($data->fule_type == $fule_type->id) selected @endif>{{ ucfirst(str_replace('_', ' ', $fule_type->title)) }}</option>
                                        @endforeach
                                    @endif
                                </select>
                                <span class="kt-form__help error fule_type"></span>
                            </div> 

                            <div class="form-group col-sm-6">
                                <label for="transmission">Transmission</label>
                                <select class="form-control" name="transmission" id="transmission" disabled>
                                    <option value="">Select Transmission</option>
                                    @if(isset($Transmission) && $Transmission->isNotEmpty())
                                        @foreach($Transmission as $transmission)
                                            <option value="{{ $transmission->id }}" @if($data->transmission == $transmission->id) selected @endif>{{ ucfirst(str_replace('_', ' ', $transmission->name)) }}</option>
                                        @endforeach
                                    @endif
                                </select>
                                <span class="kt-form__help error fule_type"></span>
                            </div> 

                               <!-- exterior_color
                            Interior_color
                            color_tone 
                             -->

                            <div class="form-group col-sm-6">
                                <label for="exterior_color">Exterior Color</label>
                                <select class="form-control " name="exterior_color[]" id="exterior_color" multiple disabled>
                                    <option value="">Select Exterior Color</option>
                                    @if(isset($Exteriorcolor) && $Exteriorcolor->isNotEmpty())
                                    
                                    @php $exterior_color_data=explode(',',$data->exterior_color); @endphp

                                        @foreach($Exteriorcolor AS $row)
                                            <option value="{{ $row->id }}" @if(in_array($row->id,$exterior_color_data)) selected @endif> {{ $row->name }} </option>
                                        @endforeach
                                    @endif

                                </select>
                                <span class="kt-form__help error exterior_color"></span>
                            </div>

                            <div class="form-group col-sm-6">
                                <label for="Interior_color">Interior color</label>
                                <select class="form-control " name="Interior_color[]" id="Interior_color" multiple disabled>
                                    <option value="">Select Interior color</option>
                                    @if(isset($Interiorcolor) && $Interiorcolor->isNotEmpty())

                                    @php $Interior_color_data=explode(',',$data->Interior_color); @endphp
                                        @foreach($Interiorcolor AS $row)
                                            <option value="{{ $row->id }}" @if(in_array($row->id,$Interior_color_data)) selected @endif> {{ $row->name }} </option>
                                        @endforeach
                                    @endif
                                </select>
                                <span class="kt-form__help error Interior_color"></span>
                            </div>

                            <div class="form-group col-sm-6">
                                <label for="color_tone">Color Tone</label>
                                <select class="form-control " name="color_tone[]" id="color_tone" multiple disabled>
                                    <option value="">Select color tone </option>
                                    @if(isset($Colortone) && $Colortone->isNotEmpty())

                                    @php $color_tone_data=explode(',',$data->color_tone); @endphp

                                        @foreach($Colortone AS $row)
                                            <option value="{{ $row->id }}" @if(in_array($row->id,$color_tone_data)) selected @endif> {{ $row->name }} </option>
                                        @endforeach
                                    @endif
                                </select>
                                <span class="kt-form__help error color_tone"></span>
                            </div>

                        </div>

                        <div class="form-group">
                            <a href="{{ route('car_varient') }}" class="btn waves-effect waves-light btn-rounded btn-outline-secondary">Back</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('scripts')
@endsection