<ul class="wpmstabs wpms-nav-tab-wrapper" id="wpms-tabs">
    <?php
    // phpcs:ignore WordPress.Security.EscapeOutput -- Content escaped in the method WpmsGsc::tabHtml and WpmsGsc::tabsHtml
    echo $html_tabs
    ?>
</ul>
<?php

if (defined('WP_DEBUG') && WP_DEBUG && WpmsGsc::getProfile() !== '') {
    ?>
    <form action="" method="post">
        <div style="width: 100%;float: left;">
            <input type='hidden' name='reload-crawl-issues-nonce'
                   value='<?php echo esc_attr(wp_create_nonce('reload-crawl-issues')); ?>'/>
            <button type="submit" name="reload-crawl-issues" id="reload-crawl-issue" class="ju-button orange-button waves-effect waves-light m-tb-20"
                    ><?php esc_html_e('Reload crawl issues', 'wpmsPro'); ?></button>
        </div>
    </form>

<?php } ?>


<?php
switch ($current_tab) {
    case 'settings':
        // Check if there is an access token.
        if (null === $this->service->getClient()->getAccessToken()) { ?>
            <form action="" method="post">
                <h2 style="font-weight: 400;"><?php esc_html_e('Google account authentication', 'wpmsPro') ?></h2>
                <table class="form-table">
                    <tbody>
                    <tr>
                        <th scope="row"><label
                                    for="googleClientId"><?php esc_html_e('Google Client ID', 'wpmsPro') ?></label>
                        </th>
                        <td>
                            <label>
                                <input name="gscapi[googleClientId]" type="text" class="regular-text"
                                       value="<?php echo esc_attr($googleClientId) ?>">
                            </label>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><label
                                    for="googleClientSecret">
                                <?php esc_html_e('Google Client Secret', 'wpmsPro') ?></label>
                        </th>
                        <td>
                            <label>
                                <input name="gscapi[googleClientSecret]" type="text" class="regular-text"
                                       value="<?php echo esc_attr($googleClientSecret) ?>">
                            </label>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row"><label for="googleClientSecret"></label></th>
                        <td>
                            <input name="gscapi[save]" type="submit" class="wpmsbtn"
                                   value="<?php esc_attr_e('Save and Connect', 'wpmsPro') ?>">
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
            <?php
        } else {
            echo '<h3>', esc_html__('Current profile', 'wpmsPro'), '</h3>';
            $profile  = WpmsGsc::getProfile();
            $profiles = $this->service->getSites();
            echo '<form action="options.php" method="post">';
            settings_fields('wpms_gsc_options');
            echo '<select name="wpms-gsc[profile]" class="wpms-large-input">';
            echo '<option value="0">' . esc_html__('Select a profile', 'wpmsPro') . '</option>';
            foreach ($profiles as $k => $v) {
                $value = trim($k, '/');
                if ($value === $profile) {
                    echo '<option selected value="' . esc_attr($value) . '">' . esc_html($v) . '</option>';
                } else {
                    echo '<option value="' . esc_attr($value) . '">' . esc_html($v) . '</option>';
                }
            }
            echo '</select>';
            echo '<p class="submit"><button type="submit" name="submit" id="submit"
 class="ju-button orange-button">' . esc_html__('Save Changes', 'wpmsPro') . '</button></p>';
            echo '<a class="ju-button" href="' . esc_url(add_query_arg('gsc_reset', 1)) . '">
            ' . esc_html__('Reauthenticate with Google ', 'wpmsPro') . '</a>';
            echo '</form>';
        }
        break;
    default:
        $form_action_url = add_query_arg('page', esc_attr(filter_input(INPUT_GET, 'page')));
        echo "<form id='wpms-crawl-issues-table-form' class='wpms-form-table' action='" . esc_attr($form_action_url) . "' method='post'>\n";
        echo "<input type='hidden' class='wpms-gsc-ajax-security'
         value='" . esc_attr(wp_create_nonce('wpms-gsc-ajax-security')) . "' />\n";
        $this->displayTable();
        echo "</form>\n";
        break;
}

?>
<br class="clear"/>