<?xml version="1.0" encoding="UTF-8"?>
<templates>

    <!--
        Chatter attachment tab
    -->

    <div t-name="mail.chatter.AttachmentBox" class="o_mail_chatter_attachments">
        <div class="o_chatter_attachment">
            <div class="o_border_dashed">
                <span class="o_attach_title">Attachments</span>
            </div>
            <div t-if="widget.imageList.length > 0" class="o_attachments_previews">
                <t t-foreach="widget.imageList" t-as="attachment">
                    <t t-call="mail.AttachmentPreview"/>
                </t>
            </div>
            <div t-if="widget.otherList.length > 0" class="o_attachments_list">
                <t t-foreach="widget.otherList" t-as="attachment">
                    <t t-call="mail.Attachment"/>
                </t>
            </div>
            <div class="o_chatter_attachment_form">
                <t t-call="HiddenInputFile">
                    <t t-set="fileupload_id" t-value="widget.fileuploadId"/>
                    <t t-set="fileupload_action" t-translation="off">/web/binary/upload_attachment</t>
                    <t t-set="multi_upload" t-value="true"/>
                    <input type="hidden" name="model" t-att-value="widget.currentResModel"/>
                    <input type="hidden" name="id" t-att-value="widget.currentResID"/>
                    <center><span class="btn btn-link o_upload_attachments_button"><span class="fa fa-plus-square"/> Add Attachments</span></center>
                </t>
            </div>
        </div>
    </div>

    <!--
        Chatter composer

        @param {mail.composer.Chatter} widget
    -->

    <t t-name="mail.chatter.Composer" t-extend="mail.Composer">
        <!-- Insert information before the composer -->
        <t t-jquery=".o_composer_container" t-operation="before">
            <!-- New message composer -->
            <t t-if="!widget.options.isLog">
                <!-- Text for followers -->
                <small class="o_chatter_composer_info">
                    <b class="text-muted">To: </b>
                    <em class="text-muted">Followers of </em>
                    <b>
                        <t t-if="widget.options.recordName">
                            &#32;&quot;<t t-esc="widget.options.recordName"/>&quot;
                        </t>
                        <t t-if="!widget.options.recordName">
                            this document
                        </t>
                    </b>
                </small>
                <!-- List of followers -->
                <div class="o_composer_suggested_partners">
                    <t t-foreach='widget.suggestedPartners' t-as='recipient'>
                        <div t-attf-title="Add as recipient and follower (reason: #{recipient.reason})">
                            <div class="custom-control custom-checkbox">
                                <input type="checkbox"
                                       class="custom-control-input"
                                       t-attf-id="o_composer_suggested_partners_p#{recipient_index}"
                                       t-att-checked="recipient.checked ? 'checked' : undefined"
                                       t-att-data-fullname="recipient.full_name"/>
                                <label t-attf-for="o_composer_suggested_partners_p#{recipient_index}" class="custom-control-label">
                                    <t t-esc="recipient.name"/>
                                    <t t-if="recipient.email_address">(<t t-esc="recipient.email_address"/>)</t>
                                </label>
                            </div>
                        </div>
                    </t>
                </div>
            </t>
        </t>

        <!-- Add a button to open the full composer dialog -->
        <t t-jquery=".o_composer_button_add_attachment" t-operation="after">
            <button tabindex="6" class="btn btn-secondary fa fa-expand o_composer_button_full_composer" type="button" title="Full composer" aria-label="Full composer"/>
        </t>
    </t>

    <!--
        Chatter (mail_thread widget) buttons

        @param {boolean} [isMobile]
        @param {boolean} [logNoteButton]
        @param {boolean} [newMessageButton]
        @param {boolean} [scheduleActivityButton]
    -->
    <t t-name="mail.chatter.Buttons">
        <button t-if="newMessageButton" type="button" class="btn btn-link o_chatter_button_new_message" title="Send a message" disabled="disabled">
            Send message
        </button>
        <button t-if="logNoteButton" class="btn btn-link o_chatter_button_log_note" title="Log a note. Followers will not be notified." disabled="disabled">
            Log note
        </button>
        <button t-if="scheduleActivityButton" class="btn btn-link o_chatter_button_schedule_activity" title="Log or schedule an activity" disabled="disabled">
            <i class="fa fa-clock-o" role="img" aria-label="Dates" title="Dates"/> <t t-if="isMobile">Activity</t><t t-else="">Schedule activity</t>
        </button>

    </t>

    <!--
        Chatter attachment paperclip button.

        @param {boolean} [displayCounter]
        @param {integer} [count]
    -->
    <t t-name="mail.chatter.Attachment.Button">
        <button class="btn btn-link o_chatter_button_attachment" title="View all the attachments of the current record">
            <span>
                <i class="fa fa-paperclip"/>
                <span t-if="displayCounter" class="o_chatter_attachment_button_count">
                    <t t-esc="count"/>
                </span>
            </span>
        </button>
    </t>

    <!--
        Chatter main div
    -->
    <t t-name="mail.Chatter">
        <aside class="o_chatter">
            <div class="o_chatter_topbar">
                <div class="o_topbar_right_area"/>
            </div>
        </aside>
    </t>

</templates>
