
<?php $__env->startSection('title'); ?>
<title><?php echo e(__('admin.Languages')); ?></title>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('admin-content'); ?>
<!-- Main Content -->
<div class="main-content">
    <section class="section">
        <div class="section-header">
            <h1><?php echo e(__('admin.Languages')); ?></h1>
            <div class="section-header-breadcrumb">
                <div class="breadcrumb-item active"><a
                        href="<?php echo e(route('admin.dashboard')); ?>"><?php echo e(__('admin.Dashboard')); ?></a></div>
                <div class="breadcrumb-item"><?php echo e(__('admin.Languages')); ?></div>
            </div>
        </div>

        <div class="section-body">
            <a href="<?php echo e(route('admin.languages.create')); ?>" class="btn btn-primary"><i class="fas fa-plus"></i>
                <?php echo e(__('admin.Add New')); ?></a>
            <div class="row mt-4">
                <div class="col">
                    <div class="card">
                        <div class="card-body">
                            <div class="table-responsive table-invoice">
                                <table class="table table-striped" id="dataTable">
                                    <thead>
                                        <tr>
                                            <th width="5%"><?php echo e(__('admin.SN')); ?></th>
                                            <th width="30%"><?php echo e(__('admin.Name')); ?></th>
                                            <th width="10%"><?php echo e(__('admin.Code')); ?></th>
                                            <th width="15%"><?php echo e(__('admin.Direction')); ?></th>
                                            <th width="15%"><?php echo e(__('admin.Translations')); ?></th>
                                            <th width="15%"><?php echo e(__('admin.Default')); ?></th>
                                            <th width="15%"><?php echo e(__('admin.Action')); ?></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e(++$index); ?></td>
                                            <td><?php echo e($language->name); ?></td>
                                            <td><?php echo e($language->code); ?></td>
                                            <td><?php echo e($language->direction); ?></td>
                                            <td>
                                                <div class="dropdown d-inline">
                                                    <button class="btn btn-primary dropdown-toggle" type="button"
                                                        id="dropdownMenuButton2" data-toggle="dropdown"
                                                        aria-haspopup="true" aria-expanded="false" title="<?php echo e(__('admin.Edit Languages')); ?>">
                                                        <i class="fas fa-language"></i>
                                                    </button>

                                                    <div class="dropdown-menu" x-placement="top-start"
                                                        style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, -131px, 0px);">
                                                        <a class="dropdown-item has-icon"
                                                            href="<?php echo e(route('admin.admin-language', $language->code)); ?>"><i
                                                                class="fa fa-cog"></i>
                                                            <?php echo e(__('admin.Admin Language')); ?> (<?php echo e($language->code); ?>)</a>
                                                        <a class="dropdown-item has-icon"
                                                            href="<?php echo e(route('admin.admin-validation-language', $language->code)); ?>"><i
                                                                class="fa fa-cog"></i>
                                                            <?php echo e(__('admin.Admin Validation')); ?> (<?php echo e($language->code); ?>)</a>
                                                        <a class="dropdown-item has-icon"
                                                            href="<?php echo e(route('admin.website-language', $language->code)); ?>"><i
                                                                class="fa fa-cog"></i>
                                                            <?php echo e(__('admin.Frontend Language')); ?> (<?php echo e($language->code); ?>)</a>
                                                        <a class="dropdown-item has-icon"
                                                            href="<?php echo e(route('admin.website-validation-language', $language->code)); ?>"><i
                                                                class="fa fa-cog"></i>
                                                            <?php echo e(__('admin.Frontend Validation')); ?> (<?php echo e($language->code); ?>)</a>
                                                    </div>
                                                </div>
                                            </td>
                                            <td>
                                            <?php if($language->status || (!$is_default && $language->id == 1)): ?>
                                            <input onchange="changeStatus(<?php echo e($language->id); ?>, 'status')" type="checkbox" checked data-toggle="toggle" data-on="<?php echo e(__('admin.Yes')); ?>" data-off="<?php echo e(__('admin.No')); ?>" data-onstyle="success" data-offstyle="danger">
                                            <?php else: ?>
                                            <input onchange="changeStatus(<?php echo e($language->id); ?>, 'status')" type="checkbox" data-toggle="toggle" data-on="<?php echo e(__('admin.Yes')); ?>" data-off="<?php echo e(__('admin.No')); ?>" data-onstyle="success" data-offstyle="danger">
                                            <?php endif; ?>
                                            </td>
                                            <td>
                                                <?php if($language->code !== 'en'): ?>
                                                <a href="<?php echo e(route('admin.languages.edit',$language->id)); ?>"
                                                    class="btn btn-primary btn-sm"><i class="fa fa-edit"
                                                        aria-hidden="true"></i></a>
                                                <?php if(strtolower($language->code) !== strtolower(app()->getLocale())): ?>
                                                <a href="javascript:;" data-toggle="modal" data-target="#deleteModal"
                                                    class="btn btn-danger btn-sm"
                                                    onclick="deleteData(<?php echo e($language->id); ?>)"><i class="fa fa-trash"
                                                        aria-hidden="true"></i></a>
                                                <?php endif; ?>
                                                <?php endif; ?>
                                            </td>

                                        </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
    </section>
</div>

<script>
    function deleteData(id) {
        $("#deleteForm").attr("action", '<?php echo e(url("admin/languages/")); ?>' + "/" + id)
    }

        function changeStatus(id, type) {
            var isDemo = "<?php echo e(env('PROJECT_MODE') ?? 1); ?>"
            if (isDemo == 0) {
                toastr.error("<?php echo e(__('admin.This Is Demo Version. You Can Not Change Anything')); ?>");
                return;
            }
            $.ajax({
                type: "put",
                data: {
                    _token: '<?php echo e(csrf_token()); ?>',
                    column: type
                },
                url: "<?php echo e(url('/admin/languages/update-status')); ?>" + "/" + id,
                success: function(response) {
                    if (response.status) {
                        toastr.success(response.message);
                        setTimeout(function() {
                            window.location.reload();
                        }, 2000);
                    } else {
                        toastr.warning(response.message);
                        setTimeout(function() {
                            window.location.reload();
                        }, 2000);
                    }
                },
                error: function(err) {
                    console.log(err);
                }
            })
        }

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

<?php echo $__env->make('admin.master_layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home3/paprdcor/topriserealtors.com/resources/views/admin/languages.blade.php ENDPATH**/ ?>