<?php

/**
 * @package         MailChimp Auto-Subscribe
 * @version         5.0.3 Pro
 *
 * @author          Tassos Marinos <info@tassos.gr>
 * @link            http://www.tassos.gr
 * @copyright       Copyright © 2021 Tassos Marinos All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
 */

// No direct access to this file
defined('_JEXEC') or die;

JFormHelper::loadFieldClass('text');

class JFormFieldTestConnection extends JFormFieldText
{
    protected function getInput()
    {
        JFactory::getDocument()->addScript(JURI::root() . 'plugins/user/tm_mailchimpuserautoadd/fields/testconnection.js');
        JFactory::getDocument()->addStyleDeclaration('
            .test_connection .btn.working {
                pointer-events:none;
                opacity:.5;
            }
            .test_connection .error {
                color:#802420;
            }
            .test_connection_response {
                margin-left: 10px;
            }
            .test_connection .icon-checkmark-2 {
                color:#378137;
                position: relative;
                top: 1px;
            }
        ');

        return '
            <div class="test_connection" data-base="' . JURI::base() . '">
                <button class="btn btn-secondary">' . JText::_('MAS_TEST_ADD_USER') . '</button>
                <span class="test_connection_response"></span>
            </div>';
    }
}