@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">
        {{ __('navigation.my_data') }}
    </h4>
    {!! Form::open(['action' => route('user_edit'), 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!}
        <input type="hidden" name="user_id" id="user_id" value="@if($user->id>0){{$user->id}}@else new @endif">
         @include('user.user_form')
    <div class="text-left mt-3">
        <button type="submit" class="btn btn-secondary">{{ __('save changes') }}</button>&nbsp;
        <a href="{{route('home')}}" class="btn btn-default">{{ __('back') }}</a>
    </div>
    {!! Form::close() !!}


    <!-- Modal template -->
    <div class="modal fade" id="modal-user-vat-validation">
        <div class="modal-dialog">
            {!! Form::open(['action' => route('user_edit'), 'class' => 'modal-content']) !!}
            <input type="hidden" name="user_id" id="user_id" value="@if($user->id>0){{$user->id}}@else new @endif">

                <div class="modal-header">
                    <h5 class="modal-title">Neue UST-ID validieren und Reverse Charge Verfahren aktivieren</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-12">
                            <p>Umkehrung der Steuerschuldnerschaft oder auch Abzugsverfahren. In diesem Spezialfall muss der Leistungsempfänger (Vertriebspartner) und nicht der leistende Unternehmer (Grüne Seele) die Umsatzsteuer entrichten.</p>
                            <p>Bei der Aktivierung wird die USt-ID benötigt und validiert.</p>
                        </div>
                        <div class="form-group col-sm-12 {{ $errors->has('reverse_charge') ? 'has-error' : '' }}">
                                <label class="form-label" for="tax_identification_number">{{ __('USt-ID Nummer') }} *</label>
                                {{ Form::text('tax_identification_number', $user->account-> tax_identification_number,  array('placeholder'=>__('USt-ID Nummer'), 'class'=>'form-control', 'id'=>'tax_identification_number', 'required'=>true)) }}
                            
                            @if ($errors->has('reverse_charge'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('reverse_charge') }}</strong>
                                </span>
                            @endif
                        </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" name="action" value="reverse_charge_validate">USt-ID Nummer validieren</button>
                </div>
                {!! Form::close() !!}
         </div>
    </div>



@endsection
