@extends('layouts.layout-2')

@section('content')

    @if ($errors->any())
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            </div>
        </div>
    @endif
    <style>

    </style>
    {{--
      <div class="card-body" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
            <h4>{{ __('Your Data') }}</h4>
            <p>{{__('Here you can adjust your data.')}}</p>
            <div id="accordion">
                <div class="card mb-2">
                    <a class="card-header">
                        <div class="collapsed text-dark" data-toggle="collapse" href="#accordion-2" aria-expanded="false">
                            {{ __('Your Data') }} <i class="ion ion-ios-arrow-down"></i>
                        </div>
                    </a>
                    <div id="accordion-2" class="collapse" data-parent="#accordion" style="">
                        <div class="card-body" style="background-color: #f5f5f5;">
                            {{--
                            @if($user->account->company == 1)
                                <h5 class="mt-0 mb-3">{{ __('Company data') }}</h5>
                                <div class="table-responsive">

                                    <table class="table user-view-table m-0">
                                        <tbody>
                                        <tr>
                                            <td>{{ __('Company name') }}:</td>
                                            <td>{{ $user->account->company_name }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ __('Street') }} / {{ __('House number') }}:</td>
                                            <td>{{ $user->account->company_street }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ __('Postcode') }}:</td>
                                            <td>{{ $user->account->company_postal_code }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ __('City') }}:</td>
                                            <td>{{ $user->account->company_city }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ __('Country') }}:</td>
                                            <td>@if($user->account->company_country_id) {{ $user->account->company_country->getLocated()  }} @endif</td>
                                        </tr>
                                        <tr>
                                            <td>{{ __('Phone') }}:</td>
                                            <td>@if($user->account->company_pre_phone_id) {{  $user->account->company_pre_phone->code  }}@endif {{ $user->account->company_phone  }}</td>
                                        </tr>
                                        <tr>
                                            <td>{{ __('Homepage') }}:</td>
                                            <td>{{ $user->account->company_homepage }}</td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>

                                <hr class="border-primary mt-2">
                                <h5 class="mt-4 mb-3">{{ __('Industry') }}</h5>
                                <div class="table-responsive">

                                    <table class="table user-view-table m-0">
                                        <tbody>
                                        @foreach($user->account->getUserIndustrySectorsParents() as $user_industry_sector_parents)
                                            <tr>
                                                <td>{{ $user_industry_sector_parents->industry_sector->getLang('name') }}:</td>
                                                <td>
                                                    @foreach($user->account->getUserIndustrySectorsChilds($user_industry_sector_parents->industry_sector->id) as $user_industry_sector_childs)
                                                        {{ $user_industry_sector_childs->industry_sector->getLang('name') }},
                                                    @endforeach
                                                </td>
                                            </tr>
                                        @endforeach

                                        </tbody>
                                    </table>
                                </div>
                                <hr class="border-primary mt-2">

                            @endif

                            <h5 class="mt-4 mb-3">{{ __('Your Data') }}</h5>
                            <div class="table-responsive">

                                <table class="table user-view-table m-0">
                                    <tbody>
                                    <tr>
                                        <td>{{ __('Function') }}:</td>
                                        <td>{{ $user->account->position_text }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('Salutation') }}:</td>
                                        <td>{!!  HTMLHelper::getSalutationLang($user->account->salutation) !!}</td>
                                    </tr>

                                    <tr>
                                        <td>{{ __('Title') }}:</td>
                                        <td>{{ $user->account->title }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('First name') }}:</td>
                                        <td>{{ $user->account->first_name }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('Last Name') }}:</td>
                                        <td>{{  $user->account->last_name  }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('Street') }} / {{ __('House number') }}:</td>
                                        <td>{{  $user->account->street  }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('Postcode') }}:</td>
                                        <td>{{  $user->account->postal_code  }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('City') }}:</td>
                                        <td>{{  $user->account->city  }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('Country') }}:</td>
                                        <td>@if($user->account->country_id){{  $user->account->country->getLocated() }}@endif</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('Phone') }}:</td>
                                        <td>@if($user->account->pre_phone_id) {{  $user->account->pre_phone->code  }}@endif {{ $user->account->phone  }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('Mobile Phone') }}:</td>
                                        <td>@if($user->account->pre_mobil_id) {{  $user->account->pre_mobil->code  }}@endif {{ $user->account->mobil  }}</td>
                                    </tr>
                                    <tr>
                                        <td>{{ __('E-Mail Address') }}:</td>
                                        <td>{{  $user->email  }}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>

                            <hr class="border-primary mt-2">
                            <h5 class="mt-4 mb-3">{{ __('Your interests') }}</h5>
                            <div class="table-responsive">

                                <table class="table user-view-table m-0">
                                    <tbody>
                                    @foreach($user->account->user_interests as $user_interest)
                                        <tr>
                                            <td>{{ $user_interest->interest->getLang('name') }}:</td>
                                            <td>
                                                <span class="ion ion-md-checkmark-circle-outline text-primary"></span>

                                            </td>
                                        </tr>
                                    @endforeach
                                    </tbody>
                                </table>
                            </div>

                            <hr class="border-primary mt-2">
                            <div class="table-responsive">

                                <table class="table user-view-table m-0">
                                    <tbody>
                                    <tr>
                                        <td>{{ $user->account->contactpartner }}</td>
                                    </tr>

                                    </tbody>
                                </table>
                            </div>


                    </div>

                </div>
            </div>
        </div>


        @if($user->active == 0)
            <a href="{{ route('user_edit') }}" class="btn btn-secondary"
               onclick="$('#user-edit-info-btn').click();">{{ __('Adjust data') }}</a>
        @endif
        @if($user->active == 1)
            <a href="{{ route('user_edit') }}" class="btn btn-secondary"
               onclick="$('#user-edit-info-btn').click();">{{ __('Adjust data') }}</a>
        @endif
    </div>
    --}}
{{-- Später need ADMIN!!!! --}}
    @if(\Auth::user()->isAdmin())
    <div class="card-body mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
        <h4>{{__('Notizen') }} Buchnungen <span class=" text-muted">letzten 10</span></h4>

        @if($last_booking_notices)
            @foreach($last_booking_notices as $booking_notice)
            <div class="row">
                <div class="col-sm-12">
                    @if($booking_notice->from_user_id === \Auth::user()->id)
                    <div class="bg-primary rounded py-2 px-3 mr-3 text-white mb-2">
                    @else
                    <div class="bg-secondary rounded py-2 px-3 mr-3 mb-2">
                    @endif
                        <div class="font-weight-semibold mb-1">{{ $booking_notice->getName() }} | {{ $booking_notice->created_at->format("d.m.Y - H:i:s") }} 
                            @if($booking_notice->edit_at != null)
                            | <i class="ion ion-ios-create"></i> {{ $booking_notice->edit_at->format("d.m.Y - H:i:s") }}
                            @endif
                            | <a class="btn btn-white btn-xs " href="{{ route('booking_detail', [$booking_notice->booking_id]) }}#collapseBookingNotice">zur Buchnung {{ $booking_notice->booking_id }}</a>
                        </div>
                        {!! nl2br($booking_notice->message) !!}
                    </div>
                </div>
            </div>
            {{--  <div class="col-sm-12">
                <div class="bg-lighter rounded py-2 px-3 mr-3 mb-2">
                    <div class="font-weight-semibold mb-1">You | {{ $booking_notice->created_at->format("d.m.Y H:i:s") }}</div>
                    {!! nl2br($booking_notice->message) !!}
                </div>
            </div>
            --}}
            @endforeach
        @endif
    </div>
    
    <div class="card-body mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
        <h4>{{__('Notizen') }} FeWo <span class=" text-muted">letzten 10</span></h4>

        @if($last_booking_fewo_notices)
            @foreach($last_booking_fewo_notices as $booking_fewo_notice)
            <div class="row">
                <div class="col-sm-12">
                    @if($booking_fewo_notice->from_user_id === \Auth::user()->id)
                    <div class="bg-primary rounded py-2 px-3 mr-3 text-white mb-2">
                    @else
                    <div class="bg-secondary rounded py-2 px-3 mr-3 mb-2">
                    @endif
                        <div class="font-weight-semibold mb-1">{{ $booking_fewo_notice->getName() }} | {{ $booking_fewo_notice->created_at->format("d.m.Y - H:i:s") }} 
                            @if($booking_fewo_notice->edit_at != null)
                            | <i class="ion ion-ios-create"></i> {{ $booking_fewo_notice->edit_at->format("d.m.Y - H:i:s") }}
                            @endif
                            | <a class="btn btn-white btn-xs " href="{{ route('travel_user_booking_fewo_detail', [$booking_fewo_notice->travel_user_booking_fewo_id]) }}#collapseBookingNotice">zur Buchnung {{ $booking_fewo_notice->travel_user_booking_fewo_id }}</a>
                        </div>
                        {!! nl2br($booking_fewo_notice->message) !!}
                    </div>
                </div>
            </div>
            {{--  <div class="col-sm-12">
                <div class="bg-lighter rounded py-2 px-3 mr-3 mb-2">
                    <div class="font-weight-semibold mb-1">You | {{ $booking_notice->created_at->format("d.m.Y H:i:s") }}</div>
                    {!! nl2br($booking_notice->message) !!}
                </div>
            </div>
            --}}
            @endforeach
        @endif
    </div>

    <div class="card-body mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
        <h4>{{__('Notizen') }} Anfragen <span class=" text-muted">letzten 10</span></h4>

        @if($last_lead_notices)
            @foreach($last_lead_notices as $lead_notice)
            <div class="row">
                <div class="col-sm-12">
                    @if($lead_notice->from_user_id === \Auth::user()->id)
                    <div class="bg-primary rounded py-2 px-3 mr-3 text-white mb-2">
                    @else
                    <div class="bg-secondary rounded py-2 px-3 mr-3 mb-2">
                    @endif
                        <div class="font-weight-semibold mb-1">{{ $lead_notice->getName() }} | {{ $lead_notice->created_at->format("d.m.Y - H:i:s") }} 
                            @if($lead_notice->edit_at != null)
                            | <i class="ion ion-ios-create"></i> {{ $lead_notice->edit_at->format("d.m.Y - H:i:s") }}
                            @endif
                            | <a class="btn btn-white btn-xs " href="{{ route('lead_detail', [$lead_notice->lead_id]) }}#collapseLeadNotice">zur Buchnung {{ $lead_notice->lead_id }}</a>
                        </div>
                        {!! nl2br($lead_notice->message) !!}
                    </div>
                </div>
            </div>
            {{--  <div class="col-sm-12">
                <div class="bg-lighter rounded py-2 px-3 mr-3 mb-2">
                    <div class="font-weight-semibold mb-1">You | {{ $lead_notice->created_at->format("d.m.Y H:i:s") }}</div>
                    {!! nl2br($lead_notice->message) !!}
                </div>
            </div>
            --}}
            @endforeach
        @endif
    </div>
    @endif

    <div class="card-body  mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
        <h4>{{__('Activities') }}</h4>

        @if($user->active == 1)
            <p><span class="ion ion-md-checkmark-circle-outline  text-primary"></span>
                <strong>{{__('Data released')}}</strong> {{__('at')}} {{ $user->getActiveDateFormat() }}</p>
        @endif
        @if($user->confirmed == 1)
            <p><span class="ion ion-md-checkmark-circle-outline  text-primary"></span>
                <strong>{{__('E-Mail verified')}}</strong> {{__('at')}} {{ $user->getConfirmationDateFormat() }}</p>
        @endif
        @if($user->account_id)
            @if($user->account->data_protection)
                <p><span class="ion ion-md-checkmark-circle-outline  text-primary"></span>
                    <strong>{{__('Privacy policy approved')}}</strong> {{__('at')}} {{ $user->account->getDataProtectionFormat() }}
                </p>
            @endif
            @if($user->active == 1)
                @if($user->agreement)
                    <p><span class="ion ion-md-checkmark-circle-outline text-primary"></span>
                        <strong>{{__('Consent for further information')}}</strong> {{__('at')}} {{ $user->getAgreementFormat() }}
                    </p>
                @else
                    <p><span class="ion ion-md-close-circle-outline text-danger"></span>
                        <strong>{{__('Consent for further information')}}</strong> {{ __('nicht akzeptiert') }}</p>

                @endif
            @endif
        @endif
    </div>

    @if($user->active == 1)


        <div class="card-body  mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
            <h4>{{ __('Einwilligung & Datenschutz') }}</h4>

            {!! Form::open(['url' => route('user_data_accepted_form'), 'class' => 'form-horizontal' , 'id'=>'data-privacy-form-validations']) !!}

            <div class="form-group">
                <label class="custom-control custom-checkbox m-0">
                    <input type="checkbox" class="custom-control-input" name="sender_accepted_infos"
                           id="sender_accepted_infos" @if($user->agreement) checked @endif>
                    <span class="custom-control-label"> {{ __('Yes, I agree that will send me more information.') }}</span>
                </label>
            </div>
            <div class="text-left mt-3">
                <button type="submit" class="btn btn-secondary">{{__('save changes') }}</button>&nbsp;

            </div>

            {!! Form::close() !!}

        </div>
    @endif


    <div class="card-body  mb-2" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
        <h4>{{__('Login & Security') }}</h4>
        <p>{{__('Sign in with your e-mail:')}} {{ Auth::user()->email }}</p>
        @if(!$user->isPasswort())
            <p>{{__('Assign a password for your account.')}}</p>
            <a href="{{route('user_update_password_first')}}" class="btn btn-secondary">{{__('Create Password')}}</a>
        @else
            <p>{{__('Change your password here to access your account.')}}</p>
            <a href="{{route('user_update_password')}}" class="btn btn-secondary">{{__('Change password')}}</a>
        @endif
        <a href="{{route('user_update_email')}}" class="btn btn-secondary">{{__('Change E-Mail')}}</a>
    </div>

    <div class="card-body" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
        <h4>{{ __('Logout') }}</h4>
        <a href="{{route('logout')}}" class="btn btn-primary"><i class="ion ion-ios-log-out text-default"></i>
            &nbsp; {{ __('Logout') }}</a>
    </div>

{{--
<div class="card-body" style="background: #fff; border: 1px solid rgba(24, 28, 33, 0.06);">
     <h4>{{__('Delete') }}</h4>
     <p>{{__('If you no longer want to use our offer, you can delete your account here.')}}</p>
     <a href="{{route('user_delete_account')}}" class="btn btn-default">{{__('Delete Account')}}</a>
 </div>
 --}}


@endsection
