New thread on the orders page

I have called contact seller button which means creating a new thread button on my orders page. There are might be many orders and also many contact seller button. For each item there is one button. The problem is, i am not being able to upload an attachment on the new thread modal. If there are one or two orders it works well, i can upload an attachment on the modal window. Also it is not showing the image on this modal form. What i did, i called my orders in this loop:

{foreach from=$orders item="o"}
    {assign var="order_info" value=fn_get_order_info($o.order_id)}
        {foreach from=$order_info.products item="product" key="key"}
            {hook name="orders:items_list_row"}
                {if !$product.extra.parent}

and inside this loop i have called the new thread button as following:

{if $addons.vendor_communication.show_on_product == "Y"}
                                    <div id="product_vendor_communication_thread_form">
                                        {if $auth.user_id}
                                            {include file="addons/vendor_communication/views/vendor_communication/components/login_form.tpl"}

For now i am able to send a new form and able to see them on admin, but not able to show their images and ability to upload an attachment. Also it is giving an js error when clicked the outside of the new thread modal window.