<?php $__env->startSection('content'); ?>
<div class="side-title">
    <h3><?php echo e($head ?? ''); ?></h3>
</div>

<div class="border-item">
    <form class="form-row add_page_form" method="post" action="<?php echo e($action); ?>" enctype="multipart/form-data">
        <?php if($page ?? ''  && $page->id): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <?php echo csrf_field(); ?>

        <?php $__currentLoopData = languages(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="form-group col">
            <label><?php echo e(meta('page_title', $language->local) ?? __('pages.page_title')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('page_title_'.$language->local) ? 'is-invalid' : ''); ?>" name="page_title_<?php echo e($language->local); ?>" placeholder="<?php echo e(meta('page_title', $language->local) ?? __('pages.page_title')); ?>" value='<?php echo e(old("page_title_{$language->local}", $page[$language->local]->page_title ?? "")); ?>'/>
        </div>

        <?php if($page[$language->local]->title): ?>
            <div class="form-group col">
                <label><?php echo e(meta('title', $language->local) ?? __('pages.title')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
                <input type="text" class="form-control <?php echo e($errors->has('title_'.$language->local) ? 'is-invalid' : ''); ?>" name="title_<?php echo e($language->local); ?>" placeholder="<?php echo e(meta('title', $language->local) ?? __('pages.title')); ?>" value='<?php echo e(old("title_{$language->local}", $page[$language->local]->title ?? "")); ?>'/>
            </div>
        <?php endif; ?>
        <?php if($page[$language->local]->title_2): ?>
            <div class="form-group col">
                <label><?php echo e(meta('title_2', $language->local) ?? __('pages.title_2')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
                <input type="text" class="form-control <?php echo e($errors->has('title_2_'.$language->local) ? 'is-invalid' : ''); ?>" name="title_2_<?php echo e($language->local); ?>" placeholder="<?php echo e(meta('title_2', $language->local) ?? __('pages.title_2')); ?>" value='<?php echo e(old("title_2_{$language->local}", $page[$language->local]->title_2 ?? "")); ?>'/>
            </div>
        <?php endif; ?>
        <?php if($page[$language->local]->description): ?>
            <div class="form-group col-lg-12">
                <label><?php echo e(meta('description', $language->local) ?? __('pages.description')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
                <textarea rows="7" name="description_<?php echo e($language->local); ?>" id="description_<?php echo e($language->local); ?>" class="form-control my-editor  <?php echo e($errors->has('description_'.$language->local) ? 'is-invalid' : ''); ?>" placeholder="<?php echo e(meta('description', $language->local) ?? __('pages.description')); ?>"><?php echo e(old("description_{$language->local}", $page[$language->local]->description ?? "")); ?></textarea>
            </div>
        <?php endif; ?>

        <?php if($page[$language->local]->description_2): ?>
            <div class="form-group col-lg-12">
                <label><?php echo e(meta('description_2', $language->local) ?? __('pages.description_2')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
                <textarea rows="7" name="description_2_<?php echo e($language->local); ?>" id="description_2_<?php echo e($language->local); ?>" class="form-control my-editor <?php echo e($errors->has('description_2_'.$language->local) ? 'is-invalid' : ''); ?>" placeholder="<?php echo e(meta('description_2', $language->local) ?? __('pages.description_2')); ?>"><?php echo e(old("description_2_{$language->local}", $page[$language->local]->description_2 ?? "")); ?></textarea>
            </div>
        <?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

























            
            <?php if($page->image): ?>
                <div class="form-group col-lg-12">
                    <label><?php echo e(meta('image', $lang) ?? __('pages.image')); ?> </label>
                    <input id="image_thumbnail" class="image_thumbnail" type="hidden" name="image" value="<?php echo e(old("image", $page->image ?? "")); ?>"/>

                    <div class="photos image_main_photo <?php echo e(old('image', $page->image ?? '') ? ' wow fadeInUp' : 'hide'); ?>">
                        <div class="col-lg-6">
                            <div class="items">
                                <div class="img">
                                    <a href="#" id="lfm" data-input=".image_thumbnail" data-preview=".image_holder" class="lfm" data-hide=".image_pick_button">
                                        <img src="<?php echo e(asset(old('image', $page->image ?? ''))); ?> "  id="image_holder" class="image_holder"/>
                                    </a>
                                </div>
                                <a href="#" class="showHide resetImage close" data-empty=".image_thumbnail" data-hide=".image_main_photo" data-show=".image_pick_button"><i class="fas fa-times"></i></a>
                            </div>
                        </div>
                    </div>

                    <div class="clearfix"></div>
                    <span class="input-group-btn image_pick_button <?php echo e(old('image', $page->image ?? '') ? 'hide' : ''); ?> ">
                <a id="lfm" data-input=".image_thumbnail" data-preview=".image_holder" data-show=".image_main_photo" data-hide=".image_pick_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-camera-retro"></i> <?php echo e(__('dashboard.choose')); ?>

                </a>
            </span>
                </div>
            <?php endif; ?>
            

            
            <?php if(is_array($page->meta) && count($page->meta)): ?>
                <div class="form-group col-lg-3">
                    <label><?php echo e(meta('video', $lang) ?? __('pages.video')); ?> </label>
                    <input id="video_image_thumbnail" class="video_image_thumbnail" type="hidden" name="video" value="<?php echo e(old("video", $page->meta['video'] ?? "")); ?>"/>

                    <div class="photos video_image_main_photo <?php echo e(old('image', $page->meta['video'] ?? '') ? ' wow fadeInUp' : 'hide'); ?>">
                        <div class="col-lg-12">
                            <div class="items">
                                <div class="img">
                                    <a href="#" id="lfm" data-input=".video_image_thumbnail" data-preview=".video_image_holder" class="lfm" data-hide=".video_image_pick_button">
                                        <img src="<?php echo e(asset('assets/admin/images/video.png')); ?>"  id="video_image_holder" class="video_image_holder"/>
                                    </a>
                                </div>
                                <a href="#" class="showHide resetImage close" data-empty=".video_image_thumbnail" data-hide=".video_image_main_photo" data-show=".video_image_pick_button"><i class="fas fa-times"></i></a>
                            </div>
                        </div>
                    </div>

                    <div class="clearfix"></div>
                    <span class="input-group-btn video_image_pick_button <?php echo e(old('video', $page->meta['video'] ?? '') ? 'hide' : ''); ?> ">
                <a id="lfm" data-input=".video_image_thumbnail" data-preview=".video_image_holder" data-show=".video_image_main_photo" data-hide=".video_image_pick_button" class="lfm_file btn btn-primary text-light">
                    <i class="fas fa-camera-retro"></i> <?php echo e(__('dashboard.choose')); ?>

                </a>
            </span>
                </div>
            <?php endif; ?>
            

            
            <?php if(is_array($page->images ?? []) && count($page->images ?? [])): ?>
            <div class="border-item photos col-md-12 other_image_container">
                <div class="row">
                    <?php $__currentLoopData = $page->images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="col-md-4">
                            <div class="items">
                                <div class="img">
                                    <a href="<?php echo e(asset($image ?? null)); ?>" data-fancybox="gallery"><img src="<?php echo e(asset($image ?? null)); ?>" alt=""></a>
                                </div>
                                <input type="hidden" name="images[]" value="<?php echo e($image ?? null); ?>">
                                <a href="#" class="close"><i class="fas fa-times"></i></a>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
                <div class="text-center">
                    <input id="other_image_thumbnail" class="other_image_thumbnail" type="hidden"/>
                    <div class="clearfix"></div>
                    <span id="add">
                    <a id="lfm" data-width="" data-cache="article_gallery" data-input=".other_image_thumbnail" data-preview="" data-show="" data-hide="" class="lfm add">
                        <?php echo e(__('dashboard.add_new_item')); ?>

                    </a>
                </span>
                </div>
            </div>
            <?php endif; ?>
            
        <div class="text-center mt-5 col-12">
            <button class="butn add_page_button"><span><?php echo e(__('dashboard.save')); ?></span></button>
        </div>
    </form>
</div>

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

<?php $__env->startSection('inner_js'); ?>
    <script src="<?php echo e(asset('/assets/admin/js/lib/tinymce.min.js')); ?>"></script>
    
    <script>
        let route_prefix = "<?php echo e(url(config('lfm.prefix'))); ?>",
            url = "<?php echo e(url('/')); ?>/",
            currentLanguage = "<?php echo e($lang); ?>",
            imageTitle = "<?php echo e(meta('image_title', $lang) ?? null); ?>",
            fileIcon = "<?php echo e(asset('assets/admin/images/video.png')); ?>",
            inputName = null;
    </script>

    <script src="<?php echo e(asset('assets/admin/js/editor.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/lfm.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/articles.js')); ?>"></script>

    <script>

        sendAjax('.add_page_button', '.add_page_form');

        $('.add_properties').click(function (e) {
            e.preventDefault();
            let counter = (Math.random()*100000).toString(20).replace('.', '_');
            let serviceDiv = `
                <div class="form-group col-lg-12 card deleted_property property_card">
                    <label><?php echo e(__('pages.properties')); ?></label>
                   <div class="row">
                   <div class="form-group col-md-12 d-flex justify-content-end">
                   <a href="#" class="btn btn-danger delete_property mr-3"><i class="fa fa-times"></i></a>
                   </div>
                    <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="form-group col-md-12">
                            <input type="text" name="properties_<?php echo e($language->local); ?>[]" placeholder="<?php echo e(__('pages.property_title') . ' ' . "($language->name)"); ?>" class="form-control" value=""/>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                </div>`;

            $('.property_container').append(serviceDiv);

        });

        $(document).on('click', '.delete_property', function (e) {
            e.preventDefault();
            $(this).parents('.deleted_property').remove();
        });


        $('body').on('DOMNodeInserted', '.properties_container', function(e) {
            if ($(e.target).find('.lfm')) {
                $('.lfm').filemanager('image', {prefix: route_prefix});
            }
        });

    </script>

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




<?php echo $__env->make('admin.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/balyomhost/public_html/procare/resources/views/admin/pages/form.blade.php ENDPATH**/ ?>