{if (isset($mbe_uap) && $mbe_uap)}
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
    if (typeof jQuery === 'undefined') {
        document.write(unescape("%3Cscript src='js/jquery.js' type='text/javascript'%3E%3C/script%3E"));
    }
</script>

<script type="text/javascript">
    $(document).ready(function() {
        var uapList{$carrierId} = '{$suap}';
        var setUAP{$carrierId} = '{$link->getPageLink('mbeuap&fc=module&module=mbeshipping&ajax=1&action=SetUAP')|escape:'javascript'}';

        $( "#mbeuap{$carrierId}" ).change(function () {
            var selectedUap = $("#mbeuap{$carrierId}").children("option:selected").val();
            $.ajax({
                type: 'POST',
                url: setUAP{$carrierId},
                data: {
                    ajax : true,
                    mbeSelectedUap: selectedUap,
                    mbeUapList: uapList{$carrierId},
                },
                success: function(resp, textStatus, jqXHR)
                {
                }
            });
        });
    });
</script>

<div class="form-group row" style="background: #ffffff; border: 1px solid #d6d4d4; padding: 14px 18px 13px; margin: 0 0 30px 0; line-height: 23px;">
    <div class="col-md-12">
        <p style="font-weight: bold">{l s='Set Shipping address to UAP (optional)' mod="mbeshipping"}<br/>
        </p>
        <select class="form-control" id="mbeuap{$carrierId}" required="required">
            <option value="">{l s="Select a UAP" mod='mbeshipping'}</option>
            {foreach $uapList as $uap}
                <option value="{$uap['PublicAccessPointID']}">{$uap['Distance']} - {$uap['ConsigneeName']}, {$uap['AddressLine']}, {$uap['PoliticalDivision2']} ({$uap['StandardHoursOfOperation']})</option>
            {/foreach}
        </select>
    </div>
</div>
<div></div>
<div class="form-group row"></div>
{/if}