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


@section('content')
   <style type="text/css">
       .form-control.has-error {
            border: 1px solid #ea8e49;
        }
   </style>
    <!-- row -->
    <div class="row">
        <div class="col-md-12">
            <div class="white-box p-0 min-height-500">
                <!-- .left-right-aside-column-->
                <div class="page-aside">
                    <!-- .left-aside-column-->
                    <div class="left-aside">
                        <div class="scrollable">
                            <ul class="list-style-none">
                                <li class="box-label">Choose <select onchange="if (this.value) window.location.href=this.value" >
                                                    <option value="">Pick one:</option>
                                                     @foreach($langs as $lang)
                                                        <option value="{{ url('/admin/translation/0/'.$lang.'/'.$langsource.'/'.$show) }}" @if($language == $lang) selected @endif>{{ $lang }}</option>
                                                    @endforeach 
                                                </select>
                                </li>
                                <li class="divider"></li>
                                @foreach($files as $fl)
                                <li <?php if(substr($fl, 0, strrpos($fl,' (')) === $edit) echo 'class="font-bold"' ?>><a href="{{ url('/admin/translation/'.substr($fl, 0, strrpos($fl,' (')).'/'.$language.'/'.$langsource.'/'.$show) }}">{{ $fl }}</a></li>
                                @endforeach
                               

                            </ul>
                        </div>
                    </div>

                
                    @if($translations)

                 

                        {!! Form::open([ 'url' => route('admin_translation_update', [$file, $language, $langsource, $show]), '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-xs-12">
                                    <button type="submit" class="btn btn-primary">
                                        Save
                                    </button>
                                </div>
                            </div>
                                  <div class="clearfix"><br></div>

                                <div class="table-responsive">
                                
                          
                                    <table class="table table-striped">
                                        <thead>
                                        <tr>
                                            <th width="20%">Key</th>
                                            <th width="40%">Source  
                                                <select onchange="if (this.value) window.location.href=this.value" >
                                                    <option value="">Pick one:</option>
                                                     @foreach($langs as $source)
                                                        <option value="{{ url('/admin/translation/'.$file.'/'.$language.'/'.$source.'/'.$show) }}" @if($source == $langsource) selected @endif>{{ $source }}</option>
                                                    @endforeach 
                                                </select>
                                            </th>
                                            <th width="40%">Translation 
                                                <select onchange="if (this.value) window.location.href=this.value" >
                                                    <option value="">Pick one:</option>
                                                     @foreach($langs as $lang)
                                                        <option value="{{ url('/admin/translation/'.$file.'/'.$lang.'/'.$langsource.'/'.$show) }}" @if($language == $lang) selected @endif>{{ $lang }}</option>
                                                    @endforeach 
                                                </select>

                                                <select onchange="if (this.value) window.location.href=this.value" >
                                                        <option value="{{ url('/admin/translation/'.$file.'/'.$language.'/'.$langsource.'/all') }}" @if($show == 'all') selected @endif>ALL</option>
                                                        <option value="{{ url('/admin/translation/'.$file.'/'.$language.'/'.$langsource.'/empty') }}" @if($show == 'empty') selected @endif>EMPTY</option>
                                                </select>

                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody>
        
                                        @foreach($translations as $key => $value)
                                            @include('components.translation_row', [
                                                'key' => $key,
                                                'value' => $value,
                                                'language'=> $language,
                                                'parent' => null,
                                                'prefix' => $prefix,
                                                'langsource' => $langsource,
                                                'show' => $show,
                                            ])
                                        @endforeach
                                        </tbody>
                                    </table>
                                            
                                </div>
                            </div>

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

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

@endsection
