<div class="correlation__row">
    <div class="correlation__key">
        {$base_params['description']}<span class="help_bt" h_id="{$base_params['help']}"></span>:
    </div>
    <div style="text-align: left; padding: 3px; display: flex; flex-direction: row; align-items: center; gap: 10px;">
        <select class="form-control form-control-200 dont_use_chosen" name="calc_params[{$tpl_num}][{$base_params['name']}]">
            {foreach from=$type_params['values'] key=calc_id item=calc_name}
                <option value="{$calc_id}" {if $calc_id == $base_params['set_params']}selected{/if} link="edit_calc.php?calc_id={$calc_id}">
                    {$calc_name}
                </option>
            {/foreach}
        </select>
        <div class="iconDiv"></div>
    </div>
</div>

<script>
document.querySelectorAll('.iconDiv').forEach(div => {
    div.addEventListener('click', () => {
        const select = div.previousElementSibling;
        const selectedOption = select.options[select.selectedIndex];
        const link = selectedOption.getAttribute('link');
        if (link) {
            window.open(link, '_blank');
        }
    });
});
</script>
