<div id="main" role="main">
    <div class="container-fluid row">
        <div class="border col-lg-3 flex-column nav nav-pills shadow bg-white pt-3 pb-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
            <button class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true"><?php echo $this->lang->line('general_settings'); ?></button>
            <button class="nav-link" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false"><?php echo $this->lang->line('Translations'); ?></button>
            <button class="nav-link" id="v-pills-messages-tab" data-bs-toggle="pill" data-bs-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</button>
            <button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>
        </div>
        <div class="col-lg-9 tab-content" id="v-pills-tabContent">
            <div class="bg-white tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">...</div>
            <div class="bg-white tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">
                <div class="row">
                    <div class="col-lg-12">
                        <ul class="nav nav-pills">
                            <li class="active">
                                <a data-toggle="tab" href="#permessions">
                                    <?php echo $this->lang->line('permissions'); ?>
                                </a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div id="permessions" class="tab-pane fade in active">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <form action="<?php echo site_url(); ?>admin/settings/saveAllTranslates" method="POST">
                                            <table class="table table-bordered table-striped">
                                                <thead>
                                                    <th><?php echo $this->lang->line('permission'); ?></th>
                                                    <th><?php echo $this->lang->line('lang_name'); ?></th>
                                                    <th><?php echo $this->lang->line('lang_name'); ?></th>
                                                    <th><?php echo $this->lang->line('type'); ?></th>
                                                    <th></th>
                                                </thead>
                                                <tbody>
                                                    <?php foreach ($main_permessions as $permession) { ?>
                                                        <tr>
                                                            <td><?php echo $permession->text; ?></td>
                                                            <td>
                                                                <input type="text" name="translation[<?php echo $permession->main_id; ?>][desc]" value="<?php echo $permession->desc; ?>" class="desc form-control" />
                                                            </td>
                                                            <td>
                                                                <input type="text" name="translation[<?php echo $permession->main_id; ?>][desc_ar]" value="<?php echo $permession->desc_ar; ?>" class="desc_ar form-control" />
                                                            </td>
                                                            <td><?php echo $permession->type; ?></td>
                                                            <td>
                                                                <a href="#0" class="btn btn-success btn-circle saveTranslate" rel="<?php echo $permession->main_id; ?>"><i class="fa fa-check"></i></a>
                                                            </td>
                                                        </tr>
                                                    <?php }; ?>
                                                    <tr>
                                                        <td colspan="5" class="text-align-center" style=" position: sticky; bottom: 0; ">
                                                            <button type="submit" class="btn btn-success">
                                                            <?php echo $this->lang->line('savefeminsit'); ?>
                                                            </button>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="bg-white tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">...</div>
            <div class="bg-white tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">...</div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $(document).on('click', '.saveTranslate', function() {
            var elem = $(this);
            var parent = $(this).parent().parent();
            var data = {};
            data.main_id = elem.attr("rel");
            data.desc = parent.find('.desc').val();
            data.desc_ar = parent.find('.desc_ar').val();
            $.post(root + 'admin/settings/updateTranslate', data, function(d) {
                if (d.result == true) {
                    var a = getResult(type = 'success');
                } else {
                    var a = getResult(type = 'failed');
                }
            }, 'json');
        });
    });
</script>

<style>
    body {
        overflow: unset !important;
    }
</style>