<?php $__env->startSection('content'); ?>

<div class="col-md-12 content-header" >

    <h1><i class="fa fa-globe"></i> Language Manager</h1>

</div>

<section class="content">

    <div class="row">

    <div class="col-md-3">

        <?php echo $__env->make('settings.partials._menu', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

    </div>

    <div class="col-md-9">
        <div class="box box-primary">
            <div class="box-header">
                <a href="<?php echo e(route('settings.translations.index')); ?>" class="btn btn-sm btn-info"><i class="fa fa-backward"></i> Back to Languages</a>
            </div>
            <?php echo Form::hidden('locale', $locale, ['id' => 'locale']); ?>

            <div class="box-body scrollable" style="max-height: 1000px">
                    <div class="alert alert-warning">
                        <i class="fa fa-warning"></i>
                        Warning, translations are not visible until they are exported back to the app/lang file, using 'php artisan translation:export' command or publish button.
                    </div>
                <div class="alert alert-success success-find" style="display:none;">
                    <p>Done searching for translations, found <strong class="counter">N</strong> items!</p>
                </div>

                <?php if(Session::has('successPublish')): ?>
                    <div class="alert alert-info">
                        <?php echo e(Session::get('successPublish')); ?>

                    </div>
                <?php endif; ?>

                <?php echo Form::open(['url'=>['translations/import'], 'data-remote'=>'true', 'class'=>'form-inline', 'role'=>'form']); ?>

                <div class="form-group">
                    <?php echo Form::select('replace', array('0'=>'Append new translations', '1'=>'Replace existing translations'), null, ['class'=>'form-control input-sm']); ?>

                    <button type="submit" class="btn btn-sm btn-success"  data-disable-with="Loading..">Import groups</button>
                </div>
                <?php echo Form::close(); ?>

                <br/>
                <?php echo Form::open(['url'=>['translations/find'], 'data-remote'=>'true', 'role'=>'form', 'class' => 'form-find', 'data-confirm'=>'Are you sure you want to scan you app folder? All found translation keys will be added to the database.']); ?>

                <div class="form-group ">
                    <button type="submit" class="btn btn-sm btn-primary" data-disable-with="Searching.." >Find translations in files</button>
                </div>
                <?php echo Form::close(); ?>


                <?php echo Form::open(); ?>

                    <div class="input-group col-md-4">
                        <?php echo Form::select('group',$groups,$group,['class'=>'form-control group-select  input-sm'] ); ?>

                    </div>
                <br/>
                <?php echo Form::close(); ?>


                <?php if($group): ?>
                <?php echo Form::open(['url' => ['translations/add', $group]]); ?>

                <div class="form-group ">
                <?php echo Form::textarea('keys',null,['class'=>'form-control','placeholder'=>'Add 1 key per line, without the group prefix']); ?>

                    </div>
                    <input type="submit" value="Add keys" class="btn btn-sm btn-primary">
                <?php echo Form::close(); ?>


                    <h4>Total: <?php echo e($numTranslations); ?>, changed: <?php echo e($numChanged); ?></h4>
                    <table class="table">
                        <thead>
                        <tr>
                            <th width="15%">Key</th>
                            <th><?php echo e($locale); ?></th>
                            <?php if($deleteEnabled): ?>
                                <th>&nbsp;</th>
                            <?php endif; ?>
                        </tr>
                        </thead>
                        <tbody>

                        <?php foreach($translations as $key => $translation): ?>
                            <tr id="<?php echo e($key); ?>">
                                <td><?php echo e($key); ?></td>

                                    <?php $t = isset($translation[$locale]) ? $translation[$locale] : null ?>
                                    <td>
                                        <a href="#edit" class="editable status-<?php echo e($t ? $t->status : 0); ?> locale-<?php echo e($locale); ?>" data-locale="<?php echo e($locale); ?>" data-name="<?php echo e($locale . "|" . $key); ?>" id="username" data-type="textarea" data-pk="<?php echo e($t ? $t->id : 0); ?>" data-url="<?php echo e($editUrl); ?>" data-title="Enter translation"><?php echo e($t ? htmlentities($t->value, ENT_QUOTES, 'UTF-8', false) : ''); ?></a>
                                    </td>
                                <?php if($deleteEnabled): ?>
                                    <td>
                                        <a href="<?= action('\Barryvdh\TranslationManager\Controller@postDelete', [$group, $key]) ?>" class="delete-key" data-msg="Are you sure you want to delete the translations for '<?php echo e($key); ?>'?"><span class="glyphicon glyphicon-trash"></span></a>
                                    </td>
                                <?php endif; ?>
                            </tr>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
                <div class="alert alert-success success-publish" style="display:none;">
                    <p>Done publishing the translations for group '<?php echo e($group); ?>'!</p>
                </div>
                <?php if(isset($group)): ?>
                <?php echo Form::open(['url'=>['translations/publish', $group], 'data-remote'=>'true', 'role'=>'form', 'class' => 'form-publish', 'data-confirm'=>'Are you sure you want to publish the translations group '. $group.'? This will overwrite existing language files.']); ?>

                <div class="form-group ">
                    <button type="submit" class="btn btn-sm btn-success" data-disable-with="Publishing.." >Publish translations</button>
                </div>
                <?php echo Form::close(); ?>

                <?php endif; ?>


                <?php else: ?> <br/>
                    <div class="alert alert-info">Choose a group to display the group translations. If no groups are visible, make sure you have run the migrations and imported the translations.</div>
                <?php endif; ?>

            </div>

        </div>
    </div>

    </div>

</section>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<?php echo $__env->make('settings.partials.settings_js', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>