<div class="modal fade top" id="addMultiReceiverModal" tabindex="-1" role="dialog" aria-labelledby="addMultiReceiverLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <form action="" id="add-multiple-receiver-form">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="addMultiReceiverLabel"><?php esc_html_e('Add Additional Receiver', 'wpcargo-multi-receiver-popup'); ?></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div id="additional-receiver" class="modal-body">
                    <?php
                    if( function_exists( 'wpc_address_book_get_all_list' ) ):
                        $address_list   = wpc_address_book_get_list('receiver');
                        $search_option 	= get_option('wpc_address_receiver_search');
                        // Dont display option if the address is empty
                        if( !empty( $address_list ) ):
                            uasort($address_list, function( $receiver_a, $receiver_b ){
                                return strcmp($receiver_a["wpcargo_receiver_name"], $receiver_b["wpcargo_receiver_name"]);
                            });
                            ?>
                            <div id="multireceiver_autofill" class="form-group">
                                <select class="form-control browser-default custom-select wpcmr_autofill" id="wpcmr-address-list">
                                    <option value=""><?php esc_html_e('-- Select One --', 'wpcargo-multi-receiver-popup'); ?></option>
                                    <?php foreach ( $address_list as $key => $address ): ?>
                                        <?php
                                            if( $search_option ){
                                                $label = $address[$search_option];
                                            }else{
                                                $address = array_values( $address );
                                                $label = $address[0];
                                            }
                                        ?>
                                        <option value="<?php echo $key; ?>"><?php echo $label; ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <?php 
                        endif; 
                    endif; // End- Checking if Address Book is installed and activated 
                    ?>
                    <?php $WPCCF_Fields->convert_to_form_fields(  wpcmr_registered_fields(), 0 ); ?>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal"><?php esc_html_e('Close','wpcargo-multi-receiver-popup'); ?></button>
                    <button id="wpcmr-add" type="submit" class="btn btn-sm btn-primary"><?php esc_html_e('Add','wpcargo-multi-receiver-popup'); ?></button>
                </div>
            </div>
        </form> 
    </div>
</div>