@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

    <h4 class="font-weight-bold py-2 mb-2">
        @if(!$user->id || $user->id === 'new')
        {{ __('Neuen Vertriebspartner erstellen') }}
        @else
            {{ __('Vertriebspartner bearbeiten') }}
        @endif
    </h4>

    {!! Form::open(['url' => route('admin_lead_store')."?show=".$show, 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!}

    <div class="text-left mt-0 mb-2">
        <button type="submit" class="btn btn-submit btn-primary">{{ __('save') }}</button>&nbsp;
        <a href="{{ route('admin_leads') }}" class="btn btn-default">{{ __('back') }}</a>
    </div>

        @include('admin.lead.m_register_data')

        @if(!$user->id || $user->id === 'new')
            @include('user.user_new_form')
            @include('user.data_verify')
        @else
            @include('user.user_form')
        @endif

    <div class="text-left mt-3">
        <button type="submit" class="btn btn-submit btn-primary">{{ __('save') }}</button>&nbsp;
        <a href="{{ route('admin_leads') }}" class="btn btn-default">{{ __('back') }}</a>
    </div>

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


    <!-- Modal template -->
    <div class="modal fade" id="modals-edit-m-data">
        <div class="modal-dialog">
            <form class="modal-content" action="{{route('admin_lead_edit', [$user->id])}}?show={{$show}}" method="post">
                @csrf
                <div class="modal-header">
                    <h5 class="modal-title"> {{__('Daten mivita')}} <span class="font-weight-light">{{__('edit')}}</span></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
                </div>
                <div class="modal-body">
                    <div class="form-row">
                        <div class="form-group col">
                            <label for="name" class="form-label">{{__('Passwort eingeben')}}</label>
                            <input type="text" class="form-control" name="edit_m_data_key" placeholder="gseele">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
                    <button type="submit" class="btn btn-primary">{{__('öffnen')}}</button>
                </div>
            </form>
        </div>
    </div>

    <!-- Modal template -->
    <div class="modal fade" id="modals-register-m-data">
        <div class="modal-dialog">
            <form class="modal-content" action="{{route('admin_lead_released', ['incomplete', $user->id])}}?show={{$show}}" method="post">
                @csrf
                <div class="modal-header">
                    <h5 class="modal-title"> {{__('Vertriebspartner Daten nicht vollständig')}}</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
                </div>
                <div class="modal-body">
                    <p>Vertriebspartner eine E-Mail senden, dass die Daten nicht vollständig sind?<br>
                    Vervollständige die Nachricht welche Daten fehlerhaft sind, die Nachricht wird an den Vertriebspartner gesendet. Anrede, Links, Absender wird automatisch in die E-Mail eingefügt. </p>

                    <div class="form-row">
                        <div class="form-group col">
                            <label for="name" class="form-label">{{__('Betreff')}}</label>
                            <input type="text" class="form-control" name="account_incomplete_subject" value="{{__('email.email_incomplete')}}">
                        </div>
                    </div>

                    <div class="form-row">
                        <div class="form-group col">
                            <label for="name" class="form-label">{{__('Nachricht')}}</label>
                            <textarea name="account_incomplete_message" class="form-control" rows="6">{{__('email.account_incomplete_copy1line')}}</textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
                    <button type="submit" class="btn btn-primary">{{__('save')}}</button>
                </div>
            </form>
        </div>
    </div>



@endsection