<?xml version="1.0" encoding="UTF-8"?>
<!-- © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<template>

<t t-name="mail.tracking.status">
    <t t-if="tracking[0] == 'unknown'">
        <span class="mail_tracking_unknown">
            <i class="fa fa-ban"></i>
        </span>
    </t>
    <t t-if="tracking[0] == 'waiting'">
        <span class="mail_tracking_waiting mail_tracking_pointer">
            <i class="fa fa-clock-o"></i>
        </span>
    </t>
    <t t-if="tracking[0] == 'error'">
        <span class="mail_tracking_error mail_tracking_pointer">
            <i class="fa fa-remove"></i>
        </span>
    </t>
    <t t-if="tracking[0] == 'sent'">
        <span class="mail_tracking_sent mail_tracking_pointer">
            <i class="fa fa-check"></i>
        </span>
    </t>
    <t t-if="tracking[0] == 'delivered'">
        <span class="fa-stack mail_tracking_delivered mail_tracking_pointer">
            <i class="fa fa-check fa-stack-1x" style="margin-left:1px"></i>
            <i class="fa fa-check fa-inverse fa-stack-1x" style="margin-left:-2px;"></i>
            <i class="fa fa-check fa-stack-1x" style="margin-left:-3px"></i>
        </span>
    </t>
    <t t-if="tracking[0] == 'opened'">
        <span class="fa-stack mail_tracking_opened mail_tracking_pointer">
            <i class="fa fa-check fa-stack-1x" style="margin-left:1px"></i>
            <i class="fa fa-check fa-inverse fa-stack-1x" style="margin-left:-2px;"></i>
            <i class="fa fa-check fa-stack-1x" style="margin-left:-3px"></i>
        </span>
    </t>
</t>

<t t-extend="mail.ChatThread.Message">
    <t t-jquery="p[class='o_mail_info']" t-operation="after">
        <p class="o_mail_tracking">
            <strong>To:</strong>
            <t t-set="first_tracking" t-value="true"/>
            <t t-foreach="message.partner_trackings" t-as="tracking">
                <t t-if="!first_tracking">
                    -
                </t>
                <t t-if="tracking[3]">
                    <a class="o_mail_action_tracking_partner"
                       t-att-data-partner="tracking[3]"
                       t-attf-href="#model=res.partner&amp;id=#{tracking[3]}">
                        <t t-esc="tracking[2]"/>
                    </a>
                </t>
                <t t-if="!tracking[3]">
                    <span><t t-esc="tracking[2]"/></span>
                </t>
                <span class="mail_tracking o_mail_action_tracking_status"
                      t-att-data-tracking="tracking[1]"
                      t-attf-title="Status: #{tracking[0]}">
                    <t t-call="mail.tracking.status"/>
                </span>
                <t t-set="first_tracking" t-value="false"/>
            </t>
        </p>
    </t>
</t>

</template>
