<?php
/**
 * Flex @package Helix Framework
 * @author Aplikko http://www.aplikko.com
 * @copyright Copyright (c) 2025 Aplikko
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;

// Remove this deprecated line:
// HTMLHelper::_('formbehavior.chosen', 'select');

$currentLanguage = Factory::getLanguage();
$currentLanguageName = $currentLanguage->getName();
$isRTL = $currentLanguage->isRtl();

// Simplify the class - remove vm-chzn-select since we're not using Chosen.js anymore (Joomla 6 not compatible)
$class = 'inputbox form-select'; // Using Bootstrap 5 class for better styling
?>
<div class="currency-selector-module">
<!-- Currency Selector Module -->
<?php if ($text_before != '') { ?><p><?php echo $text_before ?></p><?php } ?>
<form action="<?php echo vmURI::getCleanUrl() ?>" method="post" class="d-flex flex-nowrap gap-2 align-items-center">
    <button class="btn btn-default btn-sm flex-shrink-0" type="submit" name="submit" data-bs-toggle="tooltip" title="<?php echo vmText::_('MOD_VIRTUEMART_CURRENCIES_CHANGE_CURRENCIES') ?>">
        <i class="fas fa-sync px-4 px-sm-5 px-lg-2 w-100"></i>
    </button>
    <?php echo HTMLHelper::_('select.genericlist', $currencies, 'virtuemart_currency_id', 'class="'.$class.' flex-grow-1 ps-4 ps-lg-2 ps-xl-3 pe-5 pe-lg-4 pt-1 pe-3" role="button"', 'virtuemart_currency_id', 'currency_txt', $virtuemart_currency_id) ; ?>
</form>
</div>