@extends('admin.layouts.container')

@section('content')
<div class="side-title">
    <h3>{{$head ?? '' }}</h3>
</div>
<div class="border-item">
    <form class="form-row">

        <div class="form-group col-lg-4">
            <label> {{__('units.applicant_name')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{$unit->applicant_name}}'/>
        </div>
        <div class="form-group col-lg-4">
            <label> {{__('units.nationality')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{$unit->nationality}}'/>
        </div>
        <div class="form-group col-lg-4">
            <label> {{__('units.dependent_no')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{$unit->dependent_no}}'/>
        </div>
        <div class="form-group col-lg-4">
            <label> {{__('units.adult')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{$unit->adult}}'/>
        </div>
        <div class="form-group col-lg-4">
            <label> {{__('units.children')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{$unit->children}}'/>
        </div>
        <div class="form-group col-lg-4">
            <label> {{__('units.id_type')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{$unit->id_type}}'/>
        </div>
        <div class="form-group col-lg-4">
            <label> {{__('units.id_no')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{$unit->id_no}}'/>
        </div>
        <div class="form-group col-lg-4">
            <label> {{__('units.rental_source')}}</label>
            <input type="text" readonly class="form-control bg-white" value='{{__('units.'.$unit->rental_source)}}'/>
        </div>
        @if($unit->rental_source == 'company')
            <div class="form-group col-lg-4">
                <label> {{__('units.company_name')}}</label>
                <input type="text" readonly class="form-control bg-white" value='{{$unit->company_name}}'/>
            </div>
            <div class="form-group col-lg-4">
                <label> {{__('units.company_address')}}</label>
                <input type="text" readonly class="form-control bg-white" value='{{$unit->company_address}}'/>
            </div>
            <div class="form-group col-lg-4">
                <label> {{__('units.company_contact_no')}}</label>
                <input type="text" readonly class="form-control bg-white" value='{{$unit->company_contact_no}}'/>
            </div>
        @endif
        @if($unit->rental_source == 'self')
            <div class="form-group col-lg-4">
                <label> {{__('units.person_name')}}</label>
                <input type="text" readonly class="form-control bg-white" value='{{$unit->person_name}}'/>
            </div>
            <div class="form-group col-lg-4">
                <label> {{__('units.person_address')}}</label>
                <input type="text" readonly class="form-control bg-white" value='{{$unit->person_address}}'/>
            </div>
            <div class="form-group col-lg-4">
                <label> {{__('units.person_contact_no')}}</label>
                <input type="text" readonly class="form-control bg-white" value='{{$unit->person_contact_no}}'/>
            </div>
        @endif


        @if(count($unit->applicant_contact))
            <div class="col-lg-12 mb-3 mt-3">
                <table class="table table-striped text-center table-hover table-bordered">
                    <tr>
                        <th colspan="2">{{__('units.applicant_contact')}}</th>
                    </tr>
                    @foreach($unit->applicant_contact as $contactName => $contact)
                        @if($contact == '') @continue @endif
                        <tr>
                            <td>{{__('units.applicant_contact_'.$contactName)}}</td>
                            <td>{{$contact}}</td>
                        </tr>
                    @endforeach

                </table>
            </div>
        @endif

        @if(count($unit->selected_compound))
            <div class="col-lg-12">
                <table class="table table-striped text-center table-hover table-bordered">
                    <tr>
                        <th>#</th>
                        <th>{{__('units.selected_compound')}}</th>
                    </tr>
                    @foreach($unit->selected_compound as  $compound)
                        @if($compound == '') @continue @endif
                        <tr>
                            <td>{{$loop->iteration}}</td>
                            <td>{{__('units.'.$compound)}}</td>
                        </tr>
                    @endforeach

                </table>
            </div>
        @endif

        <div class="text-center mt-5 col-12">
            <a href="{{route('units.index')}}" class="butn"><span>{{ __('units.head') }}</span></a>
        </div>
    </form>
</div>

@endsection
