<script type="text/javascript" src="/web/templates/default/admin/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.css">

<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.js"></script>

<h1>Edit English Lang Config</h1>

<form action="/admin/general/lang/en" method="post">
        <table width="100%"><tr><td>

            <table id="params" class="display">
                <thead>
                <tr>
                    <th>Param</th>
                    <th>Value</th>
                    <th>Action</th>
                </tr>
                </thead>
                <tbody>
                {foreach $LangEn item=value key=param}
                    {if $param != 'Messages'}
                        <tr>
                            <td>{$param}</td>
                            <td><input type="text" value='{$value}' style=" color: #000;" readonly="readonly"></td>
                            <td><button value="{$param}" name="update_value">Update</button></td>
                        </tr>
                    {/if}
                {/foreach}
                </tbody>
            </table>
        </td></tr></table>
</form>

<h3>Add/Edit Parametr</h3>

<div>
    <form action="/admin/general/lang/en" method="post">
        <table width="100%">

            <tr>
                <th colspan="2">Enter again to replace</th>
            </tr>
            <tr>
                <th>Param</th>
                <th>Value</th>
            </tr>
            <tr>
                <td><input type="text" name="param" value="{$UpdateValue.Key}"></td>
                <td><input type="text" id="text_input" value="{$UpdateValue.Value}" name="value"><a class="expand"> Expand</a></td>
            </tr>

            <tr id="tr_extend_area">
                <td colspan="2"><textarea name="extend_area" id="extend_area"></textarea></td>
            </tr>
            <tr>
                <td colspan="2"><button class="button_send"  name="lang_en_btn" value="">Save</button></td>
            </tr>
        </table>
    </form>
</div>

<br><br><br><br>
<h1>Messages Language Config</h1>


<table width="100%"><tr><td>
            <table id="messages" class="display">
                <thead>
                <tr>
                    <th>Param</th>
                    <th>Value</th>
                </tr>
                </thead>
                <tbody>
                {foreach $LangEn.Messages item=value key=param}
                    <tr>
                        <td>{$param}</td>
                        <td><input type="text" value='{$value}' style="width: 100%; color: #000;" readonly="readonly"></td>
                    </tr>
                {/foreach}
                </tbody>
            </table>
        </td></tr></table>


<h3>Add/Edit Parametr</h3>

<div>
    <form action="/admin/general/lang/en" method="post">
        <table width="100%">

            <tr>
                <th colspan="2">Enter again to replace</th>
            </tr>
            <tr>
                <th>Param</th>
                <th>Value</th>
            </tr>
            <tr>
                <td><input type="text" name="param" ></td>
                <td><input type="text" name="value" ></td>
            </tr>
            <tr>
                <td colspan="2"><button class="button_send"  name="messages_lang_en_btn" value="">Save</button></td>
            </tr>
        </table>
    </form>
    <br><br><br><br>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        $('#tr_extend_area').hide();
        $('#params').DataTable();
        $('#messages').DataTable();
        CKEDITOR.replace("extend_area");
        var ExpandOnClick = true;
        $('.expand').click(function() {
            if (ExpandOnClick) {
                $('#tr_extend_area').show();
                CKEDITOR.instances['extend_area'].setData($('#text_input').val());
               // $('#cke_extend_area #document').html($('#text_input').html());
                ExpandOnClick = false;
            } else {
                $('#tr_extend_area').hide();
              //  $('#cke_extend_area #document').html('');
               CKEDITOR.instances['extend_area'].setData('');
                ExpandOnClick = true;
            }
        });
    });
</script>
