{!! Form::open(['url' => route('admin_sales_customers_detail', [$current->id]), 'class' => 'modal-content', 'enctype' => 'multipart/form-data']) !!}

<input type="hidden" name="action" value="{{$data['action']}}">
<input type="hidden" name="id" value="{{$data['id']}}">
<input type="hidden" name="back" value="{{$data['back']}}">

    <div class="modal-header">
        <h5 class="modal-title">
            Der Kunde hat ggf. unter einer anderen Email-Adresse bestellt als sonst.
            <span class="font-weight-light"> Bitte vor der Bearbeitung prüfen und dem richtigen Vertriebspartner zuordnen.</span>
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
    </div>
    <div class="modal-body">
        <div class="row">
            <div class="col-sm-6">
                <p class="font-weight-bold">Die aktuelle Bestellung wurde getätigt von:</p>
                <div class="bg-light p-3" style="border-radius: 6px">
                    <div class="row">
                        <div class="col-sm-6">
                            <p class="font-weight-bold">Rechnungsadresse:</p>
                            <p>
                                @if($current->billing_company)
                                   Firma: {{ $current->billing_company }}<br>
                                @endif
                                {{ \App\Services\HTMLHelper::getSalutationLang($current->billing_salutation) }}
                                {{ $current->billing_firstname }}
                                <strong class="text-match">{{ $current->billing_lastname }}</strong><br>
                                {{ $current->billing_address }}
                                @if($current->billing_address_2)
                                   / {{ $current->billing_address_2 }}<br>
                                @else
                                    <br>
                                @endif
                                <strong class="text-match">{{ $current->billing_zipcode }}</strong>
                                {{ $current->billing_city }}<br>
                                {{ $current->billing_email }}<br>
                                {{ $current->billing_phone }}<br>
                                {{ $current->billing_country->getLocated() }}
                            </p>
                        </div>
                        <div class="col-sm-6">
                            <p class="font-weight-bold">Lieferadresse:</p>
                            <p>
                            @if($current->same_as_billing)
                                {{__('email.checkout_mail_same_address')}}
                            @else
                                @if($current->shipping_company)
                                    Firma: {{ $current->shipping_company }}<br>
                                @endif
                                {{ \App\Services\HTMLHelper::getSalutationLang($current->shipping_salutation) }}
                                {{ $current->shipping_firstname }}
                                {{ $current->shipping_lastname }}<br>
                                {{ $current->shipping_address }}
                                @if($current->shipping_address_2)
                                    / {{ $current->shipping_address_2 }}<br>
                                @else
                                    <br>
                                @endif
                                {{ $current->shipping_zipcode }}
                                {{ $current->shipping_city }}<br>
                                {{ $current->shipping_email }}<br>
                                {{ $current->shipping_phone }}<br>
                                {{ $current->shipping_country->getLocated() }}
                            @endif
                            </p>
                        </div>
                        <div class="col-sm-12">

                            @if($current->member_id)
                                <input type="hidden" name="change_shopping_user" value="true">

                                <hr>
                                <p class="font-weight-bold">Zugeordneter Vertriebspartner:</p>
                                <p>
                                    <span class="text-muted">#{{$current->member->number}}</span><br>
                                    {{$current->member->getFullName()}}<br>
                                    {{$current->member->account->zipcode}}  {{$current->member->account->city}}<br>
                                    @if($current->member->shop)
                                        @if($current->member->isActive() && $current->member->isActiveShop())
                                            <a href="{{$current->member->shop->getSubdomain(false)}}" class="badge badge-success" target="_blank">{{$current->member->shop->getSubdomain(false)}}</a>
                                        @else
                                            <span class="badge badge-danger" target="_blank">{{$current->member->shop->getSubdomain(false)}}</span>
                                        @endif
                                    @else
                                        Keinen Shop eingerichtet
                                    @endif
                                    <label class="custom-control custom-radio mt-3">
                                        <input type="radio" class="custom-control-input" name="is_like_shopping_user_id" value="{{$current->id}}">
                                        <span class="custom-control-label">Nein, das ist ein neuer Kunde, Vertriebspartner <span class="text-muted">#{{$current->member->number}}</span> zuordnen</span>
                                    </label>
                                </p>
                            @endif

                            <hr>
                            <p class="font-weight-bold">Bestellt im Shop:</p>
                            <p>
                                @if($current->shopping_order && $current->shopping_order->user_shop)
                                    <span class="text-muted">#{{$current->shopping_order->user_shop->user->number}}</span><br>
                                    {{$current->shopping_order->user_shop->user->getFullName()}}<br>
                                    {{$current->shopping_order->user_shop->user->account->zipcode}}  {{$current->shopping_order->user_shop->user->account->city}}<br>
                                @if($current->shopping_order->user_shop)
                                @if($current->shopping_order->user_shop->user->isActive() && $current->shopping_order->user_shop->user->isActiveShop())
                                    <a href="{{$current->shopping_order->user_shop->getSubdomain(false)}}" class="badge badge-success" target="_blank">{{$current->shopping_order->user_shop->getSubdomain(false)}}</a>
                                @else
                                    <span class="badge badge-danger" target="_blank">{{$current->shopping_order->user_shop->getSubdomain(false)}}</span>
                                @endif
                                @endif
                                    @if(!$current->member_id)
                                    <label class="custom-control custom-radio mt-3">
                                        <input type="radio" class="custom-control-input" name="is_like_shopping_user_id" value="{{$current->id}}">
                                        <span class="custom-control-label">Nein, das ist ein neuer Kunde, Vertriebspartner <span class="text-muted">#{{$current->shopping_order->user_shop->user->number}}</span> zuordnen</span>
                                    </label>
                                    @endif
                                @else
                                    Keiner Bestellung / Shop zugeordnet
                                @endif
                            </p>

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

            <div class="col-sm-6">
                <p class="font-weight-bold">Ist das vielleicht dieser Kunde?</p>
                @foreach($possibles as $possible)
                    @if(isset($possible[0]))
                        @php($possible = $possible[0])
                    @endif
                <div class="bg-light p-3 mb-3" style="border-radius: 6px">
                    <div class="row">
                        <div class="col-sm-6">
                            <p class="font-weight-bold">Rechnungsadresse:</p>
                            <p>
                                @if($possible->billing_company)
                                    Firma: {{ $possible->billing_company }}<br>
                                @endif
                                {{ \App\Services\HTMLHelper::getSalutationLang($possible->billing_salutation) }}
                                {{ $possible->billing_firstname }}
                                <strong class="text-match">{{ $possible->billing_lastname }}</strong> <span class="text-muted">#{{$possible->number}}</span> <br>
                                {{ $possible->billing_address }}
                                @if($possible->billing_address_2)
                                    / {{ $possible->billing_address_2 }}<br>
                                @else
                                    <br>
                                @endif
                                <strong class="text-match">{{ $possible->billing_zipcode }}</strong>
                                {{ $possible->billing_city }}<br>
                                <strong class="text-danger">{{ $possible->billing_email }}</strong><br>
                                {{ $possible->billing_phone }}<br>
                                {{ $possible->billing_country->getLocated() }}
                            </p>
                        </div>
                        <div class="col-sm-6">
                            <p class="font-weight-bold">Lieferadresse:</p>
                            <p>
                                @if($possible->same_as_billing)
                                    {{__('email.checkout_mail_same_address')}}
                                @else
                                    @if($possible->shipping_company)
                                        Firma: {{ $possible->shipping_company }}<br>
                                    @endif
                                    {{ \App\Services\HTMLHelper::getSalutationLang($possible->shipping_salutation) }}
                                    {{ $possible->shipping_firstname }}
                                    {{ $possible->shipping_lastname }}<br>
                                    {{ $possible->shipping_address }}
                                    @if($possible->shipping_address_2)
                                        / {{ $possible->shipping_address_2 }}<br>
                                    @else
                                        <br>
                                    @endif
                                    {{ $possible->shipping_zipcode }}
                                    {{ $possible->shipping_city }}<br>
                                    {{ $possible->shipping_email }}<br>
                                    {{ $possible->shipping_phone }}<br>
                                    {{ $possible->shipping_country->getLocated() }}
                                @endif
                            </p>
                        </div>
                        <div class="col-sm-12">
                            <hr>
                            <p class="font-weight-bold">Zugeordneter Vertriebspartner:</p>
                            <p>
                                @if($possible->member_id)
                                    <span class="text-muted">#{{$possible->member->number}}</span><br>
                                    {{$possible->member->getFullName()}}<br>
                                    {{$possible->member->account->zipcode}}  {{$possible->member->account->city}}<br>
                                    @if($possible->member->shop)
                                        @if($possible->member->isActive() && $possible->member->isActiveShop())
                                            <a href="{{$possible->member->shop->getSubdomain(false)}}" class="badge badge-success" target="_blank">{{$possible->member->shop->getSubdomain(false)}}</a>
                                        @else
                                            <span class="badge badge-danger" target="_blank">{{$possible->member->shop->getSubdomain(false)}}</span>
                                        @endif
                                    @else
                                        Keinen Shop eingerichtet
                                    @endif

                                    <label class="custom-control custom-radio mt-3">
                                        <input type="radio" class="custom-control-input" name="is_like_shopping_user_id" value="{{$possible->id}}">
                                        <span class="custom-control-label">Stimmt, das ist der gleiche Kunde, Vertriebspartner <span class="text-muted">#{{$possible->member->number}}</span> zuordnen</span>
                                    </label>
                                @else
                                    Keinem Vertriebspartner zugeordnet
                                @endif
                            </p>
                        </div>
                    </div>
                </div>

                @endforeach
            </div>
        </div>
        <hr>
        <div class="form-row">
            <div class="form-group col">
                <label for="change_member_key" class="form-label">{{__('Passwort eingeben')}}*</label>
                <input type="text" class="form-control" name="change_member_key" id="change_member_key" placeholder="mivita" required>
            </div>
        </div>
        <div class="form-row">
            <div class="form-group col">
                <label class="custom-control custom-checkbox mt-3">
                    <input type="checkbox" class="custom-control-input" name="send_member_mail" value="send" checked>
                    <span class="custom-control-label">zugeordneten Vertriebspartner die Bestellung als E-Mail zusenden</span>
                </label>
            </div>
        </div>

    </div>
<div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
        <button type="submit" class="btn btn-primary">{{__('übernehmen')}}</button>

    </div>
{!! Form::close() !!}

<script type="text/javascript">
    $( document ).ready(function() {

    });
</script>
