<?php
defined('ABSPATH') || exit;
// Add Instructions submenu under CF7 Submissions
add_action('admin_menu', function() {
    add_submenu_page(
        'cf7-submissions',                 // Parent menu slug
        'Instructions',                    // Page title
        'Instructions',                    // Menu title
        'manage_options',                  // Capability
        'cf7-instructions',                // Menu slug
        'cf7_submissions_instructions_page'// Callback function
    );
});


function cf7_submissions_instructions_page() {
    ?>
    <div class="wrap">
        <h1>How to Set Up CF7 with CF7 Submissions Plugin</h1>

        <ol style="padding-left: 20px; line-height: 1.8;">
            <li>🔌 <strong>Activate Plugins:</strong> Ensure both <strong>Contact Form 7</strong> and <strong>CF7 Submissions</strong> plugins are activated.</li>

            <li>📝 <strong>Create a CF7 Form:</strong> Go to <code>Contact > Add New</code> and build your form.</li>

            <li>🏷️ <strong>Identify Field Names:</strong> Look at the "name" attribute of your CF7 form inputs. For example:<br>
                <code>[text* fullname]</code>, <code>[email* email]</code>, <code>[tel phone]</code>, etc.
            </li>

            <li>⚙️ <strong>Map Fields:</strong> 
               Please Match below input field wioth cf7 form inputs
                <ul>
                    <li><strong>Name:</strong>  <code>fullname</code></li>
                    <li><strong>Email:</strong><code>email</code></li>
                    <li><strong>Phone:</strong>  <code>phone</code></li>
                    <li><strong>Message:</strong> <code>message</code></li>
                </ul>
            </li>

            <li>✅ <strong>Save the Mapping.</strong> This will be used to pull data dynamically from the form submissions.</li>

            <li>📩 <strong>Submit the CF7 Form:</strong> Now test the form on the front-end of your site.</li>

            <li>📊 <strong>View Submissions:</strong> Go to <strong>CF7 Submissions</strong> in the WordPress admin to see stored entries.</li>
        </ol>

        <p><strong>Need help?</strong> Contact your developer or open a support ticket.</p>
    </div>
    <?php
}
