<?php

defined('ABSPATH') or die;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <meta http-equiv="Imagetoolbar" content="No"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php esc_html_e('Preview Form', 'fluentform') ?></title>
    <?php
    wp_head();
    ?>
    <style type="text/css">

    </style>
</head>
<body class="ff-form-preview-body">
<div class="ff_preview_text">
    Design Mode
</div>
<div id="ff_preview_top">
    <div id="ff_preview_header">
        <div class="ff_form_name">
            <?php echo intval($form->id) .' - '. esc_attr($form->title);  ?>
        </div>
        <ul class="ff_preview_menu">
            <li>
                <a class="ff_preview_menu_link" href="<?php echo esc_url(admin_url('admin.php?page=fluent_forms&form_id=' . intval($form_id) . '&route=editor')) ?>"><?php esc_html_e('Edit Fields', 'fluentform') ?></a>
            </li>
            <li>
                <a class="ff_preview_menu_link" href="<?php echo esc_url(admin_url('admin.php?page=fluent_forms&form_id=' . intval($form_id) . '&route=settings&sub_route=form_settings#/basic_settings' )) ?>"><?php esc_html_e('Settings & Integrations', 'fluentform') ?></a>
            </li>
            <li>
                <a class="ff_preview_menu_link" href="<?php echo esc_url(admin_url('admin.php?page=fluent_forms&form_id=' . intval($form_id) . '&route=entries#/' )) ?>"><?php esc_html_e('Entries', 'fluentform') ?></a>
            </li>
        </ul>
        <div class="ff_preview_only_label_wrap">
            <label for="ff_preview_only"><input id="ff_preview_only" type="checkbox" /><?php esc_html_e('Preview Only', 'fluentform') ?></label>
        </div>
        <div class="ff_preview_action" id="copy-toggle">
            <i class="el-icon el-icon-document-copy mr-1"></i>
            <span id="copy">
                [fluentform id="<?php echo intval($form_id); ?>"]
            </span>
        </div>
    </div>
    <div class="ff_preview_body">
        <div class="ff_form_preview_wrapper" style="width:100%">
            <div class="ff_form_preview_header">
                <div class="ff_dot_wrap">
                    <span class="dot dot-red"></span>
                    <span class="dot dot-yellow"></span>
                    <span class="dot dot-success"></span>
                </div>
                <div class="ff_device_control_wrap">
                    <span class="ff_device_control monitor" data-type="monitor">
                        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 1024 1024">
                            <path d="M853.35 597.335c0 23.506-19.113 42.665-42.665 42.665h-597.336c-23.552 0-42.666-19.159-42.666-42.665v-341.335c0-23.51 19.114-42.666 42.666-42.666h597.336c23.552 0 42.665 19.157 42.665 42.666v341.335zM810.685 128h-597.336c-70.57 0-128 57.43-128 128v341.335c0 70.569 57.43 128 128 128h256v85.33h-170.666c-23.466 0-42.666 19.2-42.666 42.67 0 23.465 19.2 42.665 42.666 42.665h426.667c23.465 0 42.665-19.2 42.665-42.665 0-23.47-19.2-42.67-42.665-42.67h-170.665v-85.33h256c70.569 0 128-57.431 128-128v-341.335c0-70.57-57.431-128-128-128v0z"/>
                        </svg>
                        <span class="ff_tooltip"><?php esc_html_e('Desktop', 'fluentform') ?></span>
                    </span>
                    <span class="ff_device_control tablet" data-type="tablet">
                        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 1024 1024">
                            <path d="M768 170.683c23.562 0 42.665 19.103 42.665 42.666v597.336c0 23.562-19.103 42.665-42.665 42.665h-512c-23.564 0-42.666-19.103-42.666-42.665v-597.336c0-23.564 19.102-42.666 42.666-42.666h512zM256 85.35c-70.692 0-128 57.308-128 128v597.336c0 70.692 57.308 128 128 128h512c70.692 0 128-57.308 128-128v-597.336c0-70.692-57.308-128-128-128h-512z"/>
                            <path d="M554.685 768.015c0 23.567-19.103 42.67-42.67 42.67-23.563 0-42.665-19.103-42.665-42.67 0-23.562 19.103-42.665 42.665-42.665 23.567 0 42.67 19.103 42.67 42.665z"/>
                        </svg>
                        <span class="ff_tooltip"><?php esc_html_e('Tablet', 'fluentform') ?></span>
                    </span>
                    <span class="ff_device_control mobile"  data-type="mobile">
                        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 1024 1024">
                            <path d="M384.017 170.683h-42.667c-23.564 0-42.666 19.103-42.666 42.666v597.336c0 23.562 19.103 42.665 42.666 42.665h341.336c23.562 0 42.665-19.103 42.665-42.665v-597.336c0-23.564-19.103-42.666-42.665-42.666h-42.67c0 35.346-28.652 64-64 64h-127.998c-35.346 0-64-28.654-64-64zM682.685 85.35c70.692 0 128 57.308 128 128v597.336c0 70.692-57.308 128-128 128h-341.336c-70.692 0-128-57.308-128-128v-597.336c0-70.692 57.308-128 128-128h341.336z"/>
                        </svg>
                        <span class="ff_tooltip"><?php esc_html_e('Mobile', 'fluentform') ?></span>
                    </span>
                </div>
            </div>
            <div class="ff_form_preview">
                <?php echo do_shortcode('[fluentform id="' . intval($form_id) . '"]'); ?>
            </div>
        </div>
        <div class="ff_form_styler_wrapper">
            <?php
            if (!defined('FLUENTFORMPRO')): ?>
                <div class="ff_form_preview_app" id="ff_form_preview_app">
                    <preview-app :form_id="<?php echo intval($form_id); ?>"></preview-app>
                    <global-search></global-search>
                </div>
            <?php endif; ?>
            <?php
            // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variables in view files
            $isShowPreview = true;

            if(defined('FLUENTFORMPRO')): ?>
            <?php
                do_action_deprecated(
                    'fluentform_form_styler',
                    [
                        $form_id
                    ],
                    FLUENTFORM_FRAMEWORK_UPGRADE,
                    'fluentform/form_styler',
                    'Use fluentform/form_styler instead of fluentform_form_styler.'
                );
                do_action('fluentform/form_styler', $form_id);
            ?>
            <?php
                $isShowPreview = apply_filters_deprecated(
                    'fluentform_show_preview_promo',
                    [
                        true
                    ],
                    FLUENTFORM_FRAMEWORK_UPGRADE,
                    'fluentform/show_preview_promo',
                    'Use fluentform/show_preview_promo instead of fluentform_show_preview_promo.'
                );
                elseif(apply_filters('fluentform/show_preview_promo', $isShowPreview)):
            ?>
                <div class="ff_styler_promo">
                    <div class="ff_promo_header">
                        <?php esc_html_e('Advanced Form Styler (Pro)', 'fluentform'); ?>
                    </div>
                    <div class="ff_promo_body">
                        <p><a target="_blank" href="https://wpmanageninja.com/docs/fluent-form/fluent-forms-styles/"><?php esc_html_e('Advanced Form styler', 'fluentform'); ?></a> <?php esc_html_e('is available in Pro version of Fluent Forms. You can style every element of the forms including input fields, form container, success / error messages and many more.', 'fluentform'); ?></p>
                        <h5>Other Features</h5>
                        <ul class="ff_feature_list">
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Stripe & PayPal with 6 Payment Integration', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Style Export & Import', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Conditional Email Routing', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Advanced Form Fields', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Quiz & Survey Forms', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Inventory Module', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('40+ Integrations', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Calculated Fields', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Multi-Step Forms', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('File Upload Feature', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('SMS Notifications', 'fluentform'); ?></li>
                            <li><i class="el-icon el-icon-check"></i> <?php esc_html_e('Visual Data Reporting', 'fluentform'); ?></li>
                        </ul>
                        <div style="text-align: center; margin-top: 40px; margin-bottom: 40px;">
                            <a target="_blank" rel="nofollow" class="el-button el-button--primary" href="<?php echo esc_url(fluentform_upgrade_url()); ?>"><?php esc_html_e('Upgrade to Pro', 'fluentform'); ?></a>
                        </div>
                        <?php $addOns = (new \FluentForm\App\Modules\AddOnModule())->getPremiumAddOns(); ?>

                        <h5><?php esc_html_e('Integrations available in Fluent Forms Pro', 'fluentform'); ?></h5>
                        <ul class="ff_addons">
                            <?php
                            // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variable in foreach loop
                            foreach ($addOns as $addOn): ?>
                                <li><img title="<?php echo esc_attr($addOn['title']); ?>" src="<?php echo esc_attr($addOn['logo']); ?>" /></li>
                            <?php endforeach; ?>
                        </ul>

                        <div style="text-align: center; margin-top: 40px; margin-bottom: 30px;">
                            <a target="_blank" rel="nofollow" class="el-button el-button--primary" href="<?php echo esc_url(fluentform_upgrade_url()); ?>"><?php esc_html_e('Upgrade to Pro', 'fluentform'); ?></a>
                        </div>
                    </div>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
<div class="ff_notice">
    <div class="ff_notice_inner">
        <i class="el-icon el-icon-warning"></i>
        <p><?php esc_html_e('You are seeing preview version of Fluent Forms. This form is only accessible for Admin users. Other users may not access this page. To use this for in a page please use the following shortcode: ', 'fluentform') ?>
        <strong>[fluentform id='<?php echo intval($form_id) ?>']</strong>
        </p>
    </div>
</div>
<?php
wp_footer();
?>
</body>
</html>
