@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">
        {{ __('Registrierung abschließen') }}
    </h4>

    <div id="smartwizard-3" class="smartwizard-register">
        <ul class="card px-4 pt-3 mb-3">
            <li>
                <a href="#smartwizard-3-step-1" class="mb-3">
                    <span class="sw-done-icon ion ion-md-checkmark"></span>
                    <span class="sw-number">1</span>
                    Datenschutz
                    <div class="text-muted small">zustimmen</div>

                </a>
            </li>
            <li>
                <a href="#smartwizard-3-step-2" class="mb-3">
                    <span class="sw-done-icon ion ion-md-checkmark"></span>
                    <span class="sw-number">2</span>
                    Passwort
                    <div class="text-muted small">vergeben</div>

                </a>
            </li>
            <li>
                <a href="#smartwizard-3-step-3" class="mb-3">
                    <span class="sw-done-icon ion ion-md-checkmark"></span>
                    <span class="sw-number">3</span>
                    Daten
                    <div class="text-muted small">anpassen</div>


                </a>
            </li>
            <li>
                <a href="#smartwizard-3-step-4" class="mb-3">
                    <span class="sw-done-icon ion ion-md-checkmark"></span>
                    <span class="sw-number">4</span>
                    Paket
                    <div class="text-muted small">auswählen</div>
                </a>
            </li>
        </ul>

        <div class="mb-3">
            <div id="smartwizard-3-step-1" class="card animated fadeIn">
                <div class="card-body">
                        {!! Form::open(['url' => route('wizard_store_create', [10]), 'class' => 'form-horizontal', 'id'=>'lead-form-validation-confirm']) !!}
                            @include('user.data_confirm')
                        <div class="text-left mt-3">
                            <button type="submit" class="btn btn-secondary">{{ __('zustimmen und weiter') }}</button>&nbsp;
                        </div>
                        {!! Form::close() !!}
                </div>
            </div>
            <div id="smartwizard-3-step-2" class="card animated fadeIn">
                <div class="card-body">
                    @if(!$user->isPasswort())
                        {!! Form::open(['url' => route('wizard_store_create', [11])]) !!}
                            @include('user.update_password_first_form')
                        <div class="text-left mt-3">
                            <button type="submit" class="btn btn-secondary">{{ __('erstellen und weiter') }}</button>&nbsp;
                        </div>
                        {!! Form::close() !!}
                    @else
                        {!! Form::open(['url' => route('wizard_store_create', [11])]) !!}
                            <p>Passwort wurde bereits erstellt.</p>
                            <button type="submit" class="btn btn-secondary">{{ __('weiter') }}</button>&nbsp;
                        {!! Form::close() !!}
                    @endif
                </div>
            </div>
            <div id="smartwizard-3-step-3" class="card animated fadeIn">
                <div class="card-body">
                    {!! Form::open(['url' => route('wizard_store_create', [12]), 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!}
                    @include('user.user_form')
                    <div class="text-left mt-3">
                        <button type="submit" class="btn btn-secondary">{{ __('speichern und weiter') }}</button>&nbsp;
                    </div>
                    {!! Form::close() !!}
                </div>
            </div>
            <div id="smartwizard-3-step-4" class="card animated fadeIn">
                <div class="card-body">
                    @if($userHistoryWizardPayment && $userHistoryWizardPayment->status > 2)
                        <h6 class="alert badge-{{$userHistoryWizardPayment->getStatusColor()}}">Eine Zahlung wurde ausgeführt. Status: {{ trans('payment.status.'.$userHistoryWizardPayment->getStatusType())}}</h6>
                        <h5 class="card-header bg-light">
                            <a href="#" class=""  data-toggle="collapse" data-target="#collapsePaymentForm" aria-expanded="false" aria-controls="collapsePaymentForm">
                                <i class="fa fa-caret-expand"></i>  {{ __('Zahlungsoptionen öffnen') }}
                            </a>
                        </h5>
                        <div class="collapse" id="collapsePaymentForm">
                            @include('user.wizard._payment')
                        </div>

                    @else
                        @include('user.wizard._payment')
                    @endif
                </div>
            </div>
        </div>
    </div>

    <link rel="stylesheet" href="{{ mix('/vendor/libs/smartwizard/smartwizard.css') }}">
    <script src="{{ mix('/vendor/libs/smartwizard/smartwizard.js') }}"></script>
    <script type="text/javascript">
        $(document).ready(function() {

            $('.smartwizard-register').smartWizard({
                autoAdjustHeight: true,
                backButtonSupport: true,
                useURLhash: false,
                showStepURLhash: false,
                selected: '{{$step-10}}',
                toolbarSettings: {
                    showNextButton: false,
                    showPreviousButton: false,
                }
            });
        });
    </script>

@endsection
