<?php $__env->startSection('css_libraries'); ?>
    <link rel="stylesheet" href="<?php echo e(asset(AdminTheme::assets('modules/summernote/summernote-bs4.css'))); ?>"/>
    <link rel="stylesheet" href="<?php echo e(asset(AdminTheme::assets('modules/select2/dist/css/select2.min.css'))); ?>">

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

<?php $__env->startSection('js_libraries'); ?>
    <script src="<?php echo e(asset(AdminTheme::assets('modules/summernote/summernote-bs4.js'))); ?>"></script>
    <script src="<?php echo e(asset(AdminTheme::assets('modules/select2/dist/js/select2.full.min.js'))); ?>"></script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('container'); ?>
    <div class="">
        <form action="<?php echo e(route('pages.update', ['page' => $page->id])); ?>" method="POST" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
            <?php echo method_field('PUT'); ?>
            <div class="col-12 col-md-12 col-lg-12">
                <div class="card">
                    <div class="card-header">
                        <h4><?php echo __('admin.edit_page', ['default' => 'Edite Page']); ?></h4>
                    </div>
                    <div class="card-body">
                        <div class="row">

                            <div class="form-group col-md-4 col-12">
                                <div
                                    class="control-label"><?php echo __('admin.is_enabled', ['default' => 'Is Enabled']); ?></div>
                                <label class="custom-switch mt-2">
                                    <input type="checkbox" name="is_enabled" class="custom-switch-input" value="1"
                                           <?php if($page->is_enabled): ?> checked <?php endif; ?>>
                                    <span class="custom-switch-indicator"></span>
                                    <span class="custom-switch-description">
                                        <?php echo __('admin.page_is_enabled_desc', ['default' => 'Determine whether the page is enabled or disabled']); ?>

                                    </span>
                                </label>
                            </div>

                            <div class="form-group col-md-4 col-12">
                                <div
                                    class="control-label"><?php echo __('admin.allow_guests', ['default' => 'Allow Guests']); ?></div>
                                <label class="custom-switch mt-2">
                                    <input type="checkbox" name="allow_guests" class="custom-switch-input" value="1"
                                           <?php if($page->allow_guests): ?> checked <?php endif; ?>>
                                    <span class="custom-switch-indicator"></span>
                                    <span class="custom-switch-description">
                                        <?php echo __('admin.page_allow_guests_desc', ['default' => 'Determine whether the page is viewable for guests']); ?>

                                    </span>
                                </label>
                            </div>

                            <div class="form-group col-md-4 col-12">
                                <div  class="control-label"><?php echo __('admin.basic_page', ['default' => 'Basic Page']); ?></div>
                                <label class="custom-switch mt-2">
                                    <input type="checkbox" name="basic_page" class="custom-switch-input" value="1" <?php if($page->basic_page): ?> checked <?php endif; ?>>
                                    <span class="custom-switch-indicator"></span>
                                    <span class="custom-switch-description">
                                        <?php echo __('admin.basic_page_desc', ['default' => 'Basic pages are blank pages without any HTML wrapper. You can write custom HTML/Tailwind code to fill the page']); ?>

                                    </span>
                                </label>
                            </div>

                            <div class="form-group col-md-12 col-12">
                                <label for="title"><?php echo __('admin.title', ['default' => 'Title']); ?></label>
                                <input type="text" name="title" id="title"
                                       class="form-control <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                       value="<?php echo e($page->title); ?>"
                                       oninput="updatePath()"
                                       required>
                                <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class="invalid-feedback" role="alert">
                                    <strong><?php echo e($message); ?></strong>
                                </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div class="form-group col-md-12 col-12">
                                <label for="path"><?php echo __('admin.link'); ?></label>
                                <div class="input-group-prepend">
                                    <div>
                                        <div class="input-group-text">
                                            <?php echo e(route('page', '')); ?>/
                                        </div>
                                    </div>
                                    <input type="text" name="path" id="path" placeholder="web-hosting"
                                           class="form-control <?php $__errorArgs = ['link'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                           value="<?php echo e($page->path); ?>" required/>
                                    <?php $__errorArgs = ['path'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                    <strong><?php echo e($message); ?></strong>
                                </span>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>

                            <div class="form-group col-md-12 col-12">
                                <label for="content"><?php echo __('admin.content', ['default' => 'Content']); ?></label>
                                <textarea class="summernote form-control" name="content" id="content"
                                          style="display: none;">
                                <?php echo $page->content; ?>

                            </textarea>
                                <small class="form-text text-muted">
                                    <?php echo __('admin.page_content_desc', ['default' => 'This field is the custom content as shown on the page. You are free to use custom code if you wish for example <code>&lt;img src="path-to-image"&gt;</code>']); ?>

                                </small>
                            </div>

                            <div class="form-group col-md-12 col-12">
                                <label for="name"><?php echo __('admin.button_name', ['default' => 'Button Name']); ?></label>
                                <input type="text" name="name" id="name"
                                       class="form-control <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                       value="<?php echo e($page->name); ?>"
                                       required>
                                <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class="invalid-feedback" role="alert">
                                    <strong><?php echo e($message); ?></strong>
                                </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div class="form-group col-md-12 col-12">
                                <label for="icon"><?php echo __('admin.icon'); ?></label>
                                <input type="text" name="icon" id="icon"
                                       class="form-control <?php $__errorArgs = ['icon'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                       value="<?php echo e($page->icon); ?>"
                                       required>
                                <small class="form-text text-muted">
                                    <?php echo __('admin.page_icon_desc', ['default' => 'You can get icons from: <a href="https://boxicons.com/" target="_blank">Boxicons</a> or set this value to a custom svg code']); ?>

                                </small>
                                <?php $__errorArgs = ['icon'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class="invalid-feedback" role="alert">
                                    <strong><?php echo e($message); ?></strong>
                                </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div class="form-group col-md-12 col-12">
                                <label><?php echo __('admin.visible_placement', ['default' => 'Visible placement']); ?></label>
                                <select
                                    class="form-control select2 select2-hidden-accessible  <?php $__errorArgs = ['placement'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                    name="placement[]" multiple="" tabindex="-1" aria-hidden="true">
                                    <option value="portal" <?php if(in_array( 'portal', $page->placement)): ?> selected <?php endif; ?>>
                                        <?php echo __('admin.portal_navbar', ['default' => 'Portal Navbar']); ?>

                                    </option>
                                    <option value="navbar" <?php if(in_array( 'navbar', $page->placement)): ?> selected <?php endif; ?>>
                                        <?php echo __('admin.navbar'); ?>

                                    </option>
                                    <option value="footer_help_center"
                                            <?php if(in_array( 'footer_help_center', $page->placement)): ?> selected <?php endif; ?>>
                                        <?php echo __('admin.footer_help_center', ['default' => 'Help Center (footer)']); ?>

                                    </option>
                                    <option value="footer_resources"
                                            <?php if(in_array( 'footer_resources', $page->placement)): ?> selected <?php endif; ?>>
                                        <?php echo __('admin.footer_resources', ['default' => 'Resources (footer)']); ?>

                                    </option>
                                    <option value="footer_legal"
                                            <?php if(in_array( 'footer_legal', $page->placement)): ?> selected <?php endif; ?>>
                                        <?php echo __('admin.footer_legal', ['default' => 'Legal (footer)']); ?>

                                    </option>
                                </select>
                                <small class="form-text text-muted">
                                    <?php echo __('admin.choose_locations_links', ['default' => 'Choose the locations to show the page links']); ?>

                                </small>
                                <?php $__errorArgs = ['placement'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class="invalid-feedback" role="alert">
                                <strong><?php echo e($message); ?></strong>
                            </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div class="form-group col-md-2 col-12">
                                <div class="control-label"><?php echo __('admin.new_tab', ['default' => 'New Tab']); ?></div>
                                <label class="custom-switch mt-2">
                                    <input type="checkbox" name="new_tab" class="custom-switch-input" value="1"
                                           <?php if($page->new_tab): ?> checked <?php endif; ?>>
                                    <span class="custom-switch-indicator"></span>
                                    <span class="custom-switch-description">
                                        <?php echo __('admin.new_tab_redirect', ['default' => 'Redirect in a new tab']); ?>

                                    </span>
                                </label>
                            </div>

                            <div class="form-group col-md-10 col-12">
                                <label for="redirect"><?php echo __('admin.redirect_url', ['default' => 'Redirect URL']); ?></label>
                                <input type="text" name="redirect" id="redirect"
                                       class="form-control <?php $__errorArgs = ['redirect'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                       value="<?php echo e($page->redirect_url); ?>"
                                       placeholder="Leave empty not to redirect">
                                <small class="form-text text-muted">
                                    <?php echo __('admin.redirect_url_page_desc', ['default' => 'If you wish to redirect the user, fill in the URL of the page you want them to redirect to. Leave this field empty to disable redirect']); ?>

                                </small>

                                <?php $__errorArgs = ['redirect'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class="invalid-feedback" role="alert">
                                    <strong><?php echo e($message); ?></strong>
                                </span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer text-right">
                        <button class="btn btn-dark" type="submit"><?php echo __('admin.update'); ?></button>
                    </div>
                </div>
        </form>
    </div>
</div>

<script>
    function updatePath() {
        var path = document.getElementById('path');
        var title = document.getElementById('title').value;
        path.value = title
                    .toLowerCase() // convert to lowercase
                    .trim() // remove leading and trailing whitespace
                    .replace(/[^\w\s-]/g, '') // remove non-word characters
                    .replace(/[\s_-]+/g, '-') // replace spaces, underscores, and hyphens with a single hyphen
                    .replace(/^-+|-+$/g, ''); // remove leading and trailing hyphens
    }
</script>

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

<?php echo $__env->make(AdminTheme::wrapper(), ['title' =>  __('admin.pages'), 'keywords' => 'WemX Dashboard, WemX Panel'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/wemx/resources/themes/admin/default/pages/edit.blade.php ENDPATH**/ ?>