@extends('layouts.layout-2')
@section('content')

    <!-- row -->
    <div class="row">

      <!--  <div class="col-lg-3 col-xl-2">

            <div>
                @foreach($files as $k => $fl)
                <a href="{{ url('/admin/translate/all/edit/'.$k) }}" class="media align-items-center bg-lighter text-dark py-1 px-1 @if($k == $language) active @endif">
                    <div class=" text-center text-xlarge"><img src="{{asset('images/'.$k.'.png')}}" alt="" height="20"></div>
                    <div class="media-body ml-3">
                         {{ $k }}
                    </div>
                </a>

                @endforeach
            </div>

        </div>
        -->

        <div class="col">
            <div class="white-box p-0 min-height-500">
                <!-- .left-right-aside-column-->
                <div class="page-aside">
                    <!-- .left-aside-column-->
                    @if($translations)

                        {!! Form::open([ 'url' => route('admin_translate_all_update', [$language, $from]), 'method' => 'post', 'class' => 'form-horizontal' ]) !!}

                        <!-- /.left-aside-column-->
                        <div class="right-aside">
                            
                       
                            <div class="clearfix"></div>
                            <div class="scrollable">

                            <div class="row">
                                <div class="col-12">
                                  <!--  <div class="float-right">
                                        Translation from
                                        <select class="selectpicker" onchange="if (this.value) window.location.href=this.value" >
                                            @foreach($files as $k => $fl)
                                                <option value="{{ url('/admin/translate/all/edit/'.$language.'/'.$k) }}" @if($k == $from) selected @endif>{{ $k }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                    -->
                                    <div class="">
                                        <br>
                                    <button type="submit" class="btn btn-primary">
                                        Save
                                    </button>
                                        </div>


                                </div>
                            </div>
                                  <div class="clearfix"><br></div>

                                <div class="table-responsive">
                                
                          
                                    <table class="table table-striped">
                                        <thead>
                                        <tr>
                                            <th width="30%">Source</th>

                                            <th width="70%">Inhalt {{ $language }}



                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <?php
                                            $dest  = (array) $translations['dest'];
                                            $from  = (array) $translations['from'];

                                        ?>
                                        @foreach($translations['keys'] as $key => $value)
                                            <?php
                                                    $text = $value;
                                                    if(!empty($dest[$key])){
                                                        $text = $dest[$key];
                                                    }
                                                    if(!empty($from[$key])){
                                                        $text = $from[$key];
                                                    }
                                            ?>
                                            <tr <?php if($show == 'empty' && $bool) echo 'style="display:none"'; ?>>
                                                <td>{{ $text }}</td>
                                                <td>
                                                    <textarea name="{{ $key }}"
                                                              class="form-control"
                                                              rows="4">@if(!empty($dest[$key])){{ $dest[$key] }}@endif</textarea>
                                                </td>
                                            </tr>
                                        @endforeach
                                        </tbody>
                                    </table>
                                            
                                </div>
                            </div>

                            
                                <div class="col-xs-12">
                                    <button type="submit" class="btn btn-primary">
                                        Save
                                    </button>
                                </div>
                        </div>
                      {!! Form::close() !!}
                    @endif

                    <!-- .left-aside-column-->
                </div>
                <!-- /.left-right-aside-column-->
            </div>
        </div>
    </div>
    <!-- /.row -->

@endsection
