
<div class="card mb-2">

    <h5 class="card-header">
        {{ __('Land') }}
        <label class="custom-control custom-checkbox float-right">
            {!! Form::checkbox('active', 1, $country->active, ['class'=>'custom-control-input']) !!}
            <span class="custom-control-label">{{__('aktiv')}}</span>
        </label>

    </h5>
    <div class="card-body">
        <div class="form-row">
            <div class="form-group col-sm-6">
                <label class="form-label" for="de">{{ __('Name DE') }}*</label>
                {{ Form::text('name', $country->de,  array('placeholder'=>__('Land DE'), 'class'=>'form-control', 'id'=>'de', 'required')) }}
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label" for="en">{{ __('Name EN') }}</label>
                {{ Form::text('en', $country->en,  array('placeholder'=>__('Land EN'), 'class'=>'form-control', 'id'=>'en')) }}
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label" for="es">{{ __('Name ES') }}*</label>
                {{ Form::text('es', $country->es,  array('placeholder'=>__('Land ES'), 'class'=>'form-control', 'id'=>'es')) }}
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label" for="fr">{{ __('Name FR') }}</label>
                {{ Form::text('fr', $country->fr,  array('placeholder'=>__('Land FR'), 'class'=>'form-control', 'id'=>'fr')) }}
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label" for="it">{{ __('Name IT') }}</label>
                {{ Form::text('it', $country->it,  array('placeholder'=>__('Land IT'), 'class'=>'form-control', 'id'=>'it')) }}
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label" for="ru">{{ __('Name RU') }}</label>
                {{ Form::text('ru', $country->ru,  array('placeholder'=>__('Land RU'), 'class'=>'form-control', 'id'=>'ru')) }}
            </div>
        </div>
        <hr>
        <div class="form-row">
            <div class="form-group col-sm-6">
                <label class="form-label" for="code">Ländercode</label>
                {{ Form::text('code', $country->code,  array('placeholder'=>__('code'), 'class'=>'form-control', 'id'=>'code')) }}
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label" for="phone">Telefonvorwahl</label>
                {{ Form::text('phone', $country->phone,  array('placeholder'=>__('phone'), 'class'=>'form-control', 'id'=>'phone')) }}
            </div>
        </div>
    </div>
</div>


<div class="card mb-2">
    <h5 class="card-header">
        Anzeige und Währung
    </h5>
    <div class="card-body">
        <div class="form-row">
            <div class="form-group col-sm-12">
                <label class="custom-control custom-checkbox">
                    {!! Form::checkbox('switch', 1,  $country->switch, ['class'=>'custom-control-input']) !!}
                    <span class="custom-control-label">Land aus Auswahl auf der Webseite anzeigen (Länderwechsel)</span>
                </label>
            </div>
            <div class="form-group col-sm-12">
                <label class="custom-control custom-checkbox">
                    {!! Form::checkbox('own_eur', 1,  $country->own_eur, ['class'=>'custom-control-input']) !!}
                    <span class="custom-control-label">Land hat eigenen EURO Preis</span>
                </label>
            </div>
            <div class="col-12">
                <hr class="mt-0">
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label">Eigene Währung</label>
                <label class="custom-control custom-checkbox">
                    {!! Form::checkbox('currency', 1,  $country->currency, ['class'=>'custom-control-input', 'id'=>'currency']) !!}
                    <span class="custom-control-label">Land hat eigene Währung<br>(Währung wird nur zuzsätzlich zum EUR angezeigt, bezahlt wird in EUR)</span>
                </label>
            </div>
            <div class="form-group col-sm-6">
                <label class="form-label" for="currency_unit">Abkürzung der Währung</label>
                {{ Form::text('currency_unit', $country->currency_unit,  array('placeholder'=>__('CHF'), 'class'=>'form-control', 'id'=>'currency_unit')) }}
            </div>
        </div>
        <div id="show_currency_calc" style="display: @if($country->currency) block @else none @endif">
            <div class="form-row">
                <div class="col-12">
                    <hr class="mt-0" >
                </div>
                <div class="form-group col-sm-6">
                    <label class="form-label">Umrechnungsfaktor zum EUR {{$country->currency_calc}}</label>
                    <div class="custom-controls-stacked">
                        <label class="custom-control custom-radio">
                            {!! Form::radio('currency_calc', 0,  !$country->currency_calc, ['class'=>'custom-control-input']) !!}
                            <span class="custom-control-label">dient nur als Anzeigungshilfe, jeder Preis wird manuell angegeben</span>
                        </label>
                        <label class="custom-control custom-radio">
                            {!! Form::radio('currency_calc', 1,  $country->currency_calc, ['class'=>'custom-control-input']) !!}
                            <span class="custom-control-label">berechnet den Preis automatisch</span>
                        </label>
                    </div>
                </div>
                <div class="form-group col-sm-6">
                    <label class="form-label" for="currency_faktor">Faktor Währungen zum Euro (z.B. 1 Euro zu 1,07 CHF)</label>
                    {{ Form::text('currency_faktor', formatNumber($country->currency_faktor, 4),  array('placeholder'=>__('1,07'), 'class'=>'form-control', 'id'=>'currency_faktor')) }}
                </div>
            </div>
        </div>
    </div>
</div>


<div class="card mb-2">
    <h5 class="card-header">
        {{trans('register.required_fields')}}
    </h5>
    <div class="card-body">
        <div class="form-row">
            <div class="form-group col-sm-3">
                <label class="custom-control custom-checkbox">
                    {!! Form::checkbox('attr[tax_number]', 1,  $country->getAttrByKey('tax_number'), ['class'=>'custom-control-input']) !!}
                    <span class="custom-control-label">{{__('SteuerNr.')}}</span>
                </label>
            </div>
            <div class="form-group col-sm-3">
                <label class="custom-control custom-checkbox">
                    {!! Form::checkbox('attr[tax_id_number]', 1,  $country->getAttrByKey('tax_id_number'), ['class'=>'custom-control-input']) !!}
                    <span class="custom-control-label">{{__('UST-ID')}}</span>
                </label>
            </div>
            <div class="form-group col-sm-3">
                <label class="custom-control custom-checkbox">
                    {!! Form::checkbox('attr[taxable_sales]', 1,  $country->getAttrByKey('taxable_sales'), ['class'=>'custom-control-input']) !!}
                    <span class="custom-control-label">{{__('Umsatzsteuerpflichtig')}}</span>
                </label>
            </div>
        </div>
    </div>
</div>




<div class="card mb-2">
    <h5 class="card-header">
        {{ __('Übersetzungen') }}
    </h5>
    <div class="card-body">
    @foreach($trans as $lang)
        @if(!in_array($lang, ['en', 'de', 'es', 'fr', 'it', 'ru']))
            <div class="form-row">
                <div class="form-group col-12">
                    <label for="trans_name_{{$lang}}" class="form-label">{{__('Name')}} <strong style="text-transform: uppercase">{{$lang}}</strong></label>
                    {{ Form::text('trans_name['.$lang.']', $country->getLocated($lang),  array('class'=>'form-control', 'id'=>'trans_name_'.$lang)) }}
                </div>
            </div>
        @endif
    @endforeach
    </div>
</div>



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

        $('input#currency').on('change', function () {
            if($(this).prop('checked')){
                $('input#show_currency_calc').prop('checked', true);
                $('#show_currency_calc').show('slow');
            }else{
                $('input#show_currency_calc').prop('checked', false);
                $('#show_currency_calc').hide('slow');
            }
        });
    });
</script>