<?php $__env->startPush('styles'); ?>
    <link href="<?php echo e(asset('public/backend/css/cloudEdit.min.css')); ?>" rel="stylesheet">
<?php $__env->stopPush(); ?>
<?php $__env->startSection('mainContent'); ?>

    <?php echo generateBreadcrumb(); ?>



    <section class="mb-20 student-details">
        <div class="container p-0">
            <div class="row">
                <div class="col-lg-12">
                    <ul class="nav nav-tabs no-bottom-border justify-content-start mt-sm-md-20 mb-20 ml-0"
                        role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active show" href="#cssSection" role="tab"
                               data-toggle="tab" id="1"
                               aria-selected="true"><?php echo e(__('frontendmanage.CSS')); ?></a>
                        </li>

                        <li class="nav-item">
                            <a class="nav-link  show" href="#jsSection" role="tab"
                               data-toggle="tab" id="2"
                               aria-selected="true"><?php echo e(__('frontendmanage.JS')); ?></a>
                        </li>


                    </ul>
                    <div class="tab-content">
                        <div role="tabpanel" class="tab-pane fade active show"
                             id="cssSection">
                            <div class="white-box   ">
                                <div class="add-visitor">
                                    <div class="row">
                                        <div class="col-xl-12">
                                            <div class="primary_input mb-35">
                                                <div class="tab-content">
                                                    <div class="window css">
                                                        <pre id="css"> <?php echo $css; ?> </pre>
                                                        <span class="windowLabel" id="cssLabel">CSS</span>
                                                    </div>
                                                </div>
                                            </div>

                                        </div>
                                    </div>

                                    <div class="row mt-40">
                                        <div class="col-lg-12 text-center tooltip-wrapper" data-title=""
                                             data-original-title="" title="">
                                            <button
                                                class="primary-btn fix-gr-bg tooltip-wrapper  text-nowrap"
                                                type="button"
                                                id="cssSectionBtn">
                                                <span class="ti-check"></span>
                                                <?php echo e(__('common.Update')); ?> </button>
                                        </div>


                                    </div>

                                </div>
                            </div>

                        </div>


                        <div role="tabpanel" class="tab-pane   fade"
                             id="jsSection">
                            <div class="white-box   ">
                                <div class="add-visitor">
                                    <div class="row">
                                        <div class="col-xl-12">
                                            <div class="primary_input mb-35">
                                                <div class="tab-content">
                                                    <div class="window js">
                                                        <pre id="js"><?php echo $js; ?></pre>
                                                        <span class="windowLabel" id="jsLabel">JavaScript/jQuery</span>
                                                    </div>
                                                </div>
                                            </div>

                                        </div>
                                    </div>

                                    <div class="row mt-40">
                                        <div class="col-lg-12 text-center tooltip-wrapper" data-title=""
                                             data-original-title="" title="">
                                            <button
                                                class="primary-btn fix-gr-bg tooltip-wrapper  text-nowrap"
                                                type="button"
                                                id="jsSectionBtn">
                                                <span class="ti-check"></span>
                                                <?php echo e(__('common.Update')); ?> </button>
                                        </div>


                                    </div>

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


                    </div>

                </div>
            </div>
        </div>
    </section>


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

<?php $__env->startPush('scripts'); ?>
    <script src="<?php echo e(asset('public/backend/js/ace/ace.js')); ?>" type="text/javascript" charset="utf-8"></script>
    <script src="<?php echo e(asset('public/backend/js/cloudEdit.js')); ?>" type="text/javascript" charset="utf-8"></script>
    <script>
        let js_btn = '#jsSectionBtn';
        let css_btn = '#cssSectionBtn';

        $(document).on('click', js_btn, function (event) {
            event.preventDefault();

            let demoMode = $('#demoMode').val();
            if (demoMode == 1) {
                toastr.warning("For the demo version, you cannot change this", "Warning");
                return false;
            }

            updateFile('js', js_btn)

        });
        $(document).on('click', css_btn, function (event) {
            event.preventDefault();

            let demoMode = $('#demoMode').val();
            if (demoMode == 1) {
                toastr.warning("For the demo version, you cannot change this", "Warning");
                return false;
            }

            updateFile('css', css_btn)

        });

        function updateFile(type, btn) {
            $(btn).prop('disabled', true);
            $(btn).text('<?php echo e(trans('common.Updating')); ?>');
            let data = '';

            if (type == 'css') {
                data = cssField.getValue();
            } else if (type == 'js') {
                data = jsField.getValue();
            }

            let formData = new FormData();
            formData.append('_token', "<?php echo e(csrf_token()); ?>");
            formData.append('data', data);
            formData.append('type', type);
            $.ajax({
                url: "<?php echo e(route('frontend.customJsCss')); ?>",
                type: "POST",
                cache: false,
                contentType: false,
                processData: false,
                data: formData,
                success: function (response) {
                    toastr.success('<?php echo e(__('common.Operation successful')); ?>')
                    $(btn).text('<?php echo e(__('common.Update')); ?>');
                    $(btn).prop('disabled', false);
                },
                error: function (response) {
                    toastr.error('<?php echo e(__('common.Something Went Wrong')); ?>')
                    $(btn).text('<?php echo e(__('common.Update')); ?>');
                    $(btn).prop('disabled', false);
                }
            });
        }
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('backend.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/penastud/public_html/lmspena/Modules/FrontendManage/Resources/views/custom-css-js.blade.php ENDPATH**/ ?>