<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
    <!-- Replaces the employee's own summary block (id="o_leave_stats_employee")
         with a table grouped by leave type (one rowspan'd cell per type,
         one row per leave under it), replacing core's flat per-leave list,
         for clearer scanning when an employee has several leaves of the
         same type in the year. The department block below it is untouched.
         Data (state.leaves) is still core's own, unmodified; xenoGroupedLeaves
         (leave_stats_patch.js) only regroups it for this table. -->
    <t t-inherit="hr_holidays.LeaveStatsComponent" t-inherit-mode="extension">
        <xpath expr="//div[@id='o_leave_stats_employee']//div[@t-foreach='state.leaves']"
               position="replace">
            <table class="o_xeno_summary_table">
                <t t-foreach="xenoGroupedLeaves" t-as="grp" t-key="grp.typeId">
                    <tr t-foreach="grp.rows" t-as="leave" t-key="leave.id">
                        <td t-if="leave_index === 0" t-att-rowspan="grp.rows.length"
                            t-attf-style="color:{{ grp.color }}"
                            class="o_xeno_summary_type fw-bold" t-esc="grp.typeName"/>
                        <td class="o_xeno_summary_dates">
                            <t t-if="leave.leave_type_request_unit == 'hour'">
                                <span t-esc="leave.date_from"/>
                                <span t-esc="leave.hour_from" class="fst-italic"/>
                                <i class="fa fa-long-arrow-right mx-1" aria-label="Arrow icon" title="Arrow"/>
                                <span t-esc="leave.hour_to" class="fst-italic"/>
                            </t>
                            <t t-else="">
                                <span t-esc="leave.date_from"/>
                                <i class="fa fa-long-arrow-right mx-1" aria-label="Arrow icon" title="Arrow"/>
                                <span t-esc="leave.date_to"/>
                            </t>
                        </td>
                        <td class="o_xeno_summary_days text-muted">
                            (<t t-if="leave.leave_type_request_unit == 'hour'"><t t-esc="leave.number_of_hours"/> hours</t>
                            <t t-else=""><t t-esc="leave.number_of_days"/> days</t>)
                        </td>
                    </tr>
                </t>
            </table>
        </xpath>
    </t>
</templates>
