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

    <t t-name="mail.AttachmentPanel">
        <t t-set="title">Attachments</t>
        <ActionPanel title="title">
            <div t-if="hasToggleAllowPublicUpload" class="form-check form-switch">
                <label class="form-check-label">
                    <input t-on-change="toggleAllowPublicUpload" class="form-check-input" type="checkbox" role="switch" t-att-checked="props.thread.allow_public_upload"/>
                    <t t-if="props.thread.allow_public_upload">File upload is enabled for external users</t>
                    <t t-else="">File upload is disabled for external users</t>
                </label>
            </div>
            <div class="flex-grow-1" t-att-class="{
                'd-flex justify-content-center align-items-center': props.thread.attachments.length === 0,
            }">
                <p t-if="props.thread.attachments.length === 0" class="text-center fst-italic text-500">
                    <t t-if="props.thread.type === 'channel'">This channel doesn't have any attachments.</t>
                    <t t-else="">This conversation doesn't have any attachments.</t>
                </p>
                <div t-else="" t-foreach="attachmentsByDate" t-as="dateDay" t-key="dateDay" class="d-flex flex-column">
                    <DateSection date="dateDay" className="'my-1'"/>
                    <AttachmentList imagesHeight="100" attachments="dateDay_value" unlinkAttachment="(attachment) => this.attachmentUploadService.unlink(attachment)"/>
                </div>
            </div>
            <span t-ref="load-older"/>
        </ActionPanel>
    </t>
</templates>
